/* Calify tokens (DESIGN.md): dark is the default, light is data-theme="light". Neutral greys, one lime accent. */
:root {
    --w: 180px; /* a photo card's width; each layout sets its own */
    --frame: #0d0d0e;
    --bg: #131314;
    --panel: #19191b;
    --hover: #202022;
    --border: #27272a;
    --input: #333337;
    --ink: #ededee;
    --muted: #a0a0a6;
    --faint: #67676d;
    --primary: #c6f432;
    --primary-ink: #111113;
    --brand-ink: #c6f432;
    --paper: #f4f4f5; /* a polaroid's frame */
    --paper-ink: #18181b;
    --paper-muted: #5c5c64;
    --paper-brand: #4f7a06;
    --photo-shadow: 0 1px 0 rgb(0 0 0 / 0.4), 0 10px 30px -12px rgb(0 0 0 / 0.7);
    --font: "Onest", ui-sans-serif, system-ui, sans-serif;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --frame: #ffffff;
    --bg: #f7f7f8;
    --panel: #ffffff;
    --hover: #f2f2f4;
    --border: #e6e6e9;
    --input: #d6d6db;
    --ink: #18181b;
    --muted: #5c5c64;
    --faint: #9b9ba3;
    --primary-ink: #18181b;
    --brand-ink: #4f7a06;
    --paper: #ffffff;
    --photo-shadow: 0 0 0 1px rgb(0 0 0 / 0.06), 0 10px 28px -14px rgb(0 0 0 / 0.35);
    color-scheme: light;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    background: var(--frame);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    line-height: 20px;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100svh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ---------- Wordmark (copied from packages/ui/src/styles.css) ---------- */

.wordmark {
    font-family: var(--font);
    font-weight: 650;
    letter-spacing: -0.045em;
    line-height: 1;
    white-space: nowrap;
}

.wordmark-colon {
    display: inline-block;
    position: relative;
    width: 0.17em;
    height: 0.527em;
    margin: 0 0.05em 0 0.0675em;
    vertical-align: baseline;
}

.wordmark-colon::before,
.wordmark-colon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 0.17em;
    height: 0.17em;
    border-radius: 0.045em;
    background-color: var(--primary);
}

.wordmark-colon::before {
    top: 0;
}

.wordmark-colon::after {
    bottom: 0;
}

/* ---------- Nav ---------- */

.nav {
    position: relative;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 32px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 20px 24px;
}

.nav-brand {
    font-size: 24px;
}

.nav-links {
    display: flex;
    gap: 24px;
    margin-left: auto;
    color: var(--muted);
}

.nav-links a:hover {
    color: var(--ink);
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 18px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    transition: filter 120ms;
}

.btn-sm {
    height: 36px;
    padding: 0 14px;
    font-size: 14px;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-ink);
}

.btn-primary:hover {
    filter: brightness(0.94);
}

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

.hero {
    position: relative;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

.hero-copy {
    position: relative;
    z-index: 30;
    max-width: 560px;
}

.hero-copy.center {
    margin: 0 auto;
    text-align: center;
}

h1 {
    margin: 0;
    font-size: clamp(40px, 6vw, 68px);
    line-height: 1.02;
    font-weight: 600;
    letter-spacing: -0.04em;
    text-wrap: balance;
}

.lede {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 26px;
    text-wrap: pretty;
}

.center .lede {
    margin-inline: auto;
    max-width: 460px;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
}

.center .hero-actions {
    justify-content: center;
}

.hint {
    color: var(--faint);
    font-size: 13px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--faint);
    flex: none;
}

/* ---------- Photo card: a polaroid ---------- */

.card {
    container-type: inline-size;
    width: var(--w);
    margin: 0;
    user-select: none;
}

.card-img {
    overflow: hidden;
    background: var(--panel);
}

.card-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card figcaption {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.city {
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Every photo is a polaroid: a paper frame, a wider bottom edge with the city and its time, and a slight tilt. */
.card {
    padding: calc(var(--w) * 0.055) calc(var(--w) * 0.055) 0;
    background: var(--paper);
    color: var(--paper-ink);
    border-radius: 3px;
    box-shadow: var(--photo-shadow);
    rotate: var(--r, 0deg);
}

.card-img {
    aspect-ratio: 1;
    border-radius: 1px;
}

.card figcaption {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: calc(var(--w) * 0.06) 2px calc(var(--w) * 0.07);
    font-size: clamp(12px, calc(var(--w) * 0.075), 15px);
}

/* A small polaroid puts the time under the city instead of beside it. */
@container (max-width: 165px) {
    .card figcaption {
        flex-direction: column;
        align-items: flex-start;
        gap: 1px;
    }
    .card .clock {
        align-items: flex-start;
    }
}

.card .city {
    white-space: normal;
    line-height: 1.15;
}

.card .clock {
    --colon: var(--paper-brand);
    color: var(--paper-ink);
}

.card .clock-meta {
    color: var(--paper-muted);
}

/* ---------- Clock: 14:07 with the wordmark's colon, and "Tue · UTC+9" ---------- */

.clock {
    --colon: var(--brand-ink);
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.clock-time {
    display: inline-flex;
    align-items: baseline;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.tick {
    position: relative;
    display: inline-block;
    width: 0.17em;
    height: 0.6em;
    margin: 0 0.09em 0 0.1em;
    opacity: var(--blink, 1);
    transition: opacity 200ms;
}

.tick::before,
.tick::after {
    content: "";
    position: absolute;
    left: 0;
    width: 0.17em;
    height: 0.17em;
    border-radius: 0.045em;
    background: var(--colon);
}

.tick::before {
    top: 0;
}

.tick::after {
    bottom: 0;
}

.clock-meta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 0.78em;
    line-height: 1.2;
}

.clock .dot {
    width: 5px;
    height: 5px;
    border-radius: 1.5px;
}

.clock.is-open .dot {
    background: var(--colon);
}

/* ---------- A: floating cluster ---------- */

.hero-float {
    display: grid;
    place-items: center;
    min-height: max(680px, calc(100svh - 76px));
    max-width: none;
    overflow: hidden;
}

.float-layer {
    position: absolute;
    inset: 0;
}

.floater {
    position: absolute;
    will-change: transform;
}

/* ---------- B: path marquee ---------- */

.hero-path {
    padding-top: 56px;
    max-width: none;
    padding-inline: 0;
    overflow: hidden;
}

.hero-path .hero-copy {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

.hero-path .hero-copy > * {
    max-width: 640px;
}

.path-band {
    position: relative;
    height: clamp(460px, 44vw, 640px);
    margin-top: 0;
}

/* On wide screens the path climbs up beside the copy. */
@media (min-width: 1100px) {
    .path-band {
        margin-top: -260px;
    }
}

.path-line {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.path-line path {
    fill: none;
    stroke: var(--border);
    stroke-width: 1;
}

.path-line .line-chips {
    stroke-dasharray: 2 6;
}

.track {
    position: absolute;
    inset: 0;
}

.rider {
    position: absolute;
    top: 0;
    left: 0;
    offset-rotate: 0deg;
    offset-anchor: center;
    will-change: offset-distance;
}

.track-photos .card {
    --w: 156px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    white-space: nowrap;
}

.chip-city {
    font-weight: 500;
}

.chip .clock {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.chip .clock-meta {
    order: -1;
}

.chip .meta {
    display: none;
}

/* ---------- Prototype controls ---------- */

/* Room under the page for the fixed controls bar. */
main {
    padding-bottom: 80px;
}

.controls {
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: 16px;
    translate: -50% 0;
    display: flex;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: 0 12px 32px -16px rgb(0 0 0 / 0.5);
}

.seg {
    display: flex;
    gap: 2px;
    padding-left: 6px;
    border-left: 1px solid var(--border);
}

.seg:first-child {
    padding-left: 0;
    border-left: 0;
}

.seg button {
    height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.seg button:hover {
    color: var(--ink);
}

.seg button[aria-pressed="true"] {
    background: var(--hover);
    color: var(--ink);
}

:focus-visible {
    outline: 2px solid var(--brand-ink);
    outline-offset: 2px;
}

/* ---------- Narrow screens ---------- */

/* The floating photos shrink on mid-size screens so they stay clear of the headline. */
@media (max-width: 1200px) {
    .hero-float {
        --k: 0.82;
    }
}

@media (max-width: 1000px) {
    .hero-float {
        --k: 0.66;
    }
}

@media (max-width: 720px) {
    .nav {
        padding: 14px 16px;
    }
    .nav-brand {
        font-size: 22px;
    }
    .nav-links {
        display: none;
    }
    .nav .btn {
        margin-left: auto;
    }
    .hero {
        padding: 0 16px;
    }
    h1 {
        font-size: 38px;
    }
    .lede {
        font-size: 16px;
        line-height: 24px;
    }
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        text-align: center;
    }
    .hero-actions .btn {
        justify-content: center;
    }

    .hero-float {
        --k: 1;
        min-height: 760px;
        padding-inline: 20px;
    }

    .hero-path {
        padding-top: 32px;
        padding-inline: 0;
    }
    .hero-path .hero-copy {
        padding: 0 16px;
    }
    .path-band {
        height: 380px;
        margin-top: 8px;
    }
    .track-photos .card {
        --w: 112px;
    }

    main {
        padding-bottom: 120px;
    }
    .controls {
        left: 8px;
        right: 8px;
        translate: none;
        flex-wrap: wrap;
        justify-content: center;
    }
    .seg button {
        padding: 0 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tick {
        opacity: 1;
        transition: none;
    }
}
