/* NovelReader — "midnight library" theme.
   Deep warm ink, lamplight amber, literary serif display type. */

:root {
  color-scheme: dark;
  --bg: #0e0c09;
  --bg-raised: #15120d;
  --paper: #1a1610;
  --paper-edge: #2a241a;
  --ink: #ece4d4;
  --muted: #a89c86;
  --faint: #6e6452;
  --line: rgba(236, 228, 212, 0.1);
  --line-strong: rgba(236, 228, 212, 0.18);
  --accent: #e3a85c;
  --accent-bright: #f2c282;
  --accent-dim: rgba(227, 168, 92, 0.14);
  --accent-glow: rgba(227, 168, 92, 0.32);
  --premium: #b89ae8;
  --premium-dim: rgba(184, 154, 232, 0.13);
  --warn: #e0b35c;
  --warn-dim: rgba(224, 179, 92, 0.1);
  --code-bg: #12100c;
  --code-ink: #e8dfcc;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Atkinson Hyperlegible", "Avenir Next", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", monospace;
  font-family: var(--sans);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  background:
    radial-gradient(ellipse 80% 50% at 70% -10%, rgba(227, 168, 92, 0.07), transparent 60%),
    radial-gradient(ellipse 60% 40% at 10% 0%, rgba(184, 154, 232, 0.04), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-size: 16.5px;
  line-height: 1.65;
}

/* Paper-grain overlay for atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

main,
.site-header,
.site-footer {
  position: relative;
  z-index: 2;
}

::selection {
  background: var(--accent);
  color: #1a1208;
}

a {
  color: var(--accent-bright);
  text-decoration-color: rgba(242, 194, 130, 0.4);
  text-underline-offset: 0.2em;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

a:hover {
  color: var(--ink);
  text-decoration-color: var(--accent);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 12, 9, 0.82);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.coming-soon-banner {
  border-bottom: 1px solid rgba(227, 168, 92, 0.26);
  background: linear-gradient(90deg, rgba(227, 168, 92, 0.18), rgba(184, 154, 232, 0.12));
  color: var(--accent-bright);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 8px 16px;
  text-align: center;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 15px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand:hover {
  color: var(--accent-bright);
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(227, 168, 92, 0.45);
  border-radius: 9px;
  background: linear-gradient(160deg, rgba(227, 168, 92, 0.22), rgba(227, 168, 92, 0.05));
  box-shadow: 0 0 18px rgba(227, 168, 92, 0.18), inset 0 1px 0 rgba(242, 194, 130, 0.25);
  color: var(--accent-bright);
  font-family: var(--serif);
  font-size: 19px;
  font-style: italic;
  font-weight: 600;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 0.93rem;
}

.nav-links a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.nav-links a:hover {
  background: var(--accent-dim);
  color: var(--accent-bright);
}

/* ---------- Layout shells ---------- */

.hero,
.page-hero,
.section,
.footer-inner {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 56px;
  align-items: center;
  padding: 88px 0 64px;
}

.page-hero {
  padding: 64px 0 24px;
}

/* ---------- Type ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 480;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  max-width: 860px;
  font-size: clamp(2.6rem, 6.5vw, 5.2rem);
}

h1 em,
h2 em {
  font-style: italic;
  font-weight: 420;
  color: var(--accent-bright);
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

h3 {
  font-size: 1.3rem;
  line-height: 1.25;
}

h4 {
  font-size: 1.02rem;
}

p {
  margin: 0;
}

.lede {
  max-width: 720px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 1.14rem;
  line-height: 1.7;
}

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 22px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: linear-gradient(160deg, var(--accent-bright), var(--accent));
  color: #221608;
  font-weight: 700;
  font-size: 0.98rem;
  text-decoration: none;
  box-shadow: 0 0 24px rgba(227, 168, 92, 0.22);
  transition: box-shadow 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.button:hover {
  color: #221608;
  filter: brightness(1.07);
  box-shadow: 0 0 36px rgba(227, 168, 92, 0.38);
  transform: translateY(-1px);
}

.button.secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
  box-shadow: 0 0 20px rgba(227, 168, 92, 0.14);
}

/* ---------- Product preview panel ---------- */

.product-panel {
  position: relative;
  border: 1px solid var(--paper-edge);
  border-radius: 14px;
  background: linear-gradient(170deg, #1d1812, #14110c);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(227, 168, 92, 0.07),
    inset 0 1px 0 rgba(236, 228, 212, 0.06);
  overflow: hidden;
}

/* lamplight falling across the panel */
.product-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 60% at 85% -15%, rgba(227, 168, 92, 0.13), transparent 60%);
}

.panel-topbar {
  display: flex;
  gap: 7px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--paper-edge);
}

.dot:first-child {
  background: rgba(227, 168, 92, 0.55);
}

.product-panel-body {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.preview-toolbar {
  display: flex;
  gap: 10px;
}

.toolbar-pill {
  height: 32px;
  min-width: 76px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent-dim);
}

.reader-preview {
  min-height: 300px;
  border: 1px solid var(--paper-edge);
  border-radius: 8px;
  background: linear-gradient(175deg, #211b12, #1a1510);
  padding: 28px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35);
}

.reader-preview h3 {
  margin-bottom: 18px;
  color: var(--ink);
  font-style: italic;
}

.preview-line {
  height: 9px;
  margin: 13px 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(227, 168, 92, 0.28), rgba(168, 156, 134, 0.2));
}

.preview-line.short {
  width: 68%;
}

/* ---------- Sections ---------- */

.section {
  padding: 52px 0;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.section-header p {
  max-width: 560px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card,
.doc-block {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(170deg, var(--paper), var(--bg-raised));
  padding: 26px 24px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
  border-color: rgba(227, 168, 92, 0.35);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4), 0 0 28px rgba(227, 168, 92, 0.08);
  transform: translateY(-2px);
}

.card p,
.doc-block p,
.doc-block li {
  color: var(--muted);
}

.card h3,
.doc-block h2,
.doc-block h3,
.doc-block h4 {
  margin-bottom: 12px;
}

.card .badge {
  margin-bottom: 14px;
}

.doc-block h3,
.doc-block h4 {
  margin-top: 20px;
}

/* ---------- Docs layout ---------- */

.doc-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 88px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-raised);
  padding: 18px;
}

.toc strong {
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.toc a {
  display: block;
  padding: 6px 10px;
  border-left: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-size: 0.94rem;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.toc a:hover {
  border-left-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent-bright);
}

.doc-content {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.doc-block {
  min-width: 0;
  scroll-margin-top: 96px;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 10px;
  border: 1px solid rgba(227, 168, 92, 0.35);
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent-bright);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge.premium {
  border-color: rgba(184, 154, 232, 0.35);
  background: var(--premium-dim);
  color: var(--premium);
}

.badge.warning {
  border-color: rgba(224, 179, 92, 0.4);
  background: var(--warn-dim);
  color: var(--warn);
}

/* ---------- Lists & callouts ---------- */

.feature-list,
.doc-block ul,
.doc-block ol {
  margin: 14px 0 0;
  padding-left: 20px;
}

.feature-list li + li,
.doc-block li + li {
  margin-top: 9px;
}

.doc-block li::marker {
  color: var(--accent);
}

.callout {
  margin-top: 18px;
  border: 1px solid rgba(227, 168, 92, 0.25);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--accent-dim);
  padding: 14px 18px;
}

.callout.warning {
  border-color: rgba(224, 179, 92, 0.3);
  border-left-color: var(--warn);
  background: var(--warn-dim);
}

/* ---------- Code & tables ---------- */

code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(227, 168, 92, 0.08);
  padding: 0.08em 0.34em;
  color: var(--accent-bright);
  font-family: var(--mono);
  font-size: 0.88em;
}

p code,
li code,
td code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

pre {
  overflow-x: auto;
  max-width: 100%;
  contain: paint;
  margin: 16px 0 0;
  border: 1px solid var(--paper-edge);
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 18px;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(236, 228, 212, 0.04);
}

pre code {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

table {
  width: 100%;
  max-width: 100%;
  contain: paint;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: rgba(227, 168, 92, 0.07);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.02em;
}

td {
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(227, 168, 92, 0.03));
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0;
  color: var(--faint);
  font-size: 0.93rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent-bright);
}

/* ---------- Entrance animation ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero > div:first-child > *,
  .page-hero > * {
    animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .hero > div:first-child > :nth-child(2),
  .page-hero > :nth-child(2) {
    animation-delay: 0.08s;
  }

  .hero > div:first-child > :nth-child(3),
  .page-hero > :nth-child(3) {
    animation-delay: 0.16s;
  }

  .hero > div:first-child > :nth-child(4) {
    animation-delay: 0.24s;
  }

  .product-panel {
    animation: rise 0.9s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .nav-links a {
    padding: 6px 10px;
  }

  .hero,
  .doc-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 56px;
  }

  .toc {
    position: static;
  }

  .grid,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 15.5px;
  }

  .hero {
    padding-top: 44px;
  }

  .actions,
  .button {
    width: 100%;
  }

  .button {
    justify-content: center;
  }

  pre code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
