/* ============================================================
   Components — interactive primitives (tabs, FAQ, form)
   Conventions inherited from base.css / sections.css — do not
   redefine here: .wrap, .section, .eyebrow, .lede, .btn
   (+.btn-primary), h1–h4, .accent.

   Flat class selectors only. No :has(), no nesting, no @layer,
   no @container, no child combinators deeper than one level, no
   :nth-child. Attribute selectors used for state, which is fine:
   [aria-selected], [hidden], [open], [data-touched],
   [aria-expanded].
   ============================================================ */


/* ============================================================
   TABS
   .tabs / .tablist / .tab / .tabpanel
   Markup contract (see components.js for the full ARIA pattern):
     <div class="tabs">
       <div class="tablist" role="tablist" aria-label="...">
         <button class="tab" role="tab" id="tab-a" aria-selected="true"
                 aria-controls="panel-a" tabindex="0">Middle School</button>
         <button class="tab" role="tab" id="tab-b" aria-selected="false"
                 aria-controls="panel-b" tabindex="-1">High School</button>
       </div>
       <div class="tabpanel" id="panel-a" role="tabpanel" aria-labelledby="tab-a">...</div>
       <div class="tabpanel" id="panel-b" role="tabpanel" aria-labelledby="tab-b">...</div>
     </div>
   Ship the panels visible in the markup — JS hides the inactive
   ones on init. See components.js for why.
   ============================================================ */
.tablist {
  display: flex;
  gap: calc(var(--gutter) * 0.6);
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: calc(var(--gutter) * 0.9);
}
.tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 14px 4px;
  min-height: 44px;
  font-family: var(--mono);
  font-size: var(--eyebrow-size);
  letter-spacing: var(--eyebrow-track);
  text-transform: uppercase;
  color: var(--paper-mute);
  cursor: pointer;
  transition: color 0.3s var(--ease-cine), border-color 0.3s var(--ease-cine);
}
.tab:hover { color: var(--paper-dim); }
/* Class mirrors aria-selected; the attribute stays for assistive tech, the
   class is what the converter can carry. */
.tab.is-selected {
  color: var(--paper);
  border-bottom-color: var(--paper);
}

/* Hidden state comes only from the `hidden` attribute the JS sets —
   never fight it with a class-based display rule. */
/* The `hidden` attribute still does the real hiding for no-JS and assistive
   tech; this class is the converter-safe equivalent. */
.tabpanel.is-hidden { display: none; }

/* ---- Unit index list living inside a panel ----
   A clean, scannable multi-column index: hairline rules between
   rows, mono numerals as the scan anchor. */
.unitlist {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 var(--gutter);
}
.unitlist-item {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}
/* Sized for the published label, not a bare numeral: the source copy reads
   "Unit 1: The Americas Before Columbus", so this column holds "Unit 1" —
   and one High School row holds "Review Unit". nowrap stops it breaking
   after the word; min-width keeps the titles aligned across the numbered
   rows while letting the longer review label push its own title right. */
.unitlist-num {
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--paper-mute);
  flex: none;
  min-width: 5.2em;
  white-space: nowrap;
}
.unitlist-title {
  font-size: var(--step--1);
  line-height: 1.4;
  color: var(--paper-dim);
}


/* ============================================================
   FAQ
   .faq / .faq-item
   Pure <details>/<summary> — no JS involved at all. Markup:
     <div class="faq">
       <details class="faq-item">
         <summary class="faq-question">Question text</summary>
         <div class="faq-answer"><p>Answer copy.</p></div>
       </details>
       ...
     </div>
   ============================================================ */
.faq-item {
  border-bottom: 1px solid var(--line);
}
.faq-item:first-child { border-top: 1px solid var(--line); }

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gutter);
  padding: calc(var(--gutter) * 0.55) 0;
  min-height: 44px;
  font-family: var(--serif);
  font-size: var(--step-1);
  line-height: 1.3;
  color: var(--paper);
  cursor: pointer;
  list-style: none;
}
/* Remove the native disclosure triangle in both engines. Do NOT
   remove :focus-visible — keyboard users still need it. */
.faq-question::-webkit-details-marker { display: none; }
.faq-question::marker { content: ""; }

.faq-affordance {
  flex: none;
  position: relative;
  width: 18px;
  height: 18px;
}
/* Two real spans, not ::before/::after — Webflow's converter rejects
   pseudo-elements. The horizontal bar is always there; the vertical one
   collapses to turn + into −. */
.faq-affordance-bar {
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--paper-mute);
  transition: transform 0.3s var(--ease-cine), background 0.3s var(--ease-cine);
}
.faq-affordance-h {
  width: 14px;
  height: 1px;
  transform: translate(-50%, -50%);
}
.faq-affordance-v {
  width: 1px;
  height: 14px;
  transform: translate(-50%, -50%);
}
/* Open state rides on a class, set by script alongside the native `open`
   attribute, because attribute selectors are rejected by the converter too.
   With no script the accordion still opens and closes — only the icon stops
   flipping, which is a decoration, not the function. */
/* State classes sit on the elements being styled, not on the <details>: a
   state on an ancestor is a descendant selector, which the converter drops. */
.faq-affordance-v.is-open { transform: translate(-50%, -50%) scaleY(0); }
.faq-affordance-bar.is-open { background: var(--paper); }
.faq-question.is-open { color: var(--paper); }

.faq-answer {
  padding: 0 0 calc(var(--gutter) * 0.6);
  max-width: 62ch;
}
.faq-answer p {
  font-size: var(--step-0);
  line-height: 1.7;
  color: var(--paper-dim);
}


/* ============================================================
   FORM
   .form / .field / .field-label / .field-input / .field-error /
   .form-note
   Markup contract:
     <form class="form" novalidate>
       <div class="field">
         <label class="field-label" for="f-name">Name</label>
         <input class="field-input" id="f-name" name="name" required>
         <p class="field-error">Enter your name.</p>
       </div>
       <div class="field field-wide">
         <label class="field-label" for="f-msg">Message</label>
         <textarea class="field-input" id="f-msg" name="message"></textarea>
       </div>
       <button class="btn btn-primary form-submit" type="submit">Send</button>
       <p class="form-note">...</p>
     </form>
   `:invalid` styling is gated on `[data-touched]`, which
   components.js sets on blur — fields must not scream red before
   the visitor has typed anything.
   ============================================================ */
.form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--gutter) * 0.7) var(--gutter);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.field-wide { grid-column: 1 / -1; }

.field-label {
  font-family: var(--mono);
  font-size: var(--eyebrow-size);
  letter-spacing: var(--eyebrow-track);
  text-transform: uppercase;
  color: var(--paper-mute);
}

.field-input {
  appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 13px 16px;
  background: rgba(232, 222, 197, 0.03);
  border: 1px solid var(--line-strong);
  color: var(--paper);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.4;
  transition: background 0.3s var(--ease-cine), border-color 0.3s var(--ease-cine);
}
.field-input::placeholder { color: var(--paper-mute); }
textarea.field-input {
  min-height: 132px;
  resize: vertical;
}
select.field-input {
  cursor: pointer;
}
.field-input:hover { border-color: var(--line-strong); background: rgba(232, 222, 197, 0.05); }
.field-input:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-color: var(--brass);
}
/* Errors are driven by leadform.js, not by :invalid, so a field is only
   marked once the visitor has left it — never on first paint or first focus.
   The [hidden] attribute on .field-error does the showing and hiding. */
.field-input.is-invalid {
  border-color: var(--red-deep);
}

.field-hint {
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--paper-mute);
  margin-top: 6px;
}

.field-error {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  line-height: 1.5;
  color: var(--red-text);
  margin-top: 6px;
}

/* Column so the status message sits under the button rather than beside it,
   and start-aligned to sit on the same edge as the fields above. */
.form-submit {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  /* Centred: the form sits inside a centre-aligned CTA band, so a left-aligned
     button reads as a mistake against the heading and lede above it. */
  align-items: center;
  margin-top: 8px;
}
.form-status { text-align: center; }

/* Submission outcome. role="status" announces it; the colour is decoration on
   top of wording that already says which it is. */
.form-status {
  margin-top: 16px;
  max-width: 46ch;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  line-height: 1.5;
}
.form-status.is-pending { color: var(--paper-mute); }
.form-status.is-success { color: var(--brass); }
.form-status.is-error   { color: var(--red-text); }

.form-note {
  grid-column: 1 / -1;
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--paper-mute);
}


/* ============================================================
   RESPONSIVE
   Matches Webflow's own breakpoints: 991 / 767 / 479.
   ============================================================ */
@media (max-width: 991px) {
  .unitlist { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .tablist { gap: calc(var(--gutter) * 0.4); }
  .form { grid-template-columns: 1fr; }
  .field-wide { grid-column: 1 / -1; }
}

@media (max-width: 479px) {
  .faq-question { font-size: var(--step-0); }
  .tab { font-size: 9px; }
}

/* Honeypot. Positioned off-canvas rather than display:none — the field has to
   look real enough to a bot that it fills it in. aria-hidden and tabindex="-1"
   keep it away from anyone actually using the form. */
.field-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Shared footer signup: link to the single hosted subscription form. */
.footer-signup{display:flex;align-items:center;justify-content:space-between;gap:32px;padding:38px 0;margin:0 0 42px;border-bottom:1px solid rgba(128,128,128,.25)}
.footer-signup h2{font-size:28px;line-height:1.2;margin:0 0 10px;letter-spacing:-.5px}
.footer-signup p{font-size:16px;line-height:1.5;margin:0;opacity:.8}
.footer-signup a{display:inline-flex;align-items:center;gap:24px;flex-shrink:0;padding:14px 24px;border:1px solid currentColor;border-radius:999px;text-decoration:none;font-size:16px;font-weight:600;color:inherit}
.footer-signup a:hover{opacity:.8}
@media(max-width:700px){.footer-signup{align-items:flex-start;flex-direction:column;gap:22px}.footer-signup h2{font-size:24px}}
