:root {
  --bg: #fdf8ed;
  --ink: #182235;
  --ink-soft: #4f5f7a;
  --paper: #fffdf7;
  --edge: #d5cfbf;
  --accent: #0a8f84;
  --accent-strong: #076c64;
  --sun: #f2b84b;
  --code-bg: #182235;
  --code-ink: #f8f5ec;
  --shadow-soft: 0 12px 30px rgba(24, 34, 53, 0.1);
  --shadow-strong: 0 22px 50px rgba(24, 34, 53, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 1.2rem;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--ink);
  line-height: 1.65;
  background:
    radial-gradient(
      circle at 8% 12%,
      rgba(242, 184, 75, 0.36) 0,
      transparent 38%
    ),
    radial-gradient(
      circle at 90% 6%,
      rgba(10, 143, 132, 0.2) 0,
      transparent 34%
    ),
    linear-gradient(160deg, #fdf8ed 0%, #f7efe0 52%, #fdf8ed 100%);
}

.hero {
  max-width: 1200px;
  margin: 0 auto 1.4rem;
  padding: 1.8rem 2rem;
  border: 1px solid var(--edge);
  border-radius: 24px;
  background: linear-gradient(
    120deg,
    rgba(255, 253, 247, 0.95) 0%,
    rgba(247, 239, 224, 0.9) 100%
  );
  box-shadow: var(--shadow-soft);
  animation: rise-in 550ms ease-out both;
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

h1 {
  margin: 0.35rem 0 0.4rem;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 0;
  max-width: 66ch;
  color: var(--ink-soft);
  font-size: 1.06rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.hero-meta span {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(10, 143, 132, 0.3);
  background: rgba(10, 143, 132, 0.08);
  color: #0f4f58;
  font-size: 0.82rem;
  font-weight: 600;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
}

.toc {
  position: sticky;
  top: 1rem;
  padding: 1.2rem 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--edge);
  background: rgba(255, 252, 245, 0.85);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-soft);
}

.toc-title {
  margin: 0 0 0.7rem;
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-strong);
}

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

.toc li + li {
  margin-top: 0.35rem;
}

.toc a {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  color: #1f3655;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.toc a:hover,
.toc a:focus-visible {
  background: rgba(242, 184, 75, 0.25);
  color: #122846;
  transform: translateX(3px);
  outline: none;
}

main {
  min-width: 0;
}

section {
  margin-bottom: 1rem;
  padding: 1.4rem;
  border: 1px solid var(--edge);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.88);
  box-shadow: var(--shadow-soft);
  animation: rise-in 700ms ease both;
}

section:nth-child(2n) {
  background: rgba(255, 249, 236, 0.9);
}

h2 {
  margin-top: 0;
  margin-bottom: 0.7rem;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.95rem);
  color: #13263f;
  border-bottom: 2px dashed rgba(10, 143, 132, 0.38);
  padding-bottom: 0.4rem;
}

h3 {
  margin-top: 1.2rem;
  margin-bottom: 0.45rem;
  color: #1a3456;
}

h4 {
  color: #254063;
}

p,
li {
  color: #2b3a54;
}

pre {
  margin: 0.85rem 0;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(248, 245, 236, 0.18);
  border-left: 5px solid var(--sun);
  background: linear-gradient(135deg, #162033 0%, #1f2b40 100%);
  color: var(--code-ink);
  box-shadow: 0 10px 25px rgba(13, 19, 29, 0.28);
  overflow-x: auto;
}

code {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.92rem;
}

table {
  width: min(500px, 100%);
  border-collapse: collapse;
  margin-top: 0.9rem;
  border: 1px solid var(--edge);
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--edge);
}

th {
  background: rgba(10, 143, 132, 0.12);
  color: #0d3a47;
}

.note {
  margin-top: 0.8rem;
  padding: 0.85rem 0.95rem;
  border-left: 5px solid #cf7f26;
  border-radius: 10px;
  background: rgba(242, 184, 75, 0.22);
}

footer {
  max-width: 1200px;
  margin: 0.8rem auto 1.5rem;
  padding: 1rem;
  text-align: center;
  color: #4b5872;
  border-radius: 14px;
  border: 1px solid var(--edge);
  background: rgba(255, 252, 245, 0.75);
}

#toc-toggle {
  display: none;
}

@media (max-width: 920px) {
  body {
    padding: 0.9rem;
  }

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

  .toc {
    position: fixed;
    top: 0;
    right: 0;
    width: min(82vw, 340px);
    max-height: 100vh;
    height: 100vh;
    border-radius: 20px 0 0 20px;
    transform: translateX(105%);
    transition: transform 230ms ease;
    z-index: 50;
  }

  .toc.active {
    transform: translateX(0);
  }

  #toc-toggle {
    display: inline-flex;
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 60;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #f4fffd;
    font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-strong);
    cursor: pointer;
  }

  body.menu-open {
    overflow: hidden;
  }

  section {
    padding: 1.1rem;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

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

  * {
    animation: none !important;
    transition: none !important;
  }
}
