/* Saiturin Käsikirja — local stylesheet (replaced the Tailwind CDN) */

:root {
  --navy: rgb(15, 30, 56);
  --gold: rgb(201, 168, 76);
  --gold-rgb: 201, 168, 76;
  --muted-blue: rgb(138, 154, 184);
  --banner-bg: #08111F;
  --content-bg: rgb(10, 21, 37);
  --content-text: rgb(238, 236, 231);
  --heading-size: clamp(28px, 4vw, 38px);
}

/* ---------- Reset / base ---------- */

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .scroll-cue__icon {
    animation: none;
  }
}

body {
  font-family: "Open Sans", system-ui, sans-serif;
  line-height: 1.5;
  color: var(--navy);
  background: var(--banner-bg);
}

a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* ---------- Hero banner ---------- */

.banner {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-inline: 1.5rem;
  overflow: hidden;
  background-color: var(--banner-bg);
}

.banner__grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(var(--gold-rgb), 0.07) 1px, transparent 1px);
  background-size: 64px 64px;
}

.container {
  position: relative;
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
}

/* ---------- Eyebrow kicker ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.eyebrow--hero {
  margin-bottom: 2rem;
}

.eyebrow--toc {
  margin-bottom: 1rem;
}

.eyebrow__rule {
  width: 32px;
  height: 1px;
  background: var(--gold);
}

.eyebrow__label {
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ---------- Hero copy ---------- */

.hero-title {
  font-family: "Playfair Display", serif;
  color: var(--content-text);
  line-height: 1.08;
  font-weight: 700;
  font-size: clamp(44px, 6vw, 76px);
  margin-bottom: 28px;
}

.hero-title__em {
  color: var(--gold);
  font-style: italic;
}

.hero-lead {
  color: var(--muted-blue);
  font-size: 17px;
  line-height: 1.7;
  max-width: 480px;
  font-weight: 400;
  margin-bottom: 40px;
}

/* ---------- Scroll cue ---------- */

.scroll-cue {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.scroll-cue__icon {
  color: var(--gold);
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }

  50% {
    transform: none;
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

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

.menu {
  padding: 6rem 1.5rem 2rem;
  background: var(--navy);
}

/* Desktop: the TOC moves to the fixed sidebar rail */
@media (min-width: 1024px) {
  .menu {
    display: none;
  }
}

.content {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  padding: 4rem 1.5rem;
  background: var(--content-bg);
  color: var(--content-text);
  font-size: 17px;
}

/* ---------- Navbar (mobile only; sticky fallback; JS adds the fixed auto-hiding bar) ---------- */

.navbar {
  display: none; /* desktop: no bar */
}

@media (max-width: 1023.98px) {
  .navbar {
    display: block;
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 0.65rem 1.5rem;
    background: var(--navy);
    border-bottom: 1px solid var(--gold);
  }

  .navbar__inner {
    display: flex;
    justify-content: flex-end;
  }

  .navbar__toggle {
    background: none;
    border: 0;
    padding: 0.25rem;
    cursor: pointer;
  }

  .navbar__icon {
    display: block;
    color: var(--gold);
  }

  /* With JS (IntersectionObserver in js/main.js): the bar is fixed and hidden
     until the TOC is completely out of view, then shown; hidden again as soon
     as any part of the TOC re-enters. */
  .js .navbar {
    position: fixed;
    inset-inline: 0;
    display: none;
  }

  .js .navbar--visible {
    display: block;
  }

  /* Anchor targets land below the bar */
  .content h2,
  .content h3,
  .content h4,
  .content .tldr {
    scroll-margin-top: 4.5rem;
  }
}

/* ---------- Sidebar (mobile: drawer from the navbar hamburger; desktop: fixed left rail) ---------- */

.sidebar {
  display: none;
}

@media (max-width: 1023.98px) {
  .sidebar {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20; /* above the navbar so backdrop covers the toggle button */
    pointer-events: none; /* clicks outside the panel pass through to the backdrop */
  }

  /* Toggled by the navbar hamburger in js/main.js */
  .sidebar.hidden {
    display: none;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto; /* tap outside the panel closes the menu */
  }

  .sidebar__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(20rem, 85vw);
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--navy);
    pointer-events: auto;
  }
}

/* Desktop: the drawer becomes a permanent rail on the left */
@media (min-width: 1024px) {
  .sidebar {
    display: block;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    width: 22rem;
    overflow-y: auto;
    background: var(--navy);
    border-right: 1px solid rgba(var(--gold-rgb), 0.35);
    pointer-events: auto;
  }

  .sidebar__backdrop {
    display: none;
  }

  .sidebar__panel {
    position: static;
    width: auto;
    min-height: 100%;
    padding: 2rem 1.75rem;
    background: none;
    overflow: visible;
  }

  /* The rail is narrow, so TOC section titles use a smaller size there */
  .sidebar .toc > ul > li > a {
    font-size: 22px;
  }

  /* Make room for the rail */
  body {
    padding-left: 22rem;
  }
}

/* ---------- Content typography (index.md) ---------- */

.content h2 {
  color: var(--content-text);
  border-left: 4px solid var(--gold);
  padding-left: 1rem;
  font-size: var(--heading-size);
  font-weight: 700;
  line-height: 1.15;
  margin: 4.5rem 0 1.25rem;
}

.content h2:first-of-type {
  margin-top: 1.5rem;
}

.content h3,
.content h4 {
  color: var(--content-text);
  border-left: 2px solid var(--gold);
  padding-left: 0.75rem;
  font-weight: 700;
}

.content h3 {
  font-size: 26px;
  line-height: 1.25;
  margin: 3rem 0 0.75rem;
}

.content h4 {
  font-size: 21px;
  line-height: 1.3;
  margin: 2rem 0 0.5rem;
}

.content p {
  line-height: 1.75;
  margin-bottom: 1rem;
  max-width: 80ch;
  overflow-wrap: break-word;
}

.content .tldr {
  margin-bottom: 2.5rem;
}

.content .tldr-label {
  color: var(--gold);
  font-size: var(--heading-size);
  font-weight: 700;
  line-height: 1.15;
  margin-right: 0.5rem;
}

.content li {
  line-height: 1.75;
  margin-bottom: 0.35rem;
  max-width: 72ch;
  overflow-wrap: break-word;
}

.content a {
  color: var(--content-text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.content a:hover {
  color: var(--gold);
}

.content ul,
.content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

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

.content code {
  font-family: "DM Mono", monospace;
  font-size: 0.875em;
  color: var(--gold);
  background: rgba(var(--gold-rgb), 0.12);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.content pre {
  background: var(--navy);
  color: var(--content-text);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  margin-bottom: 1.5rem;
}

.content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ---------- Table of contents (eleventy-plugin-toc) ---------- */

.toc {
  color: var(--muted-blue);
  font-size: 17px;
  line-height: 1.55;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc a {
  color: inherit;
  text-decoration: none;
}

.toc a:hover {
  color: var(--gold);
}

.toc li li::before {
  content: "•";
  color: var(--gold);
  display: inline-block;
  width: 1em;
}

.toc li li {
  padding-left: 1em;
  text-indent: -1em;
}

.toc > ul > li > ul > li > ul {
  padding-left: 1.5em;
}

/* Card grid (top menu on mobile; sidebar rail on desktop, drawer on mobile) */
.toc > ul {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: rgba(var(--gold-rgb), 0.12);
}

.toc > ul > li {
  padding: 1.5rem;
  background: var(--navy);
}

.toc > ul > li > a {
  display: block;
  color: var(--content-text);
  font-size: var(--heading-size);
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.15;
}

.toc > ul > li > ul {
  padding-top: 1rem;
}

.toc > ul > li > ul li {
  padding-top: 0.5rem;
}
