/*
 * My Account's tiles: the dashboard's grid, and My Account → Tapper Brews's
 * (TC_Account_Cafe_Page). Their own sheet, on every account page, because
 * the dashboard's sheet loads on the dashboard alone and carries rules --
 * the hidden intro paragraph, the migration list -- no other page should get.
 *
 * A tile is a row card in the storefront look (the theme's assets/flow.css
 * carries it through these pages): a small green disc with the icon in it,
 * then the tile's name and a line saying what it is. The title's link is
 * stretched over the whole tile. The dashboard's account tiles are an <a>
 * already and do not need it; the Cafe tiles are a <div>, because the usuals
 * card holds a second link -- "Order my usual now" -- lifted above the
 * stretched one.
 *
 * The --tc-* tokens are declared on body.tt-flow by the theme; each is read
 * with its literal fallback. flow.css also colours every link inside the page
 * green at (0,3,2), green-dark on hover at (0,4,2): the rules below that set a
 * link's own colour are written from .woocommerce-MyAccount-content to outrank
 * it, and say so.
 */
.tiles-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0;
    font-family: var(--tc-home-display, var(--mt-font__main, "Outfit", Arial, sans-serif));
}

/*
 * .tc-shelf-card, twice over: tapper-cafe-storefront's storefront.css gives
 * that class a 2px gap and its links a weight, for the card's other home on
 * the shelf page, and may load after this sheet.
 */
.tile-container,
.tile-container.tc-shelf-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 16px;
    border-radius: var(--tc-radius-sm, 14px);
    background-color: #FFFFFF;
    text-decoration: none;
    box-shadow: inset 0 0 0 1px rgba(18, 17, 17, 0.13), 0 2px 8px rgba(18, 17, 17, 0.05);
}

.tile-container:hover,
.tile-container:focus-within {
    text-decoration: none;
    box-shadow: inset 0 0 0 1px var(--tc-green, #29594B), 0 2px 8px rgba(18, 17, 17, 0.05);
    cursor: pointer;
}

/*
 * One outline for the whole tile, whichever element in it holds the focus: the
 * tile itself where it is the link, the tile around its title link where it is
 * not. Two rules, not one list -- a browser without :has() would drop both --
 * and the title only gives up its own outline where :has() can replace it.
 */
.tile-container:focus-visible {
    outline: 2px solid var(--tc-green, #29594B);
    outline-offset: 2px;
}

.tile-container:has(.tile-title:focus-visible) {
    outline: 2px solid var(--tc-green, #29594B);
    outline-offset: 2px;
}

.tile-container:has(.tile-title:focus-visible) .tile-title {
    outline: none;
}

/* The disc. The glyph is stroked or filled in currentColor, so this colours it. */
.tile-container .tile-icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background-color: var(--tc-green-soft, #E4EEE9);
    color: var(--tc-green, #29594B);
}

/* Motta wraps its own icons (the Cafe tiles') in an inline-block span with a line box. */
.tile-container .tile-icon .motta-svg-icon {
    display: flex;
}

.tile-container .tile-icon img,
.tile-container .tile-icon svg {
    display: block;
    width: 20px;
    height: 20px;
}

.tile-container .tile-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 0;
    border: 0;
    color: var(--tc-muted, #6B6660);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
}

.tile-container .tile-title {
    color: var(--tc-ink, #121111);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
}

/* On the Cafe tiles the title is the link, and flow.css would paint it green. */
.woocommerce-MyAccount-content .tiles-container .tile-container .tile-title,
.woocommerce-MyAccount-content .tiles-container .tile-container .tile-title:hover {
    color: var(--tc-ink, #121111);
}

.tile-container .tile-title::after {
    content: "";
    position: absolute;
    inset: 0;
}

/* ------------------------------------------------------------ "Your usuals"
 *
 * My Account → Tapper Brews (TC_Shelf_Page::usuals_card()). Not a tile but a
 * banded card across the grid: the title is its head band, the sentence its
 * body, "Order my usual now" a small green pill under it. Its markup is a
 * tile's, so this is as far as CSS reaches: one sentence for all the usuals,
 * not a line for each. The stretched title link is kept, so anywhere on the
 * card that is not the pill opens the usuals page.
 * ------------------------------------------------------------------------ */
.tile-container.tc-usuals-card {
    grid-column: 1 / -1;
    gap: 0;
    padding: 0;
    border: 1px solid var(--tc-line, rgba(18, 17, 17, 0.1));
    border-radius: var(--tc-radius, 18px);
    box-shadow: var(--tc-shadow, 0 18px 40px rgba(18, 17, 17, 0.08));
    overflow: hidden;
}

.tile-container.tc-usuals-card:hover,
.tile-container.tc-usuals-card:focus-within {
    border-color: var(--tc-green, #29594B);
    box-shadow: var(--tc-shadow, 0 18px 40px rgba(18, 17, 17, 0.08));
}

/* A band has no room for a disc, and the title says what the card is. */
.tile-container.tc-usuals-card .tile-icon {
    display: none;
}

.tile-container.tc-usuals-card .tile-body {
    align-items: stretch;
    gap: 0;
}

.tile-container.tc-usuals-card .tile-title {
    display: block;
    padding: 14px 16px;
    border-bottom: 1px solid var(--tc-band-line, rgba(18, 17, 17, 0.12));
    background-color: var(--tc-band, #F5EFE3);
    font-size: 18px;
}

/* The sentence. Body colour at 15px: it is the card's content, not a tile's caption. */
.tile-container.tc-usuals-card .tile-body > span {
    padding: 16px;
    color: var(--tc-body, #413E3C);
    font-size: 15px;
    line-height: 1.5;
}

/*
 * "Order my usual now": the small primary pill. Above the stretched title
 * link, or a tap on it would open the usuals page instead. Written from
 * .woocommerce-MyAccount-content because flow.css's link colour, (0,3,2) and
 * (0,4,2) on hover, would otherwise make its words green on green.
 */
.tile-container .tc-usuals-card__now,
.woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now,
.woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now:hover,
.woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now:focus,
.woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now:active {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    justify-content: center;
    min-height: 44px;
    margin: -4px 16px 16px;
    padding: 0 16px;
    border: 1px solid var(--tc-green, #29594B);
    border-radius: 999px;
    background-color: var(--tc-green, #29594B);
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: var(--tc-shadow-go, 0 2px 6px rgba(41, 89, 75, 0.28));
}

.woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now:hover,
.woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now:focus {
    border-color: var(--tc-green-dark, #1F463B);
    background-color: var(--tc-green-dark, #1F463B);
}

.woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now:active {
    border-color: var(--tc-green-dark, #1F463B);
    background-color: var(--tc-green-dark, #1F463B);
    box-shadow: none;
}

.woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now:focus-visible {
    outline: 2px solid var(--tc-green, #29594B);
    outline-offset: 2px;
}

@media (min-width: 48em) {
    .tiles-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }

    .tile-container.tc-usuals-card .tile-title {
        padding: 16px 22px;
    }

    .tile-container.tc-usuals-card .tile-body > span {
        padding: 20px 22px;
    }

    .tile-container .tc-usuals-card__now,
    .woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now,
    .woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now:hover,
    .woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now:focus,
    .woocommerce-MyAccount-content .tiles-container .tile-container .tc-usuals-card__now:active {
        margin: -4px 22px 22px;
    }
}
