/* A3EM project site — shared styles */

:root {
  --bg: #f7f6f1;
  --bg-alt: #eeece3;
  --surface: #ffffff;
  --text: #1e2620;
  --text-muted: #52604f;
  --primary: #1f4a3d;
  --primary-dark: #14332a;
  --primary-light: #2f6b57;
  --accent: #c98a2b;
  --accent-light: #e2a53a;
  --border: #dcd8cb;
  --shadow: 0 2px 10px rgba(20, 30, 20, 0.08);
  --radius: 10px;
  --max-width: 1120px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121712;
    --bg-alt: #182019;
    --surface: #1a221c;
    --text: #e7ece5;
    --text-muted: #a9b6a4;
    --primary: #4f8c72;
    --primary-dark: #3a6d58;
    --primary-light: #6ba98d;
    --accent: #e2a53a;
    --accent-light: #f0bf63;
    --border: #2a352c;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

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

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--text);
  line-height: 1.25;
  font-weight: 700;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text);
}

.brand:hover { text-decoration: none; }

.brand-mark { width: 34px; height: 34px; flex-shrink: 0; color: var(--primary); }

.brand-sub {
  display: block;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

nav.main-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}

nav.main-nav a:hover,
nav.main-nav a.active {
  color: var(--primary);
  text-decoration: none;
}

nav.main-nav a.external {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--primary);
  border-radius: 999px;
  color: var(--primary);
}

nav.main-nav a.external:hover {
  background: var(--primary);
  color: #fff;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  nav.main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 1.5rem 1rem;
    display: none;
  }
  nav.main-nav.open { display: flex; }
  nav.main-nav a { padding: 0.6rem 0; width: 100%; }
  nav.main-nav a.external { margin-top: 0.5rem; text-align: center; }
}

/* ---------- Hero ---------- */

.hero {
  background: linear-gradient(160deg, var(--primary-dark), var(--primary) 70%);
  color: #f4f1e8;
  padding: 4.5rem 0 3.5rem;
}

.hero .container {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

@media (max-width: 860px) {
  .hero .container { grid-template-columns: 1fr; }
  .hero-art { order: -1; max-width: 220px; margin: 0 auto; }
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 0.9rem;
}

.hero h1 {
  color: #fff;
  font-size: 2.6rem;
  margin: 0 0 1rem;
}

.hero p.lead {
  font-size: 1.1rem;
  color: #dfe6dc;
  max-width: 56ch;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.6rem; }

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
}

.btn-primary { background: var(--accent); color: #241505; }
.btn-primary:hover { background: var(--accent-light); text-decoration: none; }

.btn-outline { border-color: rgba(244,241,232,0.5); color: #f4f1e8; }
.btn-outline:hover { border-color: #f4f1e8; text-decoration: none; }

/* ---------- Stat strip ---------- */

.stats {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.stats .container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  padding: 2rem 1.5rem;
  text-align: center;
}

@media (max-width: 700px) {
  .stats .container { grid-template-columns: repeat(2, 1fr); }
}

.stat .num {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--primary);
}

.stat .label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

section { padding: 3.5rem 0; }
section.alt { background: var(--bg-alt); }

.section-head { max-width: 70ch; margin-bottom: 2.2rem; }
.section-head h2 { font-size: 1.9rem; margin-bottom: 0.6rem; }
.section-head p { color: var(--text-muted); }

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* Card grid */

.grid { display: grid; gap: 1.4rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card h3 { font-size: 1.15rem; margin: 0 0 0.5rem; }
.card p { color: var(--text-muted); font-size: 0.95rem; margin: 0; }

.card .icon {
  width: 40px; height: 40px;
  margin-bottom: 0.9rem;
  color: var(--primary);
}

/* Goal number badge */
.goal-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

/* Tag pills */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin: 0 0.35rem 0.35rem 0;
}

.tag.status-active { background: #e6f0eb; color: var(--primary-dark); border-color: var(--primary-light); }
.tag.status-recovered { background: var(--bg-alt); color: var(--text-muted); }
.tag.status-lost { background: #f3e4e0; color: #8a3b2a; border-color: #d59f8f; }

@media (prefers-color-scheme: dark) {
  .tag.status-active { background: #1f3a2f; color: var(--accent-light); }
  .tag.status-lost { background: #3a241f; color: #e08b6f; }
}

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.92rem; min-width: 480px; }
th, td { text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); }
th { background: var(--bg-alt); font-weight: 600; color: var(--text); }
tr:last-child td { border-bottom: none; }

/* Timeline / deployment cards */
.deployment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.4rem;
}

.deployment-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.deployment-head h3 { margin: 0; font-size: 1.25rem; }
.deployment-loc { color: var(--text-muted); font-size: 0.9rem; }

.deployment-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0.9rem 0;
  font-size: 0.88rem;
}
.deployment-stats div strong { display: block; color: var(--text); font-size: 1rem; }
.deployment-stats div span { color: var(--text-muted); }

/* Deployment photo slideshow */
.slideshow { max-width: 900px; margin: 0 auto; }

.slide-frame {
  position: relative;
  background: #0d120e;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.slide-frame img {
  width: 100%;
  height: min(64vh, 560px);
  object-fit: contain;
  margin: 0 auto;
  background: #0d120e;
  transition: opacity 0.25s ease;
}

.slide-frame img.is-loading { opacity: 0.35; }

.slide-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.slide-btn:hover { background: rgba(0, 0, 0, 0.72); }
.slide-btn:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.slide-btn.prev { left: 0.8rem; }
.slide-btn.next { right: 0.8rem; }

.slide-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.3rem;
  margin-top: 1rem;
}

.slide-counter {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.slide-play {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.slide-play:hover { color: var(--primary); border-color: var(--primary-light); }

@media (max-width: 500px) {
  .slide-frame img { height: 56vh; }
  .slide-btn { width: 38px; height: 38px; font-size: 1.4rem; }
}

/* People */
.person {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
}

.avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 1.1rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.person h3 { margin: 0 0 0.15rem; font-size: 1.05rem; }
.person .role { color: var(--accent); font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; }
.person p { margin: 0; font-size: 0.9rem; color: var(--text-muted); }

/* Repo cards */
.repo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.repo-card .repo-name {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--primary);
}

.repo-card .lang {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.lang-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Media split (text + image) — stays side-by-side until quite narrow */
.media-split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2.5rem;
}

.media-split .section-head { margin-bottom: 0; flex: 1 1 320px; }
.media-split .figure { flex: 0 0 280px; max-width: 280px; }

@media (max-width: 620px) {
  .media-split { gap: 1.4rem; }
  .media-split .figure { flex-basis: 100%; max-width: 320px; margin: 0 auto; }
}

/* Figure with framed image + caption */
.figure { margin: 0; }

.figure img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
  padding: 0.6rem;
}

.figure figcaption {
  margin-top: 0.7rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* Blockquote / callout */
.callout {
  border-left: 4px solid var(--accent);
  background: var(--bg-alt);
  padding: 1rem 1.3rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Footer */
footer.site-footer {
  background: var(--primary-dark);
  color: #d9e2d6;
  padding: 2.6rem 0 1.6rem;
  margin-top: 2rem;
  font-size: 0.9rem;
}

footer.site-footer a { color: #f0e6c8; }

footer .footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 1.8rem;
}

@media (max-width: 700px) {
  footer .footer-grid { grid-template-columns: 1fr; }
}

footer h4 {
  color: #fff;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.8rem;
  font-family: var(--font-sans);
}

footer ul { list-style: none; padding: 0; margin: 0; }
footer li { margin-bottom: 0.5rem; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 1.2rem;
  font-size: 0.8rem;
  color: #b7c4b2;
}

/* Page header (non-home pages) */
.page-header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 2.6rem 0;
}
.page-header h1 { font-size: 2.1rem; margin: 0 0 0.5rem; }
.page-header p { color: var(--text-muted); max-width: 70ch; margin: 0; }

ol.steps { padding-left: 1.3rem; }
ol.steps li { margin-bottom: 0.6rem; }
ul.plain { padding-left: 1.3rem; }
ul.plain li { margin-bottom: 0.5rem; }
