/* Calcrisp stylesheet. One file, no framework. */

@font-face {
  font-family: "Atkinson";
  src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --ink: #1f2a44;
  --ink-soft: #4a5672;
  --ink-faint: #75809a;
  --paper: #ffffff;
  --panel: #f4f7fb;
  --grid: #e2e9f2;
  --rule: #d5dde8;
  --primary: #2b59c3;
  --primary-dark: #1f4396;
  --mark: #fff1b8;
  --error: #b42318;
  --error-bg: #fdecea;
  --finance: #1e7a57;
  --student: #5b46c9;
  --health: #0d7f86;
  --accent: var(--primary);
  --radius-s: 6px;
  --radius-m: 10px;
  --font: "Atkinson", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: 2rem;
  --step-4: 2.625rem;
  --wrap: 1120px;
  --measure: 70ch;
}

body[data-cat="finance"] { --accent: var(--finance); }
body[data-cat="student"] { --accent: var(--student); }
body[data-cat="health"]  { --accent: var(--health); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--primary); text-underline-offset: 0.18em; }
a:hover { color: var(--primary-dark); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: var(--step-4); letter-spacing: -0.01em; }
h2 { font-size: var(--step-3); margin-top: 1.6em; }
h3 { font-size: var(--step-1); margin-top: 1.4em; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 100; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); background: #fff; position: relative; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: var(--step-1); color: var(--ink); text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--ink-soft); text-decoration: none; padding: 8px 10px; border-radius: var(--radius-s); font-size: var(--step--1); font-weight: 700; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--panel); }
.header-search { margin-left: auto; position: relative; width: 260px; }
.menu-btn { display: none; }

/* Search */
.search-input {
  width: 100%; font: inherit; font-size: var(--step--1);
  padding: 9px 12px 9px 36px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink);
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2375809a' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat 12px center;
}
.search-input:focus { background-color: #fff; border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(43,89,195,.18); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--rule);
  border-radius: var(--radius-m); box-shadow: 0 12px 32px rgba(31,42,68,.14); list-style: none; margin: 0; padding: 6px; display: none; max-height: 360px; overflow: auto;
}
.search-results.open { display: block; }
.search-results a { display: block; padding: 8px 10px; border-radius: var(--radius-s); color: var(--ink); text-decoration: none; }
.search-results a small { display: block; color: var(--ink-faint); }
.search-results a:hover, .search-results a.active { background: var(--panel); }
.search-results .empty { padding: 8px 10px; color: var(--ink-faint); }

/* Breadcrumb */
.crumbs { font-size: var(--step--1); color: var(--ink-faint); margin: 20px 0 12px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--rule); }
.crumbs a { color: var(--ink-soft); }

/* Tool page */
.tool-head { max-width: var(--measure); margin-bottom: 20px; }
.tool-head h1 { font-size: var(--step-4); }
.lead { font-size: var(--step-1); color: var(--ink-soft); }
.tool-panel {
  border: 1px solid var(--rule); border-radius: var(--radius-m); overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background-color: var(--panel);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  border-top: 4px solid var(--accent);
}
.tool-form { padding: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; align-content: start; background: rgba(255,255,255,.9); border-right: 1px solid var(--rule); }
.tool-result { padding: 24px; }
.field { grid-column: span 2; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.half { grid-column: span 1; }
.field label, .field .label { font-size: var(--step--1); font-weight: 700; color: var(--ink); }
.field .help { font-size: 0.8125rem; color: var(--ink-faint); line-height: 1.4; }
.input-wrap { display: flex; align-items: stretch; border: 1px solid var(--rule); border-radius: var(--radius-s); background: #fff; }
.input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43,89,195,.18); }
.input-wrap .affix { display: flex; align-items: center; padding: 0 10px; color: var(--ink-faint); font-size: var(--step--1); background: var(--panel); white-space: nowrap; }
.input-wrap .affix:first-child { border-right: 1px solid var(--rule); border-radius: var(--radius-s) 0 0 var(--radius-s); }
.input-wrap .affix:last-child { border-left: 1px solid var(--rule); border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.tool-form input, .tool-form select, .tool-form textarea {
  font: inherit; font-size: var(--step-0); color: var(--ink); width: 100%; min-width: 0;
  padding: 10px 12px; border: 0; background: transparent; border-radius: var(--radius-s);
}
.tool-form input:focus, .tool-form select:focus, .tool-form textarea:focus { outline: none; }
.tool-form > .field > select, .tool-form > .field > textarea, .tool-form .plain { border: 1px solid var(--rule); background: #fff; }
.tool-form > .field > select:focus, .tool-form > .field > textarea:focus, .tool-form .plain:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43,89,195,.18); }
.tool-form textarea { min-height: 110px; resize: vertical; }
.seg { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--rule); border-radius: var(--radius-s); background: #fff; overflow: hidden; }
.seg label { flex: 1 1 auto; text-align: center; font-weight: 700; font-size: var(--step--1); cursor: pointer; position: relative; }
.seg label + label { border-left: 1px solid var(--rule); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: block; padding: 9px 10px; color: var(--ink-soft); }
.seg input:checked + span { background: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: -3px; }
.check { display: flex; align-items: center; gap: 8px; font-size: var(--step--1); font-weight: 700; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-actions { grid-column: span 2; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.btn { font: inherit; font-weight: 700; font-size: var(--step--1); padding: 10px 18px; border-radius: var(--radius-s); border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(.92); }
.btn-ghost { background: #fff; border-color: var(--rule); color: var(--ink); }
.btn-ghost:hover { background: var(--panel); }
.btn-small { padding: 6px 12px; }
[hidden] { display: none !important; }

/* Dynamic rows (GPA, weighted grade) */
.rows { grid-column: span 2; display: flex; flex-direction: column; gap: 8px; }
.rows-head, .row-item { display: grid; gap: 8px; align-items: center; }
.rows-head { font-size: 0.8125rem; font-weight: 700; color: var(--ink-soft); }
.row-item input, .row-item select { border: 1px solid var(--rule) !important; background: #fff !important; padding: 8px 10px !important; }
.row-remove { border: 0; background: none; color: var(--ink-faint); font-size: 1.25rem; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-s); }
.row-remove:hover { color: var(--error); background: var(--error-bg); }

/* Result */
.result-label { font-size: var(--step--1); color: var(--ink-soft); font-weight: 700; margin: 0 0 4px; }
.result-main { margin-bottom: 18px; }
.result-value {
  display: inline; font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em;
  background: linear-gradient(transparent 58%, var(--mark) 58%, var(--mark) 92%, transparent 92%);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.result-note { font-size: var(--step--1); color: var(--ink-soft); margin-top: 6px; }
.result-list { margin: 0; border-top: 1px solid var(--rule); background: rgba(255,255,255,.85); border-radius: var(--radius-s); }
.result-list div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--rule); }
.result-list dt { color: var(--ink-soft); }
.result-list dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.result-actions { display: flex; gap: 8px; margin-top: 14px; }
.result-error { background: var(--error-bg); color: var(--error); border-radius: var(--radius-s); padding: 12px 14px; font-weight: 700; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: var(--step--1); font-weight: 700; background: var(--accent); color: #fff; margin-top: 8px; }
.result-extra { grid-column: 1 / -1; background: #fff; border-top: 1px solid var(--rule); padding: 20px 24px; }
.result-extra:empty { display: none; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--ink-soft); font-weight: 700; border-bottom: 2px solid var(--rule); }
.prose table th, .prose table td { text-align: left; white-space: normal; }
.bar { height: 10px; border-radius: 999px; background: var(--grid); overflow: hidden; display: flex; margin: 10px 0 4px; }
.bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--step--1); color: var(--ink-soft); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* Content */
.page-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; margin-top: 40px; }
.prose { max-width: var(--measure); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.35em; }
.prose blockquote { margin: 1em 0; padding: 12px 16px; background: var(--panel); border-left: 4px solid var(--accent); border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.prose blockquote p:last-child { margin: 0; }
.prose code { background: var(--panel); padding: 1px 6px; border-radius: 4px; font-size: 0.95em; }
.prose .table-scroll, .prose table { margin: 0 0 1.2em; }
.formula { margin: 0 0 1em; font-size: var(--step-1); background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 14px 16px; overflow-x: auto; white-space: nowrap; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3em; line-height: 1; }
.faq details[open] summary::after { content: "\2212"; }
.faq details > div { padding: 0 0 14px; color: var(--ink-soft); }
.side h2 { font-size: var(--step-1); margin-top: 0; }
.side-block { margin-bottom: 32px; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { border-bottom: 1px solid var(--rule); }
.link-list a { display: block; padding: 10px 0; text-decoration: none; color: var(--ink); font-weight: 700; }
.link-list a:hover { color: var(--accent); }
.link-list small { display: block; font-weight: 400; color: var(--ink-faint); }
.disclaimer-note { font-size: var(--step--1); color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 24px; }

/* Ads: space is reserved so the page does not jump when an ad loads */
.ad-slot { min-height: 280px; margin: 28px 0; display: flex; justify-content: center; align-items: center; }
.ad-slot ins { display: block; width: 100%; }

/* Home */
.home-hero { padding: 56px 0 40px; border-bottom: 1px solid var(--rule); background-color: #fff;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px; background-position: center top; }
.home-hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); max-width: 16ch; }
.home-hero .lead { max-width: 52ch; }
.hero-search { position: relative; max-width: 560px; margin-top: 24px; }
.hero-search .search-input { font-size: var(--step-1); padding: 16px 18px 16px 46px; background-position: 18px center; background-color: #fff; border-width: 2px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.quick a { font-size: var(--step--1); font-weight: 700; background: #fff; border: 1px solid var(--rule); border-radius: 999px; padding: 6px 14px; text-decoration: none; color: var(--ink); }
.quick a:hover { border-color: var(--ink); }
.cat-section { padding: 44px 0 8px; }
.cat-section h2 { margin: 0; display: flex; align-items: center; gap: 12px; }
.cat-section h2::before { content: ""; width: 14px; height: 14px; border-radius: 3px; background: var(--c); flex: none; }
.cat-section .cat-intro { color: var(--ink-soft); margin: 6px 0 16px; max-width: 60ch; }
.tool-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); border-top: 1px solid var(--rule); }
.tool-grid li { border-bottom: 1px solid var(--rule); }
.tool-grid a { display: block; padding: 14px 16px 14px 0; text-decoration: none; color: var(--ink); height: 100%; }
.tool-grid a strong { display: block; }
.tool-grid a span { display: block; font-size: var(--step--1); color: var(--ink-faint); }
.tool-grid a:hover strong { color: var(--c, var(--accent)); text-decoration: underline; text-underline-offset: 0.18em; }
.more-link { display: inline-block; margin-top: 12px; font-weight: 700; }
.blog-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 32px; }
.blog-list li { border-top: 1px solid var(--rule); padding: 16px 0; }
.blog-list a { font-weight: 700; color: var(--ink); text-decoration: none; font-size: var(--step-1); line-height: 1.3; }
.blog-list a:hover { color: var(--primary); text-decoration: underline; }
.blog-list p { margin: 6px 0 0; color: var(--ink-soft); font-size: var(--step--1); }
.blog-list .cat-tag { font-size: 0.8125rem; font-weight: 700; color: var(--c); }

/* Hub */
.hub-head { padding: 8px 0 28px; border-bottom: 4px solid var(--accent); margin-bottom: 8px; }
.hub-head h1 { max-width: 20ch; }

/* Blog post */
.post-head { max-width: var(--measure); }
.post-meta { color: var(--ink-faint); font-size: var(--step--1); }
.tool-callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: var(--radius-s); padding: 14px 18px; margin: 1.5em 0; }
.tool-callout p { margin: 0; }
.tool-callout a.btn { text-decoration: none; }

/* Simple pages */
.simple { max-width: var(--measure); padding-bottom: 40px; }

/* Footer */
.site-footer { margin-top: 72px; border-top: 1px solid var(--rule); background: var(--panel); padding: 40px 0 28px; font-size: var(--step--1); }
.footer-grid { display: grid; grid-template-columns: 1.3fr repeat(5, 1fr); gap: 24px; }
.site-footer h2 { font-size: var(--step-0); margin: 0 0 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.footer-bottom { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--rule); color: var(--ink-faint); }

/* Responsive */
@media (max-width: 900px) {
  .tool-panel { grid-template-columns: minmax(0, 1fr); }
  .tool-form { border-right: 0; border-bottom: 1px solid var(--rule); }
  .page-cols { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .header-search { width: auto; flex: 1; }
}
@media (max-width: 720px) {
  :root { --step-4: 2rem; --step-3: 1.6rem; }
  .site-header .wrap { flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .menu-btn { display: block; margin-left: auto; background: none; border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 6px 10px; font: inherit; font-weight: 700; font-size: var(--step--1); color: var(--ink); }
  .nav { display: none; width: 100%; flex-direction: column; order: 3; }
  .nav.open { display: flex; }
  .header-search { order: 4; width: 100%; flex: none; }
  .tool-form, .tool-result, .result-extra { padding: 18px; }
  .tool-form { grid-template-columns: minmax(0, 1fr); }
  .field, .field.half, .form-actions, .rows { grid-column: span 1; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print {
  .site-header, .site-footer, .ad-slot, .side, .result-actions, .form-actions { display: none !important; }
  .tool-panel { background: none; }
}
.prose > h2:first-child { margin-top: 0; }
.hub-head + .tool-grid { border-top: 0; }

/* Share links and page feedback */
.engage { margin-top: 32px; border-top: 1px solid var(--rule); padding-top: 20px; display: grid; gap: 20px; }
.engage-title { font-size: var(--step-0); margin: 0 0 10px; }
.share-row, .feedback-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-link { font: inherit; font-size: var(--step--1); font-weight: 700; color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: 999px; padding: 7px 14px; text-decoration: none; cursor: pointer; line-height: 1.2; }
.share-link:hover { background: var(--panel); border-color: var(--ink-faint); }
.share-link:focus-visible, .feedback button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.share-native { background: var(--ink); color: #fff; border-color: var(--ink); }
.share-native:hover { background: var(--ink-soft); }
.share-status, .feedback-thanks, .feedback-more { font-size: var(--step--1); color: var(--ink-soft); margin: 8px 0 0; }
.share-status:empty { display: none; }
.feedback button[aria-pressed="true"] { background: var(--mark); border-color: var(--ink-faint); }
@media print { .engage { display: none; } }
.embed-box { border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 0 16px; }
.embed-box summary { cursor: pointer; font-weight: 700; padding: 12px 0; }
.embed-box p { font-size: var(--step--1); color: var(--ink-soft); margin: 0 0 10px; }
.embed-code { width: 100%; font: 0.8125rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 10px; resize: vertical; margin-bottom: 8px; }
.embed-status:empty { display: none; }
.embed-box[open] { padding-bottom: 12px; }

/* Embedded calculator (iframe on other sites) */
body.embed { background: #fff; }
.embed-main { padding: 16px; max-width: 640px; margin: 0 auto; }
.embed-title { font-size: var(--step-1); margin: 0 0 12px; }
body.embed .tool-panel { margin: 0; }
.embed-credit { font-size: var(--step--1); color: var(--ink-soft); margin: 14px 0 0; }
body.embed .tool-form, body.embed .tool-result, body.embed .result-extra { padding: 16px; }
body.embed .tool-form { gap: 10px 14px; }
@media (min-width: 520px) {
  body.embed .tool-form { grid-template-columns: 1fr 1fr; }
  body.embed .field, body.embed .form-actions, body.embed .rows { grid-column: span 2; }
  body.embed .field.half { grid-column: span 1; }
}
/* High school GPA rows: on narrow screens the class name gets its own line */
@media (max-width: 560px) {
  #hs-rows .row-item, #hs-rows .rows-head { grid-template-columns: 0.9fr 0.7fr 1.6fr 32px !important; }
  #hs-rows .row-item > input:first-child { grid-column: 1 / -1; }
  #hs-rows .rows-head > span:first-child { display: none; }
  #hs-rows .row-item { padding-bottom: 10px; border-bottom: 1px solid var(--grid); }
  .row-item input, .row-item select { min-width: 0; }
}
body[data-cat="everyday"] { --accent: var(--everyday); }
:root { --everyday: #b4531a; }
.case-out { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 10px 12px; margin: 4px 0 12px; resize: vertical; }
.tool-form textarea#text { min-height: 180px; }
.ad-slot.ad-banner { min-height: 274px; flex-direction: column; gap: 4px; }
.ad-slot.ad-native { min-height: 0; display: block; }
.ad-label { display: block; font-size: 0.6875rem; color: var(--ink-faint); text-align: center; letter-spacing: 0.02em; }
