@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,500;8..60,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #1B2A4A;
  --gold: #C97A25;
  --bg: #F5F3EE;
  --card: #ffffff;
  --border: #E2DED4;
  --muted: #83807A;
  --body: #5F5E58;
  --field-bg: #F9F8F5;
  --radius: 10px;

  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --max-width: 68rem;
  --content-width: 36rem;
}



/* Category accent colors */
.cat-finance   { --accent: #1D3E8F; --accent-dark: #122658; }
.cat-shopping  { --accent: #C2740A; --accent-dark: #5C3705; }
.cat-health    { --accent: #C2295C; --accent-dark: #5C1230; }
.cat-utilities { --accent: #0F8F6E; --accent-dark: #08442F; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.wrap { max-width: var(--max-width); margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .wrap { padding: 0 1.5rem; } }
.narrow { max-width: var(--content-width); margin: 0 auto; }
main { flex: 1; width: 100%; padding: 0 0 3rem; }

/* ===== Header (navy bookend) ===== */
.site-header { background: #1B2A4A; border-bottom: none; }
.header-inner { height: 4.25rem; display: flex; align-items: center; gap: 0.75rem; }
@media (min-width: 640px) { .header-inner { height: 5rem; } }
.brand { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.brand-mark { flex-shrink: 0; }
.brand-name { font-weight: 600; font-size: 1.2rem; color: #fff; letter-spacing: -0.01em; }
.primary-nav { display: none; align-items: center; gap: 1.25rem; margin-left: auto; }
@media (min-width: 768px) { .primary-nav { display: flex; } }
.nav-link { font-size: 0.85rem; color: #B9C2D4; }
.nav-link:hover, .nav-link.active { color: #fff; }
.menu-btn { margin-left: auto; display: grid; place-items: center; height: 2.25rem; width: 2.25rem; border-radius: 0.5rem; border: none; background: transparent; color: #fff; cursor: pointer; }
.menu-btn:hover { background: rgba(255,255,255,0.1); }
@media (min-width: 768px) { .menu-btn { display: none; } }
.mobile-menu { display: none; background: #1B2A4A; padding: 0.75rem 1rem; }
.mobile-menu.open { display: block; }
@media (min-width: 768px) { .mobile-menu { display: none !important; } }
.mobile-menu a { display: block; padding: 0.5rem 0; font-size: 0.9rem; color: #fff; }

/* ===== Category-tinted hero band (sits right under the navy header) ===== */
.hero-band { padding: 1.75rem 0 2rem; }
.hero-band.tint-home { background: #EFE7D8; }
.cat-finance .hero-band { background: #DCE4FB; }
.cat-shopping .hero-band { background: #FBE7C6; }
.cat-health .hero-band { background: #FBDCE6; }
.cat-utilities .hero-band { background: #D2F1E5; }

/* ===== Icons ===== */
.icon { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { height: 1rem; width: 1rem; }
.icon-md { height: 1.25rem; width: 1.25rem; }

/* ===== Search ===== */
.search-wrap { position: relative; margin-bottom: 1.375rem; }
.search-wrap .icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input { width: 100%; padding: 0.7rem 0.9rem 0.7rem 2rem; border-radius: 0.5rem; border: 1px solid var(--border); background: #fff; font-size: 0.95rem; font-family: inherit; color: var(--ink); outline: none; }
.search-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,122,37,0.15); }
.search-empty { text-align: center; color: var(--muted); font-size: 0.875rem; padding: 2rem 0; display: none; }

/* ===== Homepage hero ===== */
.hero { max-width: 34rem; margin-bottom: 1.25rem; }
.hero h1 { font-family: var(--font-serif); font-size: 1.9rem; line-height: 1.16; letter-spacing: -0.01em; color: var(--ink); }
@media (min-width: 640px) { .hero h1 { font-size: 2.3rem; } }
.hero .lede { font-size: 1rem; color: var(--muted); line-height: 1.65; margin-top: 0.625rem; }

/* ===== Category boxes ===== */
.cat-grid { display: grid; gap: 0.75rem; margin-bottom: 1.5rem; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
.cat-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; gap: 0.75rem; }
.cat-rail { width: 3px; border-radius: 2px; flex-shrink: 0; background: var(--accent); }
.cat-box-body { flex: 1; min-width: 0; }
.cat-box-title { font-size: 0.95rem; font-weight: 600; color: var(--accent); margin-bottom: 0.85rem; }
.cat-calc-list { display: flex; flex-direction: column; gap: 0.85rem; }
.cat-calc-item { display: flex; align-items: flex-start; gap: 0.65rem; }
.cat-calc-item[hidden] { display: none; }
.mini-badge { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.mini-badge .icon { height: 16px; width: 16px; }
.cat-calc-name { display: block; font-size: 0.9rem; color: var(--ink); }
.cat-box:hover .cat-calc-name, a.cat-calc-item:hover .cat-calc-name { color: var(--accent); }
.cat-calc-desc { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }

/* ===== Homepage content section ===== */
.home-article { border-top: 1px solid var(--border); padding-top: 1.5rem; margin-top: 1.5rem; }
.home-article h2 { font-size: 1.1rem; font-weight: 600; color: var(--ink); margin-bottom: 1rem; text-align: center; }
.home-article-grid { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .home-article-grid { grid-template-columns: repeat(3, 1fr); } }
.home-article p { font-size: 0.88rem; color: var(--body); line-height: 1.7; text-align: justify; hyphens: auto; }

/* ===== Footer (navy bookend) ===== */
.site-footer { background: #1B2A4A; }
.footer-inner { padding: 1.25rem 0 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; align-items: center; text-align: center; font-size: 0.8rem; color: #B9C2D4; }
@media (min-width: 640px) { .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; } }
.footer-brand { display: flex; align-items: center; gap: 0.5rem; color: #fff; }
.footer-links { display: flex; gap: 1rem; }
.footer-links a { color: #B9C2D4; }
.footer-links a:hover { color: #fff; }

/* ===== Calculator page shell ===== */
.back-link { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.875rem; }
.back-link:hover { color: var(--ink); }
.calc-title { font-family: var(--font-serif); font-size: 1.7rem; color: var(--ink); letter-spacing: -0.01em; }
@media (min-width: 640px) { .calc-title { font-size: 1.9rem; } }
.calc-desc { font-size: 0.9rem; color: var(--muted); line-height: 1.6; margin-top: 0.5rem; }

.calc-grid { display: grid; gap: 0.625rem; margin-bottom: 1.25rem; }
@media (min-width: 640px) { .calc-grid { grid-template-columns: 1fr 1fr; } }
.calc-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
@media (min-width: 640px) { .calc-card { padding: 1.15rem; } }

.field-label { display: block; font-size: 0.83rem; font-weight: 500; color: var(--ink); margin-bottom: 0.35rem; }
.field-label .opt { font-weight: 400; color: var(--muted); }
.field-input { width: 100%; padding: 0.6rem 0.75rem; border-radius: 0.4rem; border: 1px solid var(--border); background: var(--field-bg); font-size: 0.95rem; font-family: inherit; color: var(--ink); outline: none; margin-bottom: 0.75rem; }
.field-input:last-child { margin-bottom: 0; }
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
select.field-input { cursor: pointer; }
.field-group { margin-bottom: 0.75rem; }
.field-group:last-child { margin-bottom: 0; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

.chip-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.65rem; }
.chip { padding: 0.4rem 0.7rem; font-size: 0.8rem; border-radius: 0.4rem; background: #fff; border: 1px solid var(--border); color: var(--muted); cursor: pointer; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:hover:not(.active) { color: var(--ink); }
.custom-label { font-size: 0.78rem; color: var(--muted); display: block; margin-bottom: 0.3rem; }

.example-note { background: var(--field-bg); border-radius: 0.5rem; padding: 0.7rem 0.8rem; margin-top: 0.75rem; }
.example-note .tag { font-size: 0.68rem; font-weight: 600; color: var(--muted); letter-spacing: 0.05em; margin-bottom: 0.25rem; display: block; }
.example-note .txt { font-size: 0.82rem; color: var(--body); line-height: 1.55; }
.example-note .txt strong { color: var(--ink); }

.result-label { font-size: 0.83rem; color: var(--muted); }
.result-value { font-size: 1.85rem; font-weight: 500; color: var(--accent); margin-top: 0.25rem; }
.result-value .unit { font-size: 1.1rem; }
.result-rows { border-top: 1px solid var(--border); margin-top: 0.8rem; padding-top: 0.7rem; font-size: 0.83rem; }
.result-row { display: flex; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.45rem; }
.result-row:last-child { margin-bottom: 0; }
.result-row .k { color: var(--muted); }
.result-row .v { color: var(--ink); }
.result-row .v.strong { font-weight: 600; }
.result-empty { font-size: 0.78rem; color: var(--muted); height: 100%; min-height: 6rem; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1.5rem 0; }
.result-highlight { text-align: center; }
.result-highlight .from { font-size: 0.75rem; color: var(--muted); }
.result-highlight .to { font-size: 1.5rem; font-weight: 500; color: var(--accent); margin-top: 0.2rem; }

/* ===== Ad slot ===== */
.ad-slot { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); border-radius: 0.4rem; background: #EFEBE0; color: var(--muted); font-size: 0.68rem; padding: 0.5rem; margin: 0 auto; }
.ad-slot.leaderboard { height: 80px; max-width: 728px; }
.ad-wrap { display: none; justify-content: center; margin: 1.5rem 0; } /* change it to flex once adSense is approved */

/* ===== Article content ===== */
.article { margin-top: 0; }
.article > section { margin-bottom: 1.375rem; }
.article h2 { font-size: 1.1rem; font-weight: 600; color: var(--ink); margin-bottom: 0.6rem; }
.article p { font-size: 0.9rem; color: var(--body); line-height: 1.7; }
.article p + p { margin-top: 0.625rem; }

.formula-box { background: var(--field-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1.05rem; }
.formula-box .tag { font-size: 0.7rem; font-weight: 600; color: var(--muted); letter-spacing: 0.05em; margin-bottom: 0.55rem; display: block; }
.formula-line { font-family: var(--font-mono); font-size: 0.83rem; color: var(--ink); line-height: 1.9; }
.formula-line .k { color: var(--muted); }

.steps { display: flex; flex-direction: column; gap: 0.875rem; }
.step { display: flex; gap: 0.75rem; }
.step-num { flex-shrink: 0; height: 1.6rem; width: 1.6rem; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.8rem; font-weight: 600; display: grid; place-items: center; }
.step-body h3 { font-size: 0.9rem; font-weight: 500; color: var(--ink); margin-bottom: 0.15rem; }
.step-body p { font-size: 0.83rem; }

.example-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1rem; font-size: 0.83rem; }
.example-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.55rem; }
.example-row:last-child { margin-bottom: 0; }
.example-row .k { color: var(--muted); }
.example-row .work { color: var(--muted); font-family: var(--font-mono); font-size: 0.72rem; margin-right: 0.4rem; }
.example-row .v { color: var(--ink); }
.example-row .v strong { color: var(--ink); }
.example-row.highlight { border-top: 1px solid var(--border); padding-top: 0.55rem; }
.example-row.highlight .v { color: var(--accent); font-weight: 600; }
.example-why { font-size: 0.72rem; color: #8E8B82; margin-top: 0.4rem; line-height: 1.55; }

.faq-item { border-top: 1px solid var(--border); padding: 0.8rem 0; }
.faq-item:last-child { border-bottom: 1px solid var(--border); }
.faq-q { width: 100%; text-align: left; background: none; border: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; font-size: 0.9rem; font-weight: 500; color: var(--ink); font-family: inherit; padding: 0; }
.faq-q .chev { flex-shrink: 0; color: var(--muted); transition: transform .2s ease; }
.faq-item.open .faq-q .chev { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .22s ease; }
.faq-item.open .faq-a { max-height: 20em; }
.faq-a-inner { padding-top: 0.6rem; font-size: 0.83rem; color: var(--body); line-height: 1.65; }

.related { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1.375rem; }
.related .tag { font-size: 0.7rem; font-weight: 600; color: var(--muted); letter-spacing: 0.05em; margin-bottom: 0.5rem; display: block; }
.related ul { display: flex; flex-wrap: wrap; gap: 1rem; }
.related a { font-size: 0.88rem; color: var(--ink); }
.related a:hover { color: var(--accent); }

/* ===== Static/info pages ===== */
.page-hero { text-align: center; padding-top: 0.25rem; margin-bottom: 1.5rem; }
.page-icon { height: 2.75rem; width: 2.75rem; border-radius: 0.65rem; background: var(--ink); color: #fff; display: grid; place-items: center; margin: 0 auto 0.875rem; }
.page-hero h1 { font-family: var(--font-serif); font-size: 1.7rem; color: var(--ink); letter-spacing: -0.01em; }
@media (min-width: 640px) { .page-hero h1 { font-size: 1.9rem; } }
.page-hero p { font-size: 0.85rem; color: var(--muted); line-height: 1.6; margin-top: 0.6rem; }
.page-hero .updated { font-size: 0.68rem; color: var(--muted); margin-top: 0.75rem; }

.prose { margin-top: 1.5rem; }
.prose-block + .prose-block { margin-top: 1.5rem; }
.prose-block h2 { font-size: 1rem; font-weight: 600; color: var(--ink); margin-bottom: 0.55rem; }
.prose-block p { font-size: 0.8rem; color: var(--body); line-height: 1.7; }
.prose-block p + p { margin-top: 0.6rem; }

.value-list { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 1.25rem; }
.value-item { display: flex; gap: 0.875rem; align-items: flex-start; }
.value-icon { height: 2.25rem; width: 2.25rem; border-radius: 0.5rem; background: var(--field-bg); color: var(--ink); display: grid; place-items: center; flex-shrink: 0; }
.value-title { font-size: 0.85rem; font-weight: 500; color: var(--ink); }
.value-body { font-size: 0.78rem; color: var(--body); line-height: 1.6; margin-top: 0.2rem; }

.cta-center { text-align: center; margin-top: 2rem; }
.btn-pill { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--ink); color: #fff; font-size: 0.8rem; font-weight: 500; padding: 0.55rem 1.1rem; border-radius: 999px; border: none; cursor: pointer; }
.btn-pill:hover { background: #142138; }

.contact-cards { display: grid; gap: 1rem; margin-top: 1.5rem; }
@media (min-width: 640px) { .contact-cards { grid-template-columns: 1fr 1fr; } }
.contact-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; gap: 0.75rem; }

.form-field { margin-bottom: 0.875rem; }
.form-field label { display: block; font-size: 0.78rem; font-weight: 500; color: var(--ink); margin-bottom: 0.35rem; }
textarea.field-input { resize: vertical; min-height: 90px; margin-bottom: 0; }
.contact-success { text-align: center; padding: 1.5rem; }

/* ===== Range/GPA rows (used in gpa page) ===== */
.gpa-row { display: flex; align-items: center; gap: 0.5rem; }
.gpa-row + .gpa-row { margin-top: 0.55rem; }
.gpa-row select.field-input { flex: 1; margin-bottom: 0; }
.gpa-row input.field-input { width: 5rem; flex-shrink: 0; margin-bottom: 0; }
.gpa-remove { flex-shrink: 0; height: 2rem; width: 2rem; border-radius: 0.4rem; border: none; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.gpa-remove:hover { background: var(--field-bg); color: #c81e1e; }
.gpa-add { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.6rem; background: none; border: none; color: var(--accent); font-size: 0.78rem; cursor: pointer; padding: 0.2rem 0; }
.gpa-add:hover { opacity: 0.8; }
