/* ============================================================
   TRAILHANDS — landing page
   Warm, earthy palette echoing the Trailendar / Musichands
   wooden-sign logos.
   ============================================================ */

:root {
    --cream-50:  #fbf7ec;
    --cream-100: #f5ecd5;
    --cream-200: #ead5a0;
    --cream-300: #ebd093;
    --tan-300:   #c2a870;
    --tan-400:   #ad9363;
    --tan-500:   #896e4f;
    --bronze-700:#604a2e;
    --bronze-800:#4c3622;
    --bronze-900:#492f17;
    --bronze-950:#38270f;
    --gold:      #f2c03d;

    --bg: var(--cream-50);
    --surface: #ffffff;
    --border: rgba(73, 47, 23, 0.10);
    --border-strong: rgba(73, 47, 23, 0.22);
    --shadow-sm: 0 1px 2px rgba(73, 47, 23, 0.06);
    --shadow-md: 0 2px 4px rgba(73, 47, 23, 0.06), 0 12px 28px rgba(73, 47, 23, 0.10);
    --shadow-lg: 0 4px 10px rgba(73, 47, 23, 0.10), 0 30px 60px rgba(73, 47, 23, 0.18);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    font-family: var(--font-sans);
    color: var(--bronze-950);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(242,192,61,0.18), transparent 60%),
        radial-gradient(1000px 600px at 110% 110%, rgba(173,147,99,0.20), transparent 55%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Page layout ---------- */
.hub {
    max-width: 1180px;
    margin: 0 auto;
    padding: 56px 28px 40px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Header ---------- */
.hub-header {
    text-align: center;
    margin-bottom: 40px;
}
.hub-title {
    margin: 0;
    font-size: clamp(38px, 6vw, 64px);
    font-weight: 900;
    letter-spacing: 0.18em;
    color: var(--bronze-900);
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.hub-tag {
    margin: 10px 0 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--bronze-700);
}
.hub-tag::before, .hub-tag::after {
    content: "";
    display: inline-block;
    width: 28px;
    height: 1px;
    background: var(--tan-400);
    vertical-align: middle;
    margin: 0 14px;
}

/* ---------- Tile grid ----------
   Default: responsive auto-fit (works at any width).
   Desktop: explicit 4+3 layout on a 12-track grid, so the top row fits four
   tiles (each spanning 3 tracks) and the bottom row fits three tiles
   (each spanning 4 tracks) — both rows fill the full width, no awkward gap. */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 22px;
    margin: 8px 0 36px;
}
@media (min-width: 880px) {
    .tiles { grid-template-columns: repeat(12, 1fr); }
    /* Top row — four tiles, 3 tracks each. */
    .tile:nth-child(1) { grid-column: 1  / span 3; }   /* Codecks */
    .tile:nth-child(2) { grid-column: 4  / span 3; }   /* Google Drive */
    .tile:nth-child(3) { grid-column: 7  / span 3; }   /* Miro */
    .tile:nth-child(4) { grid-column: 10 / span 3; }   /* Asset Viewer */
    /* Bottom row — three tiles, 4 tracks each. */
    .tile:nth-child(5) { grid-column: 1  / span 4; }   /* Trailendar */
    .tile:nth-child(6) { grid-column: 5  / span 4; }   /* Musichands */
    .tile:nth-child(7) { grid-column: 9  / span 4; }   /* Vote now */
}

/* ---------- Tile ---------- */
.tile {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    isolation: isolate;
    /* Allow the grid item to shrink to its allotted track instead of being
       sized by its intrinsic content (Safari needs this explicit hint when
       the tile contains an aspect-ratio box with a big intrinsic image). */
    min-width: 0;
    min-height: 0;
}
.tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}
.tile:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
}

/* ---- URGENT tile (poll) ---- */
.tile--urgent {
    border: 3px solid #a52a1f;
    box-shadow:
        0 0 0 1px rgba(165, 42, 31, 0.15),
        0 4px 14px rgba(165, 42, 31, 0.15),
        var(--shadow-sm);
    position: relative;
    overflow: visible;
}
.tile--urgent:hover {
    border-color: #c2362a;
    box-shadow:
        0 0 0 1px rgba(165, 42, 31, 0.25),
        0 12px 28px rgba(165, 42, 31, 0.22),
        var(--shadow-md);
}
.urgent-badge {
    position: absolute;
    top: -12px;
    right: -10px;
    background: linear-gradient(180deg, #c2362a 0%, #a52a1f 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.18em;
    padding: 5px 11px;
    border-radius: 6px;
    box-shadow: 0 3px 8px rgba(165, 42, 31, 0.45), 0 1px 0 rgba(0,0,0,0.10) inset;
    transform: rotate(4deg);
    z-index: 5;
    pointer-events: none;
    text-shadow: 0 1px 0 rgba(0,0,0,0.20);
    /* gentle pulse so it draws the eye */
    animation: urgentPulse 2.6s ease-in-out infinite;
}
@keyframes urgentPulse {
    0%, 100% { transform: rotate(4deg) scale(1); }
    50%      { transform: rotate(4deg) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
    .urgent-badge { animation: none; }
}

/* ---------- Tile art (the upper logo area) ----------
   Pinned size + object-fit on the img is the robust way to constrain large
   intrinsic-size PNGs inside an aspect-ratio box. Relying on
   max-width / max-height alone trips a Safari layout quirk where the image
   falls back to its natural pixel size on certain interactions. */
.tile-art {
    aspect-ratio: 4 / 3;
    position: relative;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
    background: linear-gradient(180deg, var(--cream-100) 0%, var(--cream-50) 100%);
}
.tile-art img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 14px;
    box-sizing: border-box;
    object-fit: contain;
    object-position: center center;
    filter: drop-shadow(0 4px 8px rgba(73, 47, 23, 0.18));
    transition: transform 0.25s ease;
    transform-origin: center center;
    /* Don't let the browser pre-compute layout based on the natural pixel
       size — width/height attributes on the <img> would force this in some
       Safari versions. */
    max-width: 100%;
    max-height: 100%;
}
.tile:hover .tile-art img {
    transform: scale(1.04);
}

/* ---------- Tile meta (lower text bar) ---------- */
.tile-meta {
    padding: 14px 16px 16px;
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, transparent 0%, rgba(173,147,99,0.04) 100%);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tile-name {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--bronze-900);
}
.tile-desc {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tan-500);
}

/* ---------- Footer ---------- */
.hub-footer {
    margin-top: auto;
    text-align: center;
    color: var(--tan-500);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
}

/* ---------- Smaller screens ---------- */
@media (max-width: 600px) {
    .hub { padding: 36px 18px 24px; }
    .hub-title { letter-spacing: 0.12em; }
    .tiles { gap: 14px; }
    .tile { border-radius: 14px; }
    .tile-art { aspect-ratio: 16 / 10; padding: 14px; }
    .hub-tag::before, .hub-tag::after { width: 18px; margin: 0 8px; }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .tile, .tile-art--photo img { transition: none; }
    .tile:hover { transform: none; }
}
