/* Southern Ocean Exploration: site styles (mobile first) */

:root {
  --navy-900: #071a2c;
  --navy-800: #0b2540;
  --navy-700: #12365a;
  --blue-600: #1470af;
  --blue-500: #1f86cf;
  --blue-100: #e3f0fa;
  --sand-50: #f6f8fa;
  --line: #dfe5ec;
  --ink: #142231;
  --ink-soft: #4d5e70;
  --white: #fff;

  --font-head: "Poppins", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(7, 26, 44, 0.06), 0 8px 24px rgba(7, 26, 44, 0.06);
  --gutter: 20px;
  --max: 1200px;
  --measure: 720px;
  --header-h: 64px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--blue-600); text-underline-offset: 3px; }
a:hover { color: var(--navy-700); }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--navy-800);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1.1em; }
strong { font-weight: 600; color: var(--navy-800); }
ul, ol { padding-left: 1.25em; margin: 0 0 1.2em; }
li { margin-bottom: 0.45em; }
li > ul { margin: 0.5em 0 0; }

blockquote {
  margin: 1.6em 0;
  padding: 1em 1.25em;
  background: var(--sand-50);
  border-left: 4px solid var(--blue-600);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--ink-soft);
}

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

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--white); padding: 8px 14px; }
.skip-link:focus { left: 8px; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.measure { max-width: var(--measure); }

.eyebrow {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue-600);
  margin-bottom: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  font: 600 0.95rem/1 var(--font-head);
  border-radius: 999px;
  text-decoration: none;
  border: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--blue-600); color: var(--white); }
.btn-primary:hover { background: var(--blue-500); color: var(--white); }
.btn-ghost { border-color: rgba(255, 255, 255, 0.5); color: var(--white); }
.btn-ghost:hover { border-color: var(--white); color: var(--white); background: rgba(255, 255, 255, 0.08); }
.btn-outline { border-color: var(--line); color: var(--navy-800); background: var(--white); }
.btn-outline:hover { border-color: var(--blue-600); color: var(--blue-600); }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  /* solid background: a backdrop-filter here would trap the fixed mobile menu inside the header */
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy-800); }
.brand img { width: 44px; height: 34px; object-fit: contain; }
.brand span { font: 600 0.98rem/1.15 var(--font-head); letter-spacing: -0.01em; }
.brand small { display: block; font: 500 0.7rem/1.2 var(--font-body); color: var(--ink-soft); letter-spacing: 0.04em; }

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  background: none;
  border: 0;
  color: var(--navy-800);
  cursor: pointer;
}
.menu-toggle svg { width: 26px; height: 26px; }
.menu-toggle .icon-close { display: none; }
body.menu-open .menu-toggle .icon-open { display: none; }
body.menu-open .menu-toggle .icon-close { display: block; }

/* Mobile navigation panel */
.nav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--white);
  overflow-y: auto;
  padding: 8px var(--gutter) 40px;
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
body.menu-open { overflow: hidden; }
body.menu-open .nav { opacity: 1; visibility: visible; transform: none; }

.nav ul { list-style: none; margin: 0; padding: 0; }
.nav > ul > li { border-bottom: 1px solid var(--line); margin: 0; }
.nav a,
.nav .sub-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  font: 500 1.05rem/1.3 var(--font-head);
  color: var(--navy-800);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.nav a[aria-current="page"] { color: var(--blue-600); }
.nav .ext::after { content: "↗"; font-size: 0.85em; color: var(--ink-soft); margin-left: 6px; }
.sub-toggle .chev { transition: transform 0.15s ease; }
.has-sub.open .chev { transform: rotate(180deg); }
.sub { display: none; padding: 0 0 12px !important; }
.has-sub.open .sub { display: block; }
.sub a { min-height: 40px; font: 400 0.98rem/1.3 var(--font-body); color: var(--ink-soft); padding-left: 12px; }
.sub .sub-all a { font-weight: 600; color: var(--blue-600); }

/* ---------- Hero (home) ---------- */

.hero {
  position: relative;
  overflow: hidden;
  color: var(--white);
  background:
    radial-gradient(120% 80% at 80% 0%, rgba(31, 134, 207, 0.45) 0%, rgba(31, 134, 207, 0) 60%),
    linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
  padding: 56px 0 88px;
}
.hero .container { position: relative; z-index: 1; }
.hero-logo { width: 120px; filter: invert(1); opacity: 0.95; margin-bottom: 20px; }
.hero h1 { color: var(--white); max-width: 14ch; }
.hero .lede { font-size: 1.12rem; color: rgba(255, 255, 255, 0.82); max-width: 40rem; margin-bottom: 28px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-waves { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 90px; }
.hero-waves path { fill: none; stroke: rgba(255, 255, 255, 0.12); stroke-width: 1.5; }
.hero-waves path.fill { fill: var(--white); stroke: none; }

/* ---------- Page header (inner pages) ---------- */

.page-head {
  background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
  color: var(--white);
  padding: 36px 0 44px;
}
.page-head h1 { color: var(--white); margin-bottom: 0.25em; }
.page-head .subtitle { color: rgba(255, 255, 255, 0.75); font-size: 1.05rem; margin: 0; }
.page-head .eyebrow { color: #8cc7f0; }
.crumbs { font-size: 0.85rem; margin-bottom: 14px; color: rgba(255, 255, 255, 0.7); }
.crumbs a { color: rgba(255, 255, 255, 0.85); text-decoration: none; }
.crumbs a:hover { color: var(--white); text-decoration: underline; }
.chip {
  display: inline-block;
  font: 600 0.72rem/1 var(--font-head);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-600);
}
.page-head .chip { background: rgba(140, 199, 240, 0.16); color: #b9defa; margin-bottom: 12px; }

/* ---------- Sections ---------- */

.section { padding: 48px 0; }
.section-alt { background: var(--sand-50); }
.section-head { margin-bottom: 28px; }
.section-head p { color: var(--ink-soft); margin: 0; }

.prose > :first-child { margin-top: 0; }
.prose h2 { margin-top: 1.6em; font-size: 1.45rem; }
.prose h3 { margin-top: 1.4em; }
.prose figure { margin: 1.8em 0; }
.prose figure img { border-radius: var(--radius-sm); margin: 0 auto; }
.prose figcaption { font-size: 0.88rem; color: var(--ink-soft); margin-top: 0.6em; text-align: center; }
.prose .lead { font-size: 1.2rem; line-height: 1.6; color: var(--ink); }

.media-grid { display: grid; gap: 16px; margin: 1.8em 0; }
.media-grid figure { margin: 0; }

.embed-ig { display: flex; justify-content: center; margin: 2em 0; }
.embed-ig .instagram-media { margin: 0 auto !important; }
.embed-raw { margin: 2em 0; }

/* Values / pillars */
.pillars { display: grid; gap: 14px; }
.pillar {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.pillar h3 { margin-bottom: 0.35em; }
.pillar p { color: var(--ink-soft); margin: 0; font-size: 0.98rem; }
.pillar .num { font: 600 0.8rem/1 var(--font-head); color: var(--blue-600); letter-spacing: 0.1em; display: block; margin-bottom: 12px; }

/* Project cards */
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 20px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: none;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--navy-800);
  font: 500 0.9rem/1 var(--font-head);
  cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--navy-800); border-color: var(--navy-800); color: var(--white); }

.cards { display: grid; gap: 14px; list-style: none; padding: 0; margin: 0; }
.cards > li { margin: 0; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: #b9cde0; box-shadow: var(--shadow); transform: translateY(-2px); color: var(--ink); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card .year { font: 600 1.6rem/1 var(--font-head); color: var(--navy-800); }
.card h3 { font-size: 1.12rem; margin-bottom: 0.3em; }
.card .type { color: var(--ink-soft); font-size: 0.92rem; margin: 0 0 14px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--ink-soft); }
.card .meta span { display: inline-flex; align-items: center; gap: 6px; }
.card .meta svg { width: 14px; height: 14px; flex: none; color: var(--blue-600); }
.card .go { position: absolute; top: 20px; right: 20px; color: var(--blue-600); opacity: 0; transition: opacity 0.15s ease; }
.card:hover .go { opacity: 1; }
.cards [hidden] { display: none; }

/* Project page layout */
.project { display: grid; gap: 32px; }
.facts {
  background: var(--sand-50);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.facts h2 { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue-600); margin: 0 0 12px; }
.facts dl { margin: 0; display: grid; }
.facts dl > div { display: grid; grid-template-columns: minmax(7.5rem, 38%) 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.facts dl > div:first-child { border-top: 0; padding-top: 0; }
.facts dt { font-size: 0.74rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; padding-top: 3px; }
.facts dd { margin: 0; font-size: 0.94rem; line-height: 1.5; color: var(--ink); }

.pager { display: grid; gap: 12px; margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.pager a {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--navy-800);
}
.pager a:hover { border-color: var(--blue-600); }
.pager small { display: block; font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em; }
.pager strong { font-family: var(--font-head); }
.pager .next { text-align: right; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 2em 0; }
.gallery-item { display: block; aspect-ratio: 3 / 4; overflow: hidden; border-radius: var(--radius-sm); background: var(--sand-50); border: 1px solid var(--line); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.gallery-item:hover img { transform: scale(1.04); }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
.lightbox::backdrop { background: rgba(7, 26, 44, 0.92); }
.lightbox img { max-width: 94vw; max-height: 88vh; width: auto; border-radius: var(--radius-sm); }
.lightbox button { position: fixed; top: 10px; right: 14px; width: 48px; height: 48px; font: 300 2.2rem/1 var(--font-body); color: #fff; background: none; border: 0; cursor: pointer; }

/* Team roles (join page) */
.roles { display: grid; gap: 16px; margin: 2em 0; }
.role { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: var(--white); }
.role h3 { margin-bottom: 0.2em; }
.role .for { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 1em; }
.role ul { font-size: 0.96rem; }

/* Link directory */
.link-groups { display: grid; gap: 16px; }
.link-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: var(--white); }
.link-group h2 { font-size: 1.1rem; margin-bottom: 0.8em; }
.link-group ul { list-style: none; padding: 0; margin: 0; }
.link-group li { margin: 0; border-top: 1px solid var(--line); }
.link-group li:first-child { border-top: 0; }
.link-group a { display: block; padding: 10px 0; text-decoration: none; color: var(--navy-800); }
.link-group a:hover { color: var(--blue-600); }
.link-group a::after { content: " ↗"; color: var(--ink-soft); font-size: 0.85em; }
.link-group .note { font-size: 0.85rem; color: var(--ink-soft); margin: 4px 0 10px; }

/* Contact card */
.contact-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--white); box-shadow: var(--shadow); }
.contact-card h2 { font-size: 1.25rem; margin-bottom: 0.2em; }
.contact-card .role-title { color: var(--ink-soft); margin-bottom: 18px; }
.contact-card .actions { display: grid; gap: 10px; }

/* Call to action band */
.cta {
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--navy-700) 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 32px 24px;
}
.cta h2 { color: var(--white); }
.cta p { color: rgba(255, 255, 255, 0.85); }
.cta .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.cta .btn-primary { background: var(--white); color: var(--navy-800); }
.cta .btn-primary:hover { background: var(--blue-100); color: var(--navy-800); }

/* Small photo strip on home */
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.strip img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); }

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

.site-footer { background: var(--navy-900); color: rgba(255, 255, 255, 0.75); padding: 48px 0 28px; font-size: 0.95rem; }
.site-footer a { color: rgba(255, 255, 255, 0.85); text-decoration: none; }
.site-footer a:hover { color: var(--white); text-decoration: underline; }
.footer-grid { display: grid; gap: 32px; }
.footer-brand img { width: 72px; filter: invert(1); opacity: 0.9; margin-bottom: 14px; }
.footer-brand .tagline { font: 600 1.05rem/1.4 var(--font-head); color: var(--white); margin-bottom: 0.4em; }
.site-footer h2 { font: 600 0.78rem/1 var(--font-head); color: var(--white); letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 0 0 8px; }
.social { display: flex; gap: 10px; margin-top: 14px; }
.social a { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); }
.social a:hover { background: rgba(255, 255, 255, 0.16); text-decoration: none; }
.social svg { width: 18px; height: 18px; }
.footer-base { margin-top: 36px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 0.82rem; display: grid; gap: 6px; }

/* ---------- Larger screens ---------- */

@media (min-width: 640px) {
  :root { --gutter: 28px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .pillars { grid-template-columns: repeat(2, 1fr); }
  .media-grid.cols-2, .media-grid.cols-3, .media-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .link-groups { grid-template-columns: repeat(2, 1fr); }
  .pager { grid-template-columns: 1fr 1fr; }
  .contact-card .actions { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .facts dl { grid-template-columns: 1fr 1fr; column-gap: 28px; }
  .facts dl > div:nth-child(2) { border-top: 0; padding-top: 0; }
}

@media (min-width: 1024px) {
  :root { --gutter: 40px; --header-h: 76px; }
  .section { padding: 80px 0; }
  .hero { padding: 96px 0 140px; }
  .hero-logo { width: 150px; }
  .hero-waves { height: 140px; }
  .page-head { padding: 56px 0 64px; }
  .cards { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .pillars { grid-template-columns: repeat(4, 1fr); }
  .media-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .media-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
  .gallery { grid-template-columns: repeat(4, 1fr); }
  .roles { grid-template-columns: repeat(3, 1fr); }
  .link-groups { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
  .footer-base { grid-template-columns: 1fr auto; }
  .cta { padding: 48px; display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: 32px; }
  .cta .actions { justify-content: flex-end; }
  .project { grid-template-columns: minmax(0, 1fr) 320px; gap: 56px; align-items: start; }
  .project .facts { position: sticky; top: calc(var(--header-h) + 24px); order: 2; }
  .facts dl { grid-template-columns: 1fr; }
  .facts dl > div { grid-template-columns: 1fr; gap: 2px; }
  .facts dl > div:nth-child(2) { border-top: 1px solid var(--line); padding-top: 9px; }
  .measure .pillars { grid-template-columns: repeat(2, 1fr); }

  /* Desktop navigation */
  .menu-toggle { display: none; }
  .nav {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: none;
    overflow: visible;
    padding: 0;
  }
  .nav > ul { display: flex; align-items: center; gap: 4px; }
  .nav > ul > li { border: 0; position: relative; }
  .nav a,
  .nav .sub-toggle {
    min-height: 40px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 500;
    gap: 6px;
  }
  .nav > ul > li > a:hover,
  .nav .sub-toggle:hover { background: var(--sand-50); }
  .nav a[aria-current="page"],
  .has-sub.current > .sub-toggle { color: var(--blue-600); background: var(--blue-100); }
  .sub {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 520px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px !important;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
  }
  .has-sub.open .sub { display: grid; }
  .sub li { margin: 0; }
  .sub a { min-height: 38px; padding: 0 12px; border-radius: var(--radius-sm); font-size: 0.92rem; }
  .sub a:hover { background: var(--sand-50); color: var(--navy-800); }
  .sub .sub-all { grid-column: 1 / -1; border-bottom: 1px solid var(--line); margin-bottom: 6px; padding-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media (min-width: 1024px) and (hover: hover) {
  .has-sub:hover .sub { display: grid; }
  .has-sub::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; }
}

/* Embedded apps (3D Wrecks, Diving) */
.embed-page { background: var(--sand-50); }
.embed-bar { display: grid; gap: 12px; padding-top: 18px; padding-bottom: 16px; }
.embed-bar h1 { font-size: 1.5rem; margin: 0 0 0.15em; }
.embed-bar p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.embed-bar .btn { justify-self: start; min-height: 42px; }
.embed-frame { height: calc(100svh - var(--header-h) - 150px); min-height: 520px; border-top: 1px solid var(--line); background: var(--navy-900); }
.embed-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
@media (min-width: 640px) {
  .embed-bar { grid-template-columns: 1fr auto; align-items: center; }
  .embed-frame { height: calc(100svh - var(--header-h) - 100px); }
}
