
/* ════════════════════════════════════════════════════════════════
   v6.13 — Per-preset essay (AdSense-compliant depth content)
   ──────────────────────────────────────────────────────────────
   Preset pages (/p/{slug}) get a recipe-specific essay below the
   chat shell. The chat is still the first thing the user sees —
   the essay sits at viewport-bottom and the user scrolls to read.
   Crawlers see the full main content from the initial HTML.
   No display:none, no visibility:hidden, no off-screen positioning.
   ════════════════════════════════════════════════════════════════ */

/* Switch body off the height-100vh overflow-hidden lock for preset
   pages. The grid still places sidebar/main/stack in row 1 at 100vh,
   then the essay flows below as row 2 spanning all columns.
   v6.30 — switch to 100dvh on mobile so the chat shell fits the visible
   viewport without the URL bar pushing the input below the fold. */
body.chat-shell[data-preset-id] {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  grid-template-rows: 100vh auto;
  grid-template-rows: 100dvh auto;
  grid-template-areas:
    "side main stack"
    "essay essay essay";
}
body.chat-shell[data-preset-id] .cs-preset-essay { grid-area: essay; }

/* On tablet (≤1100px) the stack collapses, so essay spans 2 cols */
@media (max-width: 1100px) {
  body.chat-shell[data-preset-id] {
    grid-template-rows: 100vh auto;
    grid-template-rows: 100dvh auto;
    grid-template-areas:
      "side main"
      "essay essay";
  }
}
/* On phone (≤760px) sidebar slides in/out — essay spans the lone col */
@media (max-width: 760px) {
  body.chat-shell[data-preset-id] {
    grid-template-rows: 100vh auto;
    grid-template-rows: 100dvh auto;
    grid-template-areas:
      "main"
      "essay";
  }
}

.cs-preset-essay {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 64px 32px 96px;
  font: 400 16px/1.7 var(--sans);
  color: var(--text);
  /* Cap reading column for desktop while letting the section fill the row */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.cs-preset-essay > * {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.cs-essay-head { margin: 0 auto 40px; }
.cs-essay-head h1 {
  font: 800 32px/1.2 var(--heading);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--text);
}
.cs-essay-spec-line {
  font: 600 14px var(--mono);
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin: 0 0 20px;
}
.cs-essay-lede {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  margin: 0;
}

.cs-essay-section { margin: 0 auto 36px; }
.cs-essay-section h2 {
  font: 700 22px/1.25 var(--heading);
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--text);
}
.cs-essay-section p {
  margin: 0 0 14px;
  color: var(--text);
}
.cs-essay-section p strong { color: var(--text); }

/* Specs table */
.cs-essay-specs {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.cs-essay-specs th,
.cs-essay-specs td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.cs-essay-specs th {
  font: 600 13px var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  width: 40%;
  background: var(--surface-2);
}
.cs-essay-specs a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cs-essay-specs a:hover { color: var(--accent-active); }

/* Use-case + how-it-runs lists */
.cs-essay-uses,
.cs-essay-mistakes,
.cs-essay-related {
  margin: 0 0 8px;
  padding-left: 20px;
}
.cs-essay-uses li,
.cs-essay-mistakes li {
  margin-bottom: 10px;
}
.cs-essay-steps {
  margin: 0 0 8px;
  padding-left: 20px;
}
.cs-essay-steps li { margin-bottom: 10px; }

/* FAQ accordion */
.cs-essay-faq {
  margin-bottom: 6px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.cs-essay-faq[open] { background: var(--surface-3); }
.cs-essay-faq summary {
  font: 600 15.5px var(--sans);
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 28px;
  color: var(--text);
}
.cs-essay-faq summary::-webkit-details-marker { display: none; }
.cs-essay-faq summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font: 400 20px var(--mono);
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.cs-essay-faq[open] summary::after { content: "−"; }
.cs-essay-faq p {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

/* Related list */
.cs-essay-related li { margin-bottom: 8px; list-style: none; }
.cs-essay-related li::before {
  content: "→ ";
  color: var(--accent);
  font-weight: 700;
  margin-left: -16px;
  margin-right: 6px;
}
.cs-essay-related a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.12s, color 0.12s;
}
.cs-essay-related a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.cs-essay-related-sub {
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--mono);
}
.cs-essay-parent {
  margin-top: 20px !important;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.cs-essay-parent a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.cs-essay-parent a:hover { text-decoration: underline; }

/* Mobile-specific tweaks for the essay */
@media (max-width: 760px) {
  .cs-preset-essay {
    padding: 40px 18px 64px;
    font-size: 15.5px;
    line-height: 1.65;
  }
  .cs-essay-head h1 { font-size: 26px; line-height: 1.2; }
  .cs-essay-spec-line { font-size: 13px; }
  .cs-essay-section h2 { font-size: 19px; }
  .cs-essay-specs th, .cs-essay-specs td {
    padding: 10px 8px;
    font-size: 14px;
    display: block;       /* stack rows on phones */
    width: auto;
    border-bottom: 0;
  }
  .cs-essay-specs th { padding-bottom: 0; background: transparent; }
  .cs-essay-specs td { padding-top: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
  .cs-essay-faq summary { font-size: 15px; }
}

/* Honour reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cs-essay-faq summary::after { transition: none; }
}

/* ────────────────────────────────────────────────────────────────
   v6.35 — Ad slots inside the preset essay
   ──────────────────────────────────────────────────────────────
   AdSense responsive units need an explicit min-height to avoid
   layout shift. Margin matches section gap so the ads feel native
   to the essay's rhythm rather than bolted on.
   ──────────────────────────────────────────────────────────────── */
.cs-preset-essay + .ad-slot,
.cs-preset-essay .ad-slot {
  margin: 32px auto;
  max-width: 800px;
  width: 100%;
  min-height: 100px;
  display: block;
}
.cs-preset-essay .ad-slot-placeholder,
.cs-preset-essay + .ad-slot .ad-slot-placeholder {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--mono);
}
@media (max-width: 768px) {
  .cs-preset-essay .ad-slot,
  .cs-preset-essay + .ad-slot { margin: 24px 16px; }
}
