/* Daylapse site. Tokens from projects/daylapse/DESIGN.md (Color table, The print)
   and app/src/main/java/org/sonicon/daylapse/ui/theme/Color.kt. Young Serif is a
   single static weight: never synthesise bold. Body is the system sans. */

@font-face {
    font-family: "Young Serif";
    src: url("/daylapse/fonts/young-serif-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light dark;
    --page: #FBF5EC;
    --ink: #24180F;
    --muted: #55443A;
    --surface: #F7EFE4;
    --line: #E3D5C3;
    --primary: #9A4A00;
    --on-primary: #FFFFFF;
    --sun: #FFB547;
    --on-sun: #3A1D00;
    --sun-figure: #3A1D00;
    --rose: #86385A;
    --teal: #20626A;
    --mat: #FFFFFF;
    --on-mat: #24180F;
    --shadow: rgba(58, 29, 0, 0.18);
    --serif: "Young Serif", Georgia, "Times New Roman", serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --page: #16100C;
        --ink: #F4E6D6;
        --muted: #D8C3B0;
        --surface: #1E1712;
        --line: #3A2C22;
        --primary: #FFB547;
        --on-primary: #16100C;
        --sun: #2E1A0C;
        --on-sun: #F4E6D6;
        --sun-figure: #FFB547;
        --rose: #FFB0CB;
        --teal: #94D1D8;
        --mat: #F3E3CC;
        --on-mat: #24180F;
        --shadow: rgba(0, 0, 0, 0.5);
    }
}

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

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

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--primary); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-synthesis: none;
    line-height: 1.2;
    margin: 0 0 0.6em;
    text-wrap: balance;
}
h1 { font-size: clamp(1.5rem, 1rem + 4vw, 3.4rem); overflow-wrap: break-word; }
h2 { font-size: clamp(1.55rem, 3.6vw, 2.15rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li + li { margin-top: 0.4em; }

.num { font-variant-numeric: lining-nums tabular-nums; }

.wrap { width: min(100% - 2.5rem, 70rem); margin-inline: auto; }

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 10;
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: var(--on-primary);
    border-radius: 999px;
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* Header */
.topbar { border-bottom: 1px solid var(--line); }
.topbar .wrap {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: 0.5rem 1.5rem;
    padding-block: 0.5rem;
}
.brand {
    display: inline-flex; align-items: center; gap: 0.6rem;
    min-height: 48px; color: var(--ink); text-decoration: none;
}
.brand img { border-radius: 9px; }
.wordmark { font-family: var(--serif); font-size: 1.45rem; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0 0.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav li + li { margin-top: 0; }
.site-nav a {
    display: inline-flex; align-items: center; min-height: 48px;
    padding: 0 0.75rem; color: var(--ink); text-decoration: none; border-radius: 999px;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--surface); color: var(--primary); }

/* Hero: the sun field */
.sun {
    background: var(--sun);
    color: var(--on-sun);
}
.sun a:not(.play-badge) { color: var(--on-sun); }
.hero { padding-block: 3rem; }
.hero-grid { display: grid; gap: 2.5rem; align-items: center; }
.hero .sub { font-size: 1.2rem; max-width: 34rem; }
.hero .small { font-size: 0.95rem; max-width: 30rem; }
.play-badge { display: inline-block; border-radius: 8px; }
.play-badge img { width: 188px; height: 56px; }
.hero-shot { justify-self: center; width: min(100%, 20rem); }

/* The print: a white mat, 3px window corners, an offset shadow */
.print {
    margin: 0;
    padding: 6px;
    background: var(--mat);
    color: var(--on-mat);
    border: 1px solid rgba(36, 24, 15, 0.25);
    box-shadow: 3px 5px 12px var(--shadow);
}
.print img { border-radius: 3px; border: 1px solid rgba(36, 24, 15, 0.25); }
.hero-shot.print { transform: rotate(-2deg); }
@media (prefers-reduced-motion: reduce) { .hero-shot.print { transform: none; } }

/* Sections */
.section { padding-block: 3rem; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; }
.lead { font-size: 1.15rem; }
.answer { max-width: 44rem; }
.detail { color: var(--muted); max-width: 44rem; }
.split { display: grid; gap: 2rem; align-items: start; }
.split .print { width: min(100%, 17rem); justify-self: center; }

.cards { display: grid; gap: 1rem; list-style: none; padding: 0; margin: 1.5rem 0 0; }
.cards li { margin: 0; padding: 1.25rem; background: var(--surface); color: var(--ink); border-radius: 20px; }
.cards h3 { margin-bottom: 0.3em; }
.cards p { margin: 0; color: var(--muted); }

.facts { display: grid; gap: 0.75rem; margin: 0; }
.facts div { padding: 1rem 1.25rem; background: var(--surface); color: var(--ink); border-radius: 20px; }
.facts dt { font-family: var(--serif); }
.facts dd { margin: 0; color: var(--teal); font-weight: 600; }

/* Gallery */
.gallery {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 1rem; list-style: none; padding: 0; margin: 1.5rem 0 1rem;
}
.gallery li { margin: 0; }
.gallery figcaption { padding: 0.5rem 0.25rem 0.1rem; font-size: 0.85rem; line-height: 1.4; }
.demo-note { color: var(--muted); font-size: 0.95rem; }

.qlinks { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.5rem; }
.qlinks li { margin: 0; }
.qlinks a {
    display: flex; align-items: center; min-height: 48px; padding: 0.6rem 1.1rem;
    background: var(--surface); color: var(--ink); border-radius: 20px; text-decoration: none;
    font-family: var(--serif);
}
.qlinks a:hover { color: var(--primary); }

/* Inner pages */
.page-head { padding-block: 2rem 1.5rem; border-bottom: 1px solid var(--line); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; list-style: none; padding: 0; margin: 0 0 1rem; font-size: 0.95rem; }
.crumbs li { margin: 0; }
.crumbs li + li::before { content: "›"; padding: 0 0.5rem; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; min-height: 48px; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 44rem; }

.toc { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0; }
.toc li { margin: 0; }
.toc a {
    display: inline-flex; align-items: center; min-height: 48px; padding: 0 1rem;
    border: 1px solid var(--line); border-radius: 999px; text-decoration: none;
}

.step { padding-block: 2.5rem; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.step h3 { margin-top: 1.25rem; }

.table-wrap { margin: 1.25rem 0; }
table { border-collapse: collapse; width: 100%; max-width: 44rem; font-variant-numeric: lining-nums tabular-nums; }
caption { text-align: left; color: var(--muted); padding-bottom: 0.5rem; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); }
thead th { font-family: var(--serif); font-weight: 400; }

.limits { max-width: 46rem; }
.limits li { padding-left: 0.25rem; }
.limits strong { font-weight: 600; }

.ledger section { padding-block: 2rem; border-top: 1px solid var(--line); }
.ledger section:first-child { border-top: 0; }
.ledger h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); }

.get { padding-block: 3rem; text-align: center; }
.get h2 { margin-bottom: 1rem; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding-block: 2.5rem; font-size: 0.95rem; }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 1rem; list-style: none; padding: 0; margin: 1rem 0; }
.footer-links li { margin: 0; }
.footer-links a { display: inline-flex; align-items: center; min-height: 48px; }
.fine { color: var(--muted); }
.fine p { margin: 0 0 0.4em; }

@media (max-width: 600px) {
    thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    table, caption, tbody, tr, td, th { display: block; width: 100%; }
    tr { padding: 0.75rem 1rem; margin-bottom: 0.75rem; background: var(--surface); color: var(--ink); border-radius: 20px; }
    tbody th { border: 0; padding: 0 0 0.25rem; font-family: var(--serif); font-weight: 400; }
    td { border: 0; padding: 0.15rem 0; }
    td::before { content: attr(data-label) ": "; color: var(--muted); }
}

@media (min-width: 40rem) {
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr) auto; }
    .split.flip { grid-template-columns: auto minmax(0, 1fr); }
    .split.flip > :first-child { order: 2; }
    .split .print { width: 17rem; }
}

@media (min-width: 60rem) {
    .hero { padding-block: 4.5rem; }
    .hero-grid { grid-template-columns: minmax(0, 1fr) 20rem; }
    .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
