/* ==========================================================================
   MAANG.io — Editorial Premium · Components
   Depends on tokens.css. Single theme (light primary / dark opt-in).
   Class-based + lightly opinionated element styles. Safe to load AFTER a CSS
   reset or Bootstrap (these rules are scoped to .ed-* classes + a few elements).
   ========================================================================== */

/* ---- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: var(--fs-body); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: var(--lh-tight); letter-spacing: var(--tracking-display); margin: 0 0 .4em; color: var(--text); }
h1 { font-size: var(--fs-h1); } h2 { font-size: var(--fs-h2); } h3 { font-size: var(--fs-h3); letter-spacing: -.01em; }
p { margin: 0 0 1rem; color: var(--text-muted); }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
code, pre, kbd { font-family: var(--font-mono); }

/* ---- Layout primitives --------------------------------------------------- */
.ed-container { width: min(100% - 40px, var(--maxw)); margin-inline: auto; }
.ed-prose { max-width: var(--maxw-prose); }
.ed-section { padding: var(--section-y) 0; }
.ed-section--alt { background: var(--bg-elev); border-block: 1px solid var(--border); }
.ed-head { max-width: 640px; margin: 0 auto var(--sp-7); text-align: center; }
.ed-head--left { margin-inline: 0; text-align: left; }
.ed-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.ed-eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; opacity: .7; }
.ed-display { font-size: var(--fs-display); }
.ed-lead { font-size: var(--fs-lead); color: var(--text-muted); line-height: 1.55; }
.ed-muted { color: var(--text-muted); }
.ed-mark { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 28%, transparent) 0); padding: 0 .05em; } /* editorial highlighter */
.ed-accent { color: var(--brand); }

.ed-grid { display: grid; gap: var(--sp-5); }
.ed-cols-2 { grid-template-columns: repeat(2, 1fr); }
.ed-cols-3 { grid-template-columns: repeat(3, 1fr); }
.ed-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Buttons ------------------------------------------------------------- */
.ed-btn {
  --pad: 12px 22px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: var(--pad); border-radius: var(--r-sm); font-family: var(--font-body);
  font-weight: 600; font-size: var(--fs-sm); border: 1px solid transparent; cursor: pointer;
  transition: transform var(--t-fast) var(--ease), background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease); white-space: nowrap;
}
.ed-btn:active { transform: translateY(1px); }
.ed-btn--primary { background: var(--brand); color: var(--text-on-brand); }
.ed-btn--primary:hover { background: var(--brand-strong); color: var(--text-on-brand); }
.ed-btn--ink { background: var(--text); color: var(--bg-elev); }      /* editorial signature: solid ink */
.ed-btn--ink:hover { background: color-mix(in srgb, var(--text) 88%, var(--bg)); color: var(--bg-elev); }
.ed-btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.ed-btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.ed-btn--lg { --pad: 15px 30px; font-size: 1rem; }
.ed-btn--sm { --pad: 9px 16px; font-size: var(--fs-xs); }
.ed-btn--block { width: 100%; }

/* ---- Nav ----------------------------------------------------------------- */
.ed-nav { position: sticky; top: 0; z-index: 50; height: 70px; display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color var(--t), background var(--t); }
.ed-nav.is-scrolled { border-color: var(--border); background: color-mix(in srgb, var(--bg) 92%, transparent); }
.ed-nav .ed-container { display: flex; align-items: center; gap: 22px; }
.ed-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--text); }
.ed-brand .mark { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--brand); color: var(--text-on-brand); font-family: var(--font-mono); font-size: .85rem; }
.ed-nav-links { display: flex; gap: 2px; margin-left: 12px; }
.ed-nav-links a { padding: 8px 13px; border-radius: 8px; color: var(--text-muted); font-weight: 500; font-size: var(--fs-sm); transition: color var(--t), background var(--t); }
.ed-nav-links a:hover { color: var(--text); background: var(--surface-2); }
.ed-nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---- Hero ---------------------------------------------------------------- */
.ed-hero { padding: clamp(56px, 9vw, 104px) 0 clamp(36px, 6vw, 72px); }
.ed-hero h1 { margin-bottom: 18px; }
.ed-hero .ed-lead { max-width: 540px; }
.ed-hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 24px; }
.ed-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 500; margin-bottom: 20px; }
.ed-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.ed-trust { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; color: var(--text-faint); font-size: var(--fs-xs); }
.ed-trust .logos { display: flex; gap: 16px; flex-wrap: wrap; }
.ed-trust .logos span { font-weight: 600; color: var(--text-muted); }

/* ---- Cards (flat, hairline — the editorial signature) -------------------- */
.ed-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-6);
  transition: border-color var(--t), transform var(--t) var(--ease); }
.ed-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.ed-card .ico { width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center; font-size: 1.2rem;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 16px; }
.ed-card h3 { margin-bottom: 8px; }
.ed-card p { font-size: var(--fs-sm); margin-bottom: 14px; }
.ed-card .more { font-family: var(--font-body); color: var(--brand); font-weight: 600; font-size: var(--fs-sm); display: inline-flex; gap: 6px; align-items: center; }
.ed-card .more i { transition: transform var(--t); }
.ed-card:hover .more i { transform: translateX(4px); }
.ed-kicker { font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; color: var(--text-faint); text-transform: uppercase; }

.ed-feature { display: flex; gap: 14px; align-items: flex-start; }
.ed-feature .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.ed-feature h3 { font-size: 1.05rem; margin-bottom: 4px; }
.ed-feature p { font-size: var(--fs-sm); margin: 0; }

/* ---- Badges / chips ------------------------------------------------------ */
.ed-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 600;
  padding: 4px 11px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); color: var(--text-muted); }
.ed-chip--brand { color: var(--brand); background: var(--brand-soft); border-color: transparent; }
.ed-chip--accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---- Pricing ------------------------------------------------------------- */
.ed-price { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px 24px; position: relative; }
.ed-price.is-featured { border-color: var(--brand); box-shadow: var(--shadow-2); }
.ed-price .badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: var(--text-on-brand); font-size: var(--fs-xs); font-weight: 600; padding: 5px 14px; border-radius: var(--r-pill); }
.ed-price .name { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.ed-price .amt { font-family: var(--font-display); font-size: 2.6rem; font-weight: 600; margin: 10px 0 2px; letter-spacing: -.02em; }
.ed-price .amt small { font-family: var(--font-body); font-size: .85rem; font-weight: 500; color: var(--text-faint); }
.ed-price .desc { font-size: var(--fs-sm); color: var(--text-muted); min-height: 40px; }
.ed-price ul { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; gap: 10px; }
.ed-price li { font-size: var(--fs-sm); display: flex; gap: 10px; align-items: flex-start; color: var(--text-muted); }
.ed-price li i { color: var(--brand); margin-top: 3px; font-size: .8rem; }
.ed-price li.off, .ed-price li.off i { color: var(--text-faint); }
.ed-price .ed-btn { margin-top: auto; }

/* ---- FAQ (native <details>) --------------------------------------------- */
.ed-faq { max-width: var(--maxw-prose); margin-inline: auto; display: grid; gap: 12px; }
.ed-acc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.ed-acc summary { cursor: pointer; list-style: none; padding: 18px 20px; font-weight: 600; color: var(--text); display: flex; justify-content: space-between; gap: 12px; }
.ed-acc summary::-webkit-details-marker { display: none; }
.ed-acc summary .chev { transition: transform var(--t); color: var(--text-faint); }
.ed-acc[open] summary .chev { transform: rotate(180deg); color: var(--brand); }
.ed-acc .body { padding: 0 20px 18px; color: var(--text-muted); font-size: var(--fs-sm); }

/* ---- Forms / modal (e.g. OAuth sign-in) ---------------------------------- */
.ed-field { display: grid; gap: 6px; margin-bottom: 14px; }
.ed-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.ed-input { width: 100%; padding: 11px 14px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text); font: inherit; transition: border-color var(--t), box-shadow var(--t); }
.ed-input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.ed-oauth-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }

/* ---- Footer -------------------------------------------------------------- */
.ed-footer { border-top: 1px solid var(--border); padding: 56px 0 30px; }
.ed-foot-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; }
.ed-foot-grid h4 { font-family: var(--font-body); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.ed-foot-grid a { display: block; color: var(--text-muted); font-size: var(--fs-sm); padding: 5px 0; }
.ed-foot-grid a:hover { color: var(--brand); }
.ed-foot-bottom { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--text-faint); font-size: var(--fs-sm); flex-wrap: wrap; }

/* ==========================================================================
   Curriculum app (sidebar tree + long-form lesson)
   ========================================================================== */
.ed-app { display: grid; grid-template-columns: 300px 1fr; min-height: calc(100vh - 70px); }
.ed-sidebar { border-right: 1px solid var(--border); background: var(--bg-elev); padding: 18px 14px; overflow-y: auto; position: sticky; top: 70px; max-height: calc(100vh - 70px); }
.ed-tree { font-size: var(--fs-sm); }
.ed-tree .row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text-muted); transition: background var(--t-fast), color var(--t-fast); }
.ed-tree .row:hover { background: var(--surface-2); color: var(--text); }
.ed-tree .row.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.ed-tree .row .chev { font-size: .7rem; width: 12px; color: var(--text-faint); transition: transform var(--t); }
.ed-tree .row.open .chev { transform: rotate(90deg); }
.ed-tree .row .lock { margin-left: auto; font-size: .72rem; color: var(--text-faint); }
.ed-tree .children { margin-left: 16px; border-left: 1px solid var(--border); padding-left: 6px; display: none; }
.ed-tree .children.open { display: block; }

.ed-content { padding: clamp(28px, 4vw, 56px) clamp(20px, 5vw, 72px); max-width: 820px; }
.ed-content .crumbs { font-size: var(--fs-xs); color: var(--text-faint); margin-bottom: 14px; }
.ed-content h1 { font-size: clamp(2rem, 3.6vw, 2.8rem); margin: 8px 0 18px; }
.ed-content h2 { font-size: 1.55rem; margin-top: 40px; }
.ed-content h3 { margin-top: 26px; }
.ed-content p, .ed-content li { font-size: 1.05rem; color: var(--text); line-height: 1.75; }
.ed-content .callout { background: var(--brand-soft); border: 1px solid transparent; border-left: 3px solid var(--brand); border-radius: var(--r-sm); padding: 14px 16px; margin: 18px 0; }
.ed-content .note { background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: var(--r-sm); padding: 14px 16px; margin: 18px 0; font-size: var(--fs-sm); }
.ed-content table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: var(--fs-sm); }
.ed-content th, .ed-content td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.ed-content th { color: var(--text-faint); text-transform: uppercase; font-size: var(--fs-xs); letter-spacing: .04em; }
.ed-content pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; overflow-x: auto; }
.ed-content pre code { font-size: .86rem; line-height: 1.7; color: var(--text); }
.ed-content figure.diagram { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; margin: 18px 0; text-align: center; }
.ed-content figure.diagram figcaption { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 10px; }
.ed-lesson-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.ed-lesson-nav a { flex: 1; max-width: 320px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r); color: var(--text); transition: border-color var(--t), transform var(--t) var(--ease); }
.ed-lesson-nav a:hover { border-color: var(--brand); transform: translateY(-2px); }
.ed-lesson-nav .dir { font-size: var(--fs-xs); color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; }
.ed-lesson-nav .ttl { font-family: var(--font-display); font-weight: 600; margin-top: 4px; }
.ed-lesson-nav .next { text-align: right; }

/* ==========================================================================
   Marketing extras (home/pricing): hero layout, code mock, stats, steps,
   quotes, featured lesson, pricing toggle, sign-in modal.
   ========================================================================== */
.ed-hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 52px; align-items: center; }

.ed-mock { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; }
.ed-mock .bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ed-mock .bar .dots { display: flex; gap: 6px; }
.ed-mock .bar .dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); }
.ed-mock .bar .file { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-faint); margin-left: 6px; }
.ed-mock pre { margin: 0; padding: 18px 20px; font-family: var(--font-mono); font-size: .84rem; line-height: 1.8; white-space: pre; overflow-x: auto; color: var(--text); }
.ed-mock .foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-xs); color: var(--text-muted); }
.ed-code-k { color: #9d174d; } .ed-code-s { color: #047857; } .ed-code-c { color: var(--text-faint); } .ed-code-f { color: var(--brand); }
[data-theme="dark"] .ed-code-k { color: #f9a8d4; } [data-theme="dark"] .ed-code-s { color: #6ee7b7; } [data-theme="dark"] .ed-code-f { color: var(--brand); }

.ed-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.ed-stat { text-align: center; padding: 24px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.ed-stat .num { font-family: var(--font-display); font-size: clamp(1.8rem, 3vw, 2.4rem); font-weight: 600; color: var(--brand); }
.ed-stat .lbl { color: var(--text-muted); font-size: var(--fs-sm); margin-top: 4px; }

.ed-steps { counter-reset: step; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.ed-step { padding: 26px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.ed-step::before { counter-increment: step; content: counter(step); font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; color: var(--text-on-brand); background: var(--brand); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 14px; }
.ed-step h3 { margin-bottom: 6px; }
.ed-step p { font-size: var(--fs-sm); margin: 0; }

.ed-quote { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 26px; }
.ed-quote .stars { color: var(--accent); letter-spacing: 2px; font-size: .85rem; margin-bottom: 10px; }
.ed-quote p { color: var(--text); font-family: var(--font-display); font-size: 1.05rem; font-weight: 500; line-height: 1.5; }
.ed-quote .who { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.ed-quote .av { width: 42px; height: 42px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; color: var(--text-on-brand); font-weight: 600; }
.ed-quote .who b { display: block; font-size: .92rem; } .ed-quote .who span { font-size: var(--fs-xs); color: var(--text-faint); }

.ed-lesson-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; }
.ed-lesson-card .lc-head { padding: 20px 22px 0; }
.ed-lesson-card .lc-head .crumbs { font-size: var(--fs-xs); color: var(--text-faint); margin-bottom: 6px; }
.ed-lesson-card .lc-body { padding: 8px 22px 18px; }
.ed-lesson-card .lc-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.ed-lesson-card .lc-foot a { font-size: var(--fs-xs); color: var(--text-muted); }
.ed-lesson-card .lc-foot .dir { display: block; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; font-size: .68rem; }

.ed-toggle-wrap { display: flex; justify-content: center; align-items: center; gap: 12px; color: var(--text-muted); font-size: var(--fs-sm); }
.ed-switch { width: 50px; height: 28px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border-strong); position: relative; cursor: pointer; transition: var(--t); }
.ed-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); transition: var(--t); }
.ed-switch.on::after { left: 25px; }

/* Sign-in modal */
.ed-modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 20px; background: color-mix(in srgb, #000 50%, transparent); }
.ed-modal.open { display: grid; }
.ed-modal-card { width: min(100%, 420px); background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 28px; position: relative; }
.ed-modal-card .x { position: absolute; top: 14px; right: 16px; font-size: 1.4rem; color: var(--text-faint); cursor: pointer; line-height: 1; background: none; border: none; }
.ed-modal-card h3 { margin-bottom: 6px; }

/* ---- View helpers (home / pricing) --------------------------------------- */
.ed-hero--center .ed-lead { max-width: none; }
.ed-nav-links a.is-active { color: var(--brand); background: var(--brand-soft); }
.ed-price .amt .per { font-family: var(--font-body); font-size: .85rem; font-weight: 500; color: var(--text-faint); }
.ed-price-inline { font-family: var(--font-body); font-size: .9rem; font-weight: 600; color: var(--brand); margin-left: 6px; }
.ed-price-inline s { color: var(--text-faint); font-weight: 500; margin-left: 4px; }
.ed-list { list-style: none; padding: 0; margin: 8px 0 16px; display: grid; gap: 8px; }
.ed-list li { position: relative; padding-left: 22px; font-size: var(--fs-sm); color: var(--text-muted); }
.ed-list li::before { content: "\2713"; position: absolute; left: 0; color: var(--brand); font-size: .8rem; }

/* ---- Reveal-on-scroll (optional; add .ed-reveal + JS) -------------------- */
.ed-reveal { opacity: 0; transform: translateY(16px); transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease); }
.ed-reveal.in { opacity: 1; transform: none; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 980px) {
  .ed-cols-4, .ed-stats, .ed-steps { grid-template-columns: repeat(2, 1fr); }
  .ed-cols-3 { grid-template-columns: 1fr 1fr; }
  .ed-hero-grid { grid-template-columns: 1fr; }
  .ed-hero-grid .ed-mock { order: -1; }
  .ed-app { grid-template-columns: 1fr; }
  .ed-sidebar { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .ed-nav-links { display: none; }
  .ed-cols-2, .ed-cols-3, .ed-cols-4, .ed-stats, .ed-steps, .ed-foot-grid { grid-template-columns: 1fr; }
}
