/* Novella official website. Colours are tokens: light is rice paper, dark is the night over Lin'an; the hero and the closing band are always night. */

:root {
  --cinnabar: #C0392B;
  --cinnabar-deep: #962D22;
  --seal-ink: #FBEBCB;
  --night: #0D1322;
  --night-2: #141C30;

  --bg: #F6F0E4;
  --surface: #FCF8F0;
  --surface-2: #EFE5D2;
  --text: #2A201B;
  --muted: #6B5C51;
  --border: #DDCDB0;
  --gold: #94702A;
  --gold-line: #C9A24B;
  --accent: #B03427;
  --link: #A5301F;
  --code-bg: #F1E8D6;
  --shadow: 0 14px 34px -18px rgba(60, 35, 15, 0.45);

  --serif: "EB Garamond", "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --cjk: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --brush: "Ma Shan Zheng", "Noto Serif SC", serif;
  --mono: ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1322;
    --surface: #131B2E;
    --surface-2: #1A2440;
    --text: #EDE5D6;
    --muted: #A99F8E;
    --border: #2B3654;
    --gold: #D8B862;
    --gold-line: #A98B45;
    --accent: #E06150;
    --link: #E8C46F;
    --code-bg: #0A0F1C;
    --shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0D1322;
  --surface: #131B2E;
  --surface-2: #1A2440;
  --text: #EDE5D6;
  --muted: #A99F8E;
  --border: #2B3654;
  --gold: #D8B862;
  --gold-line: #A98B45;
  --accent: #E06150;
  --link: #E8C46F;
  --code-bg: #0A0F1C;
  --shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  overflow-x: hidden;
}

:lang(zh), :lang(zh-Hans) { font-family: var(--cjk); }

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

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

h1, h2, h3 { font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; margin: 0 0 0.5em; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.4rem; }
p { margin: 0 0 1em; text-wrap: pretty; }

code { font-family: var(--mono); font-size: 0.82em; background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: 0.05em 0.35em; }
pre { font-family: var(--mono); font-size: 0.86rem; line-height: 1.55; background: var(--code-bg); border: 1px solid var(--border); border-left: 3px solid var(--cinnabar); border-radius: 6px; padding: 16px 18px; overflow-x: auto; margin: 0 0 1em; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.tok-k { color: var(--accent); }
.tok-s { color: var(--gold); }
.tok-c { color: var(--muted); font-style: italic; }

.wrap { max-width: 1180px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.narrow { max-width: 820px; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* Header */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--border);
}
.bar { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.45rem; font-weight: 600; letter-spacing: 0.01em; }
.brand img { width: 34px; height: 34px; }
.brand:hover { color: var(--text); }
.nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; font-size: 1.05rem; padding: 4px 0; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--cinnabar); }
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--gold-line); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

.menu { display: none; position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 1rem; }
.menu summary::-webkit-details-marker { display: none; }
.menu nav { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px; box-shadow: var(--shadow); }
.menu nav a { color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: 4px; }
.menu nav a:hover { background: var(--surface-2); }

/* The seal: Novella ships only inside Divooka. */

.seal {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 118px; height: 118px; flex: none;
  background: var(--cinnabar);
  color: var(--seal-ink);
  border-radius: 7px;
  box-shadow: inset 0 0 0 5px var(--cinnabar), inset 0 0 0 6.5px var(--seal-ink), 0 10px 24px -10px rgba(0, 0, 0, 0.6);
  transform: rotate(-4deg);
  text-decoration: none;
  text-align: center;
  line-height: 1;
}
.seal:hover { color: var(--seal-ink); transform: rotate(-2deg) scale(1.03); }
.seal .s1 { font-size: 0.82rem; letter-spacing: 0.32em; text-transform: uppercase; margin: 0 0 7px 0.32em; }
.seal .s2 { font-size: 1.5rem; font-weight: 600; letter-spacing: 0.04em; }
.seal.small { width: 84px; height: 84px; }
.seal.small .s1 { font-size: 0.62rem; margin-bottom: 5px; }
.seal.small .s2 { font-size: 1.08rem; }

/* Hero: always night. */

.hero {
  position: relative;
  color: #EFE7D8;
  background: var(--night);
  overflow: hidden;
  isolation: isolate;
}
.hero-art { position: absolute; inset: 0; z-index: -2; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 40%; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(9, 13, 25, 0.94) 0%, rgba(9, 13, 25, 0.78) 42%, rgba(9, 13, 25, 0.25) 75%, rgba(9, 13, 25, 0.45) 100%),
    linear-gradient(0deg, rgba(9, 13, 25, 0.9) 0%, rgba(9, 13, 25, 0) 30%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; padding-top: 92px; padding-bottom: 96px; }
.hero h1 { font-size: clamp(3.4rem, 8vw, 5.6rem); font-weight: 500; letter-spacing: -0.02em; margin: 0 0 12px; line-height: 1; }
.hero h1 .zh { font-family: var(--brush); font-weight: 400; color: #E5C46E; font-size: 0.5em; letter-spacing: 0.08em; margin-left: 0.35em; vertical-align: 0.35em; }
.hero .lede { font-size: clamp(1.25rem, 2.1vw, 1.5rem); color: #D9CFBD; max-width: 34ch; margin-bottom: 30px; }
.hero .eyebrow { color: #E5C46E; }
.hero-mark { display: flex; align-items: center; gap: 22px; margin-top: 36px; }
.hero-mark p { margin: 0; color: #CFC4B0; font-size: 1.05rem; max-width: 36ch; }
.hero-mark strong { color: #F3E7CF; font-weight: 600; }
.hero-shot { margin: 0; }
.hero-shot .frame { transform: perspective(1600px) rotateY(-6deg); transform-origin: left center; }
.hero-shot figcaption { color: #BDB29F; font-size: 0.95rem; margin-top: 12px; text-align: right; }

.eyebrow { font-size: 0.86rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); margin: 0 0 14px; display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 7px; height: 7px; background: var(--cinnabar); transform: rotate(45deg); flex: none; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 4px; font-size: 1.08rem; text-decoration: none; border: 1px solid transparent; line-height: 1.2; }
.btn-primary { background: var(--cinnabar); color: #FFF6E6; border-color: var(--cinnabar); }
.btn-primary:hover { background: var(--cinnabar-deep); color: #FFF6E6; }
.btn-ghost { border-color: rgba(229, 196, 110, 0.6); color: #F0E3C4; }
.btn-ghost:hover { border-color: #E5C46E; color: #FFF3D6; background: rgba(229, 196, 110, 0.08); }
.btn-line { border-color: var(--gold-line); color: var(--text); }
.btn-line:hover { color: var(--text); background: var(--surface-2); }

/* Sections */

section { padding: 88px 0; }
section + section { border-top: 1px solid var(--border); }
.alt { background: var(--surface); }
.section-head { max-width: 760px; margin-bottom: 40px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head.center .eyebrow { justify-content: center; }
.lede { font-size: 1.3rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.95rem; }

.page-head { padding: 72px 0 40px; border-bottom: 1px solid var(--border); background: var(--surface); }
.page-head h1 { font-size: clamp(2.6rem, 6vw, 3.8rem); margin-bottom: 14px; }
.page-head .lede { max-width: 60ch; margin: 0; }

/* Frames, figures and galleries */

.frame { display: block; padding: 5px; background: var(--surface); border: 1px solid var(--gold-line); box-shadow: var(--shadow); position: relative; }
.hero .frame { background: #141C30; border-color: #8C7238; }
.frame img { width: 100%; }
a.zoom { cursor: zoom-in; }
a.zoom:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 3px; }

figure { margin: 0; }
figcaption { font-size: 1rem; color: var(--muted); margin-top: 10px; line-height: 1.45; }

.grid { display: grid; gap: 28px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.split.wide-media { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }

/* A screenshot in two languages, switched without script. */

.pair { position: relative; }
.pair > input { position: absolute; opacity: 0; pointer-events: none; }
.pair-tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 3px; margin-bottom: 12px; background: var(--surface); }
.pair-tabs label { padding: 4px 14px; border-radius: 999px; cursor: pointer; font-size: 0.98rem; color: var(--muted); user-select: none; }
.pair-views { display: grid; }
.pair-views > a { grid-area: 1 / 1; transition: opacity 0.35s ease; }
.pair-views > .zh { opacity: 0; visibility: hidden; }
.pair > .pick-zh:checked ~ .pair-views > .zh { opacity: 1; visibility: visible; }
.pair > .pick-zh:checked ~ .pair-views > .en { opacity: 0; visibility: hidden; }
.pair > .pick-en:checked ~ .pair-tabs .l-en,
.pair > .pick-zh:checked ~ .pair-tabs .l-zh { background: var(--cinnabar); color: #FFF6E6; }
.pair > .pick-en:focus-visible ~ .pair-tabs .l-en,
.pair > .pick-zh:focus-visible ~ .pair-tabs .l-zh { outline: 2px solid var(--gold-line); outline-offset: 2px; }

/* Cards */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 26px; position: relative; }
.alt .card { background: var(--bg); }
.card h3 { margin-bottom: 8px; }
.card p:last-child { margin-bottom: 0; }
.card .num { font-family: var(--brush); color: var(--cinnabar); font-size: 2.2rem; line-height: 1; display: block; margin-bottom: 12px; }
.card .media { margin: -26px -26px 22px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.card .media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: left top; }
.card.way pre { font-size: 0.74rem; margin-top: 16px; }

.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.features > div { padding: 26px 26px 22px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.features h3 { font-size: 1.25rem; display: flex; align-items: baseline; gap: 10px; }
.features h3::before { content: ""; width: 8px; height: 8px; background: var(--gold-line); transform: rotate(45deg) translateY(-2px); flex: none; }
.features p { color: var(--muted); margin: 0; font-size: 1.06rem; }

.data-list { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 0 0 24px; list-style: none; }
.data-list li { border: 1px solid var(--gold-line); border-radius: 999px; padding: 4px 16px; font-size: 1.02rem; background: var(--surface); }

.facts { list-style: none; padding: 0; margin: 0 0 1em; }
.facts li { position: relative; padding-left: 22px; margin-bottom: 10px; }
.facts li::before { content: ""; position: absolute; left: 2px; top: 0.62em; width: 7px; height: 7px; background: var(--cinnabar); transform: rotate(45deg); }

.tag { display: inline-block; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--gold-line); border-radius: 3px; padding: 1px 8px; margin-bottom: 10px; }

/* Tables */

.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 1.02rem; }
th, td { text-align: left; vertical-align: top; padding: 11px 16px; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--gold); font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td small { color: var(--muted); }

/* Graphs */

.graph { margin: 0 0 40px; }
.graph .frame { background: #F6F8FB; }
.graph-scroll { overflow-x: auto; }
.graph-scroll img { min-width: 760px; }
.graph h3 { margin-bottom: 4px; }
.graph .meta { color: var(--muted); margin: 0 0 14px; }

/* Video */

.video-frame { padding: 5px; border: 1px solid var(--gold-line); background: #05070D; box-shadow: var(--shadow); }
.video-frame video { width: 100%; aspect-ratio: 16 / 9; background: #05070D; }

/* Documentation links */

.docs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; list-style: none; padding: 0; margin: 0; }
.docs a { display: block; height: 100%; padding: 18px 20px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); text-decoration: none; color: var(--text); }
.docs a:hover { border-color: var(--gold-line); background: var(--surface-2); color: var(--text); }
.docs strong { display: block; font-weight: 600; font-size: 1.15rem; margin-bottom: 4px; color: var(--link); }
.docs span { color: var(--muted); font-size: 1rem; }

/* Divooka band and closing band */

.divooka-band { background: var(--surface); }
.divooka-band .inner { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 40px; align-items: center; }
.divooka-band h2 { margin-bottom: 10px; }

.night-band { position: relative; color: #EFE7D8; background: var(--night); isolation: isolate; overflow: hidden; text-align: center; }
.night-band img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.night-band::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at center, rgba(9, 13, 25, 0.55) 0%, rgba(9, 13, 25, 0.88) 75%); }
.night-band h2 { color: #F5ECDA; }
.night-band p { color: #D5CAB6; max-width: 58ch; margin-left: auto; margin-right: auto; }
.night-band .actions { justify-content: center; margin-top: 26px; }
.night-band .seal { margin-bottom: 26px; }

/* Credits */

.credits h2 { margin-top: 1.2em; }
.credits h2:first-child { margin-top: 0; }
.credits td:first-child { min-width: 200px; }

/* Footer */

.site-footer { border-top: 1px solid var(--border); padding: 56px 0 44px; background: var(--surface); color: var(--muted); font-size: 1rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)); gap: 32px; }
.footer-brand p { margin-top: 12px; max-width: 30ch; }
.site-footer h2 { font-size: 0.82rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin: 6px 0 12px; font-weight: 600; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 0.92rem; }

/* Lightbox */

.lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: rgba(5, 7, 13, 0.97); color: #EDE5D6; }
.lightbox::backdrop { background: rgba(5, 7, 13, 0.7); }
.lightbox .stage { position: absolute; inset: 56px 64px 72px; overflow: auto; display: grid; place-items: center; }
.lightbox .stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.lightbox .stage.actual { place-items: start; }
.lightbox .stage.actual img { max-width: none; max-height: none; cursor: zoom-out; }
.lightbox .cap { position: absolute; left: 64px; right: 64px; bottom: 18px; text-align: center; color: #CFC4B0; font-size: 1rem; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(229, 196, 110, 0.4); color: #F0E3C4; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font: inherit; font-size: 1.5rem; line-height: 1; display: grid; place-items: center; }
.lightbox button:hover { background: rgba(229, 196, 110, 0.15); }
.lightbox .close { top: 8px; right: 12px; }
.lightbox .prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox .next { right: 10px; top: 50%; transform: translateY(-50%); }

/* Responsive */

@media (max-width: 1020px) {
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .features, .docs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .nav { display: none; }
  .bar .theme-toggle { margin-left: auto; }
  .menu { display: block; }
  .hero-grid, .split, .split.wide-media { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .hero-grid { padding-top: 64px; padding-bottom: 64px; }
  .hero::before { background: linear-gradient(180deg, rgba(9, 13, 25, 0.86) 0%, rgba(9, 13, 25, 0.72) 55%, rgba(9, 13, 25, 0.92) 100%); }
  .hero-shot .frame { transform: none; }
  .hero-shot figcaption { text-align: left; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  body { font-size: 1.0625rem; }
  .wrap { padding-left: 16px; padding-right: 16px; }
  section { padding: 60px 0; }
  .g2, .g3, .g4, .features, .docs { grid-template-columns: minmax(0, 1fr); }
  .divooka-band .inner { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .hero-mark { flex-direction: row; align-items: center; gap: 16px; }
  .hero .seal { width: 92px; height: 92px; }
  .hero .seal .s1 { font-size: 0.66rem; }
  .hero .seal .s2 { font-size: 1.18rem; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lightbox .stage { inset: 56px 8px 72px; }
  .lightbox .prev, .lightbox .next { top: auto; bottom: 12px; transform: none; }
  .lightbox .cap { left: 60px; right: 60px; bottom: 14px; font-size: 0.9rem; }
  .graph-scroll img { min-width: 640px; }
  .card { padding: 20px; }
  .card .media { margin: -20px -20px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .seal, .seal:hover { transform: rotate(-4deg); }
}

kbd { font-family: var(--mono); font-size: 0.78em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0.05em 0.4em; background: var(--surface); white-space: nowrap; }
