@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  --bg: #eee3cf;
  --paper: #fbf3e4;
  --paper-bright: #fffaf0;
  --ink: #2d211b;
  --muted: #756052;
  --accent: #a34b27;
  --accent-strong: #84371f;
  --wine: #3b211f;
  --line: #cdb99b;
  --soft: #e7d8bf;
  --header-height: 77px;
  color-scheme: light;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="dark"] {
  --bg: #211b19;
  --paper: #2d2420;
  --paper-bright: #352a25;
  --ink: #f4eadc;
  --muted: #c7b7a7;
  --accent: #e29a70;
  --accent-strong: #a64f30;
  --wine: #17100f;
  --line: #5a493e;
  --soft: #3c3029;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 24px); }
body {
  min-width: 320px;
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(79, 55, 38, .055) .7px, transparent .8px);
  background-size: 7px 7px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
}
a { color: inherit; text-decoration: none; }
a, button { touch-action: manipulation; }
img { max-width: 100%; height: auto; }
button, input { font: inherit; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.skip-link { position: fixed; top: -80px; left: 18px; z-index: 30; padding: 10px 15px; background: var(--paper-bright); color: var(--wine); font-weight: 700; }
.skip-link:focus { top: 14px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.top { position: sticky; top: 0; z-index: 20; display: flex; min-height: var(--header-height); align-items: center; justify-content: space-between; gap: 25px; padding: 0 max(5vw, 24px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 96%, transparent); backdrop-filter: blur(8px); }
.logo { display: flex; min-height: 44px; flex: none; align-items: center; gap: 10px; font: 700 19px "Libre Baskerville", Georgia, serif; white-space: nowrap; }
.logo img { width: 34px; height: 34px; object-fit: contain; }
.top nav { display: flex; align-items: center; gap: 28px; font-size: 13px; font-weight: 600; }
.top nav a { display: inline-flex; min-height: 44px; align-items: center; padding-block: 8px; }
.top nav a:hover, .top nav a.selected, .top nav a[aria-current="page"] { color: var(--accent); }
.theme-toggle { display: grid; flex: none; width: 44px; height: 44px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); font-size: 18px; }
.theme-toggle:hover { background: var(--soft); }

.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .15em; }
h1, h2, h3 { font-family: "Libre Baskerville", Georgia, serif; font-weight: 400; letter-spacing: -.05em; }
h1 { margin: 18px 0 26px; font-size: clamp(52px, 6.2vw, 100px); line-height: 1.1; }
h2 { font-size: clamp(36px, 4vw, 60px); line-height: 1.17; }
em { color: var(--accent); font-weight: 400; }

.hero { display: grid; grid-template-columns: 1.08fr .92fr; min-height: 660px; background: var(--paper); }
.hero-copy { align-self: center; padding: 102px 6vw 88px max(7vw, 26px); }
.lead { max-width: 570px; color: var(--muted); font-size: 17px; line-height: 1.8; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 25px; margin-top: 37px; }
.primary { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: 13px 22px; border-radius: 3px; background: var(--accent-strong); color: #fffaf0; font-size: 13px; font-weight: 700; }
.primary::after { content: " ↗"; padding-left: 8px; }
.primary:hover { background: var(--wine); }
.secondary { color: var(--accent); font-size: 13px; font-weight: 700; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 5px; }
.secondary::after { content: " →"; }
.secondary:hover { text-decoration-color: currentColor; }
.hero-note { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: 62px; color: var(--muted); font-size: 11px; }
.hero-note span::before { content: "✧ "; color: var(--accent); }
.hero-visual { position: relative; display: flex; min-height: 580px; align-items: center; justify-content: center; overflow: hidden; border-left: 1px solid var(--line); background-color: #cdb496; background-image: radial-gradient(circle at 50% 38%, rgba(255, 244, 216, .72), transparent 56%), repeating-linear-gradient(0deg, rgba(78, 49, 33, .035) 0, rgba(78, 49, 33, .035) 1px, transparent 1px, transparent 5px); }
.book { position: relative; display: flex; width: 205px; height: 300px; flex-direction: column; justify-content: space-between; padding: 25px; border-left: 9px solid rgba(0, 0, 0, .2); box-shadow: 15px 22px 30px rgba(62, 41, 40, .3); font-family: Georgia, serif; }
.book small { font: 10px "DM Sans", sans-serif; letter-spacing: .12em; }
.book strong { font-size: 33px; font-weight: 400; line-height: 1.2; }
.book span { font-size: 12px; font-style: italic; }
.book-one { z-index: 1; transform: rotate(-13deg) translateX(28px); background: #714039; color: #f6e7d2; }
.book-two { transform: rotate(10deg) translate(-10px, 30px); background: #ead9b8; color: #4c4233; }
.leaf-mark { position: absolute; top: 12%; right: 14%; width: 72px; height: 54px; transform: rotate(-22deg); border: 1px solid rgba(94, 54, 30, .28); border-radius: 80% 10% 80% 10%; }
.leaf-mark::after { content: ""; position: absolute; top: 26px; left: -10px; width: 88px; height: 1px; transform: rotate(-33deg); background: rgba(94, 54, 30, .28); }
.hero-visual > p { position: absolute; right: 30px; bottom: 25px; margin: 0; color: #4b362c; font: italic 13px Georgia, serif; }

.edition { padding: 102px max(7vw, 25px) 110px; border-top: 1px solid var(--line); background: var(--paper-bright); }
.edition-heading { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .6fr); gap: 8vw; align-items: end; max-width: 1380px; margin: 0 auto 72px; }
.edition-heading h2 { max-width: 820px; margin: 12px 0 0; }
.edition-heading > p { max-width: 480px; margin: 0 0 9px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.release-story { display: grid; grid-template-columns: minmax(250px, .58fr) minmax(0, 1.42fr); gap: clamp(38px, 6vw, 94px); align-items: center; max-width: 1380px; margin: 0 auto; padding: 74px 0; border-top: 1px solid var(--line); }
.release-story-reverse { grid-template-columns: minmax(0, 1.42fr) minmax(250px, .58fr); }
.release-story-reverse .story-copy { order: 2; }
.release-story-reverse .screen-print { order: 1; }
.story-copy { max-width: 470px; }
.story-copy .folio { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.story-copy h3 { margin: 19px 0 20px; font-size: clamp(28px, 3vw, 42px); line-height: 1.22; }
.story-copy p, .story-copy li { color: var(--muted); font-size: 14px; line-height: 1.85; }
.story-copy ul { margin: 24px 0 28px; padding: 0; list-style: none; }
.story-copy li { position: relative; padding: 8px 0 8px 21px; border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
.story-copy li::before { position: absolute; left: 1px; color: var(--accent); content: "✦"; font-size: 9px; }
.screen-print { margin: 0; padding: 12px 12px 9px; border: 1px solid var(--line); background: var(--soft); }
.screen-print-dark { background: var(--wine); }
.screen-print img { display: block; width: 100%; border: 1px solid color-mix(in srgb, var(--line) 76%, transparent); }
.screen-print figcaption { padding: 10px 3px 1px; color: var(--muted); font: italic 12px Georgia, serif; }
.screen-print-dark figcaption { color: #d8c7b8; }
.edition-notes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 1380px; margin: 10px auto 0; border-block: 1px solid var(--line); }
.edition-notes p { margin: 0; padding: 30px 28px; border-left: 1px solid var(--line); }
.edition-notes p:first-child { border-left: 0; }
.edition-notes strong, .edition-notes span { display: block; }
.edition-notes strong { margin-bottom: 8px; font: 400 17px "Libre Baskerville", Georgia, serif; }
.edition-notes span { color: var(--muted); font-size: 12px; line-height: 1.65; }

.intro { padding: 100px max(7vw, 25px); }
.intro > p:not(.eyebrow) { max-width: 640px; color: var(--muted); }
.intro h2 { max-width: 780px; margin: 10px 0; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 45px; border: 1px solid var(--line); background: var(--line); }
.features a { min-height: 250px; padding: 38px; background: var(--paper); transition: background-color .18s ease; }
.features a:hover { background: var(--soft); }
.features span { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.features h3 { margin: 27px 0 12px; font-size: 25px; }
.features p { color: var(--muted); font-size: 13px; }

.plans { padding: 104px max(7vw, 25px) 112px; border-top: 1px solid var(--line); background: var(--paper-bright); }
.plans-heading { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, .58fr); gap: 8vw; align-items: end; max-width: 1380px; margin: 0 auto 58px; }
.plans-heading h2 { max-width: 820px; margin: 12px 0 0; }
.plans-heading > p { max-width: 480px; margin: 0 0 9px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.plan-ledger { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1380px; margin: 0 auto; border-block: 1px solid var(--line); }
.plan-entry { display: flex; min-width: 0; flex-direction: column; padding: 38px 34px 34px; border-left: 1px solid var(--line); }
.plan-entry:first-child { border-left: 0; }
.plan-entry-featured { background: color-mix(in srgb, var(--soft) 55%, transparent); }
.plan-title { min-height: 138px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.plan-title span, .plan-title strong, .plan-title small { display: block; }
.plan-title span { min-height: 44px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.plan-title strong { font: 400 clamp(30px, 3vw, 44px) "Libre Baskerville", Georgia, serif; letter-spacing: -.04em; }
.plan-title small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.plan-entry ul { flex: 1; margin: 0 0 28px; padding: 0; list-style: none; }
.plan-entry li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 14px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent); color: var(--muted); font-size: 12px; line-height: 1.55; }
.plan-entry li strong { max-width: 150px; color: var(--ink); font-weight: 600; text-align: right; }
.plan-entry > a { align-self: flex-start; }
.plan-note { max-width: 1040px; margin: 30px auto 0; color: var(--muted); font-size: 12px; line-height: 1.75; text-align: center; }

.statement { padding: 98px 24px 104px; background: var(--wine); color: #f5ede2; text-align: center; }
.statement h2 { max-width: 1000px; margin: 20px auto 22px; }
.statement > p:not(.eyebrow) { max-width: 620px; margin: 0 auto 32px; color: #d8c7b8; }
.statement .primary { margin: auto; background: #b85b34; }
.statement .primary:hover { background: #ce724a; }

.downloads { display: flex; align-items: center; justify-content: space-between; gap: 45px; padding: 96px max(7vw, 25px); }
.downloads > div:first-child { max-width: 690px; }
.downloads h2 { margin-bottom: 18px; }
.downloads p:not(.eyebrow) { max-width: 620px; color: var(--muted); }
.download-actions { display: flex; min-width: 265px; align-items: flex-start; flex-direction: column; gap: 17px; }
.download-actions span { color: var(--muted); font-size: 12px; }

footer { display: flex; justify-content: space-between; gap: 30px; padding: 55px max(7vw, 25px); background: var(--wine); color: #f4e8db; }
footer strong { font: 22px Georgia, serif; }
footer p { color: #bfae9e; }
footer > div:last-child { display: flex; flex-wrap: wrap; gap: 18px 24px; font-size: 12px; }
footer a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; }
footer a:hover { text-decoration-color: currentColor; }

/* Documentation */
.docs-layout { display: grid; grid-template-columns: 260px minmax(0, 780px) 180px; gap: 45px; max-width: 1450px; margin: auto; padding: 38px 35px 80px; align-items: start; }
.sidebar { position: sticky; top: 110px; height: calc(100vh - 140px); overflow: auto; padding-right: 15px; }
.back { display: inline-block; min-height: 44px; color: var(--muted); font-size: 12px; }
.sidebar .eyebrow { margin: 8px 0 15px; }
#search { width: 100%; min-height: 44px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); }
.nav-category { margin: 22px 0 9px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; }
.nav-link { display: flex; min-height: 38px; align-items: center; padding: 6px 12px; border-left: 2px solid transparent; color: var(--muted); font-size: 13px; }
.nav-link:hover, .nav-link.active { border-left-color: var(--accent); background: var(--soft); color: var(--ink); }
.article { min-height: 75vh; padding: 46px 55px; border: 1px solid var(--line); background: var(--paper); }
.article h1 { margin: 10px 0 20px; font-size: clamp(34px, 4vw, 51px); }
.article h2 { margin: 42px 0 12px; font-size: 26px; scroll-margin-top: 110px; }
.article p, .article li { color: var(--muted); font-size: 14px; line-height: 1.9; }
.article .intro-text { color: var(--ink); font-size: 17px; }
.article .tip { margin: 25px 0; padding: 17px 20px; border-left: 3px solid var(--accent); background: var(--bg); font-size: 13px; }
.article .tip strong { color: var(--ink); }
.doc-figure { margin: 34px 0 48px; padding: 9px 9px 7px; border: 1px solid var(--line); background: var(--bg); }
.doc-figure img { display: block; width: 100%; }
.doc-figure figcaption { padding: 9px 5px 2px; color: var(--muted); font: italic 12px Georgia, serif; }
.toc { position: sticky; top: 110px; }
.toc .eyebrow { margin-bottom: 12px; }
.toc a { display: block; padding: 7px 0; color: var(--muted); font-size: 12px; }
.toc a:hover { color: var(--accent); }
.doc-bottom { display: flex; justify-content: space-between; gap: 20px; margin-top: 55px; padding-top: 22px; border-top: 1px solid var(--line); }
.doc-bottom button { min-height: 44px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 3px; background: var(--bg); color: var(--ink); }
.doc-bottom button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.doc-bottom button:disabled { cursor: default; opacity: .45; }
.empty-search { padding: 14px 0; color: var(--muted); font-size: 13px; }

/* Privacy */
.policy-page { width: min(1180px, calc(100% - 64px)); margin: 0 auto; padding: 82px 0 120px; }
.policy-intro { padding-bottom: 48px; border-bottom: 1px solid var(--line); }
.policy-intro .eyebrow { margin-bottom: 17px; }
.policy-intro h1 { margin: 0; font-size: clamp(43px, 5vw, 72px); line-height: 1.15; }
.policy-summary { max-width: 720px; margin: 21px 0 20px; color: var(--muted); font-size: 17px; line-height: 1.75; }
.policy-intro time, .policy-intro > span { color: var(--muted); font-size: 12px; }
.policy-layout { display: grid; grid-template-columns: 240px minmax(0, 760px); gap: 90px; padding-top: 56px; }
.policy-toc { position: sticky; top: 110px; display: flex; align-self: start; flex-direction: column; gap: 11px; }
.policy-toc .eyebrow { margin-bottom: 7px; }
.policy-toc a { min-height: 34px; color: var(--muted); font-size: 13px; }
.policy-toc a:hover { color: var(--accent); }
.policy-content section { margin-bottom: 30px; padding-bottom: 31px; border-bottom: 1px solid var(--line); scroll-margin-top: 110px; }
.policy-content section:last-child { border: 0; }
.policy-content h2 { margin: 0 0 19px; font-size: 27px; letter-spacing: -.035em; }
.policy-content p { margin: 0 0 17px; color: var(--muted); font-size: 15px; line-height: 1.85; }
.policy-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.language-switcher { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.language-switcher button { min-width: 32px; min-height: 44px; padding: 4px; border: 0; background: transparent; color: inherit; font-weight: 700; }
.language-switcher button[aria-pressed="true"] { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

@media (max-width: 1100px) {
  .docs-layout { grid-template-columns: 235px minmax(0, 1fr); }
  .toc { display: none; }
  .features { grid-template-columns: repeat(2, 1fr); }
  .plan-entry { padding-inline: 25px; }
  .edition-heading { gap: 45px; }
  .release-story, .release-story-reverse { grid-template-columns: minmax(230px, .7fr) minmax(0, 1.3fr); }
  .release-story-reverse { grid-template-columns: minmax(0, 1.3fr) minmax(230px, .7fr); }
  .edition-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .edition-notes p:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .edition-notes p:nth-child(4) { border-top: 1px solid var(--line); }
  .top nav { gap: 18px; }
  .github-link { display: none; }
}

@media (max-width: 760px) {
  :root { --header-height: 116px; }
  .top { min-height: 0; padding: 10px 18px 12px; flex-wrap: wrap; gap: 6px 14px; }
  .top nav { order: 3; width: 100%; justify-content: flex-start; gap: 4px 18px; overflow-x: auto; font-size: 12px; scrollbar-width: none; }
  .top nav::-webkit-scrollbar { display: none; }
  .top nav a { display: flex; flex: none; min-height: 44px; align-items: center; }
  .theme-toggle { width: 42px; height: 42px; }
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 64px 25px 68px; }
  .hero-visual { min-height: 410px; border-top: 1px solid var(--line); border-left: 0; }
  .hero-note { margin-top: 36px; }
  .edition { padding: 72px 20px 76px; }
  .edition-heading { display: block; margin-bottom: 42px; }
  .edition-heading > p { margin-top: 22px; font-size: 16px; }
  .release-story, .release-story-reverse { display: flex; flex-direction: column; gap: 34px; align-items: stretch; padding: 54px 0; }
  .release-story-reverse .story-copy, .release-story-reverse .screen-print { order: initial; }
  .story-copy { max-width: none; }
  .story-copy p, .story-copy li { font-size: 16px; }
  .screen-print { padding: 7px 7px 6px; }
  .edition-notes { grid-template-columns: 1fr; }
  .edition-notes p, .edition-notes p:nth-child(3), .edition-notes p:nth-child(4) { border-top: 1px solid var(--line); border-left: 0; }
  .edition-notes p:first-child { border-top: 0; }
  .intro { padding: 72px 20px; }
  .features { grid-template-columns: 1fr; }
  .features a { min-height: 0; padding: 30px 26px; }
  .plans { padding: 72px 20px 78px; }
  .plans-heading { display: block; margin-bottom: 40px; }
  .plans-heading > p { margin-top: 22px; font-size: 16px; }
  .plan-ledger { grid-template-columns: 1fr; }
  .plan-entry, .plan-entry:first-child { padding: 32px 4px; border-top: 1px solid var(--line); border-left: 0; }
  .plan-entry:first-child { border-top: 0; }
  .plan-title { min-height: 0; }
  .plan-title span { min-height: 0; margin-bottom: 8px; }
  .plan-entry li { font-size: 14px; }
  .plan-entry li strong { max-width: 48%; }
  .plan-note { margin-top: 24px; text-align: left; }
  .features p, .article p, .article li, .policy-content p { font-size: 16px; }
  .statement { padding: 72px 20px; }
  .downloads, footer { align-items: flex-start; flex-direction: column; padding: 62px 22px; }
  .download-actions { min-width: 0; }
  .docs-layout { display: block; padding: 20px 14px 60px; }
  .sidebar { position: static; height: auto; padding: 0 0 20px; overflow: visible; }
  .sidebar #nav { display: flex; gap: 6px; padding: 8px 0; overflow-x: auto; scrollbar-width: none; }
  .sidebar #nav::-webkit-scrollbar { display: none; }
  .sidebar .nav-category { display: none; }
  .sidebar .nav-link { flex: none; min-height: 44px; border: 1px solid var(--line); white-space: nowrap; }
  .article { padding: 29px 23px; }
  .article h1 { font-size: 35px; }
  .book { width: 160px; height: 240px; padding: 20px; }
  .book strong { font-size: 26px; }
  .policy-page { width: calc(100% - 38px); padding: 60px 0 78px; }
  .policy-layout { display: block; padding-top: 34px; }
  .policy-toc { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin-bottom: 50px; }
  .policy-toc .eyebrow { grid-column: 1 / -1; }
  .policy-content h2 { font-size: 24px; }
  .language-switcher { margin-left: auto; }
}

@media (max-width: 430px) {
  h1 { font-size: 47px; }
  .logo { font-size: 17px; }
  .hero-copy { padding-inline: 20px; }
  .hero-visual { min-height: 340px; }
  .book { width: 137px; height: 210px; padding: 16px; }
  .book strong { font-size: 22px; }
  .book-one { transform: rotate(-12deg) translateX(21px); }
  .book-two { transform: rotate(9deg) translate(-8px, 24px); }
  .policy-toc { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
