/*
  WeReachOut public site.
  One idea carries the look: the ruled exercise book every sponsored student
  writes in. Content sits to the right of a blue-ink margin line; section
  headings and years hang in that margin. Everything else stays quiet.
*/

:root {
  --sky: #b5e1f4;          /* the old site's sky blue, top of the page */
  --paper: #f3f9fd;        /* page, fading from the sky */
  --paper-deep: #dfeffa;   /* light-blue bands */
  --ink: #18293a;          /* blue-black text */
  --ink-soft: #46596b;     /* secondary text */
  --sage: #22649f;         /* primary (buttons, figures): the old site's #2b75b4, deepened for contrast */
  --sage-light: #7fb6df;   /* chart bars */
  --margin-ink: #c8454f;   /* the red margin line of an exercise book */
  --link: #1d5a93;
  --marigold: #f2b84b;     /* focus ring */
  --rule: #c6dcee;         /* blue notebook ruling */
  --footer: #1d4f7c;

  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --sans: "Hind Madurai", "Segoe UI", system-ui, sans-serif;

  --margin: clamp(1rem, 4vw, 3.5rem); /* the space left of the margin line */
  --measure: 40rem;
  --column: 72rem;         /* page content column, centred */
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.15rem;
  --step-2: 1.4rem;
  --step-3: 1.75rem;
  --step-4: clamp(1.9rem, 3.4vw, 2.75rem);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper) linear-gradient(to bottom, var(--sky) 0, var(--paper) 34rem) no-repeat;
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: var(--step-4); letter-spacing: -0.01em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }
p, ul, ol, dl { margin: 0 0 1em; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

.wrap { max-width: calc(var(--column) + 2.5rem); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- header ---------- */

.site-header { border-bottom: 1px solid rgba(29, 79, 124, 0.15); background: transparent; }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 6.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink);
  font-family: var(--serif); font-size: clamp(2rem, 1.3rem + 2.2vw, 2.9rem); font-weight: 600; letter-spacing: -0.01em; margin-right: auto; gap: 0.85rem; }
.site-header nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.4rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.site-header nav a { color: var(--ink); text-decoration: none; font-weight: 500; padding: 0.35rem 0; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--link); }
.site-header nav .nav-donate { background: var(--sage); color: #fff; padding: 0.4rem 0.95rem; border-radius: 999px; }
.site-header nav .nav-donate:hover, .site-header nav .nav-donate[aria-current="page"] { background: var(--ink); box-shadow: none; }
.site-header nav .nav-signin { color: var(--link); }
.nav-toggle { display: none; }
.brand { flex-shrink: 0; }

/* Between phone and wide desktop the bigger title and menu don't fit on one line: menu goes under the title. */
@media (min-width: 861px) and (max-width: 1240px) {
  .header-inner { flex-wrap: wrap; padding-top: 0.6rem; padding-bottom: 0.4rem; }
  .site-header nav { width: 100%; }
  .site-header nav ul { gap: 0.25rem 1.6rem; }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-block; font: inherit; font-weight: 600; background: none; border: 1px solid var(--ink);
    border-radius: 999px; padding: 0.3rem 0.9rem; color: var(--ink); }
  .site-header nav { display: none; width: 100%; }
  .site-header nav.open { display: block; }
  .header-inner { flex-wrap: wrap; }
  .site-header nav ul { flex-direction: column; align-items: flex-start; padding: 0.5rem 0 1rem; gap: 0.4rem; }
}

/* ---------- the notebook margin ---------- */

.page { position: relative; }
.page::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: calc(var(--margin) - 1px); width: 2px; background: var(--margin-ink); opacity: 0.6;
}
.band { padding-block: clamp(2rem, 4.5vw, 3.25rem);
  padding-left: max(calc(var(--margin) + clamp(1rem, 2.5vw, 2rem)), calc((100% - var(--column)) / 2));
  padding-right: max(clamp(1.25rem, 4vw, 3rem), calc((100% - var(--column)) / 2)); }
.band > * { max-width: var(--column); }
.band.tinted { background: var(--paper-deep); }
.prose { max-width: var(--measure); }
.prose p, .prose li { color: var(--ink); }
.lead { font-size: var(--step-1); line-height: 1.5; color: var(--ink-soft); max-width: 36rem; }
.archive-note { font-size: 0.9rem; color: var(--ink-soft); max-width: 40rem; margin-top: 1.5rem; }

/* a heading with a date in front of it, on the same line */
.margin-note { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.margin-note > .note {
  font-family: var(--serif); font-style: italic; color: var(--link); font-size: var(--step-1);
  white-space: nowrap; line-height: 1.25;
}
.margin-note > h2 { margin: 0; }
@media (max-width: 700px) {
  :root { --margin: 1rem; }
}

/* ---------- home hero ---------- */

.hero { padding-top: clamp(2rem, 5vw, 3.5rem); padding-bottom: clamp(2rem, 5vw, 3.5rem);
  background-image: repeating-linear-gradient(to bottom, transparent 0 2.35rem, var(--rule) 2.35rem calc(2.35rem + 1px));
}
.hero h1 { max-width: 16ch; }
.hero .lead { margin-top: 1.25rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.button { display: inline-block; text-decoration: none; font-weight: 600; padding: 0.7rem 1.35rem; border-radius: 999px;
  background: var(--sage); color: #fff; border: 2px solid var(--sage); }
.button:hover { background: var(--ink); border-color: var(--ink); }
.button.quiet { background: transparent; color: var(--ink); border-color: var(--ink); }
.button.quiet:hover { background: var(--ink); color: #fff; }

/* the three-part sentence under the hero: real numbers, set as text */
.tally { font-family: var(--serif); font-size: var(--step-2); line-height: 1.35; max-width: 44rem; }
.tally strong { font-weight: 600; color: var(--sage); }
.as-of { font-size: var(--step--1); color: var(--ink-soft); }

/* ---------- steps (a real sequence) ---------- */

.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 1.75rem; max-width: 44rem; }
.steps > li { counter-increment: step; position: relative; }
.steps > li::before {
  content: counter(step); position: absolute; right: calc(100% + clamp(1rem, 3vw, 2.25rem) + 0.75rem); top: -0.1em;
  font-family: var(--serif); font-size: var(--step-2); color: var(--link); line-height: 1;
}
.steps h3 { margin-bottom: 0.25rem; }
@media (max-width: 700px) {
  .steps > li { padding-left: 2.25rem; }
  .steps > li::before { right: auto; left: 0; }
}

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 2rem 3rem; }
.split h3 { color: var(--sage); }

.quote { font-family: var(--serif); font-style: italic; font-size: var(--step-1); max-width: 36rem; color: var(--ink-soft); }

/* ---------- impact chart: the register of years ---------- */

.register { list-style: none; padding: 0; margin: 1.5rem 0 0; max-width: 46rem; }
.register li { display: grid; grid-template-columns: 1fr 3.5rem; align-items: center; gap: 0.75rem; position: relative;
  border-bottom: 1px solid var(--rule); padding: 0.2rem 0; }
.register .year { position: absolute; right: calc(100% + clamp(1rem, 3vw, 2.25rem) + 0.75rem); font-family: var(--serif);
  color: var(--link); font-variant-numeric: tabular-nums; }
.register .bar { height: 0.9rem; background: var(--sage-light); border-radius: 0 3px 3px 0; min-width: 2px; }
.register li.partial .bar { background: repeating-linear-gradient(90deg, var(--sage-light) 0 6px, transparent 6px 9px); }
.register .count { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-soft); }
/* In a right-hand column the years can't sit in the margin, so they get their own column. */
.register.inline li { grid-template-columns: 3rem 1fr 3rem; }
.register.inline .year { position: static; }
/* Room between the tilted photo on the left and the chart's years. */
.two-col.chart-right { column-gap: clamp(3rem, 6vw, 5.5rem); }
.two-col.chart-right .register.inline { margin-top: 0.25rem; }
@media (max-width: 700px) {
  .register li { grid-template-columns: 3rem 1fr 3rem; }
  .register .year { position: static; }
}

/* ---------- students in need ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0 1.5rem; }
.filters label { display: grid; gap: 0.2rem; font-weight: 500; font-size: var(--step--1); }
.filters select { font: inherit; padding: 0.4rem 0.6rem; border: 1px solid var(--ink-soft); border-radius: 6px; background: #fff; min-width: 12rem; }
.student-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: 1rem; }
.student { background: #fff; border: 1px solid var(--rule); border-left: 3px solid var(--link); padding: 1rem 1.1rem; border-radius: 2px 8px 8px 2px; }
.student .name { font-family: var(--serif); font-size: var(--step-1); font-weight: 600; margin: 0 0 0.1rem; }
.student .course { font-family: var(--serif); font-size: var(--step-1); font-weight: 600; margin: 0 0 0.2rem; }
.student .name + .course { font-size: var(--step-0); font-weight: 400; color: var(--ink-soft); }
.student dl { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.75rem; font-size: var(--step--1); margin: 0.5rem 0 0.9rem; }
.student dt { color: var(--ink-soft); }
.student dd { margin: 0; }
.student .ref { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: var(--step--1); }
.empty { border: 1px dashed var(--ink-soft); padding: 1.25rem 1.4rem; max-width: 38rem; border-radius: 8px; background: #fff; }

/* ---------- FAQ ---------- */

.faq details { border-bottom: 1px solid var(--rule); padding: 0.9rem 0; max-width: 44rem; }
.faq summary { cursor: pointer; font-weight: 600; font-size: var(--step-0); list-style-position: outside; }
.faq details[open] summary { color: var(--sage); }
.faq details > div { padding-top: 0.6rem; }
.faq h2 { margin-top: 2rem; font-size: var(--step-2); }
.faq h2:first-child { margin-top: 0; }

/* ---------- lists of things (team, files, newsletters) ---------- */

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.4rem 2rem; list-style: none; padding: 0; }
.people li { padding: 0.35rem 0; border-bottom: 1px solid var(--rule); }
.people span { display: block; color: var(--ink-soft); font-size: var(--step--1); }

.files { list-style: none; padding: 0; max-width: 44rem; }
.files li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--rule); }
.files .kind { color: var(--ink-soft); font-size: var(--step--1); white-space: nowrap; }

.year-group { margin-bottom: 1.5rem; }
.year-group h3 { font-size: var(--step-0); font-family: var(--sans); font-weight: 600; margin: 0 0 0.3rem; }
.year-group ul { list-style: none; padding: 0; margin: 0; }
.year-group li { padding: 0.15rem 0; }

.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 2rem; max-width: 52rem; }
.contact-grid address { font-style: normal; }

.pay-list { list-style: none; padding: 0; max-width: 44rem; display: grid; gap: 1.5rem; }
.pay-list h3 { margin-bottom: 0.2rem; }

/* ---------- footer ---------- */

.site-footer { background: var(--footer); color: #e6f0f8; margin-top: 0; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem; padding-top: 3rem; padding-bottom: 2rem; }
.footer-grid h2 { font-family: var(--sans); font-size: var(--step-0); font-weight: 600; margin-bottom: 0.6rem; color: #fff; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.footer-brand { font-family: var(--serif); font-size: var(--step-2); color: #fff; margin-bottom: 0.4rem; }
.footer-base { border-top: 1px solid rgba(255, 255, 255, 0.25); padding-top: 1rem; padding-bottom: 2rem; font-size: var(--step--1); }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: no-preference) {
  .register .bar { transform-origin: left; animation: grow 700ms ease-out both; }
  @keyframes grow { from { transform: scaleX(0); } }
}

@media print {
  .site-header nav, .nav-toggle, .site-footer { display: none; }
  .page::before { display: none; }
}


/* ---------- columns and photos ---------- */

.two-col { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.two-col.top { align-items: start; }
.two-col.wide-left { grid-template-columns: 1.4fr 1fr; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.25rem, 3vw, 2.25rem); }
.four-col { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(1rem, 2.5vw, 2rem); }
@media (max-width: 900px) {
  .two-col, .two-col.wide-left { grid-template-columns: 1fr; }
  .three-col, .four-col { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .three-col, .four-col { grid-template-columns: 1fr; } }

.photo { margin: 0; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }
.photo.tall img { aspect-ratio: 4 / 5; }
.photo.wide img { aspect-ratio: 16 / 9; }
.hero .photo.tall { width: min(100%, 25rem); justify-self: center; align-self: center; }
.photo figcaption { font-size: var(--step--1); color: var(--ink-soft); margin-top: 0.4rem; }

/* a photo pinned like a print in an exercise book */
.pinned { position: relative; padding: 0.6rem; background: #fff; box-shadow: 0 1px 2px rgba(28, 38, 32, 0.12), 0 8px 24px rgba(28, 38, 32, 0.08); transform: rotate(-1.2deg); }
.pinned figcaption { padding: 0.35rem 0.1rem 0; }
@media (max-width: 900px) { .pinned { transform: none; } }

.card { background: #fff; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }
.card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.card .card-body { padding: 1rem 1.1rem 1.2rem; }
.card h3 { margin-bottom: 0.3rem; color: var(--sage); }
.card p { margin: 0; font-size: 0.95rem; }
.card.preferred { border: 2px solid var(--sage); }
.card .card-flag { display: inline-block; margin: 0 0 0.6rem; padding: 0.15rem 0.6rem; border-radius: 999px;
  background: var(--sage); color: #fff; font-size: var(--step--1); font-weight: 600; }

.figures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 0; }
.figures div { border-left: 2px solid var(--link); padding: 0.1rem 0 0.1rem 0.9rem; }
.figures dt { font-family: var(--serif); font-size: var(--step-3); font-weight: 600; color: var(--sage); line-height: 1.1; }
.figures dd { margin: 0.2rem 0 0; color: var(--ink-soft); font-size: 0.95rem; }
@media (max-width: 760px) { .figures { grid-template-columns: 1fr 1fr; } }

.steps.grid { grid-template-columns: repeat(3, 1fr); max-width: none; gap: 2rem 2.5rem; }
/* The number sits on the title's line; the text below runs the full width. */
.steps.grid > li { padding: 1rem 0 0; border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: auto 1fr; column-gap: 0.6rem; align-items: baseline; align-content: start; }
.steps.grid > li::before { position: static; grid-column: 1; }
.steps.grid > li > h3 { grid-column: 2; margin: 0 0 0.35rem; }
.steps.grid > li > :not(h3) { grid-column: 1 / -1; }
@media (max-width: 900px) { .steps.grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps.grid { grid-template-columns: 1fr; } }

.faq-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 3rem; }
.faq-cols .faq-group { break-inside: avoid; }
@media (max-width: 900px) { .faq-cols { grid-template-columns: 1fr; } }

.photo-strip { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0.75rem; }
.photo-strip img { width: 100%; height: 100%; aspect-ratio: auto; min-height: 12rem; max-height: 18rem; object-fit: cover; border-radius: 4px; display: block; }
@media (max-width: 700px) { .photo-strip { grid-template-columns: 1fr 1fr; } .photo-strip > :first-child { grid-column: 1 / -1; } }

.photo-note { font-size: var(--step--1); color: var(--ink-soft); }

.tile { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; margin-bottom: 0.75rem; }
#newsletters { columns: 3 15rem; column-gap: 2.5rem; }
#newsletters .year-group { break-inside: avoid; }

.faq-group { margin-bottom: 2.25rem; }

.figures.five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .figures.five { grid-template-columns: 1fr 1fr; } }

/* ---------- impact carousel (home) ---------- */

.stat-carousel { max-width: 46rem; }
.stat-viewport { overflow: hidden; }
.stat-track { list-style: none; margin: 0; padding: 0; display: flex; transition: transform 600ms cubic-bezier(0.22, 0.61, 0.36, 1); }
.stat-slide { flex: 0 0 100%; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.5rem 1.75rem; padding: 0.5rem 0 0.5rem 1.25rem; border-left: 3px solid var(--link); }
.stat-number { font-family: var(--serif); font-weight: 600; font-size: clamp(2.6rem, 6vw, 4.25rem); line-height: 1; color: var(--sage); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-label { font-size: var(--step-1); color: var(--ink); max-width: 22rem; line-height: 1.4; }
@media (max-width: 560px) { .stat-slide { grid-template-columns: 1fr; } }
.stat-controls { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0 0.75rem; }
.stat-controls button { font: inherit; cursor: pointer; background: transparent; color: var(--ink); border: 1px solid var(--ink-soft); border-radius: 999px; }
.stat-prev, .stat-next { width: 2.25rem; height: 2.25rem; font-size: 1.4rem !important; line-height: 1; padding: 0; }
.stat-pause { padding: 0.2rem 0.8rem; font-size: var(--step--1) !important; margin-left: auto; }
.stat-controls button:hover { background: var(--ink); color: #fff; }
.stat-dots { display: flex; gap: 0.45rem; }
.stat-dots button { width: 0.7rem; height: 0.7rem; padding: 0; border: 1px solid var(--link) !important; }
.stat-dots button[aria-current="true"] { background: var(--link); }
@media (prefers-reduced-motion: reduce) { .stat-track { transition: none; } }

/* carousel inside the hero: sits on the ruled paper, a little smaller */
.hero .stat-carousel { margin-top: 2rem; }
.hero .stat-number { font-size: clamp(2.2rem, 4.5vw, 3.25rem); }
.hero .stat-label { font-size: var(--step-0); }
.hero .stat-controls { margin: 0.9rem 0 0.4rem; }
.hero .stat-pause { margin-left: 0.5rem; }
.hero .as-of { display: inline-block; }
.hero .two-col { grid-template-columns: 1.1fr 1fr; }
.hero .stat-carousel { max-width: 34rem; }
@media (max-width: 900px) { .hero .two-col { grid-template-columns: 1fr; } }

/* columns must be allowed to shrink, or the carousel track widens them */
.two-col > *, .three-col > *, .four-col > * { min-width: 0; }

.brand img { border-radius: 50%; width: clamp(54px, 3.5vw + 36px, 74px); height: auto; }
.footer-logo img { display: block; background: #fff; padding: 0.4rem 0.6rem; border-radius: 6px; max-width: 100%; height: auto; }
.emblem { margin: 0; justify-self: center; max-width: 22rem; text-align: center; }
.emblem img { width: 100%; height: auto; border-radius: 8px; box-shadow: 0 8px 24px rgba(28, 38, 32, 0.12); }
.emblem figcaption { font-size: var(--step--1); color: var(--ink-soft); margin-top: 0.5rem; }
