/* ==========================================================================
   Horizons Intermediary
   Design system. Light and dark themes, both driven from one token set.
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------ */

:root {
  /* Brand */
  --gold:        #ebd683;
  --gold-deep:   #8a6d2f;   /* legible gold for text on light grounds */
  --gold-soft:   rgba(235, 214, 131, 0.16);

  /* Ground and ink */
  --bg:          #f7f5ef;
  --bg-raised:   #ffffff;
  --bg-sunken:   #efece3;
  --ink:         #14202b;
  --ink-soft:    #4d5763;
  --ink-faint:   #7c8794;
  --line:        #e0dbcd;
  --line-strong: #cbc4b1;

  /* Status */
  --ok:      #2f7d4f;
  --warn:    #9a6b16;
  --danger:  #a83232;
  --info:    #2a5f8f;

  /* Type */
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
             "URW Palladio L", Georgia, serif;
  --body:    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
             "Helvetica Neue", Arial, sans-serif;
  --mono:    ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Scale */
  --step--1: clamp(0.80rem, 0.78rem + 0.10vw, 0.86rem);
  --step-0:  clamp(0.95rem, 0.92rem + 0.14vw, 1.03rem);
  --step-1:  clamp(1.13rem, 1.06rem + 0.32vw, 1.31rem);
  --step-2:  clamp(1.38rem, 1.24rem + 0.63vw, 1.75rem);
  --step-3:  clamp(1.69rem, 1.44rem + 1.08vw, 2.34rem);
  --step-4:  clamp(2.06rem, 1.64rem + 1.78vw, 3.13rem);

  /* Space */
  --sp-1: 0.375rem;
  --sp-2: 0.75rem;
  --sp-3: 1.25rem;
  --sp-4: 2rem;
  --sp-5: 3.25rem;
  --sp-6: 5rem;

  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 2px rgba(20, 32, 43, .05), 0 8px 28px rgba(20, 32, 43, .07);
  --shadow-sm: 0 1px 3px rgba(20, 32, 43, .08);

  --wrap: 1180px;
  --wrap-narrow: 760px;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg:          #101922;
  --bg-raised:   #18242f;
  --bg-sunken:   #0b1219;
  --ink:         #f0ece1;
  --ink-soft:    #a9b4c0;
  --ink-faint:   #78848f;
  --line:        #26333f;
  --line-strong: #34434f;

  --gold-deep:   #ebd683;   /* on dark, the brand gold is the legible one */
  --gold-soft:   rgba(235, 214, 131, 0.10);

  --ok:     #6fc48d;
  --warn:   #e0b95e;
  --danger: #ef8b8b;
  --info:   #7db4e6;

  --shadow:    0 1px 2px rgba(0, 0, 0, .3), 0 10px 32px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);

  color-scheme: dark;
}

/* --- Reset ------------------------------------------------------------- */

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

a {
  color: var(--gold-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--ink); }
[data-theme="dark"] a:hover { color: #ffffff; }

:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 3px;
  border-radius: 3px;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.012em;
  margin: 0 0 var(--sp-2);
  color: var(--ink);
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p  { margin: 0 0 var(--sp-2); }
p:last-child { margin-bottom: 0; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--sp-4) 0;
}

/* --- Layout scaffolding ------------------------------------------------ */

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}
.wrap-narrow { width: min(100% - 2.5rem, var(--wrap-narrow)); margin-inline: auto; }

main { flex: 1 0 auto; }

.section { padding-block: var(--sp-6); }
.section--tight { padding-block: var(--sp-5); }
.section--sunken { background: var(--bg-sunken); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--gold);
  padding: 12px 20px;
  z-index: 200;
}
.skip-link:focus { left: 0; }

/* --- Signature: the ascent rule ---------------------------------------
   Five ascending strokes lifted straight from the mark. Used as the
   section marker and, at scale, as the masthead backdrop.
   ---------------------------------------------------------------------- */

.ascent {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 22px;
  margin-bottom: var(--sp-2);
}
.ascent span {
  width: 3px;
  background: var(--gold-deep);
  border-radius: 1px;
  opacity: .9;
}
.ascent span:nth-child(1) { height: 26%; }
.ascent span:nth-child(2) { height: 44%; }
.ascent span:nth-child(3) { height: 62%; }
.ascent span:nth-child(4) { height: 80%; }
.ascent span:nth-child(5) { height: 100%; }

.ascent--center { justify-content: center; }

/* Large ambient version behind the masthead */
.ascent-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: .5;
  -webkit-mask-image: linear-gradient(to top left, #000 5%, transparent 62%);
          mask-image: linear-gradient(to top left, #000 5%, transparent 62%);
}
.ascent-field::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: repeating-linear-gradient(
    58deg,
    var(--gold) 0 2px,
    transparent 2px 26px
  );
}

/* --- Eyebrow label ----------------------------------------------------- */

.eyebrow {
  font-family: var(--body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0 0 var(--sp-1);
}

.lede {
  font-size: var(--step-1);
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 62ch;
}

.muted     { color: var(--ink-soft); }
.faint     { color: var(--ink-faint); font-size: var(--step--1); }
.center    { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* --- Header ------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--header-h, 70px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.brand img { width: 40px; height: 40px; object-fit: contain; }
.brand__text {
  font-family: var(--display);
  font-size: 1.02rem;
  line-height: 1.15;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.brand__text b { display: block; font-weight: 600; }
.brand__text span { display: block; font-weight: 400; color: var(--ink-soft); font-size: .82em; }

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-wrap: wrap;
}
.nav a {
  display: inline-block;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--gold-soft); color: var(--ink); }
.nav a.active { color: var(--ink); font-weight: 600; }
.nav a.active::after {
  content: "";
  display: block;
  height: 2px;
  background: var(--gold-deep);
  border-radius: 2px;
  margin-top: 4px;
}

.header-tools { display: flex; align-items: center; gap: 8px; margin-left: 6px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun  { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }

.nav-toggle { display: none; }

/* --- Buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .94rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--ink);
  color: var(--gold);
  border-color: var(--ink);
}
.btn--primary:hover { background: #000; color: var(--gold); }
[data-theme="dark"] .btn--primary { background: var(--gold); color: #101922; border-color: var(--gold); }
[data-theme="dark"] .btn--primary:hover { background: #f5e5a6; color: #101922; }

.btn--outline {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn--outline:hover { border-color: var(--gold-deep); color: var(--gold-deep); }

.btn--ghost { background: transparent; color: var(--ink-soft); padding-inline: 12px; }
.btn--ghost:hover { color: var(--ink); background: var(--gold-soft); }

.btn--danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--danger:hover { filter: brightness(.92); }

.btn--sm  { padding: 7px 14px; font-size: .85rem; }
.btn--full { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }

/* --- Cards ------------------------------------------------------------- */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
a.card { text-decoration: none; color: inherit; }
a.card:hover {
  border-color: var(--gold-deep);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card__media {
  aspect-ratio: 16 / 9;
  background: var(--bg-sunken);
  overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__media--portrait { aspect-ratio: 3 / 4; }
.card__media--square   { aspect-ratio: 1 / 1; }

.card__body { padding: var(--sp-3); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card__title { font-family: var(--display); font-size: var(--step-1); margin: 0; line-height: 1.25; }
.card__meta  { font-size: var(--step--1); color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.card__foot  { margin-top: auto; padding-top: var(--sp-2); }

/* --- Grids ------------------------------------------------------------- */

.grid { display: grid; gap: var(--sp-3); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 960px) { .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .grid--4 { grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); } }

/* --- Badges ------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: var(--bg-sunken);
  white-space: nowrap;
}
.badge--gold    { background: var(--gold-soft); border-color: var(--gold-deep); color: var(--gold-deep); }
.badge--ok      { color: var(--ok);     border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.badge--warn    { color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge--danger  { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.badge--info    { color: var(--info);   border-color: color-mix(in srgb, var(--info) 45%, transparent); }

/* --- Forms ------------------------------------------------------------- */

.form { display: grid; gap: var(--sp-3); }
.field { display: grid; gap: 6px; }
.field label {
  font-size: .86rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: .01em;
}
.field label .req { color: var(--danger); }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
.field__hint { font-size: .8rem; color: var(--ink-faint); }
.field__error { font-size: .8rem; color: var(--danger); font-weight: 500; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }

.field-row { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field-row--tight { grid-template-columns: 150px 1fr; }
@media (max-width: 560px) { .field-row--tight { grid-template-columns: 1fr; } }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .92rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--gold-deep); flex-shrink: 0; }

.file-input {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  background: var(--bg-sunken);
  text-align: center;
}
.file-input input { font-size: .9rem; }

.repeat-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.repeat-row .input { flex: 1; }

/* --- Alerts ------------------------------------------------------------ */

.alert {
  padding: 13px 17px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--line-strong);
  background: var(--bg-sunken);
  font-size: .92rem;
  margin-bottom: var(--sp-3);
}
.alert--success { border-left-color: var(--ok);     color: var(--ok); }
.alert--error   { border-left-color: var(--danger); color: var(--danger); }
.alert--info    { border-left-color: var(--info);   color: var(--info); }
.alert--warn    { border-left-color: var(--warn);   color: var(--warn); }

/* --- Empty state ------------------------------------------------------- */

.empty {
  text-align: center;
  padding: var(--sp-5) var(--sp-3);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink-faint);
  background: var(--bg-sunken);
}
.empty h3 { color: var(--ink-soft); font-size: var(--step-1); }

/* --- Tables ------------------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 560px; }
.table th, .table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-faint);
  font-weight: 700;
  background: var(--bg-sunken);
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--gold-soft); }
.table td.actions { white-space: nowrap; text-align: right; }

/* --- Pagination -------------------------------------------------------- */

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: var(--sp-4); flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 38px;
  padding: 8px 12px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink-soft);
  font-size: .9rem;
}
.pagination a:hover { border-color: var(--gold-deep); color: var(--gold-deep); }
.pagination .current { background: var(--ink); color: var(--gold); border-color: var(--ink); font-weight: 600; }
[data-theme="dark"] .pagination .current { background: var(--gold); color: #101922; border-color: var(--gold); }

/* --- Footer ------------------------------------------------------------ */

.site-footer {
  margin-top: var(--sp-6);
  background: var(--ink);
  color: #cfd6dd;
  padding-block: var(--sp-5) var(--sp-3);
}
[data-theme="dark"] .site-footer { background: var(--bg-sunken); border-top: 1px solid var(--line); }

.site-footer h4 {
  color: var(--gold);
  font-size: .8rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-family: var(--body);
  font-weight: 700;
  margin-bottom: var(--sp-2);
}
.site-footer a { color: #cfd6dd; text-decoration: none; font-size: .92rem; }
.site-footer a:hover { color: var(--gold); }
.footer-grid { display: grid; gap: var(--sp-4); grid-template-columns: 1.4fr 1fr 1fr 1.2fr; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-bottom {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid rgba(255, 255, 255, .1);
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
  font-size: .84rem;
  color: #8c98a5;
}
.social { display: flex; gap: 10px; }
.social a {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius-sm);
}
.social a:hover { border-color: var(--gold); background: rgba(235, 214, 131, .1); }
.social svg { width: 17px; height: 17px; }

/* --- Auth pages -------------------------------------------------------- */

.auth {
  min-height: calc(100vh - 70px);
  display: grid;
  place-items: center;
  padding: var(--sp-4) var(--sp-3);
}
.auth__card {
  width: 100%;
  max-width: 430px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-4);
  box-shadow: var(--shadow);
}
.auth__head { text-align: center; margin-bottom: var(--sp-4); }
.auth__head img { width: 62px; margin: 0 auto var(--sp-2); }
.auth__foot { margin-top: var(--sp-3); text-align: center; font-size: .9rem; color: var(--ink-soft); }

/* --- Utility ----------------------------------------------------------- */

.stack   { display: grid; gap: var(--sp-3); }
.stack-2 { display: grid; gap: var(--sp-2); }
.row     { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }
.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;
}

/* --- Responsive nav ---------------------------------------------------- */

@media (max-width: 1040px) {
  .nav-toggle { display: grid; }
  .nav {
    position: fixed;
    /* Anchored to the real header height (set on .site-header__inner) so the
       panel never overlaps the bar or floats away from it. */
    inset: var(--header-h, 70px) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--line);
    padding: var(--sp-2);
    box-shadow: var(--shadow);
    max-height: calc(100dvh - var(--header-h, 70px));
    overflow-y: auto;
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 13px 15px; font-size: 1rem; }
  .nav a.active::after { display: none; }
  .nav a.active { background: var(--gold-soft); }
}

@media print {
  .site-header, .site-footer, .btn, .nav { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ==========================================================================
   Public pages
   ========================================================================== */

/* --- Masthead ---------------------------------------------------------- */

.masthead {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-bottom: 1px solid var(--line);
}
.masthead__inner { position: relative; }
.masthead h1 { max-width: 15ch; margin-bottom: var(--sp-3); }
.masthead .lede { max-width: 54ch; }

.masthead--page { padding-block: clamp(2.5rem, 5vw, 4rem); }
.masthead--page h1 { max-width: 22ch; }

/* --- Section headers --------------------------------------------------- */

.section-head { margin-bottom: var(--sp-4); }
.section-head h2 { margin-bottom: 6px; }
.section-head p { color: var(--ink-soft); max-width: 60ch; margin: 0; }
.section-head--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* --- Prose ------------------------------------------------------------- */

.prose { max-width: 68ch; }
.prose p { margin-bottom: var(--sp-2); line-height: 1.75; }
.prose h3 { margin-top: var(--sp-4); }
.prose ul { padding-left: 1.2rem; margin: 0 0 var(--sp-2); }
.prose li { margin-bottom: 6px; }

/* --- Marked list, used for goals, tracks, values ----------------------- */

.marked { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.marked li {
  position: relative;
  padding-left: 26px;
  line-height: 1.6;
}
.marked li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 12px;
  height: 2px;
  background: var(--gold-deep);
  border-radius: 2px;
}
.marked--split { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px var(--sp-4); }

/* --- Value cards ------------------------------------------------------- */

.value-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-3);
  background: var(--bg-raised);
}
.value-card h3 { font-size: var(--step-1); margin-bottom: 6px; }
.value-card p { color: var(--ink-soft); margin: 0; font-size: .95rem; }

/* --- Figures band ------------------------------------------------------ */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-3);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding-block: var(--sp-4);
}
.figure { text-align: center; }
.figure b {
  display: block;
  font-family: var(--display);
  font-size: var(--step-3);
  line-height: 1;
  color: var(--gold-deep);
  margin-bottom: 5px;
}
.figure span {
  font-size: .76rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

/* --- Featured event ---------------------------------------------------- */

.feature {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
}
@media (max-width: 780px) { .feature { grid-template-columns: 1fr; } }

.feature__media { background: var(--bg-sunken); min-height: 240px; }
.feature__media img { width: 100%; height: 100%; object-fit: cover; }
.feature__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.feature__body h3 { font-size: var(--step-2); margin: 0; }
.feature__meta {
  display: grid;
  gap: 8px;
  font-size: .92rem;
  color: var(--ink-soft);
  margin: var(--sp-1) 0;
}
.feature__meta div { display: flex; gap: 10px; }
.feature__meta dt {
  min-width: 74px;
  color: var(--ink-faint);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 700;
  padding-top: 2px;
}
.feature__meta dd { margin: 0; }
.feature__foot { margin-top: auto; padding-top: var(--sp-2); }

/* --- Countdown pill ---------------------------------------------------- */

.countdown {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-deep);
  color: var(--gold-deep);
  padding: 5px 14px;
  border-radius: 100px;
  font-size: .84rem;
  font-weight: 600;
}
.countdown b { font-family: var(--display); font-size: 1.05rem; }

/* --- People grid ------------------------------------------------------- */

.people { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
@media (max-width: 900px) { .people { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px) { .people { grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); } }

.person {
  display: block;
  text-align: center;
  text-decoration: none;
  color: inherit;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-2);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.person:hover {
  border-color: var(--gold-deep);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.person__photo {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto var(--sp-2);
  background: var(--bg-sunken);
  border: 2px solid var(--line);
}
.person:hover .person__photo { border-color: var(--gold-deep); }
.person__name {
  font-family: var(--display);
  font-size: 1.02rem;
  line-height: 1.3;
  margin-bottom: 4px;
  display: block;
}
.person__affiliation {
  font-size: .82rem;
  color: var(--ink-faint);
  line-height: 1.45;
  display: block;
}

/* --- Profile ----------------------------------------------------------- */

.profile { display: grid; grid-template-columns: 260px 1fr; gap: var(--sp-5); align-items: start; }
@media (max-width: 780px) { .profile { grid-template-columns: 1fr; gap: var(--sp-3); } }

.profile__photo {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
}
@media (max-width: 780px) { .profile__photo { max-width: 200px; } }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  border: 1px solid var(--line-strong);
  background: var(--bg-sunken);
  border-radius: 100px;
  padding: 4px 13px;
  font-size: .84rem;
  color: var(--ink-soft);
}

/* --- Journal and book cards -------------------------------------------- */

.pub-card {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: var(--sp-3);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.pub-card:hover { border-color: var(--gold-deep); box-shadow: var(--shadow); }
@media (max-width: 560px) { .pub-card { grid-template-columns: 92px 1fr; gap: var(--sp-2); } }

.pub-card__cover {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
}
.pub-card__body { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.pub-card__body h3 { margin: 0; font-size: var(--step-1); line-height: 1.3; }
.pub-card__body h3 a { text-decoration: none; color: var(--ink); }
.pub-card__body h3 a:hover { color: var(--gold-deep); }
.pub-card__body p { color: var(--ink-soft); font-size: .93rem; margin: 0; }
.pub-card__foot { margin-top: auto; padding-top: 6px; display: flex; gap: var(--sp-2);
  flex-wrap: wrap; align-items: center; }

.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--sp-3); }

.book {
  display: block;
  text-decoration: none;
  color: inherit;
}
.book img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  margin-bottom: 10px;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.book:hover img {
  border-color: var(--gold-deep);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.book b { font-family: var(--display); font-size: .97rem; font-weight: 500; line-height: 1.35; display: block; }

/* --- Breadcrumb -------------------------------------------------------- */

.crumbs {
  font-size: .85rem;
  color: var(--ink-faint);
  margin-bottom: var(--sp-2);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.crumbs a { color: var(--ink-faint); text-decoration: none; }
.crumbs a:hover { color: var(--gold-deep); }

/* --- Event pages ------------------------------------------------------- */

.event-hero {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: var(--sp-5);
  align-items: start;
}
@media (max-width: 860px) { .event-hero { grid-template-columns: 1fr; gap: var(--sp-3); } }

.event-hero__media img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  aspect-ratio: 16/9;
  object-fit: cover;
}

.meta-list { display: grid; gap: 11px; margin: var(--sp-3) 0 0; }
.meta-list > div { display: grid; grid-template-columns: 108px 1fr; gap: var(--sp-2); font-size: .95rem; }
.meta-list dt {
  color: var(--ink-faint);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  padding-top: 3px;
}
.meta-list dd { margin: 0; }
@media (max-width: 480px) { .meta-list > div { grid-template-columns: 1fr; gap: 2px; } }

/* Important dates as a real timeline, because the order carries meaning */
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: var(--sp-3);
  padding: 15px 0 15px 22px;
  border-left: 2px solid var(--line);
  position: relative;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 22px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line-strong);
}
.timeline li.is-next::before { background: var(--gold); border-color: var(--gold-deep); }
.timeline li.is-past { opacity: .55; }
.timeline time { font-weight: 600; color: var(--gold-deep); font-size: .93rem; }
.timeline span { font-size: .95rem; }
.timeline li.is-past time { color: var(--ink-faint); }
@media (max-width: 520px) {
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

.advisors { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.advisor {
  border-left: 2px solid var(--gold-deep);
  padding-left: 14px;
}
.advisor b { display: block; font-size: .96rem; font-weight: 600; }
.advisor span { display: block; font-size: .85rem; color: var(--ink-faint); }

.fee-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.fee-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 11px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .94rem;
}
.fee-list li b { color: var(--gold-deep); white-space: nowrap; }

.form-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: var(--sp-4);
}
.form-panel > h2 { margin-bottom: 6px; }
.form-panel > p.intro { color: var(--ink-soft); margin-bottom: var(--sp-3); max-width: 58ch; }

.past-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3); }
.past-item { display: block; text-decoration: none; color: inherit; }
.past-item img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  margin-bottom: 9px;
  filter: grayscale(.35);
  transition: filter .2s ease, border-color .2s ease;
}
.past-item:hover img { filter: none; border-color: var(--gold-deep); }
.past-item b { display: block; font-family: var(--display); font-size: .97rem;
  font-weight: 500; line-height: 1.35; }
.past-item span { font-size: .82rem; color: var(--ink-faint); }

.contact-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: var(--sp-5); align-items: start; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-line { display: flex; gap: 12px; align-items: flex-start; margin-bottom: var(--sp-3); }
.contact-line svg { width: 19px; height: 19px; color: var(--gold-deep); flex-shrink: 0; margin-top: 3px; }
.contact-line b { display: block; font-size: .76rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-faint); margin-bottom: 2px; }
.contact-line a { color: var(--ink); text-decoration: none; }
.contact-line a:hover { color: var(--gold-deep); }

.closed-note {
  border: 1px dashed var(--line-strong);
  background: var(--bg-sunken);
  border-radius: var(--radius);
  padding: var(--sp-3);
  color: var(--ink-soft);
  font-size: .95rem;
}

/* --- Science week calendar ---------------------------------------------
   Days run across as columns, so a reader sees the shape of the week at a
   glance. Below the breakpoint they stack, because five narrow columns on a
   phone are unreadable.
   ---------------------------------------------------------------------- */

.calendar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-day {
  background: var(--bg-raised);
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 150px;
}

.cal-day__head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunken);
}
.cal-day__weekday {
  display: block;
  font-size: .7rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
}
.cal-day__date {
  display: block;
  font-family: var(--display);
  font-size: 1.28rem;
  line-height: 1.2;
  color: var(--ink);
  margin-top: 2px;
}

.cal-day.is-today .cal-day__head {
  background: var(--gold-soft);
  box-shadow: inset 0 2px 0 var(--gold-deep);
}
.cal-day.is-today .cal-day__date { color: var(--gold-deep); }
.cal-day.is-past { opacity: .55; }

.cal-day__now {
  display: inline-block;
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold-deep);
  margin-top: 3px;
}

.cal-day__body { padding: 10px; display: grid; gap: 8px; flex: 1; align-content: start; }

.cal-session {
  border-left: 2px solid var(--gold-deep);
  padding: 7px 10px;
  background: var(--bg-sunken);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.cal-session b { display: block; font-size: .87rem; font-weight: 600; line-height: 1.3; }
.cal-session span { display: block; font-size: .76rem; color: var(--ink-faint); margin-top: 2px; }

.cal-day__empty {
  font-size: .8rem;
  color: var(--ink-faint);
  padding: 10px;
  font-style: italic;
}

.week-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .88rem;
  color: var(--ink-soft);
  margin-bottom: var(--sp-3);
}
.week-progress__bar {
  flex: 1;
  height: 5px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 100px;
  overflow: hidden;
  max-width: 320px;
}
.week-progress__fill { height: 100%; background: var(--gold-deep); border-radius: 100px; }

/* --- Country statistics slider -------------------------------------------- */

.country-slider{
  overflow: hidden;
  width: 100%;
}
.country-slider:hover .country-slider__track{ animation-play-state: paused; }

.country-slider__track{
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: max-content;
  animation: slide-countries 42s linear infinite;
  cursor: default;
}

@keyframes slide-countries{
  from{ transform: translateX(0); }
  to{ transform: translateX(-50%); }
}

/* Each slide matches the .figure card style from the counters section */
.country-slide{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 88px;
  padding: 16px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.country-slide__flag{
  font-size: 2rem;
  line-height: 1;
  display: block;
}

/* Fallback when no emoji is available: two-letter abbreviation */
.country-slide__flag--text{
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-deep);
  letter-spacing: .05em;
}

.country-slide__count{
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

/* Reduce motion: show a static wrapped grid, exactly like the figures grid */
@media (prefers-reduced-motion: reduce){
  .country-slider{ overflow: visible; }
  .country-slider__track{
    animation: none;
    flex-wrap: wrap;
    width: auto;
    justify-content: center;
  }
  .country-slide[aria-hidden="true"]{ display: none; }
}

/* --- Blog ----------------------------------------------------------------- */

.blog-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-3);
}
.blog-grid--compact{
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.blog-card{
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.blog-card__cover{
  display: block;
  aspect-ratio: 16/9;
  overflow: hidden;
}
.blog-card__cover img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.blog-card__cover:hover img{ transform: scale(1.03); }

.blog-card__body{
  padding: var(--sp-2);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-card__meta{
  font-size: .78rem;
  color: var(--ink-faint);
  margin: 0 0 6px;
  letter-spacing: .03em;
}

.blog-card__title{
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 8px;
}
.blog-card__title a{ color: var(--ink); text-decoration: none; }
.blog-card__title a:hover{ color: var(--accent); }

.blog-card__excerpt{
  font-size: .88rem;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0 0 12px;
  flex: 1;
}

.blog-card__read{
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold-deep);
  text-decoration: none;
  border-bottom: 2px solid var(--gold);
  padding-bottom: 2px;
  align-self: flex-start;
}

/* Blog post */
.blog-post{ padding-block: var(--sp-6); }

.wrap--narrow{ max-width: 760px; margin-inline: auto; padding-inline: 15px; }

.blog-post__header{ margin-bottom: var(--sp-4); }

.blog-post__meta{
  font-size: .82rem;
  color: var(--ink-faint);
  margin: 0 0 10px;
  letter-spacing: .03em;
}

.blog-post__cover{
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: var(--sp-4);
}

.blog-post__body.prose h2{ font-size: 1.4rem; margin: 2em 0 .5em; }
.blog-post__body.prose h3{ font-size: 1.15rem; margin: 1.6em 0 .4em; }
.blog-post__body.prose p{ line-height: 1.78; margin: 0 0 1.1em; }
.blog-post__body.prose ul,
.blog-post__body.prose ol{ margin: 0 0 1em 1.4em; line-height: 1.7; }
.blog-post__body.prose blockquote{
  border-left: 3px solid var(--gold);
  margin: 1.5em 0;
  padding: .6em 1.2em;
  color: var(--ink-soft);
  font-style: italic;
}
.blog-post__body.prose a{ color: var(--accent); }
.blog-post__body.prose code{
  background: var(--bg-sunken);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .88em;
}
.blog-post__body.prose pre{ overflow-x: auto; margin: 1em 0; }

.blog-post__foot{ margin-top: var(--sp-5); padding-top: var(--sp-3); border-top: 1px solid var(--line); }

/* --- Checkout page -------------------------------------------------------- */
.gateway-option{
  display: block;
  cursor: pointer;
}
.gateway-option input[type="radio"]{ position: absolute; opacity: 0; }

.gateway-option__inner{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-raised);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
  transition: border-color .15s, background .15s;
}
.gateway-option:hover .gateway-option__inner{ border-color: var(--gold-deep); }
.gateway-option input:checked ~ .gateway-option__inner{
  border-color: var(--gold-deep);
  background: var(--gold-soft);
}
.gateway-option__logo{
  display: flex;
  align-items: center;
  min-width: 48px;
}

/* --- LMS ------------------------------------------------------------------ */
.lesson-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.lesson-row:last-child { border-bottom: 0; }
.lesson-row:hover      { background: var(--bg-raised); }
.lesson-row--done      { color: var(--ink-faint); }
.lesson-row__icon      { font-size: .9rem; width: 1.2em; text-align: center; flex-shrink: 0; }
.lesson-row--done .lesson-row__icon { color: var(--ok); }


/* --- Mobile fixes (update 15) -------------------------------------------
   A safety net so no single element can push the page sideways on a phone,
   plus the wrappers tables need to scroll on their own.
   ----------------------------------------------------------------------- */
@media (max-width: 720px) {
  /* The side gutter is kept (never overridden): text must breathe away
     from the screen edge. It only narrows slightly so lines stay long
     enough to read comfortably on a phone. */
  .wrap        { width: min(100% - 2rem, var(--wrap)); }
  .wrap-narrow { width: min(100% - 2rem, var(--wrap-narrow)); }

  /* Long words, URLs and DOIs wrap rather than widening the page.
     break-word keeps normal words whole and only splits when a single
     word genuinely cannot fit. */
  p, li, td, th, h1, h2, h3, a { overflow-wrap: break-word; }

  /* Tables scroll smoothly inside their own wrapper. */
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* Action rows and toolbars stack rather than overflow. */
  .row, .row--between, .row--end, .toolbar { flex-wrap: wrap; }

  /* Comfortable tap targets. */
  .btn { min-height: 42px; }

  /* Media never exceeds its column. */
  img, video, iframe, table { max-width: 100%; }

  /* A very long tag (a full standards body name, for example) wraps its
     own text instead of running past the gutter. */
  .tag { max-width: 100%; overflow-wrap: break-word; }
}

/* Phone browsers without backdrop blur would leave the sticky header
   translucent, so page text shows through it while scrolling. Those
   browsers get a solid header instead. */
@supports not (backdrop-filter: blur(12px)) {
  .site-header { background: var(--bg); }
}


/* Very small phones: the brand shortens so the menu and theme buttons
   always stay reachable on one line. */
@media (max-width: 380px) {
  :root { --header-h: 62px; }
  .brand img { width: 32px; height: 32px; }
  .brand__text { font-size: .9rem; }
  .brand__text span { display: none; }
  .header-tools { gap: 4px; margin-left: 4px; }
}
