/* ==========================================================================
   Greensnake — Science
   --------------------------------------------------------------------------
   A dark, editorial reading page. Almost everything it needs already exists
   in components.css (page-head, section-head, facts, chip, field, row,
   ticker, empty) — this file only holds what is genuinely specific to the
   research library.

   The whole <main> carries `.on-dark`, which re-points the ink ramp,
   hairlines, accents and focus rings for every component inside it. There is
   no dark-mode duplicate of any component rule anywhere.
   ========================================================================== */

.science {
  background: var(--green-900);
  /* A single, very slow field of light behind the header. It is one radial
     gradient — not a mesh, not a blur stack — so it costs nothing and never
     reads as decoration for its own sake. */
  background-image:
    radial-gradient(120% 60% at 12% -10%, rgba(120, 133, 8, 0.28), transparent 62%),
    radial-gradient(70% 40% at 92% 4%, rgba(5, 117, 215, 0.16), transparent 70%);
  background-repeat: no-repeat;
}

/* ==========================================================================
   Page header
   ========================================================================== */
.science .page-head__title {
  font-family: var(--font-ui);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.science .facts b { font-size: 1.25rem; }

/* ==========================================================================
   Fields of study
   --------------------------------------------------------------------------
   The five category marks from the original build, recovered from Framer's
   CDN. Icon over label, exactly as the original set them — the only changes
   are that each one is now a real link that filters the library below, and
   that the marquee pauses on hover and stops entirely under reduced motion.
   ========================================================================== */
.fields__ticker {
  --ticker-duration: 54s;
  margin-top: var(--gap-head);
}

.field-mark {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
  width: clamp(150px, 15vw, 210px);
  padding: var(--space-5) var(--space-2);
  color: var(--mint);
  text-align: center;
  transition: transform var(--t-slow) var(--ease-soft);
}

.field-mark__icon {
  width: clamp(60px, 6vw, 84px);
  height: clamp(60px, 6vw, 84px);
  object-fit: contain;
  /* At rest the marks sit back into the page; hovering brings one forward.
     Slow, and only one at a time, so the row never reads as a light show. */
  opacity: 0.72;
  transition: opacity var(--t-slow) var(--ease-soft),
              transform 620ms var(--ease-soft);
}

.field-mark__name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: clamp(0.9375rem, 0.85rem + 0.3vw, 1.0625rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  transition: color var(--t-slow) var(--ease-soft);
}

a.field-mark:hover .field-mark__icon,
a.field-mark:focus-visible .field-mark__icon {
  opacity: 1;
  transform: translateY(-6px) scale(1.06);
}
a.field-mark:hover .field-mark__name,
a.field-mark:focus-visible .field-mark__name { color: var(--lime); }

/* a hairline that draws in under the label, matching the button language */
a.field-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: var(--space-3);
  width: 46px;
  height: 1.5px;
  background: var(--lime);
  transform: translateX(-50%) scaleX(0);
  transition: transform var(--t-slow) var(--ease-soft);
}
a.field-mark:hover::after,
a.field-mark:focus-visible::after { transform: translateX(-50%) scaleX(1); }

a.field-mark:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* ==========================================================================
   Library controls
   ========================================================================== */
.library__controls {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--gap-head);
}

.library__search { max-width: 100%; }

.library__chips {
  /* On narrow screens the chips scroll sideways rather than wrapping into
     four ragged lines and pushing the results off the first screen. */
  overflow-x: auto;
  flex-wrap: wrap;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.library__chips::-webkit-scrollbar { display: none; }

.library__status {
  margin: var(--space-6) 0 var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--step-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  min-height: 1em;
}

/* ==========================================================================
   Rows
   ========================================================================== */
.library__rows .row { background: rgba(255, 255, 255, 0.025); }

.row--static .row__summary { cursor: default; }
.row--static:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }

/* A row hidden by a filter is removed from the flow AND from the tab order
   (the JS also sets `hidden`), so keyboard users never land on a result
   they cannot see. */
.paper[hidden] { display: none; }

.paper__link {
  color: inherit;
  text-decoration: none;
}
.paper__link::after {
  content: "";
  position: absolute;
  inset: 0;
}
.row--static { position: relative; }
.row--static:hover .paper__link { color: var(--accent); }

.row__chev--link { transform: none; }
.row--static:hover .row__chev--link {
  background: var(--accent);
  color: var(--green-900);
  transform: translate(2px, -2px);
}

.paper__summary { margin: 0; }

.paper__authors {
  margin: var(--space-3) 0 0;
  font-family: var(--font-mono);
  font-size: var(--step-micro);
  letter-spacing: 0.03em;
  color: var(--ink-3);
}

.paper__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  margin-top: var(--space-4);
}

/* The search term, marked in the result. <mark> is the semantically correct
   element for exactly this, so screen readers announce it too. */
.paper mark {
  background: rgba(228, 254, 0, 0.22);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 1px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 560px) {
  .science .facts b { font-size: 1.125rem; }
  .field-mark { padding-right: var(--space-6); }
}
