/* ==========================================================================
   PUFFINS mission website
   Polarimetry in the Ultraviolet to Find Features in INterStellar dust
   --------------------------------------------------------------------------
   Palette is built from the mission itself: deep-space navy, an ultraviolet
   violet for the science, and the orange of a puffin's beak used sparingly
   as the one warm accent.
   ========================================================================== */

:root {
  --ink:      #05080F;
  --space:    #0A1020;
  --panel:    #111A2D;
  --panel-2:  #16223A;
  --line:     #23314C;
  --text:     #E9EEF8;
  --muted:    #93A3BE;
  --uv:       #8A6BFF;
  --uv-soft:  rgba(138, 107, 255, 0.16);
  --beak:     #FF7A3D;

  --wrap: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* --------------------------------------------------------------- reset -- */

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

html { scroll-behavior: smooth; }

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

body {
  margin: 0;
  background: var(--space);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--beak);
  color: var(--ink);
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  z-index: 200;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------- typography -- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 0.6em;
}

h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); letter-spacing: -0.005em; }

/* Long headings read badly in caps — use this for full sentences or questions. */
.h2--sentence { text-transform: none; letter-spacing: -0.015em; }

p { margin: 0 0 1.1em; max-width: 68ch; }

.lede {
  font-size: clamp(1.1rem, 1.7vw, 1.3rem);
  line-height: 1.55;
  color: var(--text);
}

.muted { color: var(--muted); }

.marker {
  font-family: var(--font-data);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--uv);
  display: block;
  margin-bottom: 1rem;
}

/* ------------------------------------------------------------- layout --- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section--panel { background: var(--panel); }
.section--ink { background: var(--ink); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }

.split {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 900px) {
  .split { grid-template-columns: 1.05fr 0.95fr; }
  .split--narrow-first { grid-template-columns: 0.9fr 1.1fr; }
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
}

/* The wordmark is the mission logo, not type. Both nav and footer use the
   light version; assets/img/logo-wordmark-dark.png is the same mark for use
   on white backgrounds (slides, posters, print). */
.wordmark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding-block: 0.5rem;
}
.wordmark img {
  height: 30px;
  width: auto;
}
@media (max-width: 480px) { .wordmark img { height: 26px; } }

.nav-links {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
  align-items: center;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-block: 0.4rem;
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--uv);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 4px;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

@media (max-width: 780px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    inset: 68px 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--ink);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--gutter) 1.25rem;
  }
  .nav-links[hidden] { display: none; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; width: 100%; padding-block: 0.7rem; }
}

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

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: min(720px, 84vh);
  background:
    radial-gradient(1100px 620px at 72% 8%, rgba(138,107,255,0.24), transparent 62%),
    radial-gradient(760px 520px at 12% 88%, rgba(255,122,61,0.10), transparent 60%),
    linear-gradient(180deg, #05080F 0%, #0A1020 65%, #0A1020 100%);
  border-bottom: 1px solid var(--line);
}

/* ---------------------------------------------------------------------------
   HERO IMAGE — change the file here and the credit line in index.html.
   Suggested: a NASA image of interstellar dust. Save it as
   assets/img/hero-dust.jpg (see assets/img/README.md for sources).
   The gradient above shows through if the file is missing, so the page never
   breaks while you are picking one.
   --------------------------------------------------------------------------- */
.hero-media {
  position: absolute;
  inset: 0;
  background-image: url("../img/dust.gif");
  background-size: cover;
  background-position: 62% 42%;
  opacity: 1;
  pointer-events: none;
}

/* Keeps the headline readable over whatever image is behind it. */
.hero-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(0deg, rgba(10,16,32,0.97) 0%, rgba(5,8,15,0.74) 46%,
                    rgba(5,8,15,0.58) 100%);
}

/* On narrow screens the copy sits over the middle of the image, so the scrim
   has to work vertically rather than left-to-right. */
@media (max-width: 780px) {
  .hero-scrim {
    background:
      linear-gradient(0deg, rgba(10,16,32,0.97) 0%, rgba(5,8,15,0.86) 42%,
                      rgba(5,8,15,0.62) 72%, rgba(5,8,15,0.42) 100%);
  }
  .hero { min-height: min(680px, 82vh); }
}

.starfield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.35;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  padding-block: clamp(3rem, 8vw, 5rem) clamp(1.5rem, 3vw, 2.5rem);
}

.hero-credit {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  margin: 0;
  max-width: none;
  padding: 0 var(--gutter) 0.9rem;
  font-family: var(--font-data);
  font-size: 0.7rem;
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: #9CABC6;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  text-align: right;
}
.hero-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.hero-credit a:hover { color: var(--text); }
@media (max-width: 700px) { .hero-credit { text-align: left; } }

.stats-band { background: var(--space); }

.hero-inner { text-align: center; }

.hero-title {
  font-size: clamp(1.7rem, 4.4vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-transform: none;
  max-width: 38ch;
  margin: 0 auto 1.5rem;
  text-wrap: balance;
}

/* Sized to sit on two lines on a wide screen. */
.hero .lede {
  max-width: 118ch;
  margin-inline: auto;
  font-size: clamp(0.95rem, 1.15vw, 1.08rem);
  line-height: 1.6;
}

.hero-actions { justify-content: center; }


.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.8rem;
}

.btn {
  display: inline-block;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 1.5rem;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.btn--primary { background: var(--beak); color: var(--ink); }
.btn--primary:hover { background: #ff8f5c; }
.btn--ghost { border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--uv); color: #fff; }

/* the hero signature: the UV polarization curve PUFFINS is built to measure */

.curve-figure {
  position: relative;
  margin-top: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
}
@media (max-width: 640px) {
  .curve-figure { overflow-x: auto; }
  .curve-figure svg { min-width: 600px; }
}
.curve-figure figcaption {
  font-family: var(--font-data);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 0.5rem;
}

.curve-line {
  fill: none;
  stroke: var(--uv);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: draw 2.4s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .curve-line { stroke-dashoffset: 0; }
}
.curve-axis { stroke: var(--line); stroke-width: 1; }
.curve-tick {
  font-family: var(--font-data);
  font-size: 11px;
  fill: var(--muted);
}
.curve-bump-band { fill: rgba(255, 122, 61, 0.07); }
.curve-marker { stroke: rgba(255, 122, 61, 0.55); stroke-width: 1; stroke-dasharray: 3 4; }
.curve-note { font-family: var(--font-data); font-size: 11px; fill: var(--beak); }

/* --------------------------------------------------------------- stats -- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  border-top: 1px solid var(--line);
}
.stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  padding: clamp(1.4rem, 2.6vw, 2rem) clamp(1rem, 2vw, 1.6rem);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: none; }
.stat .value {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2.05rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.stat .value sup { font-size: 0.5em; top: -0.7em; }
.stat .label {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ------------------------------------------------------------ figures --- */

.figure {
  margin: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.figure img { width: 100%; height: auto; }

/* Wide figures sit outside the two-column split and run the full text width.
   The caption is longer here, so it gets a little more room to breathe. */
.figure--wide { margin-top: clamp(2.5rem, 5vw, 3.5rem); }

/* Runs the full width of the figure below it. */
.mission-lede { max-width: none; }
.figure--wide img { background: transparent; padding: 0; }
.figure--wide figcaption {
  padding: 1.25rem clamp(1rem, 3vw, 2rem);
  max-width: none;
  text-align: center;
  line-height: 1.6;
}
.figure figcaption {
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.credit {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--font-data);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #6F7F9C;
}

/* Placeholder shown until a real image is dropped in. Delete .slot when you
   replace the <img>. */
.slot {
  aspect-ratio: 16 / 10;
  display: grid;
  place-content: center;
  gap: 0.4rem;
  text-align: center;
  padding: 1.5rem;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.02) 0 12px, transparent 12px 24px),
    var(--panel-2);
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}
.slot strong { color: var(--text); font-weight: 600; letter-spacing: 0.1em; }

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

.objectives {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 2.5rem;
}
@media (min-width: 860px) { .objectives { grid-template-columns: repeat(3, 1fr); } }

.objective {
  background: var(--panel);
  padding: clamp(1.5rem, 3vw, 2.25rem);
}
.objective h3 { margin-bottom: 0.75rem; }
.objective p { font-size: 0.98rem; color: var(--muted); margin-bottom: 0; }
.objective .q {
  display: block;
  font-family: var(--font-data);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--uv);
  margin-bottom: 0.9rem;
}

/* --------------------------------------------------------------- table -- */

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-top: 1.5rem;
}
.spec-table caption {
  text-align: left;
  color: var(--muted);
  font-size: 0.85rem;
  padding-bottom: 0.75rem;
}
.spec-table th,
.spec-table td {
  text-align: left;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.spec-table th {
  font-family: var(--font-display);
  font-weight: 600;
  width: 42%;
  color: var(--text);
}
.spec-table td { font-family: var(--font-data); color: var(--muted); font-size: 0.9rem; }
.spec-table tr:last-child th,
.spec-table tr:last-child td { border-bottom: none; }

/* ---------------------------------------------------------------- team -- */

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
  margin-top: 2.5rem;
}
.member img,
.member .portrait-slot {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 3px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.member .portrait-slot {
  display: grid;
  place-content: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--line);
  letter-spacing: 0.05em;
}
.member .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin-top: 0.85rem;
}
.member .name a { text-decoration: none; border-bottom: 1px solid var(--line); }
.member .name a:hover { border-bottom-color: var(--uv); }
.member .role { font-size: 0.85rem; color: var(--uv); margin-top: 0.15rem; }
/* Placeholder styling — remove the role--todo class once the real role is in. */
.member .role--todo { color: var(--beak); opacity: 0.75; font-style: italic; }
.member .affil { font-size: 0.82rem; color: var(--muted); margin-top: 0.15rem; }

.collab-list {
  columns: 2;
  column-gap: 2.5rem;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}
@media (min-width: 760px) { .collab-list { columns: 3; } }
.collab-list li {
  break-inside: avoid;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(35, 49, 76, 0.6);
}
.collab-list li span { display: block; font-size: 0.8rem; color: #6F7F9C; }

/* --------------------------------------------------------- institutions -- */

.institutions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding: 0;
  list-style: none;
}
.institutions li {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.55rem 0.95rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* -------------------------------------------------------------- update -- */

.updates { list-style: none; padding: 0; margin: 2rem 0 0; }
.update {
  display: grid;
  gap: 0.25rem 2rem;
  padding: 1.35rem 0;
  border-top: 1px solid var(--line);
}
@media (min-width: 720px) { .update { grid-template-columns: 150px 1fr; } }
.update time {
  font-family: var(--font-data);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--uv);
  padding-top: 0.05rem;
}
.update h3 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.update p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* A funder or partner logo inside an update entry. Use the white/reverse
   version of the logo; if only a colour-on-white version is available, add the
   update-logo--chip class as well. */
.update-logo { display: inline-block; margin-top: 1rem; }
.update-logo img { height: 38px; width: auto; opacity: 0.88; transition: opacity 0.18s ease; }
.update-logo:hover img { opacity: 1; }
.update-logo--chip img {
  background: #fff;
  padding: 8px 14px;
  border-radius: 3px;
  opacity: 1;
}

/* --------------------------------------------------------- publications -- */

.pubs { list-style: none; padding: 0; margin: 1.75rem 0 0; }
.pubs li {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--muted);
}
.pubs .title { color: var(--text); }
.pubs a { color: var(--uv); text-decoration: none; border-bottom: 1px solid transparent; }
.pubs a:hover { border-bottom-color: var(--uv); }

/* ------------------------------------------------------------- contact -- */

.team-patch {
  width: min(340px, 100%);
  height: auto;
  justify-self: end;
}
@media (max-width: 899px) { .team-patch { width: min(260px, 70%); justify-self: start; } }

.contact-box {
  border: 1px solid var(--line);
  border-left: 3px solid var(--beak);
  border-radius: 4px;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--panel);
}
.contact-box a { color: var(--beak); }

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

.site-footer {
  background: var(--ink);
  border-top: 1px solid var(--line);
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
  font-size: 0.9rem;
  color: var(--muted);
}
.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.2fr 1fr 1fr; } }
.footer-mark {
  height: 34px;
  width: auto;
  margin-bottom: 1rem;
}
.footer-patch {
  width: 118px;
  height: auto;
  margin-top: 1.5rem;
}
.site-footer h4 {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 0.9rem;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { padding: 0.22rem 0; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.site-footer address { font-style: normal; line-height: 1.7; }
.colophon {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: #6F7F9C;
}

/* =========================================================
   Team groups and portraits
   ========================================================= */

.team-group + .team-group { margin-top: 3.25rem; }

.team-group > h3 {
  margin: 0 0 1.25rem;
  padding-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(12, 35, 75, 0.14);
}

.team-group .team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 2rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 560px) {
  .team-group .team-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1.5rem 1rem;
  }
}

/* Portrait: shows the photo if the file exists, initials if it doesn't. */
.team-group .portrait {
  position: relative;
  display: block;
  width: 100%;
  max-width: 150px;
  aspect-ratio: 1 / 1;
  margin-bottom: 0.7rem;
  overflow: hidden;
  border-radius: 10px;
  background: #e6eaf2;
}

.team-group .portrait::before {
  content: attr(data-initials);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #5d6b85;
}

.team-group .portrait img {
  position: relative;   /* sits above the initials */
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.team-group .member .name  { font-weight: 600; line-height: 1.3; }
.team-group .member .role  { font-size: 0.9rem; margin-top: 0.15rem; }
.team-group .member .affil { font-size: 0.85rem; margin-top: 0.15rem; opacity: 0.75; line-height: 1.35; }

/* To centre the text under each portrait like the slide, add:
   .team-group .member { text-align: center; }
   .team-group .portrait { margin-left: auto; margin-right: auto; }
*/
