/* ============================================================
   LCM Calculator — 2026 Premium Design System
   Author: Web Calculator Build Specialist
   Vanilla CSS · Responsive · Dark-mode-first · A11y-focused
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand */
  --brand-50:  #eef4ff;
  --brand-100: #d9e6ff;
  --brand-200: #bcd3ff;
  --brand-300: #8eb6ff;
  --brand-400: #598fff;
  --brand-500: #356bf2;
  --brand-600: #234fd6;
  --brand-700: #1d3fad;
  --brand-800: #1d388a;
  --brand-900: #1d336e;
  --accent:    #12c8a6;
  --accent-2:  #ff7a59;
  --warn:      #f59e0b;
  --danger:    #ef4444;

  /* Light surfaces */
  --bg:         #f6f8fc;
  --bg-soft:    #eef2f9;
  --surface:    #ffffff;
  --surface-2:  #f9fbff;
  --border:     #e4e9f2;
  --text:       #0f1729;
  --text-soft:  #475069;
  --text-mute:  #7c869e;
  --shadow-sm:  0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.05);
  --shadow-md:  0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.04);
  --shadow-lg:  0 18px 48px rgba(16,24,40,.14), 0 4px 12px rgba(16,24,40,.06);
  --glass:      rgba(255,255,255,.72);
  --glass-brd:  rgba(255,255,255,.55);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius:    18px;
  --radius-lg: 26px;
  --maxw:      1180px;
  --gap:       clamp(1rem, 2.5vw, 2rem);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg:         #070b16;
  --bg-soft:    #0b1120;
  --surface:    #0e1626;
  --surface-2:  #121d31;
  --border:     #1e2a44;
  --text:       #eaf0ff;
  --text-soft:  #aab6d4;
  --text-mute:  #6c7894;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.4);
  --shadow-md:  0 6px 18px rgba(0,0,0,.45);
  --shadow-lg:  0 24px 60px rgba(0,0,0,.55);
  --glass:      rgba(14,22,38,.62);
  --glass-brd:  rgba(120,150,220,.16);
  --brand-50:   #0f1c3d;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .4s ease, color .4s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-500); text-decoration: none; transition: color .2s; }
a:hover { color: var(--brand-600); }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
:focus-visible { outline: 3px solid var(--brand-400); outline-offset: 2px; border-radius: 6px; }

/* ---------- Ambient background ---------- */
.aurora {
  position: fixed; inset: 0; z-index: -2; pointer-events: none; overflow: hidden;
}
.aurora::before, .aurora::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: .5; animation: drift 22s ease-in-out infinite alternate;
}
.aurora::before { width: 46vw; height: 46vw; left: -10vw; top: -8vw; background: radial-gradient(circle, var(--brand-400), transparent 70%); }
.aurora::after  { width: 40vw; height: 40vw; right: -8vw; top: 30vh; background: radial-gradient(circle, var(--accent), transparent 70%); animation-delay: -6s; }
html[data-theme="dark"] .aurora::before { opacity: .35; }
html[data-theme="dark"] .aurora::after  { opacity: .28; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(40px,30px) scale(1.12); } }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.section { padding-block: clamp(3rem, 7vw, 6rem); }
.section-sm { padding-block: clamp(2rem, 4vw, 3rem); }
.center { text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; font-size: .78rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--brand-500);
  background: var(--brand-50); border: 1px solid var(--border);
  padding: .4rem .85rem; border-radius: 999px;
}
h1,h2,h3,h4 { line-height: 1.15; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2.4vw, 1.5rem); }
.lead { font-size: clamp(1.02rem, 1.6vw, 1.22rem); color: var(--text-soft); max-width: 62ch; }
.muted { color: var(--text-mute); }
.mx-auto { margin-inline: auto; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  background: var(--glass);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .3s, background .4s;
}
.site-header.scrolled { box-shadow: var(--shadow-md); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 68px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.12rem; color: var(--text); letter-spacing: -.02em; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-500), var(--accent));
  color: #fff; font-weight: 800; box-shadow: var(--shadow-sm); font-size: .95rem;
}
.nav-links { display: flex; align-items: center; gap: .35rem; }
.nav-links a {
  color: var(--text-soft); font-weight: 600; font-size: .94rem; padding: .5rem .8rem; border-radius: 10px;
  position: relative; transition: color .2s, background .2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: var(--bg-soft); }
.nav-actions { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft);
  transition: transform .2s, box-shadow .2s, color .2s;
}
.icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--brand-500); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: block; }
.menu-btn { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  font-weight: 700; font-size: .98rem; padding: .85rem 1.5rem; border-radius: 14px;
  transition: transform .18s cubic-bezier(.2,.8,.3,1), box-shadow .25s, filter .2s; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, var(--brand-500), var(--brand-600)); color: #fff; box-shadow: 0 8px 22px rgba(53,107,242,.35); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(53,107,242,.45); color:#fff; }
.btn-primary:active { transform: translateY(-1px) scale(.99); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); color: var(--text); }
.btn-accent { background: linear-gradient(135deg, var(--accent), #0fb39a); color:#04231e; }
.btn-accent:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(18,200,166,.4); }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: transform .25s, box-shadow .25s, border-color .25s;
}
.card-pad { padding: clamp(1.3rem, 2.5vw, 2rem); }
.card-hover:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--brand-300); }

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: clamp(2.5rem, 6vw, 4.5rem); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.hero h1 { margin: 1rem 0 .9rem; }
.hero h1 .grad { background: linear-gradient(120deg, var(--brand-500), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.trust-row { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: 1.8rem; }
.trust-row .ti { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--text-soft); font-weight: 600; }
.trust-row svg { width: 18px; height: 18px; color: var(--accent); }

/* ---------- Calculator ---------- */
.calc-card { position: relative; overflow: hidden; border-radius: var(--radius-lg); }
.calc-card::before {
  content: ""; position: absolute; inset: 0; padding: 1px; border-radius: inherit;
  background: linear-gradient(135deg, var(--brand-400), var(--accent), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: .6; pointer-events: none;
}
.calc-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.calc-head h2 { font-size: 1.35rem; }
.field-label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .5rem; color: var(--text); }
.field-hint { font-size: .82rem; color: var(--text-mute); margin-top: .4rem; }
.num-input {
  width: 100%; font-size: 1.08rem; font-family: var(--mono); padding: .95rem 1.05rem;
  border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.num-input::placeholder { color: var(--text-mute); font-family: var(--font); }
.num-input:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 4px rgba(53,107,242,.15); background: var(--surface); }
.num-input.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(239,68,68,.14); animation: shake .35s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.chip {
  font-size: .82rem; font-weight: 600; padding: .4rem .8rem; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-soft);
  transition: transform .15s, background .2s, color .2s, border-color .2s;
}
.chip:hover { transform: translateY(-2px); color: var(--brand-500); border-color: var(--brand-300); background: var(--brand-50); }

.method-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-top: .4rem; }
.method-opt { position: relative; }
.method-opt input { position: absolute; opacity: 0; pointer-events: none; }
.method-opt label {
  display: flex; flex-direction: column; gap: .15rem; padding: .7rem .85rem; border-radius: 13px;
  border: 1.5px solid var(--border); background: var(--surface-2); cursor: pointer;
  font-weight: 700; font-size: .9rem; transition: all .2s; height: 100%;
}
.method-opt label small { font-weight: 500; font-size: .76rem; color: var(--text-mute); }
.method-opt input:checked + label { border-color: var(--brand-400); background: var(--brand-50); color: var(--brand-600); box-shadow: 0 0 0 3px rgba(53,107,242,.12); }
.method-opt input:focus-visible + label { outline: 3px solid var(--brand-400); outline-offset: 2px; }

.calc-actions { display: flex; gap: .7rem; margin-top: 1.3rem; flex-wrap: wrap; }
.calc-actions .btn { flex: 1; min-width: 130px; }

/* ---------- Result panel ---------- */
.result { margin-top: 1.4rem; }
.result-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.4rem 1.6rem; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  color: #fff; box-shadow: 0 14px 36px rgba(53,107,242,.35); position: relative; overflow: hidden;
}
.result-hero::after { content:""; position:absolute; right:-30px; top:-30px; width:160px; height:160px; border-radius:50%; background: rgba(255,255,255,.12); }
.result-hero .label { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; opacity: .9; font-weight: 700; }
.result-hero .value { font-family: var(--mono); font-size: clamp(2rem, 6vw, 3rem); font-weight: 800; line-height: 1; margin-top: .25rem; word-break: break-all; }
.result-hero .copy-btn { background: rgba(255,255,255,.18); color:#fff; border:1px solid rgba(255,255,255,.3); padding:.6rem .9rem; border-radius:12px; font-weight:700; font-size:.85rem; display:inline-flex; gap:.4rem; align-items:center; transition: background .2s, transform .2s; z-index:1; }
.result-hero .copy-btn:hover { background: rgba(255,255,255,.3); transform: translateY(-2px); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: .7rem; margin-top: .9rem; }
.stat {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: .9rem 1rem;
}
.stat .k { font-size: .78rem; color: var(--text-mute); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-family: var(--mono); font-size: 1.15rem; font-weight: 800; margin-top: .2rem; word-break: break-all; }

.steps { margin-top: 1.2rem; }
.steps h3 { font-size: 1.05rem; margin-bottom: .7rem; display: flex; align-items: center; gap: .5rem; }
.step {
  border-left: 3px solid var(--brand-300); padding: .65rem 0 .65rem 1rem; margin-left: .3rem;
  position: relative; animation: fadeUp .5s both;
}
.step strong { color: var(--brand-500); }
.work-code {
  font-family: var(--mono); background: var(--surface-2); border:1px solid var(--border); border-radius: 12px;
  padding: .9rem 1rem; margin-top: .6rem; overflow-x: auto; font-size: .92rem; line-height: 1.8;
}
.factor-pill { display:inline-block; font-family: var(--mono); font-weight:700; padding:.12rem .5rem; border-radius:7px; margin:.12rem; }

/* table for prime factorization */
.pf-table { width:100%; border-collapse: collapse; margin-top:.6rem; font-family: var(--mono); font-size:.92rem; }
.pf-table th, .pf-table td { border:1px solid var(--border); padding:.5rem .7rem; text-align:center; }
.pf-table th { background: var(--bg-soft); }
.table-wrapper { overflow-x: auto; }

/* ---------- Bento features ---------- */
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.bento .b1 { grid-column: span 2; }
.feature { display: flex; flex-direction: column; gap: .6rem; }
.feature .fi {
  width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-500); border: 1px solid var(--border);
}
.feature .fi svg { width: 24px; height: 24px; }
.feature h3 { font-size: 1.15rem; }
.feature p { color: var(--text-soft); font-size: .96rem; }

/* ---------- Steps / how it works ---------- */
.steps-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--gap); counter-reset: s; }
.how-step { position: relative; }
.how-step .num {
  width: 44px; height: 44px; border-radius: 12px; display:grid; place-items:center; font-weight:800;
  background: linear-gradient(135deg,var(--brand-500),var(--accent)); color:#fff; margin-bottom:.8rem;
}

/* ---------- Examples table ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th, .data-table td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--bg-soft); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-soft); }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: var(--bg-soft); }
.data-table .mono { font-family: var(--mono); font-weight: 700; color: var(--brand-500); }

/* ---------- FAQ accordion ---------- */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: .8rem; overflow: hidden; transition: box-shadow .2s, border-color .2s; }
.faq-item[open] { box-shadow: var(--shadow-md); border-color: var(--brand-300); }
.faq-item summary { list-style: none; cursor: pointer; padding: 1.1rem 1.3rem; font-weight: 700; font-size: 1.02rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .ic { transition: transform .3s; flex-shrink: 0; color: var(--brand-500); }
.faq-item[open] summary .ic { transform: rotate(45deg); }
.faq-body { padding: 0 1.3rem 1.2rem; color: var(--text-soft); }
.faq-body p { margin-bottom: .6rem; }

/* ---------- CTA band ---------- */
.cta-band { border-radius: var(--radius-lg); padding: clamp(2rem,5vw,3.5rem); text-align: center; color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500) 55%, var(--accent)); box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,.9); max-width: 56ch; margin: .8rem auto 1.6rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding-block: clamp(2.5rem,5vw,3.5rem) 1.5rem; margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--gap); }
.footer-grid h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-mute); margin-bottom: 1rem; }
.footer-grid ul li { margin-bottom: .55rem; }
.footer-grid ul a { color: var(--text-soft); font-size: .94rem; }
.footer-grid ul a:hover { color: var(--brand-500); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 2.2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); color: var(--text-mute); font-size: .88rem; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: .86rem; color: var(--text-mute); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding-block: 1rem; }
.breadcrumb a { color: var(--text-soft); font-weight: 600; }
.breadcrumb span { opacity: .6; }

/* ---------- Prose (content pages) ---------- */
.prose { max-width: 75ch; }
.prose h2 { margin: 2rem 0 .8rem; }
.prose h3 { margin: 1.5rem 0 .6rem; }
.prose p { margin-bottom: 1rem; color: var(--text-soft); }
.prose ul { margin: 0 0 1rem 1.2rem; list-style: disc; color: var(--text-soft); }
.prose ul li { margin-bottom: .45rem; }
.prose strong { color: var(--text); }
.prose blockquote { border-left: 4px solid var(--brand-400); padding: .6rem 1.1rem; background: var(--bg-soft); border-radius: 0 12px 12px 0; margin: 1rem 0; color: var(--text-soft); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--text); color: var(--bg); padding: .8rem 1.3rem; border-radius: 12px; font-weight: 700;
  box-shadow: var(--shadow-lg); z-index: 100; transition: transform .35s cubic-bezier(.2,.9,.3,1); font-size:.92rem;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.2,.7,.3,1), transform .7s cubic-bezier(.2,.7,.3,1); }
.reveal.in { opacity: 1; transform: none; }
@keyframes fadeUp { from { opacity:0; transform: translateY(12px);} to {opacity:1; transform:none;} }

/* ---------- Utilities ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--gap); }
.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2rem}
.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}
.hidden { display: none !important; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }
.tag { display:inline-block; font-size:.74rem; font-weight:700; padding:.25rem .6rem; border-radius:999px; background:var(--brand-50); color:var(--brand-600); border:1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .bento { grid-template-columns: 1fr 1fr; }
  .bento .b1 { grid-column: span 2; }
  .steps-grid, .grid-3 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .nav-links { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: .8rem; gap: .2rem; box-shadow: var(--shadow-lg); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .85rem 1rem; }
  .menu-btn { display: grid; }
  .bento, .grid-2 { grid-template-columns: 1fr; }
  .method-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
}
@media (max-width: 420px) {
  .calc-actions .btn { min-width: 100%; }
}

/* ============================================================
   2026 Audit upgrades — a11y, print, share, target-size
   ============================================================ */

/* Skip link (WCAG 2.2) */
.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 200;
  background: var(--brand-600); color: #fff; padding: .7rem 1.1rem; border-radius: 10px;
  font-weight: 700; box-shadow: var(--shadow-lg); transition: top .2s;
}
.skip-link:focus { top: 12px; color: #fff; }

/* WCAG 2.2 target size — ensure interactive controls are >=24px */
.chip { min-height: 38px; }
.nav-links a { min-height: 40px; display: inline-flex; align-items: center; }
.faq-item summary { min-height: 48px; }

/* Secondary result action buttons */
.result-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.result-actions .mini-btn {
  display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; font-size: .85rem;
  padding: .6rem 1rem; min-height: 40px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); transition: transform .18s, box-shadow .2s, color .2s, border-color .2s;
}
.result-actions .mini-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--brand-500); border-color: var(--brand-300); }
.result-actions .mini-btn svg { width: 16px; height: 16px; }

/* noscript banner */
.noscript-banner {
  background: var(--warn); color: #1a1205; text-align: center; font-weight: 700;
  padding: .8rem 1rem; font-size: .95rem;
}

/* ---------- Print styles ---------- */
@media print {
  .aurora, .site-header, .site-footer, .hero-cta, .trust-row, .chips,
  .calc-actions, .result-actions, .cta-band, .menu-btn, .theme-toggle,
  .nav-actions, .skip-link, .breadcrumb, .ad-banner, .noscript-banner { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .container { max-width: 100%; }
  .card, .result-hero, .stat { box-shadow: none !important; border: 1px solid #ccc !important; }
  .result-hero { background: #fff !important; color: #000 !important; }
  .result-hero .value, .result-hero .label { color: #000 !important; }
  a { color: #000 !important; text-decoration: underline; }
  .section, .section-sm { padding-block: .5rem; }
  h1, h2, h3 { page-break-after: avoid; }
  .step, .work-code, .pf-table { page-break-inside: avoid; }
}

/* ============================================================
   LCM Calculator additions — dropdown nav, tools grid,
   visual diagrams, AI Insights panel, blog
   ============================================================ */

/* ---- Brand logo (image-based) ---- */
.brand .logo.logo-img { background: none; box-shadow: none; padding: 0; overflow: hidden; }
.brand .logo.logo-img img { width: 100%; height: 100%; display: block; }

/* ---- Nav dropdown ---- */
.has-dropdown { position: relative; }
.dropdown-toggle { display: inline-flex; align-items: center; gap: .3rem; background: none; color: var(--text-soft); font-weight: 600; font-size: .94rem; padding: .5rem .8rem; border-radius: 10px; min-height: 40px; }
.dropdown-toggle:hover { color: var(--text); background: var(--bg-soft); }
.dropdown-toggle .caret { width: 14px; height: 14px; transition: transform .25s; }
.has-dropdown.open .dropdown-toggle .caret { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 270px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: .5rem; display: none; z-index: 60;
}
.has-dropdown.open .dropdown-menu { display: grid; gap: .15rem; animation: fadeUp .22s both; }
@media (hover: hover) and (min-width: 880px) {
  .has-dropdown:hover .dropdown-menu { display: grid; gap: .15rem; animation: fadeUp .22s both; }
  .has-dropdown:hover .dropdown-toggle .caret { transform: rotate(180deg); }
}
.dropdown-menu a { display: flex; align-items: flex-start; gap: .65rem; padding: .6rem .7rem; border-radius: 11px; color: var(--text-soft); }
.dropdown-menu a:hover { background: var(--bg-soft); color: var(--text); }
.dropdown-menu a .di { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-500); border: 1px solid var(--border); }
.dropdown-menu a .di svg { width: 18px; height: 18px; }
.dropdown-menu a b { display: block; font-size: .92rem; color: var(--text); font-weight: 700; }
.dropdown-menu a small { display: block; font-size: .78rem; color: var(--text-mute); }

/* ---- Tools / calculators grid ---- */
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.tool-card { display: flex; flex-direction: column; gap: .55rem; text-decoration: none; color: inherit; }
.tool-card .ti { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-500), var(--accent)); color: #fff; box-shadow: var(--shadow-sm); }
.tool-card .ti svg { width: 26px; height: 26px; }
.tool-card h3 { font-size: 1.12rem; }
.tool-card p { color: var(--text-soft); font-size: .93rem; }
.tool-card .tlink { margin-top: auto; font-weight: 700; color: var(--brand-500); font-size: .9rem; display: inline-flex; align-items: center; gap: .35rem; }
.tool-card:hover .tlink svg { transform: translateX(4px); }
.tool-card .tlink svg { width: 16px; height: 16px; transition: transform .2s; }

/* ---- Visual diagram block ---- */
.calc-diagram { margin-top: 1.4rem; color: var(--text); }
.diagram-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem .7rem; margin-bottom: .7rem; }
.diagram-head strong { font-size: 1rem; }
.diagram-badge { font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--brand-600); background: var(--brand-50); border: 1px solid var(--border); padding: .25rem .6rem; border-radius: 999px; }
.diagram-sub { font-size: .85rem; color: var(--text-mute); }
.diagram-svg { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 12px; }
.diagram-svg .d-label { fill: var(--text); font-family: var(--mono); font-size: 15px; }
.diagram-svg .d-value { fill: var(--text); font-family: var(--mono); font-size: 15px; }
.diagram-svg .d-sub { fill: var(--text-mute); font-size: 13px; }
.diagram-legend { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; margin-top: .7rem; font-size: .85rem; color: var(--text-soft); }
.diagram-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.diagram-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.diagram-legend-note { color: var(--text-mute); font-style: italic; }
.diagram-note { font-size: .85rem; color: var(--text-mute); margin-top: .6rem; }
.venn-circle { animation: fadeUp .6s both; }

/* ---- AI Insights panel ---- */
.ai-panel { margin-top: 1.4rem; border: 1px solid var(--border); border-radius: var(--radius); background:
  linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface)); overflow: hidden; }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--border); }
.ai-title { display: flex; align-items: center; gap: .8rem; }
.ai-title strong { display: block; font-size: 1.05rem; }
.ai-sub { font-size: .8rem; color: var(--text-mute); }
.ai-spark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), #0fb39a); box-shadow: var(--shadow-sm); }
.ai-spark svg { width: 22px; height: 22px; }
.ai-gen-btn.is-loading { opacity: .7; pointer-events: none; }
.ai-body { padding: 1.2rem 1.3rem 1.4rem; }
.ai-output { color: var(--text-soft); font-size: .97rem; line-height: 1.7; }
.ai-output h4 { font-size: 1rem; margin: 1.1rem 0 .4rem; color: var(--text); }
.ai-output ul, .ai-output ol { margin: .3rem 0 .8rem 1.2rem; list-style: disc; }
.ai-output ol { list-style: decimal; }
.ai-output li { margin-bottom: .35rem; }
.ai-output p { margin-bottom: .7rem; }
.ai-output strong { color: var(--text); }
.ai-output code { font-family: var(--mono); background: var(--bg-soft); padding: .1rem .35rem; border-radius: 6px; font-size: .9em; }
.ai-pre { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: .8rem 1rem; overflow-x: auto; margin: .6rem 0; }
.ai-disclaimer { font-size: .78rem; color: var(--text-mute); margin-top: 1rem; padding-top: .8rem; border-top: 1px dashed var(--border); }
.ai-error { color: var(--danger); font-weight: 600; }
.ai-loading { display: flex; align-items: center; gap: .4rem; color: var(--text-mute); font-weight: 600; }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; animation: aiBounce 1s infinite ease-in-out; }
.ai-dot:nth-child(2) { animation-delay: .15s; } .ai-dot:nth-child(3) { animation-delay: .3s; }
@keyframes aiBounce { 0%,80%,100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* ---- AI Insights: instant analysis card + Ask-AI box (2026) ---- */
.ai-panel .ai-head { justify-content: flex-start; gap: .85rem; }
.ai-titles { display: flex; flex-direction: column; }
.ai-title-lg { font-size: 1.12rem; line-height: 1.2; }
.ai-spark.sm { width: 30px; height: 30px; border-radius: 9px; box-shadow: none; }
.ai-spark.sm svg { width: 16px; height: 16px; }
.ai-analysis { margin: 1.2rem 1.3rem 0; padding: 1.1rem 1.2rem; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); position: relative;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.ai-analysis::before { content:""; position:absolute; left:0; top:12px; bottom:12px; width:4px; border-radius:4px;
  background: linear-gradient(180deg, var(--brand-500), var(--accent)); }
.ai-analysis-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .7rem; }
.ai-analysis-head strong { color: var(--accent); font-size: 1rem; }
.ai-summary { font-weight: 600; color: var(--text); margin-bottom: .55rem; }
.ai-points { margin: 0 0 .4rem 1.1rem; list-style: disc; color: var(--text-soft); }
.ai-points li { margin-bottom: .4rem; line-height: 1.55; }
.ai-note { margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--border);
  color: var(--text-soft); font-size: .95rem; line-height: 1.65; }
.ai-ask { padding: 1.1rem 1.3rem 1.4rem; }
.ai-ask-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.ai-ask-input { flex: 1; min-width: 200px; padding: .85rem 1rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .95rem; }
.ai-ask-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.ai-ask-btn { white-space: nowrap; }
.ai-ask-btn.is-loading { opacity: .7; pointer-events: none; }
.ai-ask .ai-output:not([hidden]) { margin-top: 1rem; }

/* ---- "Explore all calculators" card grid ---- */
.cal-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gap); }
.cal-card { display: flex; flex-direction: column; gap: .3rem; text-decoration: none; }
.cal-card strong { color: var(--text); font-size: 1.02rem; }
.cal-card span { color: var(--text-soft); font-size: .9rem; line-height: 1.5; }
.cal-card:hover strong { color: var(--brand-500); }

/* ---- Ad banners (728x90 leaderboard, responsive) ---- */
.ad-banner { margin: 2.2rem auto; width: 100%; max-width: 728px; text-align: center; }
.ad-banner .ad-label { display: block; font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--text-mute); margin-bottom: .35rem; }
.ad-banner .ad-box { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 728px; min-height: 90px; margin: 0 auto; border: 1px dashed var(--border); border-radius: 12px; background: var(--bg-soft); overflow: hidden; }
.ad-banner .ad-box img, .ad-banner .ad-box ins, .ad-banner .ad-box iframe { max-width: 100%; height: auto; display: block; }
.ad-house { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; width: 100%; min-height: 90px; padding: .6rem 1rem; text-decoration: none;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500)); color: #fff; }
.ad-house-title { font-weight: 800; font-size: 1.02rem; }
.ad-house-sub { font-size: .82rem; opacity: .92; }
.prose .ad-banner { margin: 2.4rem auto; }
@media (max-width: 760px) { .ad-banner .ad-box, .ad-house { min-height: 64px; } }

/* ---- Blog ---- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.post-card { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: inherit; }
.post-card .pc-top { height: 8px; background: linear-gradient(90deg, var(--brand-500), var(--accent)); }
.post-card .pc-body { padding: 1.3rem 1.4rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.post-card .pc-cat { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-500); }
.post-card h3 { font-size: 1.1rem; line-height: 1.3; }
.post-card p { color: var(--text-soft); font-size: .92rem; }
.post-card .pc-meta { margin-top: auto; padding-top: .6rem; font-size: .82rem; color: var(--text-mute); display: flex; gap: .8rem; }
.post-tags { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 1.2rem; }
.post-tags a { font-size: .8rem; font-weight: 600; padding: .35rem .8rem; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-soft); }
.post-tags a:hover { color: var(--brand-500); border-color: var(--brand-300); }
.article-hero { padding-block: clamp(2rem, 5vw, 3.5rem) 0; }
.article-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; color: var(--text-mute); font-size: .88rem; margin-top: 1rem; align-items: center; }
.toc { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.3rem; margin: 1.5rem 0; }
.toc strong { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute); margin-bottom: .6rem; }
.toc ol { margin: 0 0 0 1.1rem; list-style: decimal; color: var(--text-soft); }
.toc ol li { margin-bottom: .35rem; }
.key-takeaway { border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); padding: 1rem 1.2rem; border-radius: 0 12px 12px 0; margin: 1.4rem 0; }
.key-takeaway strong { color: var(--text); }

@media (max-width: 980px) {
  .tools-grid, .post-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .tools-grid, .post-grid { grid-template-columns: 1fr; }
  .has-dropdown { width: 100%; }
  .dropdown-menu { position: static; box-shadow: none; min-width: 0; border: none; padding: 0 0 0 .5rem; }
  .has-dropdown.open .dropdown-menu { display: grid; }
  .ai-head { flex-direction: column; align-items: flex-start; }
  .ai-gen-btn { width: 100%; }
}

/* ---- Calculation history tape ---- */
.calc-history { margin-top: 1.2rem; }
.calc-history:empty { display: none; }

/* ---- Result / diagram / AI spacing (keep the answer clearly separated from the buttons) ---- */
#result { margin-top: 1.6rem; }
#result:empty { display: none; margin-top: 0; }
#diagram:empty { display: none; }
#aiInsights:empty { display: none; }
.result-hero { animation: resultPop .45s cubic-bezier(.2,.8,.3,1) both; }
@keyframes resultPop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .result-hero { animation: none; } }
.hist-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.hist-head strong { font-size: .95rem; }
.hist-clear { font-size: .8rem; font-weight: 700; color: var(--text-mute); padding: .3rem .6rem; border-radius: 8px; }
.hist-clear:hover { color: var(--danger); background: var(--bg-soft); }
.hist-list { display: flex; flex-direction: column; gap: .4rem; }
.hist-row { display: flex; align-items: stretch; gap: .4rem; }
.hist-main { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .6rem .9rem; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--text-soft); transition: border-color .2s, background .2s, transform .15s; }
.hist-main:hover { border-color: var(--brand-300); background: var(--brand-50); transform: translateX(2px); }
.hist-q { font-family: var(--mono); font-size: .86rem; color: var(--text); }
.hist-a { font-family: var(--mono); font-weight: 800; color: var(--brand-500); font-size: .9rem; word-break: break-all; text-align: right; }
.hist-del { width: 40px; flex: 0 0 40px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text-mute); transition: color .2s, border-color .2s; }
.hist-del:hover { color: var(--danger); border-color: var(--danger); }

/* ---- Search / filter box ---- */
.hub-search { position: relative; max-width: 480px; margin: 1.4rem auto 0; }
.hub-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-mute); pointer-events: none; }
.hub-search input { width: 100%; padding: .85rem 1rem .85rem 2.8rem; font-size: 1rem; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); transition: border-color .2s, box-shadow .2s; box-sizing: border-box; -webkit-appearance: none; appearance: none; }
.hub-search input::-webkit-search-decoration, .hub-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.hub-search input::placeholder { color: var(--text-mute); opacity: 1; }
.hub-search input:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 4px rgba(53,107,242,.15); }
.search-empty { text-align: center; color: var(--text-mute); padding: 2rem 1rem; font-weight: 600; }
.search-empty.hidden { display: none; }


/* ===== Calculator workspace layout (2026) =====
   Inputs, result and steps stay in the right-hand card.
   The animated diagram + AI Insights fill the LEFT column on desktop
   (which used to sit empty after a calculation). On mobile everything
   stacks in logical order: hero text → calculator → diagram → AI. */
.hero-visual:empty { display: none; }
.hero-visual { margin-top: 1.4rem; }
@media (min-width: 981px) {
  .hero-grid { align-items: start; }
  .hero-grid > div:first-child { grid-column: 1; }
  .hero-grid > .calc-card { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
  .hero-grid > .hero-visual { grid-column: 1; align-self: start; }
  /* tighten the gap so the left visuals sit right under the hero copy */
  .hero-grid > #diagram.hero-visual { margin-top: .4rem; }
}
