/* Production Preview - Screen 1 (ruled-notepad Mad Lib) + app chrome.
   Ported from the approved design preview
   (out/claude_ref/preview_a2_homepage_fullscreen.html):
   - --rule 44px desktop / 36px mobile; rule line at the BOTTOM of each row
   - every line-height is 1 rule (or 1/2 rule for body text); all block gaps
     are whole rules; half-rule blocks sit in .rounds wrappers that the grid
     engine (app.js) rounds UP to full-rule multiples - STRUCTURAL grid
     safety, no hardcoded line-count compensation
   - content column max-width 860px, centered; paper spans the viewport */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* The hidden attribute must always win, even over display:flex below. */
[hidden] { display: none !important; }

:root {
  --rule: 44px;
  --paper: #FDFBF4;
  --line: #D9E4EE;
  --margin-red: #E8A9A9;
  --ink: #23211C;
  --ink-soft: #5F5B50;
  --ink-muted: #8A8271;
  --cta: #D85A30;
  --cta-hover: #C74E27;
  --paper-border: #E5DFCB;
  --margin-x: clamp(34px, 5vw, 64px);
  --headline-size: 24px;
  --body-size: 16px;
  --madlib-size: 30px;
  --foot-size: 13px;
}
@media (max-width: 640px) {
  :root {
    --rule: 36px;
    --headline-size: 20px;
    --body-size: 14px;
    --madlib-size: 24px;
    --foot-size: 12px;
  }
}

html { height: 100%; }
body { font-family: Karla, sans-serif; color: var(--ink); }
button, input { font: inherit; color: inherit; }

/* ---- screen modes ---- */
body.mode-intake {
  height: 100vh; height: 100dvh;
  overflow: hidden; /* hard constraint: single viewport, no page scroll */
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    transparent 0 calc(var(--rule) - 1px),
    var(--line) calc(var(--rule) - 1px) var(--rule));
}
body.mode-results {
  overflow: auto;               /* results may scroll (kept tight in W3) */
  background: #FFFFFF;          /* tonal shift: no notepad texture here  */
}
body.mode-results .margin-line { display: none; }

.margin-line {
  position: fixed; top: 0; bottom: 0; left: var(--margin-x);
  width: 1px; background: var(--margin-red);
}

/* ---- intake layout ---- */
#intake {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 1000px) {
  #intake { padding-left: calc(var(--margin-x) + 18px); }
}
#madlib-form { margin: 0; }

.headline { font-weight: 700; font-size: var(--headline-size); line-height: var(--rule); }

.body-text {
  font-size: var(--body-size);
  line-height: calc(var(--rule) / 2);
  color: var(--ink-soft);
  text-wrap: pretty;
}
.body-text a { color: var(--cta); }
.nowrap { white-space: nowrap; }
.rounds { display: block; }

.madlib {
  font-family: Caveat, cursive;
  font-weight: 500;
  font-size: var(--madlib-size);
  line-height: var(--rule);
  margin-top: var(--rule); /* one blank ruled row above the sentence */
}

/* ---- pills (real controls) ---- */
.slot-wrap { position: relative; display: inline-block; }
.pill {
  display: inline-block;
  line-height: calc(var(--rule) - 10px);
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  transition: background .15s ease, box-shadow .15s ease;
}
.pill:focus-visible, .cta:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.pill[aria-expanded="true"] { box-shadow: inset 0 0 0 1.5px currentColor; }

.pill-making   { background: #EEEDFE; color: #3C3489; }
.pill-making:hover   { background: #E3E1FD; }
.pill-length   { background: #E1F5EE; color: #085041; }
.pill-length:hover   { background: #D5F0E5; }
.pill-timeline { background: #FAEEDA; color: #633806; }
.pill-timeline:hover { background: #F6E5C6; }
.pill-kickoff  { background: #FBEAF0; color: #72243E; }
.pill-kickoff:hover  { background: #F8DEE9; }

/* ---- dropdown panel ---- */
.pill-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40;
  list-style: none;
  padding: 6px;
  background: #FFFDF8;
  border: 1px solid var(--paper-border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(35, 33, 28, .14);
  min-width: 100%;
  width: max-content;
  max-width: min(340px, 82vw);
}
.opt { display: block; padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.opt-label {
  display: block;
  font-family: Caveat, cursive;
  font-size: 24px;
  line-height: 1.25;
}
.opt-sub {
  display: block;
  font-family: Karla, sans-serif;
  font-size: 12px;
  color: var(--ink-muted);
}
.opt:hover, .opt:focus { background: #F6F3EA; outline: none; }
.menu-making   .opt-label { color: #3C3489; }
.menu-making   .opt[aria-selected="true"] { background: #EEEDFE; }
.menu-length   .opt-label { color: #085041; }
.menu-length   .opt[aria-selected="true"] { background: #E1F5EE; }
.menu-timeline .opt-label { color: #633806; }
.menu-timeline .opt[aria-selected="true"] { background: #FAEEDA; }

/* hidden native date input: kept rendered so showPicker() can anchor to it */
.date-input { position: absolute; inset: 0; opacity: 0; pointer-events: none; border: 0; }
.weekend-note {
  position: absolute; top: calc(100% + 6px); left: 8px; z-index: 30;
  font-family: Karla, sans-serif; font-size: 12px; color: var(--ink-muted);
  background: #FFFDF8; border: 1px solid var(--paper-border);
  border-radius: 8px; padding: 3px 9px; white-space: nowrap;
}

/* ---- CTA ---- */
.cta-row {
  position: relative;
  height: calc(2 * var(--rule)); /* button centered in a fixed 2-row band */
  display: flex; align-items: center; justify-content: center;
}
.cta {
  font-family: Karla, sans-serif; font-weight: 500; font-size: 16px;
  background: var(--cta); color: var(--paper);
  padding: 12px 28px; border: none; border-radius: 999px; cursor: pointer;
  transition: background .15s ease;
  text-decoration: none;
}
.cta:hover { background: var(--cta-hover); }
.form-error {
  position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
  font-family: Karla, sans-serif; font-size: 12.5px; color: #B3402A;
  white-space: nowrap;
}

.deliverables { /* same role as .subline - shared .body-text styling */ }

.foot {
  font-size: var(--foot-size);
  line-height: var(--rule);
  color: var(--ink-muted);
  text-align: center;
  margin-top: var(--rule); /* one blank ruled row of breathing room */
}
.foot a { color: var(--cta); }

/* ---- doodles (design_spec_addendum_a2 "Doodles (homepage)") ----
   SCOPE FREEZE: purely additive. Absolutely/fixed positioned, zero layout
   height, pointer-events none, hidden on mobile. The only hook into
   existing styles is .headline position:relative (mounting anchor). */
.headline { position: relative; } /* mounting hook for the underline doodle */
.doodle { pointer-events: none; }
.doodle-underline {
  position: absolute; left: -2px; top: 31px;
  width: 498px; max-width: 100%; height: 12px; opacity: .5;
}
.doodle-arrow {
  position: absolute; left: calc(50% + 78px); top: 6px;
  width: 84px; height: 50px; opacity: .55;
}
.doodle-note {
  position: absolute; left: calc(50% + 160px); top: 2px; margin: 0;
  font-family: Caveat, cursive; font-size: 21px; line-height: 1;
  color: var(--ink); opacity: .75; transform: rotate(4deg);
  white-space: nowrap;
}
.doodle-smiley {
  position: fixed; top: 18px; right: 26px;
  width: 44px; height: 44px; opacity: .5; transform: rotate(-6deg);
}
@media (max-width: 640px) {
  /* spec: hide underline + arrow/note on mobile; smiley can collide with
     content at phone widths, so the "otherwise hide all" branch applies */
  .doodle { display: none; }
}

/* ---- loading overlay (screen-1 personality, from the copy JSON) ---- */
.loading {
  position: fixed; inset: 0; z-index: 60;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    transparent 0 calc(var(--rule) - 1px),
    var(--line) calc(var(--rule) - 1px) var(--rule));
  display: flex; align-items: center; justify-content: center;
}
.loading-line {
  font-family: Caveat, cursive;
  font-size: clamp(26px, 3vw, 34px);
  color: var(--ink);
}

/* Results-screen styles live in css/results.css (clean, no notepad texture). */
