/* ==========================================================================
   CT x Flow Festival 2026 — asiakastilaisuus
   Mobile-first: base styles target phones, min-width queries scale up.
   ========================================================================== */

:root {
    --bg: #0b0b0d;
    --bg-soft: #141418;
    --surface: #17171c;
    --surface-hi: #1b1b21;
    --line: #26262e;
    --text: #f2f2f4;
    --muted: #9a9aa6;
    --accent: #fec719;
    --accent-dim: rgba(254, 199, 25, 0.12);
    --radius: 14px;
    --maxw: 1080px;
    --header-h: 60px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img {
    max-width: 100%;
}

a {
    color: inherit;
}

/* Visible keyboard focus on the dark theme. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 200;
    padding: 12px 18px;
    background: var(--accent);
    color: #16160c;
    font-weight: 600;
    border-radius: 0 0 10px 0;
}

.skip-link:focus {
    left: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wrap {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- Header (mobile: two rows, centred) ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 11, 13, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.site-header .wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand img {
    height: 26px;
    width: auto;
    display: block;
}

.brand .divider,
.brand .brand-text {
    display: none;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.nav a {
    display: inline-block;
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
}

.nav a:hover {
    background: var(--bg-soft);
    color: var(--text);
}

.nav a.active {
    background: var(--accent-dim);
    color: var(--accent);
}

/* ---------- Hero ---------- */

.hero {
    padding: 32px 0 22px;
    background:
        radial-gradient(700px 300px at 50% -20%, rgba(254, 199, 25, 0.13), transparent 70%),
        var(--bg);
    text-align: center;
}

.eyebrow {
    display: inline-block;
    padding: 5px 13px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-dim);
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.75rem, 7vw, 3.4rem);
    line-height: 1.1;
    letter-spacing: -0.025em;
    font-weight: 700;
}

.hero p {
    max-width: 620px;
    margin: 14px auto 0;
    color: var(--muted);
    font-size: 1rem;
}

/* ---------- Buttons (full-width on phones) ---------- */

.actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 22px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px; /* comfortable touch target */
    padding: 12px 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    color: #16160c;
}

.btn-primary:hover {
    background: #ffd240;
}

.btn-ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---------- Layout ---------- */

main {
    padding: 6px 0 56px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-soft);
}

.panel-head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.panel-head .hint {
    font-size: 0.8rem;
    color: var(--muted);
}

/* ---------- Map viewer ---------- */

.viewer-card.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 300;
    border-radius: 0;
    border: 0;
    display: flex;
    flex-direction: column;
}

.viewer-card.is-fullscreen .stage {
    flex: 1;
    height: auto;
}

.stage {
    position: relative;
    height: 62vh;
    min-height: 320px;
    background: #ffffff;
    overflow: hidden;
    /* Inline the page keeps its native scroll and pinch-zoom, so swiping over
       the map never traps the reader. Fullscreen hands gestures to viewer.js. */
    touch-action: pan-y pinch-zoom;
    cursor: grab;
}

.viewer-card.is-fullscreen .stage {
    touch-action: none;
}

.stage.is-panning {
    cursor: grabbing;
}

/* Sized and positioned by viewer.js in real pixels so the browser
   re-rasterises the map at each zoom level instead of upscaling. */
.stage-inner {
    position: absolute;
    inset: 0;
}

.stage img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /* The wrapper is sized to the image's exact aspect ratio, so contain and
       fill agree — contain also keeps the no-JS fallback undistorted. */
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.stage img.stage-full {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.stage img.stage-full.is-ready {
    opacity: 1;
}

.zoom-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
}

.zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.zoom-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.zoom-level {
    min-width: 52px;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    text-align: center;
}

.zoom-bar .spacer {
    flex: 1;
}

.zoom-btn.wide {
    width: auto;
    gap: 7px;
    padding: 0 14px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ---------- Kalustolista pages ---------- */

.pages {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.page-sheet {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.page-sheet img {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
}

.page-num {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 11px;
    border-radius: 999px;
    background: rgba(11, 11, 13, 0.82);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.note {
    margin: 0 0 16px;
    padding: 12px 15px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 0.88rem;
}

/* ---------- Cards (landing) ---------- */

.cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.card {
    display: flex;
    flex-direction: column;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    background: var(--surface-hi);
}

.card .icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 15px;
    border-radius: 12px;
    background: var(--accent-dim);
    color: var(--accent);
}

.card h3 {
    margin: 0 0 6px;
    font-size: 1.2rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.93rem;
}

.card .go {
    margin-top: 18px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--line);
    padding: 24px 0 32px;
}

.site-footer .wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--muted);
    text-align: center;
}

.site-footer img {
    height: 20px;
    opacity: 0.75;
}

/* Revealed by counter.js only once the backend returns a real number. */
.visits {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-soft);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.visits[hidden] {
    display: none;
}

.visits svg {
    color: var(--accent);
    flex: none;
}

.visits-count {
    font-weight: 600;
    color: var(--text);
}

/* ==========================================================================
   Scale up
   ========================================================================== */

@media (min-width: 640px) {
    .wrap {
        padding: 0 20px;
    }

    .site-header .wrap {
        flex-direction: row;
        justify-content: space-between;
        gap: 16px;
        min-height: 68px;
        padding-top: 0;
        padding-bottom: 0;
    }

    .brand img {
        height: 30px;
    }

    .brand .divider {
        display: block;
        width: 1px;
        height: 22px;
        background: var(--line);
    }

    .brand .brand-text {
        display: block;
        font-size: 0.78rem;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--muted);
        white-space: nowrap;
    }

    .nav a {
        padding: 8px 14px;
        font-size: 0.9rem;
    }

    .actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero {
        padding: 48px 0 30px;
    }

    .hero p {
        font-size: 1.05rem;
    }

    .stage {
        height: 70vh;
    }

    .cards {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 20px;
    }

    .card {
        padding: 28px;
    }

    .site-footer .wrap {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

@media (min-width: 900px) {
    .hero {
        padding: 60px 0 34px;
    }

    .stage {
        height: min(76vh, 880px);
    }

    .pages {
        gap: 20px;
    }
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .btn:hover,
    .card:hover {
        transform: none;
    }
}

/* ---------- Print ---------- */

@media print {
    .site-header,
    .zoom-bar,
    .actions,
    .site-footer,
    .note {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .panel,
    .page-sheet {
        border: 0;
    }
}
