/* =========================================================
   ScoreChem — design tokens
   Paper:   #F5F6F1  (cool chalk/lab paper, not warm cream)
   Ink:     #14213D  (deep navy — text, borders, dark surfaces)
   Graphite:#5B6472  (secondary text)
   Violet:  #6E3FA3  (potassium-permanganate accent — primary)
   Flame:   #E2622A  (strontium flame — CTA / monetization only)
   Green:   #3F7D58  (titration end-point — success/positive)
   Display type: Literata (serif)   Body: IBM Plex Sans   Data: IBM Plex Mono
   ========================================================= */

:root {
  --paper: #F5F6F1;
  --paper-alt: #EDEFE7;
  --ink: #14213D;
  --ink-soft: #2A3550;
  --graphite: #5B6472;
  --line: rgba(20, 33, 61, 0.16);
  --border: rgba(20, 33, 61, 0.16);
  --primary: #6E3FA3;
  --violet: #6E3FA3;
  --violet-dim: #6E3FA31a;
  --flame: #E2622A;
  --flame-dim: #E2622A1a;
  --green: #3F7D58;
  --paper-rgb: 245, 246, 241;

  --font-display: "Literata", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, Segoe UI, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --max-w: 1120px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.1rem, 4vw, 3.1rem); line-height: 1.12; font-weight: 700; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.05rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; color: var(--ink-soft); max-width: 62ch; }

.section-title { margin-bottom: 0.4em; }
.section-sub { color: var(--graphite); max-width: 58ch; margin-bottom: 2.4rem; }

/* ---------- buttons & interactive actions ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75em 1.4em;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Routine / Free Academic Actions (Authoritative Violet / Ink) */
.btn-primary,
.btn-guide,
.open-chapter-btn {
  background: var(--violet);
  color: #fff;
  border-color: var(--violet);
}
.btn-primary:hover,
.btn-guide:hover,
.open-chapter-btn:hover {
  background: #593186;
  border-color: #593186;
  color: #fff;
}

.btn-ghost {
  border-color: var(--ink);
  color: var(--ink);
  background: transparent;
}
.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn-outline {
  border-color: var(--line);
  color: var(--ink);
  background: transparent;
  text-align: center;
}
.btn-outline:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* Monetization & Purchases ONLY (Exclusive High-Contrast Flame Orange) */
.btn-cta,
.btn-paywall,
.btn-monetize {
  background: var(--flame) !important;
  color: #ffffff !important;
  border: 1.5px solid var(--flame) !important;
  box-shadow: 0 3px 10px rgba(226, 98, 42, 0.22);
}
.btn-cta:hover,
.btn-paywall:hover,
.btn-monetize:hover {
  background: #c94e1c !important;
  border-color: #c94e1c !important;
  box-shadow: 0 4px 14px rgba(226, 98, 42, 0.35);
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(var(--paper-rgb), 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--ink);
}
.logo span { color: var(--violet); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.main-nav > a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
}
.main-nav > a:hover { color: var(--violet); }
.nav-cta {
  border: 1.5px solid var(--ink);
  padding: 0.5em 1.1em;
  border-radius: var(--radius);
  color: var(--ink) !important;
}
.nav-cta:hover { background: var(--ink); color: var(--paper) !important; }

/* ---------- nav dropdowns ---------- */
.nav-dropdown { position: relative; }
.nav-dropdown-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-dropdown-btn::after { content: ""; display: inline-block; margin-left: 5px; border: 4px solid transparent; border-top-color: var(--graphite); vertical-align: middle; }
.nav-dropdown-btn:hover, .nav-dropdown.open .nav-dropdown-btn { color: var(--violet); }
.nav-dropdown-panel {
  position: absolute;
  top: calc(100% + 14px);
  left: -12px;
  min-width: 200px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  display: none;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(20,33,61,0.08);
}
.nav-dropdown.open .nav-dropdown-panel { display: flex; }
.nav-dropdown-panel a {
  padding: 9px 10px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: var(--radius);
}
.nav-dropdown-panel a:hover { background: var(--violet-dim); color: var(--violet); }

@media (max-width: 860px) {
  .nav-dropdown-panel { position: static; border: none; box-shadow: none; padding: 0 0 0 12px; }
  .nav-dropdown-btn { width: 100%; text-align: left; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav-dropdown-btn::after { float: right; margin-top: 6px; }
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span { width: 24px; height: 2px; background: var(--ink); display: block; }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px 24px 20px;
    display: none;
  }
  .main-nav.open { display: flex; }
  .main-nav a { width: 100%; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav-cta { border: none !important; padding: 12px 0 !important; }
}

/* ---------- hero ---------- */
.hero { padding: 72px 0 88px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}
.hero-kicker {
  font-family: var(--font-data);
  font-size: 0.82rem;
  color: var(--violet);
  margin-bottom: 1em;
  letter-spacing: 0.01em;
}
.hero-sub { font-size: 1.05rem; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin: 1.6em 0 1.2em; }
.hero-note {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.08rem;
  font-weight: 500;
  color: var(--violet);
  margin-top: 0.35em;
}

.hero-exam-list { font-size: 0.88rem; color: var(--graphite); }
.hero-exam-list a { color: var(--ink-soft); text-decoration: none; }
.hero-exam-list a:hover { color: var(--violet); text-decoration: underline; }
.hero-exam-list span { margin: 0 8px; color: var(--line); }

.hero-visual { text-align: center; }
.visual-caption { font-size: 0.85rem; color: var(--graphite); margin-top: 0.9em; }

/* ---------- flashcard demo widget ---------- */
.flash-widget {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--paper);
  text-align: left;
}
.flash-widget-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.flash-widget-label { font-family: var(--font-data); font-size: 0.8rem; color: var(--violet); }
.flash-widget-count { font-family: var(--font-data); font-size: 0.8rem; color: var(--graphite); }

.flash-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  min-height: 148px;
  cursor: pointer;
  background: var(--paper-alt);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s ease;
}
.flash-card:hover, .flash-card:focus-visible { border-color: var(--violet); }
.flash-tag {
  font-family: var(--font-data);
  font-size: 0.78rem;
  color: var(--violet);
  margin: 0 0 0.8em;
}
.flash-face { font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); margin: 0; line-height: 1.4; }
.flash-hint { font-size: 0.78rem; color: var(--graphite); margin: 1em 0 0; text-align: right; }

.flash-controls { display: flex; gap: 10px; margin-top: 14px; }
.btn-small { padding: 0.5em 1em; font-size: 0.85rem; flex: 1; }

.flame-art { width: 100%; height: auto; }
.bench-line { stroke: var(--line); stroke-width: 2; }
.tube-glass { fill: none; stroke: var(--ink); stroke-width: 1.4; opacity: 0.35; }
.tube-liquid { opacity: 0.55; }

/* VIBGOYR — Violet, Indigo, Blue, Green, Orange, Yellow, Red (7 tubes) */
.liquid-1 { fill: #6D28D9; }   /* violet */
.liquid-2 { fill: #4338CA; }   /* indigo */
.liquid-3 { fill: #1D4ED8; }   /* blue */
.liquid-4 { fill: #15803D; }   /* green */
.liquid-5 { fill: #C2410C; }   /* orange */
.liquid-6 { fill: #A16207; }   /* yellow */
.liquid-7 { fill: #B91C1C; }   /* red */

.flame { transform-origin: 50% 100%; animation: flicker 2.6s ease-in-out infinite; animation-delay: var(--delay); }
.flame-1 { fill: #8B5CF6; }   /* violet */
.flame-2 { fill: #6366F1; }   /* indigo */
.flame-3 { fill: #3B82F6; }   /* blue */
.flame-4 { fill: #22C55E; }   /* green */
.flame-5 { fill: #F97316; }   /* orange */
.flame-6 { fill: #EAB308; }   /* yellow */
.flame-7 { fill: #EF4444; }   /* red */

@keyframes flicker {
  0%, 100% { transform: scaleY(1) translateY(0); opacity: 0.95; }
  50% { transform: scaleY(1.08) translateY(-3px); opacity: 1; }
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { order: -1; max-width: 420px; margin: 0 auto; }
}

/* ---------- tools section ---------- */
.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.tools-search-col .section-title { margin-bottom: 0.3em; }
.search-box {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  display: flex;
  align-items: center;
}
.search-box input {
  flex: 1;
  border: none;
  background: none;
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: 0.98rem;
  color: var(--ink);
}
.search-box input:focus { outline: none; }
.search-box:focus-within { border-color: var(--violet); }
.search-box kbd {
  font-family: var(--font-data);
  font-size: 0.78rem;
  color: var(--graphite);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 7px;
  margin-right: 14px;
}
.search-results {
  margin: 8px 0 0;
  list-style: none;
  padding: 6px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.search-results li { display: flex; justify-content: space-between; gap: 12px; }
.search-results a {
  flex: 1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  border-radius: var(--radius);
}
.search-results a:hover { background: var(--violet-dim); color: var(--violet); }
.search-results .result-tag { font-family: var(--font-data); font-size: 0.78rem; color: var(--graphite); }
.search-empty { padding: 10px 12px; font-size: 0.9rem; color: var(--graphite); }

@media (max-width: 860px) {
  .tools-grid { grid-template-columns: 1fr; }
}

/* ---------- sections ---------- */
.section { padding: 88px 0; }
.section-alt { background: var(--paper-alt); }

/* ---------- exam periodic grid ---------- */
.periodic-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}
.elem-tile {
  font-family: inherit;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

/* VIBGOYR tiles use the exact same hex as their matching hero flame
   (flame-1..7 above), in the same left-to-right order as the tiles:
   CBSE, NEET, JEE Main, JEE Advanced, A/AS Level, AP Chemistry, IB DP.
   Declared before :hover/.active below so hovering or selecting a tile
   still shows its violet highlight instead of getting stuck on the color. */
.elem-tile.v-violet { background: #8B5CF6; border-color: #8B5CF6; }
.elem-tile.v-indigo { background: #6366F1; border-color: #6366F1; }
.elem-tile.v-blue   { background: #3B82F6; border-color: #3B82F6; }
.elem-tile.v-green  { background: #22C55E; border-color: #22C55E; }
.elem-tile.v-orange { background: #F97316; border-color: #F97316; }
.elem-tile.v-yellow { background: #EAB308; border-color: #EAB308; }
.elem-tile.v-red    { background: #EF4444; border-color: #EF4444; }

/* Text on the saturated backgrounds above: white reads cleanly on the
   darker/cooler tiles; Yellow and Green are light enough that white
   text loses too much contrast, so those two keep dark ink text. */
.elem-tile.v-violet .elem-code,
.elem-tile.v-violet .elem-name,
.elem-tile.v-violet .elem-stat,
.elem-tile.v-indigo .elem-code,
.elem-tile.v-indigo .elem-name,
.elem-tile.v-indigo .elem-stat,
.elem-tile.v-blue .elem-code,
.elem-tile.v-blue .elem-name,
.elem-tile.v-blue .elem-stat,
.elem-tile.v-orange .elem-code,
.elem-tile.v-orange .elem-name,
.elem-tile.v-orange .elem-stat,
.elem-tile.v-red .elem-code,
.elem-tile.v-red .elem-name,
.elem-tile.v-red .elem-stat {
  color: #fff;
}
.elem-tile.v-violet .elem-tile-badge.is-live,
.elem-tile.v-indigo .elem-tile-badge.is-live,
.elem-tile.v-blue .elem-tile-badge.is-live,
.elem-tile.v-orange .elem-tile-badge.is-live,
.elem-tile.v-red .elem-tile-badge.is-live {
  color: #fff;
}
.elem-tile.v-violet .elem-tile-badge.is-soon,
.elem-tile.v-indigo .elem-tile-badge.is-soon,
.elem-tile.v-blue .elem-tile-badge.is-soon,
.elem-tile.v-orange .elem-tile-badge.is-soon,
.elem-tile.v-red .elem-tile-badge.is-soon {
  color: rgba(255, 255, 255, 0.75);
}

.elem-tile.v-yellow .elem-code,
.elem-tile.v-green .elem-code {
  color: var(--ink);
}
.elem-tile.v-yellow .elem-stat,
.elem-tile.v-green .elem-stat {
  color: var(--ink-soft);
}
.elem-tile.v-yellow .elem-tile-badge.is-soon,
.elem-tile.v-green .elem-tile-badge.is-soon {
  color: var(--ink-soft);
}

.elem-tile:hover { border-color: var(--ink); }
/* Selection state no longer repaints the tile (that used to wash out
   white text once tiles became fully-colored to match their flame) —
   it just adds a dark ring, so every tile's own color stays legible
   whether it's selected or not. */
.elem-tile.active { outline: 3px solid var(--ink); outline-offset: 2px; }
.elem-code {
  font-family: var(--font-data);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--violet);
}
.elem-name { font-weight: 600; font-size: 0.92rem; }
.elem-stat { font-size: 0.78rem; color: var(--graphite); }

@media (max-width: 860px) {
  .periodic-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .periodic-grid { grid-template-columns: repeat(2, 1fr); }
}

.exam-detail {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  background: var(--paper);
  min-height: 96px;
}
.exam-detail-placeholder { color: var(--graphite); margin: 0; }
.exam-detail h3 { margin-bottom: 0.35em; }
.exam-detail .exam-meta {
  font-family: var(--font-data);
  font-size: 0.82rem;
  color: var(--violet);
  margin-bottom: 0.9em;
}
.exam-detail ul { margin: 0 0 1.4em; padding-left: 1.1em; color: var(--ink-soft); }
.exam-detail li { margin-bottom: 0.4em; }
.btn-small-inline { padding: 0.7em 1.4em; font-size: 0.9rem; }

/* ---------- method ---------- */
.method-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 28px; max-width: 720px; }
.method-list li { display: flex; gap: 22px; align-items: flex-start; }
.method-num {
  font-family: var(--font-data);
  font-weight: 600;
  font-size: 1rem;
  color: var(--paper);
  background: var(--ink);
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.method-list h3 { margin-bottom: 0.25em; }
.method-list p { margin: 0; }

/* ---------- plans ---------- */
.plan-table {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.plan-col {
  padding: 32px 26px;
  border-left: 1.5px solid var(--line);
  display: flex;
  flex-direction: column;
}
.plan-col:first-child { border-left: none; }
.plan-col-featured { background: var(--violet); color: #fff; }
.plan-col-featured h3, .plan-col-featured .plan-price, .plan-col-featured .plan-for { color: #fff; }
.plan-tag {
  font-family: var(--font-data);
  font-size: 0.75rem;
  text-transform: none;
  color: #EADFF7;
  margin-bottom: 0.6em;
}
.plan-head { margin-bottom: 1.2em; }
.plan-price { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; margin: 0.2em 0; }
.plan-price span { font-family: var(--font-body); font-size: 0.9rem; font-weight: 400; color: var(--graphite); }
.plan-col-featured .plan-price span { color: #EADFF7; }
.plan-for { font-size: 0.9rem; margin: 0; }
.plan-features { list-style: none; margin: 0 0 1.6em; padding: 0; flex-grow: 1; }
.plan-features li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}
.plan-col-featured .plan-features li { border-top-color: rgba(255,255,255,0.25); }
.plan-col-featured .btn-primary { background: #fff; color: var(--violet); border-color: #fff; }
.plan-col-featured .btn-primary:hover { background: #EADFF7; border-color: #EADFF7; }
.plan-footnote { font-size: 0.85rem; color: var(--graphite); margin-top: 1.4em; }

@media (max-width: 860px) {
  .plan-table { grid-template-columns: 1fr; }
  .plan-col { border-left: none; border-top: 1.5px solid var(--line); }
  .plan-col:first-child { border-top: none; }
}

/* ---------- mentor ---------- */
.mentor-grid { display: grid; grid-template-columns: 260px 1fr; gap: 48px; align-items: start; }
.mentor-photo {
  aspect-ratio: 4 / 5;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--graphite);
  font-family: var(--font-data);
  font-size: 0.85rem;
  background: var(--paper);
}
.mentor-stats { list-style: none; margin: 1.6em 0 0; padding: 0; display: flex; gap: 32px; }
.mentor-stats li { display: flex; flex-direction: column; }
.mentor-stats strong { font-family: var(--font-display); font-size: 1.8rem; color: var(--violet); }
.mentor-stats span { font-size: 0.82rem; color: var(--graphite); }

@media (max-width: 700px) {
  .mentor-grid { grid-template-columns: 1fr; }
  .mentor-photo { max-width: 220px; }
}

/* ---------- reviews ---------- */
.review-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.review {
  margin: 0;
  padding: 24px;
  border-left: 3px solid var(--flame);
  background: var(--paper-alt);
}
.review p { font-style: italic; color: var(--ink-soft); margin-bottom: 0.9em; }
.review cite { font-style: normal; font-size: 0.85rem; color: var(--graphite); }

@media (max-width: 860px) { .review-grid { grid-template-columns: 1fr; } }

/* ---------- faq ---------- */
.faq-list { max-width: 720px; display: flex; flex-direction: column; gap: 8px; }
.faq-list details {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.faq-list summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 28px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+";
  position: absolute;
  right: 0; top: -2px;
  font-family: var(--font-data);
  font-size: 1.2rem;
  color: var(--violet);
}
.faq-list details[open] summary::after { content: "\2212"; }
.faq-list p { margin: 0.8em 0 0; }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 56px; align-items: start; }
.contact-alt { list-style: none; margin: 1.6em 0 0; padding: 0; }
.contact-alt li { margin-bottom: 0.6em; }
.contact-alt a { color: var(--violet); text-decoration: underline; }

.contact-form { display: flex; flex-direction: column; gap: 16px; }
.contact-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 500; color: var(--ink-soft); }
.contact-form input, .contact-form select, .contact-form textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7em 0.85em;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus {
  border-color: var(--violet);
}
.form-status { font-size: 0.9rem; color: var(--green); min-height: 1.2em; margin: 0; }
.form-note { font-size: 0.8rem; color: var(--graphite); margin: 0; }

@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; }
.footer-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-row p { margin: 0; font-size: 0.85rem; color: var(--graphite); }
.logo-footer { font-size: 1.05rem; }
.footer-links { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.footer-links a { font-size: 0.85rem; font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.footer-links a:hover { color: var(--violet); }
.footer-copy { flex-basis: 100%; }
.footer-legal { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.footer-legal p { margin: 0; max-width: none; font-size: 0.78rem; line-height: 1.6; color: var(--graphite); }
.footer-legal strong { color: var(--ink); }
.footer-legal a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.footer-legal a:hover { color: var(--violet); }

/* =========================================================
   Free Academic Actions Override (Non-Monetized)
   ========================================================= */
.guide-btn,
.open-guide-btn,
.show-key-btn,
.btn-show-key,
button[id*="showKey"],
button[id*="reveal"],
.open-chapter-guide {
  background-color: var(--violet, #6E3FA3) !important;
  border-color: var(--violet, #6E3FA3) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.guide-btn:hover,
.open-guide-btn:hover,
.show-key-btn:hover,
.btn-show-key:hover {
  background-color: #593186 !important;
  border-color: #593186 !important;
  color: #ffffff !important;
}
/* =========================================================
   LaTeX Display & Overflow Control
   ========================================================= */
mjx-container[jax="CHTML"][display="true"],
.katex-display {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  max-width: 100% !important;
  padding: 0.5rem 0 !important;
  margin: 0.75rem 0 !important;
  text-align: center;
}

.katex, mjx-container {
  white-space: normal;
  word-wrap: break-word;
}

/* ---------- product previews (Tools section) ---------- */
.pv-title { margin-top: 3rem; }
.pv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-top: 1.5rem;
}
.pv-card {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
}
.pv-card:hover { border-color: var(--violet); }
.pv-art { width: 100%; height: auto; margin-bottom: 12px; }
.pv-doc { fill: var(--paper-alt); stroke: var(--line); stroke-width: 2; }
.pv-doc-front { fill: var(--paper); stroke: var(--violet); }
.pv-line { stroke: var(--line); stroke-width: 3; stroke-linecap: round; }
.pv-line-strong { stroke: var(--ink); }
.pv-ring { fill: none; stroke: var(--violet); stroke-width: 2.5; }
.pv-bond { stroke: var(--violet); stroke-width: 2; opacity: 0.6; }
.pv-check-bg { fill: var(--violet); }
.pv-check-bg-muted { fill: var(--line); }
.pv-check { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pv-tag {
  font-family: var(--font-data);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--violet);
  margin: 0 0 4px;
}
.pv-card h3 { margin-bottom: 0.4em; }
.pv-blurb { font-size: 0.92rem; color: var(--graphite); flex-grow: 1; }
.pv-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; gap: 10px; flex-wrap: wrap; }
.pv-price { font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.pv-actions { display: flex; gap: 8px; }
.pv-actions .btn { padding: 0.55em 1em; font-size: 0.85rem; }

@media (max-width: 480px) {
  .pv-foot { flex-direction: column; align-items: flex-start; }
}
