/* Peristyle website: showcase and user guide.
   Layout: a dictionary entry as the hero, then the three wings of the peristyle (Reader, Bookmarks, Archives),
   each carrying the colour it has in the application's sidebar. The guide pages use a sticky table of contents.
   Colours and fonts are the application's own (src/Peristyle.Web/wwwroot/app.css, design/README.md). */

@font-face { font-family: "Manrope"; src: url("fonts/manrope.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("fonts/cinzel.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("fonts/cormorant-garamond.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("fonts/cormorant-garamond-italic.woff2") format("woff2"); font-weight: 300 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Gentium Book Plus"; src: url("fonts/gentium-book-plus.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
    --bg: #f4f2ee;          /* stone */
    --surface: #ffffff;
    --surface-2: #edeae3;
    --border: #e2ddd3;
    --rule: #cfc8ba;
    --text: #1f2a24;
    --text-2: #4e5651;
    --text-3: #626864;
    --accent: #2f6b57;
    --accent-hover: #295b4a;
    --accent-soft: #e2eae7;
    --accent-text: #ffffff;
    --reader: #2f6b57;
    --bookmarks: #7a4fb5;
    --archives: #905624;
    --star: #c98a00;
    --fountain: #3e9e95;
    --code-bg: #ece8e0;
    --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px rgb(0 0 0 / .05);

    --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Cinzel", "Trajan Pro", Georgia, serif;
    --font-definition: "Cormorant Garamond", Garamond, Georgia, serif;
    --font-phonetic: "Gentium Book Plus", "Gentium Plus", "Charis SIL", Georgia, serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

    --radius: 8px;
    --radius-lg: 12px;
    --page: 1120px;
    --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #141a17; --surface: #18201c; --surface-2: #212a25; --border: #2a332e; --rule: #3a433e;
        --text: #e9e4da; --text-2: #a9b3ad; --text-3: #879089;
        --accent: #8cc0ae; --accent-hover: #a3cdbe; --accent-soft: #253832; --accent-text: #0e1411;
        --reader: #8cc0ae; --bookmarks: #b79ae6; --archives: #e0a46e; --star: #f2c14e; --fountain: #5fb8ae;
        --code-bg: #1d2521; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .25);
        color-scheme: dark;
    }
    :root:not([data-theme="light"]) .only-light { display: none; }
    :root:not([data-theme="light"]) .only-dark { display: inline-block; }
}
:root[data-theme="dark"] {
    --bg: #141a17; --surface: #18201c; --surface-2: #212a25; --border: #2a332e; --rule: #3a433e;
    --text: #e9e4da; --text-2: #a9b3ad; --text-3: #879089;
    --accent: #8cc0ae; --accent-hover: #a3cdbe; --accent-soft: #253832; --accent-text: #0e1411;
    --reader: #8cc0ae; --bookmarks: #b79ae6; --archives: #e0a46e; --star: #f2c14e; --fountain: #5fb8ae;
    --code-bg: #1d2521; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .25);
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
.only-dark { display: none; }
:root[data-theme="dark"] .only-light { display: none; }
:root[data-theme="dark"] .only-dark { display: inline-block; }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 400 16px/1.65 var(--font);
    text-rendering: optimizeLegibility;
}
img { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
h1, h2, h3 { text-wrap: balance; line-height: 1.2; margin: 0; }
p { margin: 0; }
code, kbd { font-family: var(--mono); font-size: .88em; }
code { background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
kbd {
    display: inline-block; min-width: 1.7em; text-align: center; padding: .05em .45em;
    background: var(--surface); border: 1px solid var(--rule); border-bottom-width: 2px;
    border-radius: 5px; color: var(--text); font-weight: 600; line-height: 1.5;
}
pre { background: var(--code-bg); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; margin: 0; font-size: .88rem; line-height: 1.55; }
pre code { background: none; padding: 0; }

.wrap { max-width: var(--page); margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
.site-header {
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; line-height: 0; }
.brand img { height: 44px; width: auto; }
.site-nav { display: flex; gap: 4px 20px; flex-wrap: wrap; margin-left: auto; align-items: center; font-size: .92rem; font-weight: 600; }
.site-nav a { color: var(--text-2); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tools { display: flex; gap: 8px; align-items: center; }
.lang, .theme-btn {
    font: 600 .8rem/1 var(--font); letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-2); background: none; border: 1px solid var(--rule); border-radius: 999px;
    padding: 7px 11px; text-decoration: none; cursor: pointer;
}
.lang:hover, .theme-btn:hover { color: var(--text); border-color: var(--text-3); }
.theme-btn { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; }
.theme-btn svg { width: 14px; height: 14px; }
@media (max-width: 640px) {
    html { scroll-padding-top: 128px; } /* the header wraps on two lines */
    .site-header .wrap { gap: 10px 16px; }
    .brand img { height: 38px; }
    .site-nav { order: 3; width: 100%; margin-left: 0; gap: 4px 18px; }
    .tools { margin-left: auto; }
}

/* Eyebrow and section heads */
.eyebrow { font: 600 .74rem/1.2 var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.section { padding-block: 72px; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { display: grid; gap: 12px; max-width: 720px; margin-bottom: 40px; }
.section-head h2 { font: 600 clamp(1.5rem, 2.6vw, 2rem)/1.2 var(--font-display); letter-spacing: .04em; }
.section-head p { color: var(--text-2); font-size: 1.05rem; }

/* Hero: the dictionary entry */
.hero { padding-block: 56px 64px; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; align-items: center; }
.entry { display: grid; gap: 18px; min-width: 0; }
.entry-word { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.entry-word h1 { font: 600 clamp(2.4rem, 6vw, 4.2rem)/1 var(--font-display); letter-spacing: .12em; }
.entry-phon { font: 400 clamp(1.05rem, 2vw, 1.4rem)/1 var(--font-phonetic); color: var(--text-2); }
.entry-pos { font: italic 400 clamp(1.05rem, 2vw, 1.4rem)/1 var(--font-definition); color: var(--text-2); }
.entry-ety { font: italic 400 1.15rem/1.45 var(--font-definition); color: var(--text-3); }
.senses { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: sense; }
.senses li { counter-increment: sense; display: grid; grid-template-columns: 1.6em minmax(0, 1fr); gap: 0 6px; font: 400 1.32rem/1.45 var(--font-definition); }
.senses li::before { content: counter(sense) "."; font-weight: 700; color: var(--accent); }
.senses .label { font-variant: small-caps; color: var(--text-2); margin-right: .3em; }
.senses .ex { display: block; font-style: italic; color: var(--text-2); font-size: 1.12rem; }
.senses strong { font-family: var(--font-display); font-size: .82em; letter-spacing: .1em; font-weight: 600; }
.hero-lede { font-size: 1.1rem; color: var(--text-2); max-width: 54ch; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: var(--radius);
    font: 700 .95rem/1 var(--font); text-decoration: none; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-text); }
.btn-ghost { border-color: var(--rule); color: var(--text); }
.btn-ghost:hover { border-color: var(--text-3); color: var(--text); }

/* Application mock (built in HTML, no screenshot) */
.mock {
    min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); overflow: hidden; font-size: 12.5px; line-height: 1.4;
}
.mock-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mock-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--rule); }
.mock-bar span { margin-left: 10px; color: var(--text-3); font-family: var(--mono); font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mock-body { display: grid; grid-template-columns: 132px minmax(0, 1fr) minmax(0, 1.15fr); min-height: 330px; }
.mock-side { background: var(--surface-2); padding: 12px 10px; display: grid; align-content: start; gap: 2px; border-right: 1px solid var(--border); }
.mock-side .grp { font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin: 8px 0 4px; display: flex; align-items: center; gap: 6px; }
.mock-side .grp::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.mock-side .grp.r { color: var(--reader); margin-top: 0; }
.mock-side .grp.b { color: var(--bookmarks); }
.mock-side .grp.a { color: var(--archives); }
.mock-side .it { display: flex; justify-content: space-between; gap: 6px; padding: 3px 6px; border-radius: 5px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.mock-side .it.on { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.mock-side .n { color: var(--text-3); font-variant-numeric: tabular-nums; }
.mock-list { border-right: 1px solid var(--border); display: grid; align-content: start; }
.mock-row { padding: 9px 11px; border-bottom: 1px solid var(--border); display: grid; gap: 3px; }
.mock-row.sel { background: var(--accent-soft); }
.mock-row .src { color: var(--text-3); font-size: 11px; display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; }
.mock-row .src span:first-child { overflow: hidden; text-overflow: ellipsis; }
.mock-row .t { font-weight: 700; color: var(--text); }
.mock-row.read .t { font-weight: 500; color: var(--text-2); }
.mock-read { padding: 14px 16px; display: grid; align-content: start; gap: 8px; }
.mock-read h4 { margin: 0; font: 700 15px/1.3 var(--font); }
.mock-read .meta { color: var(--text-3); font-size: 11px; }
.mock-read .acts { display: flex; gap: 5px; flex-wrap: wrap; }
.mock-read .acts b { font-weight: 600; font-size: 10.5px; border: 1px solid var(--rule); border-radius: 999px; padding: 2px 8px; color: var(--text-2); }
.mock-read .img { height: 74px; border-radius: 6px; background:
    radial-gradient(circle at 50% 62%, var(--fountain) 0 14px, transparent 15px),
    linear-gradient(160deg, color-mix(in srgb, var(--reader) 55%, var(--surface)) 0%, color-mix(in srgb, var(--reader) 25%, var(--surface)) 100%); }
.mock-read p { color: var(--text-2); }
.mock-read .line { height: 7px; border-radius: 4px; background: var(--surface-2); }
@media (max-width: 1000px) {
    .hero .wrap { grid-template-columns: minmax(0, 1fr); gap: 40px; }
}
@media (max-width: 560px) {
    .mock-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
    .mock-side { display: none; }
}

/* The three wings */
.wings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.wing { --c: var(--reader); display: grid; gap: 14px; align-content: start; padding-top: 18px; border-top: 3px solid var(--c); min-width: 0; }
.wing.bookmarks { --c: var(--bookmarks); }
.wing.archives { --c: var(--archives); }
.wing h3 { font: 600 1.35rem/1.2 var(--font-display); letter-spacing: .06em; color: var(--c); }
.wing .def { font: italic 400 1.2rem/1.4 var(--font-definition); color: var(--text-2); }
.wing ul { margin: 0; padding-left: 1.1em; display: grid; gap: 7px; color: var(--text); }
.wing li::marker { color: var(--c); }
.wing a.more { font-weight: 700; font-size: .92rem; color: var(--c); text-decoration: none; }
.wing a.more:hover { text-decoration: underline; }
@media (max-width: 860px) { .wings { grid-template-columns: minmax(0, 1fr); gap: 36px; } }

/* Feature lists */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 32px 40px; }
.feature { display: grid; gap: 8px; align-content: start; min-width: 0; }
.feature h3 { font: 700 1.05rem/1.3 var(--font); }
.feature p { color: var(--text-2); }

/* Quote band */
.band { background: var(--surface-2); }
.band .wrap { padding-block: 56px; display: grid; gap: 14px; max-width: 860px; }
.band blockquote { margin: 0; font: italic 400 clamp(1.35rem, 2.6vw, 1.75rem)/1.45 var(--font-definition); color: var(--text); }
.band cite { font-style: normal; color: var(--text-3); font-size: .9rem; }

/* Shortcut strip */
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px 24px; }
.keys div { display: flex; gap: 10px; align-items: center; color: var(--text-2); }
.keys kbd { flex: none; }

/* Install steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; counter-reset: step; max-width: 780px; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 2.2em minmax(0, 1fr); gap: 4px 12px; }
.steps > li::before { content: counter(step); font: 600 1.25rem/1.5 var(--font-display); color: var(--accent); grid-row: span 3; }
.steps h3 { font: 700 1.02rem/1.5 var(--font); }
.steps p { color: var(--text-2); }
.steps pre { margin-top: 8px; }
.prose .steps { padding-left: 0; }
.prose .steps h3 { margin-top: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding-block: 36px 48px; color: var(--text-3); font-size: .9rem; }
.site-footer .wrap { display: flex; gap: 16px 32px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.site-footer img { height: 34px; width: auto; }
.site-footer nav { display: flex; gap: 8px 20px; flex-wrap: wrap; }
.site-footer a { color: var(--text-2); }

/* Guide layout */
.doc-hero { padding-block: 48px 8px; }
.doc-hero .wrap { display: grid; gap: 12px; }
.doc-hero h1 { font: 600 clamp(1.9rem, 4vw, 2.8rem)/1.15 var(--font-display); letter-spacing: .05em; }
.doc-hero p { color: var(--text-2); font-size: 1.1rem; max-width: var(--measure); }
.doc { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 56px; padding-block: 32px 80px; align-items: start; }
.toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 90px); display: grid; gap: 2px; font-size: .9rem; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 6px; }
.toc .eyebrow { margin-bottom: 8px; }
.toc a { color: var(--text-2); text-decoration: none; padding: 4px 10px; border-left: 2px solid var(--border); }
.toc a:hover { color: var(--text); border-left-color: var(--text-3); }
.toc a.sub { padding-left: 22px; font-size: .86rem; }
.toc a.active { color: var(--text); border-left-color: var(--accent); font-weight: 600; }
.prose { min-width: 0; max-width: 760px; display: grid; gap: 16px; }
.prose > section { display: grid; gap: 16px; padding-bottom: 40px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.prose > section:last-child { border-bottom: 0; }
.prose h2 { font: 600 1.6rem/1.25 var(--font-display); letter-spacing: .04em; padding-top: 8px; }
.prose h2 .tag { display: inline-block; vertical-align: middle; width: 10px; height: 10px; border-radius: 3px; margin-right: 10px; background: var(--c, var(--accent)); }
.prose h3 { font: 700 1.1rem/1.35 var(--font); margin-top: 10px; }
.prose p, .prose li { max-width: var(--measure); }
.prose ul, .prose ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.prose .ui { font-weight: 700; color: var(--text); }
.prose .path { color: var(--text-2); font-weight: 600; }
.note {
    background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px;
    color: var(--text); font-size: .95rem; max-width: var(--measure);
}
.note strong { color: var(--text); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }
.c-reader { --c: var(--reader); }
.c-bookmarks { --c: var(--bookmarks); }
.c-archives { --c: var(--archives); }
@media (max-width: 900px) {
    .doc { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .toc { position: static; max-height: none; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); padding-bottom: 16px; border-bottom: 1px solid var(--border); }
    .toc .eyebrow { grid-column: 1 / -1; }
    .toc a.sub { display: none; }
}

/* Language chooser (site root) */
.chooser { min-height: 100vh; display: grid; place-content: center; gap: 28px; text-align: center; padding-block: 48px; }
.chooser img { width: 120px; margin-inline: auto; }
.chooser .entry { max-width: 640px; margin-inline: auto; text-align: left; }
.chooser .entry-word { justify-content: center; }
.chooser .cta-row { justify-content: center; }

@media (prefers-reduced-motion: no-preference) {
    .btn, .site-nav a, .toc a { transition: color .15s, background-color .15s, border-color .15s; }
}
