/*
 * NovelScraper, novelscraper.com
 *
 * The tokens here are the app's own, lifted from
 * app/composeApp/.../ui/theme/Theme.kt so the site and the thing it describes
 * are visibly the same product. Dark is the default, as it is in the app; light
 * follows the reader's system setting.
 *
 * Three typefaces, the same three the app bundles: Playfair Display for
 * headings, Source Serif 4 for reading, JetBrains Mono for labels and anything
 * numeric or operational.
 */

:root {
    color-scheme: dark light;

    --bg: #0a0a0b;
    --surface: #161618;
    --surface-high: #1d1d20;
    --surface-highest: #232327;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --outline: #2a2a2e;
    --accent: #818cf8;
    --accent-container: #1e1f3a;
    --on-accent: #0a0a0b;
    --teal: #2dd4bf;

    --display: "Playfair Display", Georgia, "Times New Roman", serif;
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

    --measure: 34rem;
    --wide: 60rem;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #ffffff;
        --surface: #fafafa;
        --surface-high: #f4f4f5;
        --surface-highest: #efeff1;
        --text: #18181b;
        --muted: #71717a;
        --outline: #e4e4e7;
        --accent: #4f46e5;
        --accent-container: #ecebfb;
        --on-accent: #ffffff;
        --teal: #0d9488;
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--serif);
    font-size: 1.0625rem;
    line-height: 1.65;
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    width: 100%;
    max-width: var(--wide);
    margin-inline: auto;
    padding-inline: 1.5rem;
}

/* --- the small uppercase mono label the app uses above sections --- */
.kicker {
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 0.75rem;
}

h1, h2, h3 {
    font-family: var(--display);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0;
    text-wrap: balance;
}

h1 { font-size: clamp(2.5rem, 7vw, 4rem); }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.15rem); }
h3 { font-size: 1.2rem; font-weight: 600; }

p { margin: 0 0 1.1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

strong { font-weight: 600; }

/* --- masthead ------------------------------------------------------------ */

.masthead {
    border-bottom: 1px solid var(--outline);
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.masthead .wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 4rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.brand img { width: 1.75rem; height: 1.75rem; border-radius: 0.4rem; display: block; }

.masthead nav {
    margin-left: auto;
    display: flex;
    gap: 1.4rem;
    font-size: 0.95rem;
}

.masthead nav a { color: var(--muted); text-decoration: none; }
.masthead nav a:hover { color: var(--text); }

@media (max-width: 34rem) {
    .masthead nav { display: none; }
}

/* --- hero ---------------------------------------------------------------- */

.hero {
    padding: clamp(3.5rem, 11vw, 7rem) 0 clamp(2.5rem, 7vw, 4.5rem);
    text-align: center;
}

.hero img.mark {
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 1.4rem;
    display: block;
    margin: 0 auto 1.75rem;
}

.hero .lede {
    font-size: clamp(1.1rem, 2.4vw, 1.3rem);
    color: var(--muted);
    max-width: var(--measure);
    margin: 1.25rem auto 0;
    text-wrap: pretty;
}

/* --- buttons ------------------------------------------------------------- */

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 2.25rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: var(--serif);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.12s ease, background-color 0.12s ease;
}

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

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }

.btn-ghost { border-color: var(--outline); color: var(--text); background: transparent; }
.btn-ghost:hover { background: var(--surface-high); }

/* --- sections ------------------------------------------------------------ */

section { padding: clamp(2.75rem, 7vw, 4.5rem) 0; }
section + section { border-top: 1px solid var(--outline); }

.section-head { max-width: var(--measure); margin-bottom: 2.25rem; }
.section-head p { color: var(--muted); margin-top: 0.85rem; margin-bottom: 0; }

/* --- a heading beside its prose, rather than a column of text and a void --- */

.split { display: grid; gap: 1.5rem; }

@media (min-width: 54rem) {
    .split {
        grid-template-columns: 19rem 1fr;
        gap: 3.5rem;
    }
    .split-head { position: sticky; top: 6rem; align-self: start; }
}

.split-head h2 { text-wrap: pretty; }
.split-body { max-width: 38rem; }
.split-body p { color: var(--muted); }
.split-body p:first-child { color: var(--text); font-size: 1.1rem; }

/* --- the feature grid ---------------------------------------------------- */

.grid {
    display: grid;
    gap: 1px;
    background: var(--outline);
    border: 1px solid var(--outline);
    border-radius: 0.9rem;
    overflow: hidden;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.grid > div { background: var(--bg); padding: 1.6rem 1.5rem; }
.grid h3 { margin-bottom: 0.55rem; }
.grid p { color: var(--muted); font-size: 0.98rem; margin: 0; }

/* --- downloads ----------------------------------------------------------- */

.downloads {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

.dl {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.3rem;
    border: 1px solid var(--outline);
    border-radius: 0.8rem;
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.12s ease, background-color 0.12s ease;
}

.dl:hover { border-color: var(--accent); background: var(--surface-high); text-decoration: none; }
.dl .name { font-weight: 600; }
.dl .file {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--muted);
    margin-left: auto;
    white-space: nowrap;
}

.note {
    color: var(--muted);
    font-size: 0.95rem;
    max-width: var(--measure);
    margin-top: 1.5rem;
}

/* --- legal pages --------------------------------------------------------- */

.doc { padding: clamp(2.5rem, 6vw, 4rem) 0 5rem; }
.doc .wrap { max-width: 44rem; }

.doc h1 { font-size: clamp(2rem, 5vw, 2.75rem); margin-bottom: 0.5rem; }
.doc h2 {
    font-size: 1.45rem;
    margin: 2.75rem 0 0.9rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--outline);
}
.doc h2:first-of-type { border-top: 0; padding-top: 0; }
.doc h3 { margin: 1.75rem 0 0.6rem; }

.doc .updated {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 2.5rem;
}

.doc ul, .doc ol { padding-left: 1.3rem; margin: 0 0 1.1rem; }
.doc li { margin-bottom: 0.5rem; }

.doc table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.4rem;
    font-size: 0.94rem;
    display: block;
    overflow-x: auto;
}
.doc th, .doc td {
    text-align: left;
    vertical-align: top;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--outline);
}
.doc th {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.doc code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--surface-highest);
    padding: 0.12em 0.4em;
    border-radius: 0.3rem;
}

.doc pre {
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: 0.6rem;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    font-size: 0.85rem;
}
.doc pre code { background: none; padding: 0; }

.doc blockquote {
    margin: 0 0 1.2rem;
    padding: 0.9rem 1.2rem;
    border-left: 3px solid var(--accent);
    background: var(--surface);
    border-radius: 0 0.5rem 0.5rem 0;
    color: var(--muted);
}

.backlink {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    margin-bottom: 2rem;
}
.backlink:hover { text-decoration: underline; }

/* --- footer -------------------------------------------------------------- */

footer {
    border-top: 1px solid var(--outline);
    padding: 3rem 0 4rem;
    color: var(--muted);
    font-size: 0.93rem;
}

footer .cols {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem 4rem;
    margin-bottom: 2.5rem;
}

footer h4 {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.85rem;
}

footer ul { list-style: none; margin: 0; padding: 0; }
footer li { margin-bottom: 0.45rem; }
footer li a { color: var(--text); text-decoration: none; }
footer li a:hover { text-decoration: underline; }

footer .fine { max-width: var(--measure); }
footer .fine p { margin-bottom: 0.6rem; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    .btn:hover { transform: none; }
}
