/* ==========================================================================
   tiles.css - v7 "Mission Control" (Oct 2026)

   The tile look used across the site (scripts/tiles.php prints them): the
   Members Dashboard, the Admin Dashboard, About, and the section headings
   on Account and Feedback. A tile is one link: icon, name, one line, arrow.
   .needs-attention = something waiting (amber edge + flag, .dash-flag).

   1. The plain tile: a small console panel with a square key for its icon.
   2. The Members Dashboard (main.deck): each section is a console bay and
      each tool a switch with an indicator lamp.
   Every colour is a token from css/root.css. No em dashes (site rule).
   ========================================================================== */

.dash-sections {
    box-sizing: border-box;
    width: 100%;
    max-width: var(--page-w);
    margin: 1.5rem auto 0;
    padding: 0 var(--gutter);
    display: grid;
    gap: 1.8rem;
}

.dash-section {
    scroll-margin-top: 1rem;
    min-width: 0;
}

.site-content h2.dash-section-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 0 0 0.9rem;
    padding: 0;
    border: 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.3;
    text-transform: uppercase;
    text-align: left;
    color: var(--ink-2);
}

.site-content h2.dash-section-title::after {
    content: "";
    flex: 1;
    height: 2px;
    background: var(--rule-soft);
}

.dash-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 900px) {
    .dash-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ---------------------------------------------------------- the tile */
.dash-tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.95rem;
    min-height: 88px;
    padding: 1rem 1.1rem;
    box-sizing: border-box;
    background: var(--sheet);
    border: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: 0 0 0 transparent;
    color: var(--ink);
    text-decoration: none;
    text-align: left;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}

.dash-tile:hover,
.dash-tile:focus-visible {
    background: var(--sheet-2);
    color: var(--ink);
    transform: translateY(-2px);
    box-shadow: 0 0 0 transparent;
    outline: none;
}

.dash-tile:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 3px;
}

.dash-tile:active {
    transform: translateY(3px);
    box-shadow: 0 0 0 transparent;
}

/* The icon sits on a square key. */
.dash-tile-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    box-sizing: border-box;
    border-radius: 0;
    background: var(--sheet-2);
    border: 1px solid var(--rule);
    box-shadow: inset 0 -4px 0 var(--sheet-3);
    color: var(--ink);
    font-size: 1.3rem;
}

.dash-tile-icon img {
    display: block;
}

.dash-tile:hover .dash-tile-icon {
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
}

.dash-tile-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.dash-tile-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    line-height: 1.25;
    color: var(--ink);
    text-transform: uppercase;
}

.dash-tile-text {
    font-size: 0.93rem;
    line-height: 1.42;
    color: var(--ink-2);
}

.dash-tile-go {
    flex: 0 0 auto;
    color: var(--ink-3);
    transition: transform 0.15s ease, color 0.15s ease;
}

.dash-tile:hover .dash-tile-go,
.dash-tile:focus-visible .dash-tile-go {
    color: var(--ink);
    transform: translateX(3px);
}

/* Needs attention: an amber edge and a lit flag. */
.dash-tile.needs-attention {
    border-color: var(--rule);
    background-image: linear-gradient(90deg, var(--s1) 0 7px, transparent 7px);
}

.dash-tile.needs-attention .dash-tile-title {
    color: var(--ink);
}

.dash-tile .dash-flag {
    margin-left: 0.35rem;
    vertical-align: middle;
}

/* The small flag after a tile's name ("New", "Live"). Also in
   members_dashboard_layout_default.css; here so every page with tiles has it. */
.dash-flag {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.12rem 0.6rem;
    border: 1px solid var(--rule);
    border-radius: 0;
    background: var(--s1);
    color: var(--on-accent);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.35;
    text-transform: none;
    vertical-align: middle;
}

@media (max-width: 560px) {
    .dash-tiles {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.7rem;
    }

    .dash-tile {
        min-height: 74px;
        padding: 0.8rem 0.9rem;
    }

    .dash-tile-icon {
        width: 44px;
        height: 44px;
        font-size: 1.15rem;
    }

    .dash-tile-title {
        font-size: 0.86rem;
    }

    .dash-tile-text {
        font-size: 0.9rem;
    }
}

/* ==========================================================================
   MEMBERS DASHBOARD (main.deck): sections are console bays, tools switches.
   Bays sit side by side and wrap; the big Community bay takes a full row
   and lays its switches out as keys, the rest are stacked switch rows.
   ========================================================================== */
.deck .dash-sections {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 1.4rem;
    margin-top: 2.2rem;
    counter-reset: bay;
}

.deck .dash-section {
    counter-increment: bay;
    flex: 1 1 380px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 0 0 1.1rem;
    background: var(--sheet-3);
    border: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: 0 0 0 transparent;
}

/* The bay's name plate along its top edge, numbered. */
.site-content.deck h2.dash-section-title {
    margin: 0 0 1rem;
    padding: 0.75rem 1.1rem;
    background: var(--console);
    color: var(--console-ink);
    border-radius: calc(var(--r-panel) - 2px) calc(var(--r-panel) - 2px) 0 0;
    font-size: 0.7rem;
}

.site-content.deck h2.dash-section-title::before {
    content: "BAY " counter(bay, decimal-leading-zero);
    padding: 0.15rem 0.5rem;
    border-radius: 0;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 0.6rem;
}

.site-content.deck h2.dash-section-title::after {
    height: 0;
    border-top: 2px dotted currentColor;
    background: none;
    opacity: 0.35;
}

.deck .dash-tiles {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.7rem;
    padding: 0 1rem;
}

/* Switch rows line up across bays side by side (28 Oct 2026, Matt: "make these boxes in logistics and ships
   line up better"): every row in a bay is as tall as its tallest, and at least two lines of text tall, so a
   one-line row (Org Fleet) is the same height as its neighbours in the next bay. The icon, text and lamp sit
   in the middle of the row. Not the Community bay, which lays its switches out as keys. */
.deck .dash-section:not(#dpanel-user) .dash-tiles {
    grid-auto-rows: 1fr;
}

.deck .dash-section:not(#dpanel-user) .dash-tile {
    min-height: calc(1.6rem + 0.85rem * 1.25 + 0.3rem + 0.93rem * 1.42 * 2 + 2px);
}

/* A switch row: the key on the left, the name and line, a lamp on the right. */
.deck .dash-tile {
    min-height: 0;
    padding: 0.8rem 1rem 0.8rem 0.8rem;
    border-radius: 0;
    box-shadow: 0 0 0 transparent;
}

.deck .dash-tile:hover,
.deck .dash-tile:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 0 0 transparent;
}

.deck .dash-tile:active {
    transform: translateY(3px);
    box-shadow: 0 0 0 var(--rule);
}

.deck .dash-tile-icon {
    width: 46px;
    height: 46px;
    font-size: 1.15rem;
}

/* The chevron becomes the indicator lamp: dark until the switch is touched,
   amber and blinking when something is waiting. */
.deck .dash-tile-go {
    width: 14px;
    height: 14px;
    border-radius: 0;
    background: var(--sheet-3);
    box-shadow: 0 0 0 2px var(--rule), inset 0 2px 3px rgba(0, 0, 0, 0.25);
    font-size: 0;
    color: transparent;
    transform: none;
}

.deck .dash-tile:hover .dash-tile-go,
.deck .dash-tile:focus-visible .dash-tile-go {
    background: var(--good);
    box-shadow: 0 0 0 2px var(--rule), 0 0 10px var(--good);
    transform: none;
}

.deck .dash-tile.needs-attention .dash-tile-go {
    background: var(--s1);
    box-shadow: 0 0 0 2px var(--rule), 0 0 12px var(--s1);
    animation: deck-lamp 1.4s steps(2, jump-none) infinite;
}

@keyframes deck-lamp {
    0% { opacity: 1; }
    100% { opacity: 0.35; }
}

/* The Community bay (the most tools) takes the full row and shows its
   switches as keys in a grid. */
.deck #dpanel-user {
    flex-basis: 100%;
}

.deck #dpanel-user .dash-tiles {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 0.9rem;
}

.deck #dpanel-user .dash-tile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-items: start;
    gap: 0.8rem 0.9rem;
    padding: 1rem;
}

.deck #dpanel-user .dash-tile-icon {
    grid-row: 1;
    grid-column: 1;
}

.deck #dpanel-user .dash-tile-go {
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
    margin-top: 4px;
}

.deck #dpanel-user .dash-tile-body {
    grid-row: 2;
    grid-column: 1 / -1;
}

/* The Admin bay: the one dark panel on the deck. */
.deck #dpanel-admin {
    flex: 0 1 380px;
    background: var(--console);
    border-color: var(--rule);
}

.site-content.deck #dpanel-admin h2.dash-section-title {
    background: var(--console-2);
    color: var(--console-ink);
}

@media (max-width: 860px) {
    .deck #dpanel-admin {
        flex: 1 1 100%;
    }
}

@media (max-width: 560px) {
    .deck .dash-sections {
        padding: 0 var(--gutter);
        gap: 1.1rem;
    }

    .deck .dash-tiles {
        padding: 0 0.7rem;
    }

    .deck #dpanel-user .dash-tile {
        display: flex;
        align-items: center;
        padding: 0.8rem 1rem 0.8rem 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .deck .dash-tile.needs-attention .dash-tile-go {
        animation: none;
    }
}

.theme-contrast .deck .dash-tile:hover .dash-tile-go,
.theme-contrast .deck .dash-tile.needs-attention .dash-tile-go {
    box-shadow: 0 0 0 2px var(--rule);
}

/* ------------------------------------------------------------------
   Pages matched to the tiles (Account, Feedback, Admin Dashboard tools):
   <main class="... os-matched">. Same width and room as the tiles.
   ------------------------------------------------------------------ */


.os-matched .bug-panel {
    box-sizing: border-box;
    width: 100%;
    max-width: var(--page-w);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.os-matched .bug-panel > .dashboard-default-container {
    margin: 1.25rem 0 0;
}


/* Site audit (23 Oct 2026): on Origin the flag's near-black letters on its
   blue were 2.9:1; white is 6.4:1. Theme colours are unchanged. */
body.theme-mf-origin .dash-flag { color: #FFFFFF; }
