/* ==========================================================================
   LeastCommonMultiple.com | Educational SaaS stylesheet
   Indigo + Amber, Instrument Serif + Inter, Bento grid, glow & orbs
   ========================================================================== */

/* ---------- Tokens (Light) ---------- */
:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-2: #F5F4EF;
  --primary: #4F46E5;
  --primary-deep: #3730A3;
  --primary-soft: rgba(79, 70, 229, 0.08);
  --accent: #F59E0B;
  --accent-deep: #B45309;
  --accent-soft: #FEF3C7;
  --text: #0F172A;
  --text-muted: #475569;
  --text-subtle: #64748B;
  --border: #E5E7EB;
  --border-strong: #CBD5E1;
  --success: #10B981;
  --error: #EF4444;
  --error-soft: #FEE2E2;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.15);
  --shadow-glow: 0 0 0 1px rgba(79, 70, 229, 0.12), 0 12px 40px -8px rgba(79, 70, 229, 0.25);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-2xl: 28px;

  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;

  --container: 1200px;
  --container-narrow: 760px;
}

/* ---------- Dark mode ---------- */
[data-theme="dark"] {
  --bg: #0B0B12;
  --surface: #15151F;
  --surface-2: #1B1B28;
  --primary: #818CF8;
  --primary-deep: #6366F1;
  --primary-soft: rgba(129, 140, 248, 0.12);
  --accent: #FBBF24;
  --accent-deep: #F59E0B;
  --accent-soft: rgba(251, 191, 36, 0.12);
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --text-subtle: #64748B;
  --border: #27272F;
  --border-strong: #3F3F4A;
  --error-soft: rgba(239, 68, 68, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px -15px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 0 1px rgba(129, 140, 248, 0.25), 0 12px 50px -8px rgba(129, 140, 248, 0.35);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-deep); }
ul, ol { padding-left: 1.25em; }
code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--primary-soft);
  color: var(--primary-deep);
  padding: 2px 6px;
  border-radius: 4px;
}
[data-theme="dark"] code { color: var(--primary); }

/* ---------- Typography ---------- */
.display {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--text);
}
.display em {
  font-style: italic;
  color: var(--primary);
}
h1.display, .hero .display { font-size: clamp(34px, 6.5vw, 76px); margin: 0 0 20px; }
h2.display { font-size: clamp(28px, 4.5vw, 52px); margin: 0 0 16px; }
h3 { font-family: var(--font-sans); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 8px; }
h4 { font-family: var(--font-sans); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 12px; color: var(--text); }
p { margin: 0 0 1em; color: var(--text-muted); }

.kicker {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin-bottom: 14px;
}
.kicker::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 1.5px;
  background: var(--primary);
  margin-right: 10px;
  border-radius: 2px;
}

.section-header {
  max-width: 720px;
  margin: 0 auto 40px;
  text-align: center;
}
.section-lede { font-size: 17px; color: var(--text-muted); margin: 0 auto; }

/* ---------- Accessibility ---------- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ---------- Layout ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}
.container.narrow { max-width: var(--container-narrow); }
@media (max-width: 480px) {
  .container { padding: 0 16px; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 247, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .site-header { background: rgba(11, 11, 18, 0.75); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 68px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.logo:hover { color: var(--text); }
.logo:hover .logo-mark { transform: rotate(-6deg) scale(1.05); }
.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, 0.5);
}
.logo-mark svg { width: 100%; height: 100%; }
.logo-text { font-size: 15px; }
.logo-dot { color: var(--text-subtle); font-weight: 500; }

.main-nav { display: none; gap: 32px; }
.main-nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
}
.main-nav a:hover { color: var(--text); }
@media (min-width: 880px) { .main-nav { display: flex; } }

.header-actions { display: flex; align-items: center; gap: 8px; }

.nav-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.nav-toggle:hover { border-color: var(--primary); background: var(--primary-soft); }
.nav-toggle svg { width: 20px; height: 20px; transition: transform 0.3s ease; }
.nav-toggle .bar-1, .nav-toggle .bar-2, .nav-toggle .bar-3 {
  transform-origin: center;
  transition: transform 0.3s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] .bar-1 { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar-2 { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bar-3 { transform: translateY(-5px) rotate(-45deg); }
@media (min-width: 880px) { .nav-toggle { display: none; } }

.mobile-nav {
  flex-direction: column;
  gap: 2px;
  padding: 12px 24px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  animation: slideDown 0.25s ease-out;
}
.mobile-nav:not([hidden]) { display: flex; }
.mobile-nav a {
  padding: 12px 10px;
  color: var(--text);
  font-weight: 500;
  font-size: 16px;
  border-radius: var(--radius-md);
  border-bottom: 1px solid var(--border);
}
.mobile-nav a:hover { background: var(--primary-soft); color: var(--primary); }
.mobile-nav a:last-child { border-bottom: 0; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (min-width: 880px) { .mobile-nav { display: none !important; } }

.theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.theme-toggle:hover { border-color: var(--primary); background: var(--primary-soft); }
.theme-toggle svg { width: 18px; height: 18px; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ---------- Top block (hero + result share a unified backdrop) ---------- */
.top-block {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
/* Subtle fade at the bottom so the seam between the top block and the next
   section (trust bar) is soft instead of hard-edged. */
.top-block::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 120px;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 100%);
  pointer-events: none;
  z-index: -1;
}

/* Site-wide subtle paper / noise texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/></svg>");
  opacity: 0.035;
  mix-blend-mode: multiply;
}
[data-theme="dark"] body::before {
  opacity: 0.08;
  mix-blend-mode: screen;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(56px, 8vw, 110px) 0 clamp(28px, 3vw, 40px);
  text-align: center;
  isolation: isolate;
}
.hero-orbs { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.orb {
  position: absolute;
  width: 580px;
  height: 580px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  animation: drift 18s ease-in-out infinite alternate;
}
.orb-indigo {
  top: -220px;
  left: -150px;
  background: radial-gradient(circle, #6366F1 0%, transparent 70%);
}
.orb-amber {
  bottom: -240px;
  right: -160px;
  background: radial-gradient(circle, #F59E0B 0%, transparent 70%);
  animation-delay: -8s;
}
[data-theme="dark"] .orb { opacity: 0.32; }
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.1); }
}

/* Floating math elements behind hero */
.floating-math {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
.fm {
  position: absolute;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-muted);
  opacity: 0.35;
  animation: float 6s ease-in-out infinite;
}
.fm-1 { top: 18%; left: 8%;  font-size: 42px; color: var(--primary); animation-delay: 0s; }
.fm-2 { top: 30%; right: 10%; font-size: 38px; color: var(--accent); animation-delay: -1.2s; }
.fm-3 { top: 58%; left: 5%;  font-size: 24px; color: var(--text-muted); animation-delay: -2.4s; }
.fm-4 { top: 12%; right: 18%; font-size: 18px; font-family: var(--font-mono); color: var(--text-muted); animation-delay: -3s; }
.fm-5 { top: 70%; right: 6%; font-size: 48px; color: var(--primary); animation-delay: -4s; }
.fm-tree {
  top: 55%; right: 4%;
  width: 70px; height: 70px;
  color: var(--primary);
  opacity: 0.35;
  animation: float 8s ease-in-out infinite;
  animation-delay: -1s;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

@media (max-width: 900px) {
  .fm-3, .fm-tree { display: none; }
}
@media (max-width: 640px) {
  .fm-1, .fm-4 { display: none; }
  .fm-2, .fm-5 { opacity: 0.2; }
}

.hero-inner { position: relative; z-index: 1; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.eyebrow .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.hero .lede {
  font-size: clamp(17px, 2vw, 20px);
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 48px;
}

/* ---------- Calculator card ---------- */
.calculator-card {
  max-width: 780px;
  margin: 0 auto;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: clamp(24px, 3vw, 36px);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  position: relative;
}
.calculator-card::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--angle, 0deg),
    rgba(79, 70, 229, 0.55) 0%,
    rgba(245, 158, 11, 0.55) 25%,
    rgba(79, 70, 229, 0.55) 50%,
    rgba(99, 102, 241, 0.2) 75%,
    rgba(245, 158, 11, 0.55) 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.75;
  animation: rotateGradient 10s linear infinite;
}
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes rotateGradient {
  to { --angle: 360deg; }
}
/* Fallback for browsers without @property (Firefox < 128, Safari < 16.4): soft pulse */
@supports not (background: conic-gradient(from 0deg, red, blue)) {
  .calculator-card::before {
    background: linear-gradient(135deg, rgba(79,70,229,0.5), transparent 45%, rgba(245,158,11,0.5));
    animation: none;
  }
}

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text);
}
.field-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-subtle);
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 6px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--text-subtle);
  pointer-events: none;
}
.text-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  padding: 16px 18px 16px 46px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  transition: all 0.15s;
}
.text-input::placeholder { color: var(--text-subtle); opacity: 0.9; }
.text-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.text-input.is-invalid {
  border-color: var(--error);
  background: var(--error-soft);
}

.field-hint { color: var(--text-subtle); font-size: 13px; margin: 8px 0 0; }
.field-error { color: var(--error); font-size: 13px; font-weight: 500; margin: 8px 0 0; }

/* Method selector */
.method-selector { border: 0; padding: 0; margin: 24px 0 0; }
.method-selector legend { padding: 0; margin-bottom: 10px; }
.method-options { display: flex; flex-wrap: wrap; gap: 8px; }
.method-pill { position: relative; cursor: pointer; }
.method-pill input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.method-pill span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s;
  white-space: nowrap;
}
@media (max-width: 420px) {
  .method-pill span { padding: 9px 12px; font-size: 12px; gap: 6px; }
  .method-pill span svg { width: 13px; height: 13px; }
}
.method-pill span svg { width: 15px; height: 15px; color: var(--text-muted); }
.method-pill:hover span {
  border-color: var(--primary);
  color: var(--primary);
}
.method-pill:hover span svg { color: var(--primary); }
.method-pill input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.method-pill input:checked + span svg { color: #fff; }
.method-pill input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Buttons */
.button-row {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
  align-items: center;
}
@media (max-width: 520px) {
  .button-row { gap: 8px; }
  .button-row .btn-primary { width: 100%; flex: none; }
  .button-row .btn-ghost { flex: 1; }
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s, border-color 0.15s, color 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  flex: 1 1 auto;
  min-width: 180px;
  box-shadow: 0 8px 20px -6px rgba(79, 70, 229, 0.45);
}
.btn-primary:hover {
  background: var(--primary-deep);
  box-shadow: 0 12px 28px -6px rgba(79, 70, 229, 0.55);
}
[data-theme="dark"] .btn-primary { color: #0B0B12; font-weight: 700; }
[data-theme="dark"] .btn-primary:hover { background: var(--primary-deep); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}
.btn.small { padding: 9px 16px; font-size: 13px; min-width: 0; }

.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-subtle);
  margin-left: auto;
  align-self: center;
}
.kbd-hint kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1;
}
@media (max-width: 520px) { .kbd-hint { display: none; } }

/* Scroll indicator */
.scroll-indicator {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 48px auto 0;
  color: var(--text-subtle);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s, color 0.2s;
}
.scroll-indicator:hover { opacity: 1; color: var(--primary); text-decoration: none; }
.scroll-indicator svg {
  width: 18px; height: 18px;
  animation: bounce 2.2s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* ---------- Result ---------- */
.result-section { padding: 0 0 clamp(48px, 6vw, 72px); }
.result-area { animation: fadeSlide 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.result-card {
  max-width: 780px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: clamp(24px, 3vw, 32px);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.result-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.result-badge {
  display: inline-block;
  padding: 5px 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: background 0.3s, color 0.3s;
}
[data-theme="dark"] .result-badge { color: var(--accent); }
.result-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.is-done { color: var(--success) !important; border-color: var(--success) !important; }

/* Empty-state preview (before first real calculation) */
.result-area.is-preview .result-card {
  background:
    repeating-linear-gradient(
      -45deg,
      transparent 0 14px,
      rgba(79, 70, 229, 0.025) 14px 28px
    ),
    var(--surface);
  border-style: dashed;
  border-color: var(--border-strong);
}
.result-area.is-preview .result-card::before {
  opacity: 0.4;
}
.result-area.is-preview .result-value {
  opacity: 0.5;
  filter: saturate(0.6);
}
.result-area.is-preview .result-caption,
.result-area.is-preview .steps-content {
  opacity: 0.75;
}
.result-area.is-preview .result-actions,
.result-area.is-preview .share-row {
  opacity: 0.45;
  pointer-events: none;
}
.result-area.is-preview .result-badge {
  background: var(--surface-2);
  color: var(--text-subtle);
}
[data-theme="dark"] .result-area.is-preview .result-badge { color: var(--text-muted); }

/* Share row */
.share-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0 0;
  padding: 14px 0 0;
  border-top: 1px dashed var(--border);
}
.share-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-right: 4px;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.share-btn svg { width: 14px; height: 14px; }
.share-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}
.share-btn[data-share="whatsapp"]:hover { border-color: #25D366; color: #25D366; background: rgba(37, 211, 102, 0.08); }
.share-btn[data-share="twitter"]:hover { border-color: var(--text); color: var(--text); background: var(--surface-2); }
.share-btn.is-done { border-color: var(--success); color: var(--success); background: rgba(16, 185, 129, 0.08); }
@media (max-width: 520px) {
  .share-btn span { display: none; }
  .share-btn { padding: 7px 9px; }
}

/* Factor tree visualization (inline SVG rendered by JS) */
.factor-tree-box {
  margin: 14px 0 18px;
  padding: 18px 12px;
  background: linear-gradient(135deg, var(--primary-soft), transparent);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}
.factor-tree-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 8px;
  text-align: center;
}
.factor-tree-grid {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.factor-tree {
  width: 180px;
  max-width: 100%;
  height: auto;
  display: block;
}
.factor-tree .ft-root { font-family: var(--font-serif); font-size: 20px; font-weight: 700; fill: var(--text); }
.factor-tree .ft-branch { stroke: var(--primary); stroke-width: 1.5; opacity: 0.55; }
.factor-tree .ft-inner { fill: var(--primary); opacity: 0.85; }
.factor-tree .ft-inner-text { fill: #fff; font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.factor-tree .ft-prime { fill: var(--accent); }
.factor-tree .ft-prime-text { fill: #fff; font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
[data-theme="dark"] .factor-tree .ft-prime-text,
[data-theme="dark"] .factor-tree .ft-inner-text { fill: #0B0B12; }
.factor-tree .ft-node { transform-origin: center; animation: ftPop 0.35s ease-out backwards; }
@keyframes ftPop {
  0%   { opacity: 0; transform: scale(0.4); }
  70%  { opacity: 1; transform: scale(1.08); }
  100% { transform: scale(1); }
}

.result-value-wrap { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.result-prefix {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-muted);
  font-size: clamp(22px, 3vw, 30px);
}
.result-value {
  font-family: var(--font-mono);
  font-size: clamp(44px, 8vw, 72px);
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  word-break: break-all;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.result-caption {
  color: var(--text-muted);
  margin: 14px 0 20px;
  font-size: 15px;
}

.steps-wrapper {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.steps-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
@media (max-width: 520px) {
  .method-switch { width: 100%; justify-content: space-between; }
  .method-switch .ms-btn { flex: 1; text-align: center; padding: 7px 6px; font-size: 11px; }
}
.steps-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  font-weight: 700;
  margin: 0;
}

.method-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ms-btn {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.18s;
}
.ms-btn:hover { color: var(--text); }
.ms-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.all-methods-group { margin-top: 24px; padding-top: 20px; border-top: 1px dashed var(--border); }
.all-methods-group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.all-methods-group > h4 {
  color: var(--primary);
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.all-methods-group > h4::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.steps-content { font-size: 15px; line-height: 1.7; }
.steps-content ol, .steps-content ul { margin: 0; padding-left: 1.3em; }
.steps-content li { margin-bottom: 12px; color: var(--text); }
.steps-content p { margin: 0 0 14px; color: var(--text); }
.steps-content .math {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.95em;
}

.prime-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 7px;
  margin: 2px;
  font-size: 14px;
  transition: transform 0.15s;
}
.prime-pill sup { font-size: 0.7em; }
.prime-pill:hover { transform: translateY(-2px); }
.prime-2 { background: #DBEAFE; color: #1E40AF; }
.prime-3 { background: #DCFCE7; color: #166534; }
.prime-5 { background: #FEF3C7; color: #92400E; }
.prime-7 { background: #FCE7F3; color: #9D174D; }
.prime-other { background: #E0E7FF; color: #3730A3; }
[data-theme="dark"] .prime-2 { background: #1E3A8A; color: #DBEAFE; }
[data-theme="dark"] .prime-3 { background: #14532D; color: #DCFCE7; }
[data-theme="dark"] .prime-5 { background: #78350F; color: #FEF3C7; }
[data-theme="dark"] .prime-7 { background: #831843; color: #FCE7F3; }
[data-theme="dark"] .prime-other { background: #312E81; color: #E0E7FF; }

/* ---------- Trust bar ---------- */
.trust-bar {
  padding: 22px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.trust-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}
@media (max-width: 520px) {
  .trust-inner { gap: 10px 16px; font-size: 13px; }
}
.trust-item { display: inline-flex; align-items: center; gap: 8px; }
.trust-item.muted { color: var(--text-subtle); }
.trust-item strong { color: var(--text); font-weight: 700; }
.trust-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}
.stars { display: inline-flex; gap: 1px; color: var(--accent); }
.stars svg { width: 16px; height: 16px; }
.stars.small svg { width: 13px; height: 13px; }
@media (max-width: 640px) { .trust-divider { display: none; } }

/* ---------- Content sections ---------- */
.content-section { padding: clamp(64px, 8vw, 96px) 0; }

/* Split screen */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: center;
}
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1.1fr; gap: 72px; }
}
.split-visual {
  position: relative;
  display: grid;
  place-items: center;
  padding: 30px;
}
.concept-svg { width: 100%; max-width: 440px; height: auto; }
[data-theme="dark"] .concept-svg text { fill: var(--text); }
[data-theme="dark"] .concept-svg text[fill="#4F46E5"] { fill: var(--primary); }
[data-theme="dark"] .concept-svg text[fill="#F59E0B"] { fill: var(--accent); }

.usecases { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; }
.usecases li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s, transform 0.15s;
}
.usecases li:hover { border-color: var(--primary); transform: translateX(2px); }
.uc-icon {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}
.uc-icon svg { width: 18px; height: 18px; }

/* ---------- Methods grid (3 equal cards) ---------- */
.methods-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .methods-grid { grid-template-columns: repeat(3, 1fr); gap: 22px; }
}

.method-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 26px 24px;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 0.2s,
              box-shadow 0.25s;
}
.method-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, var(--primary-soft) 0%, transparent 55%);
  opacity: 0.6;
  z-index: -1;
  transition: opacity 0.3s;
}
.method-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}
.method-card:hover::before { opacity: 1; }

/* Featured (middle) card sits slightly taller with a gradient edge */
.method-card.is-featured {
  background:
    linear-gradient(180deg, rgba(79, 70, 229, 0.04), transparent 50%),
    var(--surface);
  border-color: rgba(79, 70, 229, 0.3);
}
@media (min-width: 1024px) {
  .method-card.is-featured {
    transform: translateY(-8px);
    box-shadow: 0 18px 50px -16px rgba(79, 70, 229, 0.28);
  }
  .method-card.is-featured:hover { transform: translateY(-12px); }
}
[data-theme="dark"] .method-card.is-featured {
  border-color: rgba(129, 140, 248, 0.35);
}

/* Large serif watermark number */
.method-watermark {
  position: absolute;
  top: 10px;
  right: 18px;
  font-family: var(--font-serif);
  font-size: clamp(60px, 8vw, 84px);
  font-style: italic;
  line-height: 1;
  color: var(--primary);
  opacity: 0.08;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 0;
}
.method-card:hover .method-watermark {
  opacity: 0.18;
  transform: translateY(-2px) rotate(-2deg);
}
.method-card.is-featured .method-watermark { color: var(--accent); opacity: 0.12; }
.method-card.is-featured:hover .method-watermark { opacity: 0.22; }

/* "Recommended" badge on featured card */
.method-badge {
  position: absolute;
  top: 18px;
  left: 22px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border-radius: 999px;
  box-shadow: 0 6px 14px -4px rgba(79, 70, 229, 0.45);
  z-index: 2;
}
[data-theme="dark"] .method-badge { color: #0B0B12; background: linear-gradient(135deg, var(--accent), #FBBF24); box-shadow: 0 6px 14px -4px rgba(251, 191, 36, 0.45); }

/* Visual zone */
.method-visual {
  margin: 16px -10px 22px;
  padding: 14px 10px;
  min-height: clamp(150px, 18vw, 180px);
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 100%, var(--primary-soft) 0%, transparent 65%),
    linear-gradient(135deg, var(--surface-2) 0%, transparent 100%);
  color: var(--text);
  position: relative;
  overflow: hidden;
}
.method-visual::before {
  /* subtle grid pattern */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(79, 70, 229, 0.08) 1px, transparent 1px);
  background-size: 14px 14px;
  opacity: 0.5;
  pointer-events: none;
}
.method-visual svg {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
}
.method-card:hover .method-visual svg { animation: visualPulse 0.6s ease-out; }
@keyframes visualPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}
/* match nodes pulse continuously on Method 01 */
.method-card .match-node { transform-origin: center; animation: matchPulse 2.4s ease-in-out infinite; }
@keyframes matchPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* Body */
.method-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}
.method-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.meta-pill.meta-easy,
.meta-pill.meta-visual,
.meta-pill.meta-teach {
  background: var(--primary-soft);
  color: var(--primary-deep);
  border-color: transparent;
}
[data-theme="dark"] .meta-pill.meta-easy,
[data-theme="dark"] .meta-pill.meta-visual,
[data-theme="dark"] .meta-pill.meta-teach { color: var(--primary); }
.meta-pill.meta-fast,
.meta-pill.meta-teach {
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-color: transparent;
}
[data-theme="dark"] .meta-pill.meta-fast,
[data-theme="dark"] .meta-pill.meta-teach { color: var(--accent); }

.method-body h3 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 2.4vw, 28px);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  color: var(--text);
}
.method-body p {
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 20px;
  color: var(--text-muted);
}
.method-body p code {
  font-size: 0.88em;
  padding: 1px 5px;
}

/* CTA button */
.method-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  margin-top: auto;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  z-index: 1;
}
.method-cta svg {
  width: 14px; height: 14px;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.method-cta:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -6px rgba(79, 70, 229, 0.4);
}
.method-cta:hover svg { transform: translateX(4px); }
[data-theme="dark"] .method-cta:hover { color: #0B0B12; }

.method-card.is-featured .method-cta {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, 0.5);
}
.method-card.is-featured .method-cta:hover {
  background: var(--primary-deep);
  border-color: var(--primary-deep);
}
[data-theme="dark"] .method-card.is-featured .method-cta { color: #0B0B12; font-weight: 700; }


/* ---------- Media grid (real-world) ---------- */
.media-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 620px) { .media-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .media-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 620px) and (max-width: 959px) {
  .media-grid .media-card:nth-child(3) { grid-column: 1 / -1; max-width: 640px; justify-self: center; width: 100%; }
}

.media-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}
.media-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.media-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-2);
}
.media-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.media-card:hover .media-image img { transform: scale(1.05); }
.media-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(15, 23, 42, 0.45) 100%);
}
.media-body { padding: 22px; }
.media-body h3 { font-size: 19px; margin-bottom: 6px; }
.media-body p { font-size: 14px; margin-bottom: 16px; }
.media-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.answer-pill {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
}
[data-theme="dark"] .answer-pill { color: var(--accent); }
.chip {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ---------- How it works (steps row) ---------- */
.steps-row {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  counter-reset: step;
}
@media (min-width: 820px) {
  .steps-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
  }
}
.step { position: relative; padding-top: 12px; }
.step-num {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 56px;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 12px;
  opacity: 0.9;
}
.step h3 { font-size: 19px; margin-bottom: 6px; }
.step p { font-size: 15px; margin: 0; }
@media (min-width: 820px) {
  .step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 30px;
    left: calc(100% - 16px);
    width: 48px;
    height: 2px;
    background-image: radial-gradient(circle, var(--border-strong) 1.5px, transparent 1.5px);
    background-size: 8px 2px;
    background-repeat: repeat-x;
  }
}

/* ---------- Testimonials ---------- */
.testimonials-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 620px) { .testimonials-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .testimonials-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 620px) and (max-width: 959px) {
  .testimonials-grid .testimonial:nth-child(3) { grid-column: 1 / -1; max-width: 640px; justify-self: center; width: 100%; }
}
.testimonial {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 26px;
  margin: 0;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.testimonial:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.testimonial .stars { margin-bottom: 14px; }
.testimonial blockquote {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.4;
  margin: 0 0 20px;
  color: var(--text);
}
.testimonial blockquote em { color: var(--primary); }
.testimonial figcaption {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.testimonial figcaption strong { display: block; font-size: 14px; color: var(--text); }
.testimonial figcaption span { font-size: 13px; color: var(--text-subtle); }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: 10px; margin-top: 10px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 22px;
  transition: border-color 0.15s, background 0.2s;
}
.faq-item:hover { border-color: var(--border-strong); }
.faq-item[open] { border-color: var(--primary); background: var(--primary-soft); }
.faq-item summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: 16px;
  padding: 18px 0;
  padding-right: 44px;
  position: relative;
  color: var(--text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 50%;
  width: 14px;
  height: 14px;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
  color: var(--text-subtle);
  transform: translateY(-50%) rotate(0deg);
  transition: transform 0.25s, color 0.2s;
}
.faq-item[open] summary::after {
  transform: translateY(-50%) rotate(45deg);
  color: var(--primary);
}
.faq-item p { padding: 0 0 18px; margin: 0; color: var(--text-muted); font-size: 15px; }

/* ---------- Related grid ---------- */
.related-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .related-grid { grid-template-columns: repeat(4, 1fr); } }
.related-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  color: var(--text);
  transition: transform 0.2s, border-color 0.15s, box-shadow 0.2s;
  text-decoration: none;
}
.related-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.related-icon {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 14px;
}
.related-icon svg { width: 20px; height: 20px; }
.related-card h3 { font-size: 17px; margin-bottom: 4px; }
.related-card p { color: var(--text-muted); font-size: 14px; margin: 0; }

/* ---------- CTA Banner ---------- */
.cta-banner {
  margin: 0;
  background: linear-gradient(120deg, #FDE68A 0%, #FBBF24 50%, #F59E0B 100%);
  border-radius: 0;
  padding: clamp(56px, 7vw, 84px) 0;
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .cta-banner {
  background: linear-gradient(120deg, #3730A3 0%, #4F46E5 50%, #6366F1 100%);
}
.cta-banner::before, .cta-banner::after {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
}
.cta-banner::before {
  background: rgba(255, 255, 255, 0.5);
  top: -200px; left: -100px;
}
.cta-banner::after {
  background: rgba(79, 70, 229, 0.3);
  bottom: -200px; right: -100px;
}
[data-theme="dark"] .cta-banner::before { background: rgba(129, 140, 248, 0.5); }
[data-theme="dark"] .cta-banner::after { background: rgba(251, 191, 36, 0.3); }
.cta-inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}
@media (min-width: 820px) {
  .cta-inner { flex-direction: row; align-items: center; gap: 32px; }
}
.cta-inner .btn-primary { min-width: 0; }
.cta-inner h2 { color: #1A1509; font-size: clamp(28px, 3.5vw, 40px); margin: 0 0 6px; }
[data-theme="dark"] .cta-inner h2 { color: #F1F5F9; }
.cta-inner h2 em { color: #7C2D12; font-style: italic; }
[data-theme="dark"] .cta-inner h2 em { color: #FBBF24; }
.cta-inner p { color: rgba(26, 21, 9, 0.75); margin: 0; font-size: 16px; }
[data-theme="dark"] .cta-inner p { color: rgba(241, 245, 249, 0.85); }
.cta-inner .btn-primary {
  background: #1A1509;
  color: #FBBF24;
  box-shadow: 0 12px 30px -8px rgba(26, 21, 9, 0.4);
}
.cta-inner .btn-primary:hover { background: #0F172A; }
[data-theme="dark"] .cta-inner .btn-primary { background: #FBBF24; color: #0B0B12; }
[data-theme="dark"] .cta-inner .btn-primary:hover { background: #F59E0B; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 56px 0 28px;
}
.footer-grid {
  display: grid;
  gap: 36px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) {
  .footer-grid {
    grid-template-columns: 1.4fr repeat(3, 1fr);
  }
}
.footer-brand .logo { margin-bottom: 14px; }
.footer-tagline { color: var(--text-muted); font-size: 14px; max-width: 320px; margin: 0; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col a {
  color: var(--text-muted);
  font-size: 14px;
  transition: color 0.15s;
}
.footer-col a:hover { color: var(--primary); }
.footer-col .muted { color: var(--text-subtle); font-size: 13px; margin: 0 0 6px; }

/* Contact email link in footer */
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  width: fit-content;
  max-width: 100%;
  word-break: break-all;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s;
}
.contact-link:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateY(-1px);
}
.contact-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}
.contact-icon svg { width: 15px; height: 15px; }

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: 13px;
}
@media (min-width: 640px) { .footer-bottom { flex-direction: row; } }
.footer-bottom p { margin: 0; color: inherit; }
.footer-legal { display: flex; gap: 20px; }
.footer-legal a { color: var(--text-subtle); font-size: 13px; }
.footer-legal a:hover { color: var(--primary); }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: opacity, transform;
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- Print styles ---------- */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #f5f5f5;
    --text: #000; --text-muted: #222; --text-subtle: #444;
    --border: #ccc; --border-strong: #999;
    --primary: #1a1a4a; --primary-deep: #1a1a4a; --primary-soft: #eee;
    --accent: #7a4500; --accent-deep: #7a4500; --accent-soft: #fff4d9;
    --shadow-sm: none; --shadow-md: none; --shadow-lg: none; --shadow-glow: none;
  }
  html, body { background: #fff !important; color: #000 !important; }
  .site-header, .site-footer, .cta-banner, .trust-bar,
  .testimonials-section, .related-section, .howto-section,
  .faq-section, .methods-section, .why-section, .examples-media,
  .hero-orbs, .floating-math, .scroll-indicator, .kbd-hint,
  .nav-toggle, .theme-toggle, .main-nav, .mobile-nav,
  .method-switch, .share-row, .result-header .icon-btn,
  .button-row, .method-selector, .field-hint, .field-tag,
  .eyebrow { display: none !important; }

  .hero { padding: 0 !important; min-height: auto !important; }
  .hero .display, .hero .lede { display: none !important; }
  .calculator-card, .result-card {
    box-shadow: none !important;
    border: 1px solid #999 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .calculator-card::before, .result-card::before { display: none !important; }
  .content-section, .result-section { padding: 12pt 0 !important; }
  .container { max-width: 100% !important; padding: 0 !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  a { color: #000 !important; text-decoration: underline; }
  .result-value {
    -webkit-text-fill-color: #1a1a4a !important;
    background: none !important;
    color: #1a1a4a !important;
    font-size: 48pt !important;
  }
  .prime-pill { border: 1px solid #999; background: #fff !important; color: #000 !important; }
  .steps-content { font-size: 11pt !important; }
  /* Add print title */
  body::before {
    content: "LCM Calculator | leastcommonmultiple.com";
    display: block;
    font-family: var(--font-serif);
    font-size: 18pt;
    padding: 12pt 0;
    border-bottom: 2px solid #000;
    margin-bottom: 18pt;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
