/* ============================================================
   Foundations of Finance · Amherst College
   Design system: every component pulls from these tokens.
   Aesthetic: collegiate prospectus. Flat color, hairline rules,
   serif display, no shadows, no gradients.
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  /* Palette (raw values live only here) */
  --purple-950: #221238;
  --purple-900: #2f184e;   /* brand, sampled from FOF banner art */
  --purple-800: #3b2363;
  --purple-700: #4a2f7a;
  --purple-300: #b9a6dd;
  --purple-100: #e9e2f4;
  --cream-50:  #faf8f3;
  --cream-100: #f5f1e8;
  --cream-200: #ece6d8;
  --sand-300:  #d9d1bf;
  --ink-900:   #201a2e;
  --ink-600:   #5c5470;
  --green-700: #2e6b4f;
  --gold-700:  #8a5f16;
  --red-700:   #8c2f39;
  --blue-700:  #34557d;

  /* Semantic color tokens — components use ONLY these */
  --surface:          var(--cream-50);
  --surface-alt:      var(--cream-100);
  --surface-raised:   #ffffff00; /* elevation is border-based, see --border */
  --surface-inverse:  var(--purple-900);
  --surface-inverse-deep: var(--purple-950);
  --text-primary:     var(--ink-900);
  --text-muted:       var(--ink-600);
  --text-inverse:     var(--cream-100);
  --text-inverse-muted: var(--purple-300);
  --border:           var(--sand-300);
  --border-strong:    var(--ink-900);
  --border-inverse:   var(--purple-700);
  --accent:           var(--purple-900);
  --accent-hover:     var(--purple-800);
  --accent-active:    var(--purple-950);
  --accent-on-dark:   var(--purple-300);
  --success:          var(--green-700);
  --warning:          var(--gold-700);
  --danger:           var(--red-700);
  --info:             var(--blue-700);
  --focus-ring:       var(--purple-700);

  /* Fluid type scale (minor third, clamp everywhere) */
  --step--1: clamp(0.8125rem, 0.79rem + 0.11vw, 0.875rem);
  --step-0:  clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
  --step-1:  clamp(1.1875rem, 1.12rem + 0.33vw, 1.375rem);
  --step-2:  clamp(1.4375rem, 1.32rem + 0.57vw, 1.75rem);
  --step-3:  clamp(1.75rem, 1.55rem + 0.98vw, 2.25rem);
  --step-4:  clamp(2.125rem, 1.8rem + 1.63vw, 3rem);
  --step-5:  clamp(2.55rem, 2.02rem + 2.65vw, 4rem);

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;
  --sp-10: 8rem;

  /* Radius scale — deliberately restrained */
  --radius-0: 0;
  --radius-1: 2px;

  /* Border / elevation rules */
  --rule: 1px solid var(--border);
  --rule-strong: 1px solid var(--border-strong);
  --rule-inverse: 1px solid var(--border-inverse);

  /* Type families */
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;

  --measure: 62ch;
  --page-max: 72rem;
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 var(--sp-4);
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}
h1 { font-size: var(--step-5); max-width: 18ch; }
h2 { font-size: var(--step-3); max-width: 24ch; }
h3 { font-size: var(--step-1); max-width: 32ch; }
p  { margin: 0 0 var(--sp-4); max-width: var(--measure); }
a  { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover  { color: var(--accent-hover); text-decoration-thickness: 2px; }
a:active { color: var(--accent-active); }
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-1);
}
::selection { background: var(--purple-100); }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--surface-inverse); color: var(--text-inverse);
  padding: var(--sp-2) var(--sp-4); z-index: 100;
}
.skip-link:focus { left: var(--sp-2); }

/* ---------- 3. Layout primitives ---------- */
.wrap { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--sp-5); }
.section { padding: var(--sp-9) 0; }
.section + .section { border-top: var(--rule); }
.section--inverse {
  background: var(--surface-inverse);
  color: var(--text-inverse);
}
.section--inverse h2, .section--inverse h3 { color: var(--text-inverse); }
.section--inverse p { color: var(--text-inverse-muted); }
.section--alt { background: var(--surface-alt); }

.overline {
  display: block;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.section--inverse .overline { color: var(--accent-on-dark); }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--sp-7);
  align-items: start;
}
@media (max-width: 47.9rem) {
  .two-col { grid-template-columns: 1fr; gap: var(--sp-5); }
}

/* ---------- 4. Header / nav ---------- */
.site-header {
  background: var(--surface-inverse-deep);
  border-bottom: var(--rule-inverse);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 3.75rem; gap: var(--sp-5);
}
.brand {
  display: flex; align-items: center; gap: var(--sp-3);
  color: var(--text-inverse); text-decoration: none;
  font-family: var(--font-display); font-size: var(--step-0); font-weight: 600;
  letter-spacing: 0.02em;
}
.brand:hover { color: var(--accent-on-dark); }
.brand img { width: 2rem; height: 2rem; border-radius: 50%; }
.site-nav ul {
  display: flex; gap: var(--sp-5); list-style: none; margin: 0; padding: 0;
}
.site-nav a {
  color: var(--text-inverse-muted); text-decoration: none;
  font-size: var(--step--1); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: var(--sp-2) 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text-inverse); border-bottom-color: var(--border-inverse); }
.site-nav a[aria-current="page"] { color: var(--text-inverse); border-bottom-color: var(--accent-on-dark); }
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border-inverse);
  color: var(--text-inverse); font: inherit;
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-1);
  cursor: pointer;
}
.nav-toggle:hover { background: var(--purple-800); }
@media (max-width: 47.9rem) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--surface-inverse-deep); border-bottom: var(--rule-inverse); }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; padding: var(--sp-3) var(--sp-5) var(--sp-5); }
  .site-nav a { display: block; padding: var(--sp-3) 0; border-bottom: 1px solid var(--purple-800); }
}

/* ---------- 5. Hero ---------- */
.hero {
  background: var(--surface-inverse);
  color: var(--text-inverse);
  border-bottom: var(--rule-strong);
}
.hero-banner img { width: 100%; height: auto; border-bottom: var(--rule-inverse); }
.hero-inner { padding: var(--sp-8) 0 var(--sp-9); }
.hero h1 { color: var(--text-inverse); }
.hero .lede {
  font-size: var(--step-1);
  color: var(--text-inverse-muted);
  max-width: 48ch;
}
.cta-row { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-6); }

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-body); font-size: var(--step-0); font-weight: 600;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-1);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.btn-primary { background: var(--accent); color: var(--cream-50); border-color: var(--accent); }
.btn-primary:hover  { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--cream-50); }
.btn-primary:active { background: var(--accent-active); border-color: var(--accent-active); }
.btn-primary:disabled, .btn-primary[aria-disabled="true"] {
  background: var(--text-muted); border-color: var(--text-muted);
  cursor: not-allowed; opacity: 0.7;
}
.btn-secondary { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-secondary:hover  { background: var(--purple-100); color: var(--accent-hover); }
.btn-secondary:active { background: var(--purple-300); }
.hero .btn-primary { background: var(--cream-100); color: var(--purple-900); border-color: var(--cream-100); }
.hero .btn-primary:hover { background: var(--cream-50); color: var(--purple-950); }
.hero .btn-primary:active { background: var(--sand-300); }
.hero .btn-secondary { color: var(--text-inverse); border-color: var(--border-inverse); }
.hero .btn-secondary:hover { background: var(--purple-800); }
.hero .btn-secondary:active { background: var(--purple-950); }

.btn .spinner {
  width: 1em; height: 1em;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  display: none;
  animation: spin 700ms linear infinite;
}
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading { pointer-events: none; opacity: 0.85; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn .spinner { animation-duration: 1.4s; }
  html { scroll-behavior: auto; }
}

/* ---------- 7. Stats strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  border-top: var(--rule-strong);
}
.stat {
  border-bottom: var(--rule);
  border-right: var(--rule);
  padding: var(--sp-5) var(--sp-5) var(--sp-5) 0;
  padding-left: var(--sp-4);
}
.stat:first-child { padding-left: 0; }
.stat dt {
  font-size: var(--step--1); font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.stat dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat .stat-note { display: block; font-family: var(--font-body); font-size: var(--step--1); color: var(--text-muted); margin-top: var(--sp-2); }
.stat:last-child { border-right: none; }
@media (max-width: 47.9rem) {
  .stat { border-right: none; padding-left: 0; }
}

.firm-list {
  margin: var(--sp-6) 0 0; padding: var(--sp-4) 0 0;
  border-top: var(--rule);
  font-family: var(--font-display);
  font-size: var(--step-1);
  line-height: 1.9;
  color: var(--text-primary);
  max-width: none;
}
.firm-list span { white-space: nowrap; }
.firm-list .sep { color: var(--border); padding: 0 var(--sp-3); }

/* ---------- 8. Numbered editorial list ---------- */
.numbered { list-style: none; margin: 0; padding: 0; counter-reset: item; }
.numbered > li {
  counter-increment: item;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: var(--sp-5);
  padding: var(--sp-5) 0;
  border-top: var(--rule);
}
.numbered > li:last-child { border-bottom: var(--rule); }
.numbered > li::before {
  content: counter(item, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: var(--step-2);
  color: var(--text-muted);
  line-height: 1.2;
}
.numbered h3 { margin-bottom: var(--sp-2); }
.numbered p { margin-bottom: 0; }
.section--inverse .numbered > li { border-color: var(--border-inverse); }
.section--inverse .numbered > li::before { color: var(--accent-on-dark); }

/* Plain content lists (no checkmarks, quiet square marker) */
.plain-list { margin: 0 0 var(--sp-4); padding: 0; list-style: none; max-width: var(--measure); }
.plain-list li { padding: var(--sp-2) 0 var(--sp-2) var(--sp-5); position: relative; }
.plain-list li::before {
  content: ""; position: absolute; left: 0; top: 1.05em;
  width: 0.45em; height: 1px; background: var(--text-muted);
}

/* ---------- 9. People ---------- */
.person-list { margin: 0; padding: 0; list-style: none; }
.person {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: var(--sp-4);
  align-items: baseline;
  padding: var(--sp-4) 0; border-top: var(--rule);
}
.person:last-child { border-bottom: var(--rule); }
.person .person-name { font-family: var(--font-display); font-size: var(--step-1); }
.person .person-role { color: var(--text-muted); font-size: var(--step--1); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-1);
  padding: var(--sp-6);
  color: var(--text-muted);
  max-width: var(--measure);
}
.empty-state p:last-child { margin-bottom: 0; }

/* ---------- 10. Forms ---------- */
.form { max-width: 34rem; }
.field { margin-bottom: var(--sp-5); }
.field label {
  display: block; font-weight: 600; font-size: var(--step--1);
  letter-spacing: 0.05em; margin-bottom: var(--sp-2);
}
.field .hint { font-size: var(--step--1); color: var(--text-muted); margin: calc(-1 * var(--sp-1)) 0 var(--sp-2); }
input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  font: inherit; color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-1);
  padding: 0.65rem 0.8rem;
  transition: border-color 120ms ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--text-muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 1px;
  border-color: var(--focus-ring);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-alt); color: var(--text-muted); cursor: not-allowed;
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field-error {
  display: none;
  color: var(--danger); font-size: var(--step--1); font-weight: 600;
  margin-top: var(--sp-2);
}
.field.has-error .field-error { display: block; }
.checks { display: grid; gap: var(--sp-2); }
.check { display: flex; gap: var(--sp-3); align-items: flex-start; font-weight: 400; }
.check input { width: 1.05rem; height: 1.05rem; margin-top: 0.22rem; accent-color: var(--accent); flex: none; }
.form-status { margin-top: var(--sp-4); font-weight: 600; display: none; }
.form-status.is-error { display: block; color: var(--danger); }
.hp-field { position: absolute; left: -9999px; }

/* ---------- 11. Notices ---------- */
.notice {
  border: var(--rule);
  border-radius: var(--radius-1);
  padding: var(--sp-4) var(--sp-5);
  max-width: var(--measure);
  font-size: var(--step--1);
}
.notice strong:first-child { display: block; margin-bottom: var(--sp-1); }
.notice--info    { border-color: var(--info);    color: var(--text-primary); }
.notice--success { border-color: var(--success); }
.notice--warning { border-color: var(--warning); }

/* ---------- 12. Footer ---------- */
.site-footer {
  background: var(--surface-inverse-deep);
  color: var(--text-inverse-muted);
  border-top: var(--rule-strong);
  padding: var(--sp-8) 0 var(--sp-6);
  font-size: var(--step--1);
}
.footer-grid {
  display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr) minmax(0,1fr);
  gap: var(--sp-7);
  margin-bottom: var(--sp-6);
}
@media (max-width: 47.9rem) { .footer-grid { grid-template-columns: 1fr; gap: var(--sp-5); } }
.site-footer h2 {
  font-size: var(--step-0); color: var(--text-inverse);
  letter-spacing: 0.14em; text-transform: uppercase;
  font-family: var(--font-body); font-weight: 600;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: var(--sp-2); }
.site-footer a { color: var(--text-inverse-muted); }
.site-footer a:hover { color: var(--text-inverse); }
.footer-legal {
  border-top: var(--rule-inverse);
  padding-top: var(--sp-4);
  display: flex; flex-wrap: wrap; gap: var(--sp-4); justify-content: space-between;
}
.footer-legal p { margin: 0; max-width: none; }

/* ---------- 13. Sticky mobile CTA ---------- */
.mobile-cta {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: var(--surface-inverse-deep);
  border-top: var(--rule-inverse);
  padding: var(--sp-3) var(--sp-5);
}
.mobile-cta .btn { width: 100%; background: var(--cream-100); color: var(--purple-900); border-color: var(--cream-100); }
.mobile-cta .btn:hover { background: var(--cream-50); }
@media (max-width: 47.9rem) {
  .mobile-cta.is-visible { display: block; }
  body.has-mobile-cta { padding-bottom: 4.5rem; }
}

/* ---------- 14. Misc ---------- */
.error-page { text-align: left; padding: var(--sp-10) 0; }
.error-code {
  font-family: var(--font-display);
  font-size: var(--step-5);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.prose h2 { margin-top: var(--sp-7); }
.prose h3 { margin-top: var(--sp-6); }
.updated-note { color: var(--text-muted); font-size: var(--step--1); }
.seal-figure { max-width: 16rem; }
.seal-figure img { border-radius: 50%; border: var(--rule); }
