/* ShutterMath — design system. Light, fast, mobile-first. System fonts only (Core Web Vitals friendly). */
:root {
  --ink: #1a2333;
  --ink-soft: #4b5870;
  --line: #e3e8f0;
  --bg: #f7f9fc;
  --card: #ffffff;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eaf0fe;
  --amber: #d97706;
  --amber-soft: #fdf3e3;
  --green: #15803d;
  --green-soft: #e9f7ee;
  --red: #b91c1c;
  --red-soft: #fdeeee;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(26,35,51,.07), 0 8px 24px -12px rgba(26,35,51,.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.6; font-size: 16px; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.7rem); margin: 2rem 0 .75rem; }
h3 { font-size: 1.12rem; margin: 1.4rem 0 .5rem; }
p { margin: .6rem 0; }
ul, ol { margin: .6rem 0 .6rem 1.4rem; }
code { font-family: var(--mono); font-size: .92em; background: var(--brand-soft); padding: .1em .35em; border-radius: 5px; }

/* layout */
.container { max-width: 1080px; margin: 0 auto; padding: 0 1rem; }
main { min-height: 60vh; padding: 1.5rem 0 3rem; }

/* header */
.site-header { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { font-weight: 800; font-size: 1.15rem; color: #fff; letter-spacing: -.02em; }
.brand span { color: #7da5ff; }
.nav { display: flex; gap: 1.1rem; align-items: center; }
.nav a { color: #dbe4f5; font-size: .95rem; font-weight: 500; }
.nav a:hover { color: #fff; text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }

/* hero */
.hero { background: linear-gradient(135deg, #16233c 0%, #1e3a6e 60%, #244d8f 100%); color: #fff; padding: 3.2rem 0; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); margin-bottom: .6rem; }
.hero p { color: #c7d4ec; font-size: 1.08rem; max-width: 640px; }
.hero .tool-links { margin-top: 1.4rem; display: flex; flex-wrap: wrap; gap: .6rem; }
.pill { display: inline-block; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff; padding: .45rem .95rem; border-radius: 999px; font-size: .92rem; font-weight: 600; }
.pill:hover { background: rgba(255,255,255,.22); text-decoration: none; }

/* cards & grids */
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card .go { margin-top: .8rem; display: inline-block; font-weight: 700; }
/* whole-card clickable */
a.card { display: block; color: inherit; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
a.card:hover, a.card:focus-visible { transform: translateY(-3px); border-color: var(--brand); box-shadow: 0 2px 6px rgba(26,35,51,.08), 0 16px 36px -14px rgba(37,99,235,.28); outline: none; }
a.card:hover h3 { color: var(--brand-dark); }
a.card:hover .card-go { gap: .45rem; }
.card-go { display: inline-flex; align-items: center; gap: .3rem; margin-top: .7rem; font-weight: 700; color: var(--brand); transition: gap .15s ease; }
.icon-tile { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--brand-soft), #f2f6ff); border: 1px solid #d9e4fb; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; margin-bottom: .85rem; }
a.card .icon-tile { transition: transform .15s ease; }
a.card:hover .icon-tile { transform: scale(1.06); }
.cat-head { font-size: .85rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); margin: 1.6rem 0 .7rem; font-weight: 800; }
.cat-head::before { content: "— "; color: var(--brand); }

/* tool layout */
.tool-wrap { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 860px) { .tool-wrap { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem; }
.panel h2 { margin: 0 0 .9rem; font-size: 1.05rem; }
.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .83rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin-bottom: .3rem; }
.field select, .field input { width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; font-family: inherit; background: #fff; color: var(--ink); }
.field input:focus, .field select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.field .hint { font-size: .8rem; color: var(--ink-soft); margin-top: .25rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: .45rem .8rem; font-size: .9rem; cursor: pointer; color: var(--ink-soft); font-weight: 600; }
.seg button.on { background: var(--brand); color: #fff; }

/* results */
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
.result { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .8rem .9rem; }
.result .k { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.result .v { font-size: 1.25rem; font-weight: 800; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.result .s { font-size: .78rem; color: var(--ink-soft); }
.result.warn { border-color: var(--amber); background: var(--amber-soft); }
.result.warn .v { color: var(--amber); }
.result.inf { border-color: var(--green); background: var(--green-soft); }
.result.inf .v { color: var(--green); }

/* focus bar visual */
.focus-bar { position: relative; height: 14px; border-radius: 7px; background: linear-gradient(90deg, #e8edf5, #fff 50%, #e8edf5); border: 1px solid var(--line); margin: .6rem 0; overflow: hidden; }
.focus-bar .sharp { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(37,99,235,.25), rgba(37,99,235,.75), rgba(37,99,235,.25)); }
.focus-bar .focus-pt { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--red); border-radius: 2px; }
.focus-labels { display: flex; justify-content: space-between; font-size: .78rem; color: var(--ink-soft); }

/* buttons */
.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: .6rem 1.1rem; font-size: .95rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; }

/* tables (charts) */
table { width: 100%; border-collapse: collapse; font-size: .93rem; background: var(--card); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
th, td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--brand-soft); font-weight: 700; font-size: .83rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin: 1rem 0; }

/* callouts */
.callout { border-left: 4px solid var(--brand); background: var(--brand-soft); padding: .9rem 1.1rem; border-radius: 0 10px 10px 0; margin: 1rem 0; }
.callout.warn { border-color: var(--amber); background: var(--amber-soft); }
.callout.good { border-color: var(--green); background: var(--green-soft); }

/* FAQ */
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1.1rem; margin-bottom: .6rem; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: .5rem 0 0; }

/* breadcrumbs */
.crumbs { font-size: .85rem; color: var(--ink-soft); margin-bottom: 1rem; }
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--brand); }

/* ad slots (only render post-approval; never inside tool controls) */
.ad-slot { min-height: 90px; margin: 1.4rem 0; display: flex; align-items: center; justify-content: center; }
.ad-slot .ad-label { font-size: .7rem; color: #aab4c6; text-transform: uppercase; letter-spacing: .1em; }

/* footer */
.site-footer { background: var(--ink); color: #aebad2; font-size: .9rem; margin-top: 3rem; }
.site-footer .container { padding: 2rem 1rem; display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; }
.site-footer a { color: #d6dff2; }
.site-footer .fnav { display: flex; gap: 1.2rem; flex-wrap: wrap; }

/* consent banner */
.consent { position: fixed; bottom: 0; left: 0; right: 0; background: var(--ink); color: #fff; padding: .9rem 1rem; z-index: 100; display: none; font-size: .9rem; }
.consent.show { display: block; }
body.consent-open { padding-bottom: 84px; }
.consent .container { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.consent p { margin: 0; color: #c7d4ec; font-size: .88rem; }
.consent .btn { white-space: nowrap; }

/* print (cheat sheets) */
@media print {
  .site-header, .site-footer, .ad-slot, .btn-row, .no-print, .crumbs, .consent { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .panel, .card, .result { box-shadow: none; border: 1px solid #ccc; }
  main { padding: 0; }
  .tool-wrap { grid-template-columns: 1fr; }
}

/* utilities */
.muted { color: var(--ink-soft); font-size: .9rem; }
.mt1 { margin-top: 1rem; } .mt2 { margin-top: 2rem; } .mb1 { margin-bottom: 1rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
