/* Stupus — core stylesheet
   Academic, calm, blue theme. No frameworks. ~ single file, minimal weight. */

:root {
  --bg: #F4F7FC;
  --surface: #FFFFFF;
  --text: #0F1B2D;
  --text-muted: #4B5A70;
  --border: #E2E8F1;
  --primary: #0B3B8F;
  --primary-dark: #082B69;
  --primary-tint: #EAF0FC;
  --accent-result: #2E7D5B;
  --accent-result-tint: #E9F5EF;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.04), 0 2px 8px rgba(15, 27, 45, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: var(--max-width);
  margin: 0 auto;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand img { height: 28px; width: auto; }
.brand .brand-fallback {
  height: 28px;
  width: 28px;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.main-nav a:hover { color: var(--primary); text-decoration: none; }
.main-nav a.active { color: var(--primary); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
}
.nav-toggle svg { display: block; }

@media (max-width: 720px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 20px 18px;
    gap: 14px;
  }
  .main-nav.open { display: flex; }
  .nav-toggle { display: block; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--primary); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Hero / search ---------- */
.hero {
  padding: 56px 0 40px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}
.hero p.lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 28px;
}

.search-box {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-family: inherit;
  color: var(--text);
}
.search-box input:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.search-results {
  margin-top: 8px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
}
.search-results.show { display: block; }
.search-results a {
  display: block;
  padding: 11px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--primary-tint); text-decoration: none; }
.search-empty {
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Sections ---------- */
.section { padding: 40px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: 1.35rem;
  margin: 0;
  letter-spacing: -0.01em;
}
.section-head .see-all { font-size: 0.9rem; font-weight: 600; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 6px;
}

/* ---------- Cards / grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--primary); }
.card h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
}
.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.card .card-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-tint);
  border-radius: 5px;
  padding: 2px 8px;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
a.card { display: block; color: inherit; }
a.card:hover { text-decoration: none; }

/* ---------- Why section ---------- */
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.why-item h3 { font-size: 1rem; margin: 10px 0 6px; }
.why-item p { color: var(--text-muted); font-size: 0.92rem; margin: 0; }
.why-item .icon-wrap {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--primary-tint);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 14px 0 0;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 6px; opacity: 0.6; }

/* ---------- Page header (university / calculator) ---------- */
.page-head { padding: 18px 0 8px; }
.page-head h1 {
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  margin: 4px 0 8px;
  letter-spacing: -0.02em;
}
.page-head .subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 680px;
}
.meta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-tint);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------- Calculator ---------- */
.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 18px 0 8px;
}
.calc-card h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}
.calc-card .calc-hint {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0 0 18px;
}

.subject-row {
  display: grid;
  grid-template-columns: 2.4fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}
.subject-row .field { display: flex; flex-direction: column; gap: 5px; }
.subject-row label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.subject-row input {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  width: 100%;
}
.subject-row input:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.row-remove {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.row-remove:hover { border-color: #C0393B; color: #C0393B; }

.calc-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.result-chip {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--accent-result-tint);
  border: 1px solid #C9E6D7;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.result-chip.show { display: flex; }
.result-chip .result-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-result);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 4px;
}
.result-chip .result-value {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--accent-result);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.result-chip .result-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.field-inline { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.field-inline .field { display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.field-inline label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.field-inline input, .field-inline select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
}

/* ---------- Prose content blocks ---------- */
.prose { max-width: 760px; }
.prose h2 {
  font-size: 1.25rem;
  margin: 34px 0 10px;
  letter-spacing: -0.01em;
}
.prose h3 {
  font-size: 1.02rem;
  margin: 22px 0 8px;
}
.prose p { margin: 0 0 14px; color: var(--text); }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 18px;
  font-size: 0.92rem;
}
.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.prose th { background: var(--primary-tint); font-weight: 600; }
.note-box {
  background: var(--primary-tint);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  font-size: 0.9rem;
  margin: 0 0 18px;
}

/* ---------- FAQ ---------- */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.faq-item:first-child { border-top: 1px solid var(--border); }
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.98rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .chev { transition: transform 0.15s ease; flex-shrink: 0; color: var(--text-muted); }
.faq-item[open] summary .chev { transform: rotate(180deg); }
.faq-item p { margin: 10px 0 0; color: var(--text-muted); font-size: 0.92rem; }

/* ---------- Related links ---------- */
.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.related-links a {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.related-links a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 32px 0;
  background: var(--surface);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.footer-brand { font-weight: 700; color: var(--text); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); font-size: 0.88rem; }
.footer-copy { color: var(--text-muted); font-size: 0.82rem; margin-top: 10px; }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.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;
}
