/* St. Nicholas Legacy Fund — shared styles */
:root {
  /* Palette taken from stnicholasfreedom.org theme */
  --navy: #31598A;         /* parish primary blue */
  --navy-deep: #213B5C;    /* parish dark blue */
  --navy-darkest: #101E2E;
  --blue-mid: #4074B3;
  --blue-light: #AABED8;
  --gold-bright: #FFCB05;  /* parish gold (fills, on dark backgrounds) */
  --gold-soft: #FFD84D;
  --gold: #8A6B00;         /* gold dark enough for text on light backgrounds */
  --green: #99CC33;        /* parish green */
  --green-deep: #4E6B16;
  --green-soft: #DAEEB2;
  --cream: #F7F8F4;
  --paper: #ffffff;
  --ink: #1f2733;
  --muted: #56606e;
  --line: #E0E5EC;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 30, 46, .06), 0 8px 24px rgba(16, 30, 46, .08);
  --serif: "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { color: var(--navy); text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold); }

h1, h2, h3 { font-family: var(--serif); color: var(--navy); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h3 { font-size: 1.4rem; }
p { margin: 0 0 1em; }

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 32px); margin-inline: auto; }

.eyebrow {
  font-family: var(--sans);
  font-size: .8rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: .6rem;
}
.lead { font-size: 1.2rem; color: var(--muted); }
.center { text-align: center; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: #fff; padding: 8px 12px; z-index: 10; }

/* ---------- Top nav ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: rgba(33, 59, 92, .97);
  border-bottom: 3px solid var(--gold-bright);
  backdrop-filter: blur(6px);
  color: #fff;
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.brand { font-family: var(--serif); font-size: 1.25rem; color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand svg { flex: none; }
.brand:hover { color: var(--gold-soft); }
.topbar nav { display: flex; gap: 20px; overflow-x: auto; }
.topbar nav a { color: #d9deea; text-decoration: none; font-size: .95rem; white-space: nowrap; }
.topbar nav a:hover { color: var(--gold-soft); }
@media (max-width: 760px) { .topbar nav { display: none; } }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(255, 203, 5, .16), transparent 70%),
    linear-gradient(180deg, var(--navy-deep), var(--navy));
  color: #fff;
  padding: 72px 0 88px;
  text-align: center;
}
.hero h1 { color: #fff; margin-bottom: .2em; }
.hero .tagline { font-family: var(--serif); font-size: clamp(1.3rem, 3vw, 1.8rem); color: var(--gold-soft); font-style: italic; margin-bottom: 1.6rem; }
.hero .intro { max-width: 640px; margin: 0 auto 2.2rem; color: #d9deea; font-size: 1.15rem; }
.hero .eyebrow { color: var(--gold-soft); }

/* ---------- Progress ---------- */
.progress-card {
  background: var(--paper); color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px clamp(18px, 4vw, 40px) 32px;
  border-top: 5px solid var(--gold-bright);
  max-width: 820px; margin: 0 auto; text-align: left;
}
.progress-stats { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 18px; }
.stat .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.stat .value { font-family: var(--serif); font-size: clamp(1.8rem, 5vw, 2.6rem); color: var(--navy); font-weight: 700; line-height: 1.1; }
.stat.pct .value { color: var(--green-deep); }
.stat.right { text-align: right; }

.bar { position: relative; height: 26px; background: #E3E9F1; border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #F2B900, var(--gold-bright));
  border-radius: 999px;
  transition: width 1.6s cubic-bezier(.2, .8, .2, 1);
}
.ticks { position: relative; height: 34px; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ticks span::before { content: ""; position: absolute; left: 50%; top: -10px; width: 1px; height: 8px; background: var(--blue-light); }
.ticks span:first-child { transform: none; }
.ticks span:first-child::before { left: 0; }
.ticks span:last-child { transform: translateX(-100%); }
.ticks span:last-child::before { left: auto; right: 0; }
.ticks span.reached { color: var(--green-deep); font-weight: 700; }
.asof { font-size: .85rem; color: var(--muted); margin: 6px 0 0; }
.remaining { margin: 10px 0 0; font-size: 1rem; }

/* ---------- Sections ---------- */
section { padding: 80px 0; }
section.alt { background: var(--paper); border-block: 1px solid var(--line); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 44px; }
.section-head h2::after { content: ""; display: block; width: 64px; height: 4px; border-radius: 2px; background: var(--gold-bright); margin: 16px auto 0; }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3 { grid-template-columns: 1fr; } }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 24px; box-shadow: var(--shadow);
}
section.alt .card { background: var(--cream); box-shadow: none; }
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green-deep); margin-bottom: 14px; }
.icon svg { width: 22px; height: 22px; }

/* ---------- The math ---------- */
.equation {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 14px 18px; margin: 10px auto 26px;
}
.eq-box {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 22px; text-align: center; min-width: 170px; box-shadow: var(--shadow);
}
.eq-box .big { font-family: var(--serif); font-size: 2.2rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.eq-box .small { font-size: .9rem; color: var(--muted); }
.eq-box.result { background: var(--navy); border-color: var(--navy); }
.eq-box.result .big { color: var(--gold-soft); }
.eq-box.result .small { color: #d9deea; }
.eq-op { font-family: var(--serif); font-size: 2.2rem; color: var(--gold); }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin-top: 40px; }
.compare > div { padding: 26px 24px; }
.compare .today { background: #EDF1F6; }
.compare .future { background: var(--navy); color: #e8ecf4; }
.compare .future h3 { color: var(--gold-soft); }
.compare ul { margin: 0; padding-left: 1.1em; }
.compare li { margin-bottom: .4em; }
@media (max-width: 640px) { .compare { grid-template-columns: 1fr; } }

/* ---------- Calculator ---------- */
.calc { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.calc-input { padding: 28px clamp(18px, 4vw, 36px); border-bottom: 1px solid var(--line); }
.calc-input label { display: block; font-weight: 700; color: var(--navy); margin-bottom: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.presets button {
  font: inherit; font-size: .95rem; cursor: pointer;
  border: 1px solid var(--line); background: var(--cream); color: var(--navy);
  border-radius: 999px; padding: 6px 14px;
}
.presets button:hover { border-color: var(--gold-bright); }
.presets button[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.custom { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.money-input { position: relative; }
.money-input span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money-input input {
  font: inherit; font-size: 1.1rem; width: 180px; padding: 8px 12px 8px 26px;
  border: 1px solid #cfc6b3; border-radius: 10px; background: #fff; color: var(--ink);
}
.money-input input:focus, .presets button:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 1px; }
.calc-out { display: grid; grid-template-columns: 1fr 1fr; }
.plan { padding: 26px clamp(18px, 4vw, 36px); }
.plan + .plan { border-left: 1px solid var(--line); }
.plan h3 { font-size: 1.25rem; }
.plan .sub { color: var(--muted); font-size: .95rem; margin-bottom: 14px; }
.plan dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.plan dt { color: var(--muted); }
.plan dd { margin: 0; font-weight: 700; color: var(--navy); text-align: right; font-variant-numeric: tabular-nums; }
.plan dd.hi { font-family: var(--serif); font-size: 1.5rem; line-height: 1.1; }
@media (max-width: 680px) { .calc-out { grid-template-columns: 1fr; } .plan + .plan { border-left: 0; border-top: 1px solid var(--line); } }
.impact { background: var(--green-deep); color: #f2f7e6; padding: 20px clamp(18px, 4vw, 36px); font-size: 1.05rem; }
.impact strong { color: #fff; }
.note { font-size: .92rem; color: var(--muted); margin-top: 16px; }

details.table-toggle { margin-top: 22px; }
details.table-toggle summary { cursor: pointer; color: var(--navy); font-weight: 600; }
.table-scroll { overflow-x: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .95rem; }
th, td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--navy); color: #fff; font-weight: 600; font-size: .85rem; }
th:first-child, td:first-child { text-align: left; }
tbody tr:nth-child(even) { background: #F4F7FA; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Protections ---------- */
.protect { display: flex; gap: 16px; align-items: flex-start; }
.protect .icon { flex: none; margin: 0; }
.protect h3 { font-size: 1.2rem; font-family: var(--sans); font-weight: 700; margin-bottom: .2em; }
.protect p { color: var(--muted); font-size: 1rem; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; position: relative; padding: 14px 18px 14px 62px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 50%; background: var(--gold-bright); color: var(--navy-darkest);
  display: grid; place-items: center; font-weight: 700;
}

/* ---------- FAQ ---------- */
.faq details { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
section.alt .faq details { background: var(--cream); }
.faq summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--navy); list-style: none; position: relative; padding-right: 48px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--gold); }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 20px 16px; color: var(--muted); }
.faq details > div p:last-child { margin-bottom: 0; }

/* ---------- Quote / closing ---------- */
.quote {
  font-family: var(--serif); font-size: clamp(1.5rem, 3.6vw, 2.2rem); font-style: italic;
  color: var(--navy); text-align: center; max-width: 820px; margin: 0 auto; line-height: 1.35;
}
.quote::before, .quote::after { color: var(--gold); }
.ornament { display: block; margin: 0 auto 18px; color: var(--gold); }

.cta { background: linear-gradient(180deg, var(--navy), var(--navy-deep)); color: #e8ecf4; text-align: center; }
.cta h2 { color: #fff; }
.cta p { color: #d9deea; }
.btn {
  display: inline-block; font-weight: 700; text-decoration: none; border-radius: 999px;
  padding: 12px 24px; margin: 6px; border: 2px solid var(--gold-bright);
}
.btn-gold { background: var(--gold-bright); color: var(--navy-darkest); }
.btn-gold:hover { background: #E6B600; color: var(--navy-darkest); }
.btn-ghost { color: var(--gold-soft); }
.btn-ghost:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.contact-lines { margin-top: 18px; font-size: 1.05rem; }
.contact-lines a { color: var(--gold-soft); }

.signers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 36px; text-align: center; }
.signers div { font-family: var(--serif); font-size: 1.2rem; color: #fff; }
.signers small { display: block; font-family: var(--sans); font-size: .85rem; color: #aab3c6; }

footer { background: var(--navy-darkest); color: #9ea8bd; font-size: .9rem; padding: 28px 0; text-align: center; }
footer a { color: #d9deea; }

/* ---------- Bylaws page ---------- */
.doc { border-top: 5px solid var(--gold-bright) !important; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(22px, 5vw, 56px); margin: 40px auto 60px; }
.doc h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); text-align: center; }
.doc .subtitle { text-align: center; color: var(--muted); margin-bottom: 2rem; }
.doc h2 { font-size: 1.6rem; margin-top: 1.8em; padding-top: .6em; border-top: 1px solid var(--line); }
.doc h3 { font-size: 1.2rem; font-family: var(--sans); font-weight: 700; margin-top: 1.2em; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin-bottom: .35em; }
.toc { background: var(--cream); border-radius: 12px; padding: 18px 24px; margin-bottom: 1rem; }
.toc ol { margin: 0; columns: 2; column-gap: 32px; }
@media (max-width: 600px) { .toc ol { columns: 1; } }
.adopted { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 3px solid var(--gold-bright); }
.adopted ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 20px; }
.print-btn { font: inherit; cursor: pointer; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 16px; color: var(--navy); }

.hidden { display: none !important; }

@media print {
  body { background: #fff; font-size: 12pt; }
  .topbar, .no-print, footer { display: none !important; }
  .doc { box-shadow: none; border: 0; margin: 0; padding: 0; }
  section { padding: 24px 0; }
  .hero { background: #fff; color: #000; padding: 20px 0; }
  .hero h1, .hero .tagline, .hero .intro { color: #000; }
  .bar-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 520px) {
  .progress-stats { display: grid; grid-template-columns: 1fr auto; }
  .stat.right { text-align: left; grid-column: 1 / -1; }
  .stat.pct { text-align: right; }
}
