/* PLG Anatomy home page. Light by design: no 3D code loads until a study is opened. */

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}

:root {
  --ink: #0e1820;
  --ink-2: #132330;
  --surface: #172a37;
  --rule: rgba(190, 214, 222, .15);
  --rule-strong: rgba(190, 214, 222, .28);
  --text: #ecf2f1;
  --muted: #a3b4b9;
  --accent: #63d0c8;
  --accent-ink: #062a27;

  /* Anatomical colour key, as used in atlases. */
  --bone: #e8dcc2;
  --muscle: #c9606b;
  --heart: #e2555d;
  --lung: #eaa4a8;
  --nerve: #e7c75c;
  --gland: #b893e3;
  --gut: #d99a5f;
  --urinary: #d4b46a;
  --repro: #d98fb4;
  --lymph: #7fcb8f;
  --eye: #7cc4e8;

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --measure: 34rem;
  --page: min(1200px, 100% - 2 * var(--gutter));
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--text);
  font: 400 1.0625rem/1.58 var(--sans); font-kerning: normal;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .18em; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.005em; text-wrap: balance; }

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

.wrap { width: var(--page); margin-inline: auto; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 5; background: rgba(14, 24, 32, .88); backdrop-filter: blur(14px); border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand span { font: 600 1.25rem/1 var(--serif); letter-spacing: 0; }
.site-nav { display: flex; align-items: center; gap: clamp(.75rem, 2vw, 1.6rem); }
.site-nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.site-nav a:hover { color: var(--text); }
.site-nav .button { color: var(--accent-ink); }

.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .7rem 1.25rem;
  border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 700 1rem/1.2 var(--sans);
  text-decoration: none; border: 1px solid var(--accent);
}
.button:hover { background: #82ddd6; }
.button.small { min-height: 38px; padding: .45rem .9rem; font-size: .92rem; }
.button.quiet { background: transparent; color: var(--text); border-color: var(--rule-strong); }
.button.quiet:hover { border-color: var(--accent); background: rgba(99, 208, 200, .08); }

/* Hero: an anatomical plate with labelled systems. */
.hero { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(2rem, 5vw, 3.5rem); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.hero h1 { font-size: clamp(2.5rem, 4.6vw, 3.9rem); line-height: 1.03; max-width: 12ch; text-wrap: balance; }
.hero .lead { margin-top: 1.3rem; max-width: var(--measure); color: #d3dddd; font-size: 1.15rem; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.hero-note { margin-top: 1.25rem; max-width: var(--measure); color: var(--muted); font-size: .9rem; }

.plate { position: relative; margin: 0; aspect-ratio: 1 / 1; width: min(100%, 82vh); justify-self: end; }
.plate-image { position: absolute; left: 0; top: 0; width: 75%; height: 100%; object-fit: contain; }
.plate-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.plate-lines line { stroke: rgba(236, 242, 241, .55); stroke-width: 1; vector-effect: non-scaling-stroke; }
.plate-labels { list-style: none; margin: 0; padding: 0; }
.plate-labels li { position: absolute; left: var(--x); top: var(--y); transform: translateY(-50%); max-width: 36%; }
.plate-labels a {
  display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .2rem; color: var(--text); text-decoration: none;
  font: italic 500 clamp(1rem, 1.4vw, 1.15rem)/1.2 var(--serif);
}
.plate-labels a::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--key); box-shadow: 0 0 0 3px rgba(14, 24, 32, .9); flex: none; }
.plate-labels a:hover, .plate-labels a:focus-visible { color: var(--key); }
.plate-dot { position: absolute; left: var(--x); top: var(--y); width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--key); box-shadow: 0 0 0 2px rgba(14, 24, 32, .8); pointer-events: none; }
.plate figcaption { position: absolute; left: 0; right: 0; bottom: -.25rem; text-align: center; color: var(--muted); font-size: .8rem; }

@media (prefers-reduced-motion: no-preference) {
  .plate-lines line { stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw 1.1s ease-out forwards; animation-delay: calc(var(--i) * 90ms + 250ms); }
  .plate-labels li, .plate-dot { opacity: 0; animation: appear .5s ease-out forwards; animation-delay: calc(var(--i) * 90ms + 700ms); }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes appear { to { opacity: 1; } }
}

/* Sections */
.section { padding-block: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--rule); }
.section-head { display: grid; gap: .75rem; max-width: 46rem; margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.section-head h2 { font-size: clamp(2rem, 3.4vw, 2.75rem); line-height: 1.08; }
.section-head p { color: var(--muted); max-width: var(--measure); }

/* Body systems: specimen grid with a colour key per system. */
.systems { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 2.25rem) clamp(1rem, 2.4vw, 1.75rem); }
.system { display: flex; flex-direction: column; gap: .9rem; }
.system-media { display: block; border-radius: 6px; overflow: hidden; background: #13232e; aspect-ratio: 4 / 3; }
.system-media img { width: 100%; height: 100%; object-fit: contain; transition: transform .35s ease; }
.system-media:hover img { transform: scale(1.03); }
.system h3 { display: flex; align-items: baseline; gap: .55rem; font-size: 1.32rem; line-height: 1.2; }
.system h3::before { content: ""; flex: none; width: 1.15rem; height: 3px; border-radius: 2px; background: var(--key); transform: translateY(-.32em); }
.system p { color: var(--muted); font-size: .98rem; }
.system-actions { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: auto; padding-top: .15rem; }
.system-actions a { font-weight: 700; text-decoration: none; }
.system-actions a:hover { text-decoration: underline; }
.system-actions a + a { color: var(--text); font-weight: 600; }

/* Learn by doing: rows, because these are activities rather than places. */
.activities { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.activities li { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto; gap: .5rem 2rem; align-items: center; padding: 1.25rem 0; border-bottom: 1px solid var(--rule); }
.activities h3 { font-size: 1.28rem; }
.activities p { color: var(--muted); max-width: 40rem; }
.activities .meta { display: block; color: var(--text); font-size: .9rem; margin-top: .25rem; }
.more-labs { margin-top: 1.5rem; color: var(--muted); }
.more-labs a { font-weight: 700; }

/* Animals */
.animal { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 2rem; align-items: center; padding: 1.5rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.animal h3 { font-size: 1.35rem; }
.animal p { color: var(--muted); max-width: 44rem; margin-top: .4rem; }
.tag { display: inline-block; margin-left: .5rem; padding: .1rem .5rem; border: 1px solid var(--rule-strong); border-radius: 99px; color: var(--muted); font: 600 .78rem/1.5 var(--sans); vertical-align: middle; }

/* For institutions */
.institutions { background: var(--ink-2); }
.offers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.25rem, 3vw, 2.5rem); }
.offers h3 { font-size: 1.3rem; margin-bottom: .5rem; }
.offers p { color: var(--muted); }
.contact { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 2.25rem; }
.contact[hidden] { display: none; }
.contact p { color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding-block: 2.25rem 3rem; color: var(--muted); font-size: .92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; }
.site-footer a { color: var(--text); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }

/* Responsive */
@media (max-width: 1080px) {
  .systems { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero h1 { max-width: 14ch; }
  .plate { width: min(100%, 600px); justify-self: center; }
  .systems { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activities li { grid-template-columns: 1fr; }
  .activities .button { justify-self: start; }
  .offers { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .site-nav a:not(.button) { display: none; }
  .systems { grid-template-columns: 1fr; }
  .system-media { aspect-ratio: 16 / 10; }
  .animal { grid-template-columns: 1fr; }
  /* On phones the plate labels become a key under the picture. */
  .plate { aspect-ratio: auto; width: 100%; display: grid; gap: 1rem; }
  .plate-image { position: static; width: auto; height: auto; aspect-ratio: 3 / 4; max-height: 64vh; margin-inline: auto; }
  .plate-lines, .plate-dot { display: none; }
  .plate-labels { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .75rem; }
  .plate-labels li { position: static; transform: none; max-width: none; }
  .plate-labels a { font-size: 1.05rem; padding: .45rem 0; white-space: normal; }
  .plate figcaption { position: static; }
}
