/* Page background */
body {
  background:
    radial-gradient(1200px 800px at 20% -10%, rgba(0,0,0,0.035), transparent 60%),
    radial-gradient(900px 700px at 100% 110%, rgba(0,0,0,0.05), transparent 55%),
    linear-gradient(135deg, #F4F1EB 0%, #EFEAE2 50%, #E9E3D9 100%);
}

/* ====== DOCS (unchanged) ================================================= */
#docs {
  font-family: "Segoe UI", Tahoma, sans-serif;
  line-height: 1.6;
  background: #FAF9F6;
  color: #1F2933;
  margin: 2rem auto;
  max-width: 800px;
  padding: 0 1rem 3rem 1rem;
}

#docs h1 {
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(90deg, #B45309, #D97706, #B45309);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 6s linear infinite;
  letter-spacing: 1px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
  cursor: pointer;
}

@keyframes shine {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

#docs h1:hover {
  transform: scale(1.05);
  text-shadow: 3px 3px 10px rgba(180,83,9,0.6);
  transition: all 0.3s ease;
}

#docs h2 {
  color: #444;
  margin-top: 2rem;
  border-left: 4px solid #B45309;
  padding-left: 0.5rem;
}

#docs p { margin: 1rem 0; }
#docs ul { margin: 0.5rem 0 1.5rem 1.2rem; }

#docs code {
  background: #F3EEE4;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 0.95em;
}

#docs pre {
  background: #1e1e1e;
  color: #f8f8f2;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  margin: 1rem 0;
}

#docs pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* ====== SIDEBAR (outside #docs) ========================================= */
:root {
  --docs-max: 800px;  /* match #docs max-width */
  --sidebar-w: 180px;
  --sidebar-gap: 120px;
}

/* floating parchment panel */
#sidebar {
  position: fixed;
  top: 128px;
  left: max(
    16px,
    calc(50vw - (var(--docs-max) / 2 + var(--sidebar-gap) + var(--sidebar-w)))
  );
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: .35rem;

  background: #EFEAE2;                     /* NEW: panel color */
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  padding: .6rem .75rem;                   /* uniform padding */
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 10;
}

/* sidebar links */
#sidebar a {
  display: block;
  padding: .35rem .5rem;
  border-radius: 8px;
  text-decoration: none;
  color: #374151;                          /* darker for contrast on panel */
  white-space: nowrap;
}
#sidebar a:hover {
  background: rgba(180,83,9,.10);          /* rust tint */
  color: #B45309;
}
#sidebar a.active {
  background: rgba(180,83,9,.16);
  color: #8A4B21;
  font-weight: 600;
}

/* Collapse sidebar to a top bar on narrow viewports */
@media (max-width: 1200px) {
  #sidebar {
    position: static;
    width: auto;
    padding: 0.5rem 0 1rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    flex-direction: row;
    gap: .75rem;
    justify-content: center;
  }
}






/* === Feature grid base === */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin: 2rem 0;
  justify-items: center;
  align-items: center;
  position: relative; /* anchor for absolute overlay at smaller breakpoints */
}

.feature img {
  width: 300px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  margin-bottom: 0.5rem;
}

/* Big left image (hero) */
.feature:first-child img {
  width: 800px;
  z-index: 1;
}

/* Small right image sits on top at desktop */
.feature:nth-child(2) {
  position: relative;
  left: -250px;
  top: -40px;
  z-index: 2;
}

/* Make the small (right) image noticeably smaller on desktop */
.feature:nth-child(2) img { width: 220px; }

/* Desktop slide effect (left-offset) when toggled */
.feature.move-left { left: -830px; top: -40px; }

/* Only animate when we explicitly add .anim (prevents resize-drift) */
.feature:nth-child(2).anim { transition: left .4s ease, right .4s ease; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .feature:nth-child(2).anim { transition: none; }
}

/* === Responsive === */
:root { --thumb: 200px; --gutter: 40px; }

/* ≤1200px: center hero, overlay small image; slide via RIGHT */
@media (max-width: 1200px) {
  .feature:first-child { grid-column: 1 / -1; }
  .feature:first-child img {
    width: min(700px, 100%);
    display: block;
    margin: 0 auto;
  }

  .feature:nth-child(2) {
    position: absolute;  /* overlay */
    top: 50%;
    right: var(--gutter); /* start on right */
    left: auto;
    transform: translateY(-50%);
  }
  .feature:nth-child(2) img { width: var(--thumb); }

  /* slide to LEFT side when toggled */
  .feature.move-left { right: calc(100% - var(--gutter) - var(--thumb)); left: auto; }
}

/* ≤900px: keep overlay, just scale down */
@media (max-width: 900px) {
  :root { --thumb: 160px; --gutter: 24px; }

  .feature:first-child img { width: min(560px, 100%); }

  .feature:nth-child(2) { right: var(--gutter); } /* stays overlaid & centered vertically from above */
  .feature:nth-child(2) img { width: var(--thumb); }

  .feature.move-left { right: calc(100% - var(--gutter) - var(--thumb)); }
}

/* ≤560px: hide the overlay thumb for clarity */
@media (max-width: 560px) {
  .feature:nth-child(2) { display: none !important; }
}
