/* Festivly docs — GitBook-style shell using main-site --fv-* brand tokens. */

:root {
  --fv-accent: #ec3013;
  --fv-accent-600: #dd2b0f;
  --fv-accent-700: #ae1800;
  --fv-accent-100: #fff2ef;
  --fv-accent-fill: var(--fv-accent-600);
  --fv-ground: #f7f4f1;
  --fv-surface: #ffffff;
  --fv-ink: #201e1d;
  --fv-muted: #605d5d;
  --fv-subtle: #7d7979;
  --fv-hairline: #d7d3d3;
  --fv-radius-pill: 999px;
  --fv-radius-module: 20px;
  --fv-shadow-card: 0 8px 28px rgba(45, 43, 43, 0.1);

  --sidebar-w: 272px;
  --toc-w: 220px;
  --topbar-h: 56px;
  --font: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--fv-ground);
  color: var(--fv-ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--fv-accent-700);
  text-decoration: none;
}

a:hover {
  color: var(--fv-accent);
}

/* —— Top bar —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem 0 0.75rem;
  background: var(--fv-surface);
  border-bottom: 1px solid var(--fv-hairline);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--fv-ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--fv-ink);
}

.logo-mark {
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
}

.wordmark {
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  text-transform: lowercase;
}

.wordmark em {
  font-style: normal;
  font-weight: 500;
  color: var(--fv-muted);
  margin-left: 0.15em;
}

.top-link {
  display: none;
  color: var(--fv-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.top-link:hover {
  color: var(--fv-ink);
}

.app-btn {
  display: inline-flex;
  align-items: center;
  height: 2.15rem;
  padding: 0 0.95rem;
  border-radius: var(--fv-radius-pill);
  background: var(--fv-accent-fill);
  color: #fff !important;
  font-size: 0.8125rem;
  font-weight: 700;
}

.app-btn:hover {
  filter: brightness(1.05);
}

.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.45rem;
  border-radius: 0.5rem;
  cursor: pointer;
}

.menu-btn span {
  display: block;
  height: 2px;
  background: var(--fv-ink);
  border-radius: 2px;
}

/* —— Shell: sidebar + content + toc —— */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  background: var(--fv-surface);
  border-right: 1px solid var(--fv-hairline);
}

.sidebar-inner {
  padding: 1.25rem 0.85rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  min-height: 100%;
}

.side-heading {
  margin: 0 0 0.45rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fv-subtle);
}

.side-links {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.side-link {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: 0.55rem;
  color: var(--fv-muted);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
}

.side-link:hover {
  background: var(--fv-ground);
  color: var(--fv-ink);
}

.side-link.active {
  background: var(--fv-accent-100);
  color: var(--fv-accent-700);
  font-weight: 650;
}

.sidebar-foot {
  margin-top: auto;
  padding: 1rem 0.55rem 0;
  border-top: 1px solid var(--fv-hairline);
}

.sidebar-foot a {
  font-size: 0.8rem;
  color: var(--fv-subtle);
  font-weight: 500;
}

.sidebar-foot a:hover {
  color: var(--fv-accent);
}

.sidebar-backdrop {
  display: none;
}

.main-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: 0;
  align-items: start;
  max-width: 1100px;
  width: 100%;
}

/* —— Article —— */
.content {
  padding: 2.25rem 2.5rem 4rem;
  max-width: 48rem;
}

.content h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.85rem, 3vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--fv-ink);
}

.content h2 {
  margin: 2.4rem 0 0.7rem;
  padding-top: 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fv-ink);
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}

.content h3 {
  margin: 1.6rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--fv-ink);
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}

.content p {
  margin: 0 0 1rem;
  color: var(--fv-ink);
  font-size: 1rem;
}

.content ul {
  margin: 0 0 1.15rem;
  padding-left: 1.25rem;
}

.content li {
  margin: 0.35rem 0;
  color: var(--fv-ink);
}

.content li::marker {
  color: var(--fv-accent);
}

.content strong {
  font-weight: 650;
}

.content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875em;
  background: var(--fv-accent-100);
  color: var(--fv-accent-700);
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
}

.content pre {
  background: #201e1d;
  color: #f7f4f1;
  padding: 1rem 1.1rem;
  border-radius: var(--fv-radius-module);
  overflow-x: auto;
  margin: 0 0 1.25rem;
  box-shadow: var(--fv-shadow-card);
}

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

.content a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.content ol {
  margin: 0 0 1.15rem;
  padding-left: 1.35rem;
}

.content ol li {
  margin: 0.4rem 0;
}

.doc-figure {
  margin: 1.25rem 0 1.5rem;
  padding: 0;
  border: 1px solid var(--fv-hairline);
  border-radius: var(--fv-radius-module);
  overflow: hidden;
  background: var(--fv-surface);
  box-shadow: var(--fv-shadow-card);
}

.doc-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.doc-figure figcaption {
  margin: 0;
  padding: 0.65rem 0.9rem;
  font-size: 0.8rem;
  color: var(--fv-subtle);
  border-top: 1px solid var(--fv-hairline);
  background: var(--fv-ground);
}

.content p:empty {
  display: none;
}

/* —— On this page (right rail) —— */
.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 1.25rem);
  padding: 2.25rem 1.25rem 2rem 0.5rem;
  align-self: start;
}

.toc-heading,
.toc-empty {
  margin: 0 0 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fv-subtle);
}

.toc-empty {
  opacity: 0.5;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-left: 2px solid var(--fv-hairline);
  padding-left: 0.75rem;
}

.toc-nav a {
  color: var(--fv-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
}

.toc-nav a:hover {
  color: var(--fv-accent);
}

/* —— Prev / next —— */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--fv-hairline);
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--fv-hairline);
  border-radius: var(--fv-radius-module);
  background: var(--fv-surface);
  text-decoration: none !important;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.pager-link:hover {
  border-color: var(--fv-accent);
  box-shadow: var(--fv-shadow-card);
  color: var(--fv-ink);
}

.pager-link.next {
  text-align: right;
  margin-left: auto;
  width: 100%;
}

.pager-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fv-subtle);
}

.pager-title {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--fv-ink);
}

/* —— Mobile —— */
@media (max-width: 1100px) {
  .main-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .menu-btn {
    display: flex;
  }

  .top-link {
    display: none;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-h);
    width: min(var(--sidebar-w), 86vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: var(--fv-shadow-card);
  }

  .nav-toggle:checked ~ .shell .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    background: rgba(32, 30, 29, 0.35);
    z-index: 45;
  }

  .nav-toggle:checked ~ .shell .sidebar-backdrop {
    display: block;
  }

  .content {
    padding: 1.5rem 1.15rem 3rem;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager-link.next {
    text-align: left;
  }
}

@media (min-width: 861px) {
  .top-link {
    display: inline;
  }
}
