/* ============================================================
   IdeaHorizon Research Laboratory — Stylesheet
   Design language: warm-paper background, deep academic navy,
   restrained typography, generous whitespace.
   ============================================================ */

/* ─── Tokens ─────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:           #FBFAF6;          /* warm off-white, paper-like */
  --bg-soft:      #F5F1E6;          /* cream block */
  --bg-card:      #FFFFFF;
  --bg-inverse:   #1A1F2E;          /* deep ink, used sparingly */

  /* Ink */
  --ink:          #1A1F2E;          /* near-black, slightly cool */
  --ink-2:        #3D3D3D;
  --ink-3:        #6B6B6B;
  --ink-4:        #9A968B;
  --ink-rule:     #D9D3C2;          /* hairline rules */

  /* Accents */
  --accent:       #1E3A5F;          /* deep academic navy */
  --accent-2:     #2E4F7E;
  --accent-soft:  #E6EBF2;
  --bronze:       #8B6F47;          /* academic bronze, used sparingly */
  --bronze-soft:  #F0E8D8;

  /* Type */
  --serif:        'EB Garamond', Garamond, 'Times New Roman', serif;
  --sans:         'Inter', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --mono:         'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Layout */
  --maxw:         1240px;
  --gutter:       clamp(1.25rem, 3vw, 2.25rem);
  --section-y:    clamp(4.5rem, 9vw, 8rem);

  /* Motion */
  --ease:         cubic-bezier(.2, .6, .2, 1);
}

/* ─── Reset / base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--bronze); }

::selection { background: var(--accent); color: var(--bg); }

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

/* ─── Header ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 246, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--ink-rule);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .85rem;
  color: var(--ink);
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .5px;
  font-style: italic;
}
.brand-name { display: inline-flex; flex-direction: column; line-height: 1.15; }
.brand-name-en {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: .3px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.85rem;
}
.nav a {
  position: relative;
  color: var(--ink-2);
  font-size: 14px;
  letter-spacing: .02em;
  padding: .25rem 0;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -4px;
  height: 1px;
  background: var(--ink);
  transition: right .3s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { right: 0; }
.nav a.is-active { color: var(--ink); }
.nav a.is-active::after { right: 0; }

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--ink-rule);
  cursor: pointer;
  padding: 0;
  position: relative;
}
.nav-toggle span {
  position: absolute;
  left: 9px; right: 9px;
  height: 1px;
  background: var(--ink);
  transition: transform .25s var(--ease), opacity .2s var(--ease);
}
.nav-toggle span:nth-child(1) { top: 12px; }
.nav-toggle span:nth-child(2) { top: 17.5px; }
.nav-toggle span:nth-child(3) { top: 23px; }
.nav-toggle.is-open span:nth-child(1) { top: 17.5px; transform: rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { top: 17.5px; transform: rotate(-45deg); }

/* ─── Hero ───────────────────────────────────────────────── */
.hero {
  padding: clamp(5rem, 10vw, 9rem) 0 clamp(4rem, 8vw, 7rem);
  position: relative;
  overflow: hidden;
}
.hero::before {
  /* very faint dot grid for academic texture */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(30, 58, 95, 0.06) 1px, transparent 0);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: .55;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.eyebrow-num {
  font-family: var(--mono);
  letter-spacing: .15em;
  color: var(--ink);
}
.eyebrow-rule {
  width: 48px; height: 1px;
  background: var(--ink-rule);
  display: inline-block;
}

.hero-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 6.6vw, 5.5rem);
  line-height: 1.04;
  letter-spacing: -.012em;
  margin: 0 0 2rem;
  color: var(--ink);
}
.hero-title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
}
.hero-title .hero-accent {
  position: relative;
  font-style: italic;
  color: var(--bronze);
}
.hero-title .hero-accent::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: .12em;
  height: 1px;
  background: var(--bronze);
  opacity: .35;
}
.ht-line { display: block; }
.ht-1 { font-weight: 500; }
.ht-3 { font-style: italic; color: var(--ink-2); }

.hero-sub {
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  line-height: 1.85;
  color: var(--ink-2);
  max-width: 72ch;
  margin: 0 0 2.5rem;
  font-family: var(--serif);
  font-style: italic;
  letter-spacing: .005em;
}

.hero-rule {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.25rem 0 1.5rem;
  max-width: 56ch;
}
.hr-line { flex: 1; height: 1px; background: var(--ink-rule); }
.hr-orn {
  font-family: var(--serif);
  font-style: italic;
  color: var(--bronze);
  font-size: 22px;
  line-height: 1;
}

.hero-mission {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.7vw, 1.4rem);
  line-height: 1.55;
  color: var(--ink);
  max-width: 64ch;
  margin: 0 0 4rem;
  letter-spacing: .002em;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--ink-rule);
  max-width: 720px;
}
.stat {
  padding: 1.5rem 1.5rem 1.5rem 0;
  border-right: 1px solid var(--ink-rule);
}
.stat:last-child { border-right: 0; padding-right: 0; }
.stat:not(:first-child) { padding-left: 1.5rem; }
.stat-num {
  font-family: var(--serif);
  font-size: 3rem;
  font-weight: 400;
  line-height: 1;
  color: var(--accent);
  margin-bottom: .35rem;
  font-style: italic;
}
.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: .2rem;
}
.stat-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  font-family: var(--serif);
  font-style: italic;
}

/* ─── Section primitives ─────────────────────────────────── */
.section {
  padding: var(--section-y) 0;
  position: relative;
}

.sec-label {
  display: inline-flex;
  align-items: baseline;
  gap: .65rem;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--bronze);
  margin-bottom: 1.5rem;
}
.sec-label-num { font-style: italic; }
.sec-label-text { color: var(--ink-3); letter-spacing: .22em; }

.sec-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 0 0 1.25rem;
  color: var(--ink);
  max-width: 22ch;
}
.sec-title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
}
.sec-sub {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink-3);
  max-width: 60ch;
  margin: 0;
}

.section-head {
  max-width: 760px;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

/* ─── About ──────────────────────────────────────────────── */
.section-about {
  background: var(--bg-soft);
  border-top: 1px solid var(--ink-rule);
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.about-side { position: sticky; top: 7rem; }
.about-body p {
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--ink-2);
  margin: 0 0 1.4rem;
}
.about-body .lead {
  font-size: 1.25rem;
  color: var(--ink);
  line-height: 1.6;
  border-left: 2px solid var(--bronze);
  padding-left: 1.25rem;
  margin-bottom: 2rem;
  font-style: italic;
}
.about-body em { font-style: italic; color: var(--accent); }
.about-body a { border-bottom: 1px solid currentColor; padding-bottom: 1px; }

/* ─── Research grid ──────────────────────────────────────── */
.section-research {
  background: var(--bg);
  border-top: 1px solid var(--ink-rule);
  border-bottom: 1px solid var(--ink-rule);
}
.research-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--ink-rule);
  border-left: 1px solid var(--ink-rule);
}
.research-card {
  background: var(--bg-card);
  border-right: 1px solid var(--ink-rule);
  border-bottom: 1px solid var(--ink-rule);
  padding: clamp(1.75rem, 2.5vw, 2.5rem);
  position: relative;
  transition: background .3s var(--ease);
}
.research-card:hover { background: var(--bg); }
.rc-num {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: .12em;
}
.rc-icon {
  width: 48px;
  height: 48px;
  color: var(--accent);
  margin-bottom: 1.5rem;
}
.rc-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0 0 .35rem;
  color: var(--ink);
  letter-spacing: -.005em;
}
.rc-en {
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
  font-family: var(--sans);
}
.rc-body {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-2);
  margin: 0 0 1.5rem;
}
.rc-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.rc-tags li {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .3rem .55rem;
  border: 1px solid var(--ink-rule);
  color: var(--ink-3);
  background: var(--bg);
}

/* ─── Feature sections (ScienceMate, PODsys) ─────────────── */
.section-feature { background: var(--bg-soft); }
.section-podsys {
  background: var(--bg);
  border-top: 1px solid var(--ink-rule);
  border-bottom: 1px solid var(--ink-rule);
  padding: clamp(3.25rem, 6.5vw, 5.25rem) 0; /* tighter than default --section-y */
}
.section-podsys .feature-head { margin-bottom: clamp(2rem, 3vw, 2.75rem); max-width: none; }
.section-podsys .feature-lede { max-width: none; }

.feature-head { max-width: 900px; margin-bottom: clamp(3rem, 5vw, 4.5rem); }
.feature-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 5.5vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -.012em;
  margin: 0 0 1.75rem;
  color: var(--ink);
}
.ft-pre {
  display: block;
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: .35rem;
}
.ft-sub {
  display: block;
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  line-height: 1.35;
  color: var(--ink-2);
  letter-spacing: -.005em;
}
/* The PODsys heading ends in a descender (y) that dips into the gap between
   title and subtitle, so it gets a bit extra room on its own — without
   affecting titles like ScienceMate that have no descenders. */
.section-podsys .ft-pre {
  margin-bottom: .6rem;
}
.feature-lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 80ch;
  margin: 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--bronze);
}

/* ScienceMate head: the standfirst runs the full content width while the
   display title keeps its own measure. */
.section-sm .feature-head { max-width: none; }
.section-sm .feature-title { max-width: 900px; }
.section-sm .feature-lede { max-width: none; }

/* The ScienceMate section runs tighter than the page default: same parts, less
   air between them. No element's own height is touched, only the gaps. */
.section-sm { padding: clamp(3.25rem, 6.5vw, 5.25rem) 0; } /* as tight as PODsys */
.section-sm .feature-head { margin-bottom: clamp(2rem, 3vw, 2.75rem); }
.section-sm .feature-title { margin-bottom: 1.25rem; }
.section-sm .sm-block { padding-bottom: 1.15rem; margin-bottom: 1.15rem; }
.section-sm .sm-meta { margin-top: 1.15rem; padding-top: 1.15rem; }
.section-sm .figcap { margin-top: .75rem; }

/* ScienceMate layout */
.sm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
}
/* Reset the <figure> UA margin so the diagram top-aligns with the
   text column instead of sitting a bit lower. */
.sm-diagram { margin: 0; }
/* Left column wrapper holds the figure and the download row. */
.sm-fig-col { min-width: 0; }
.sm-fig-col .sm-diagram + .sm-diagram { margin-top: 2rem; }
/* Embedded live WebUI demo — closes the section, framed so it reads as a
   product window. Head and frame run the section's full content width so they
   line up with the standfirst and the diagrams above them. */
.sm-demo-block { margin: clamp(2.25rem, 4vw, 3.5rem) 0 0; }
.sm-demo-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 .75rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--ink);
}
.sm-demo-frame {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--ink-rule);
  border-radius: 12px;
  background: var(--bg-soft);
  box-shadow: 0 24px 48px -34px rgba(26, 31, 46, .5);
}
.sm-demo-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
}
/* Actions folded into the figure metadata list (last row, no rule below). The
   row holds buttons rather than a labelled value, so the label column is
   reproduced as padding to keep the buttons on the value column above. */
/* Specificity note: .sm-meta > div sets padding: .55rem 0 and
   lign-items: baseline, so this must out-specify it, not merely follow it. */
.sm-meta > .sm-meta-actions {
  align-items: center;
  padding-left: calc(var(--sm-meta-key) + 1rem);
}
/* Equal columns rather than wrapping flex: the shorter label (Demo) then takes
   the wider button's width (GitHub) whatever the font metrics do. */
.sm-meta-btns {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  gap: .55rem;
}
.diagram-frame {
  border: 1px solid var(--ink-rule);
  /* No own fill: the frame inherits whichever band it sits in, so the figure's
     background and its section's background are always the same colour
     (cream in ScienceMate, paper in PODsys). */
  background: transparent;
  padding: 1.25rem;
  position: relative;
}
.diagram-frame::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 14px; height: 14px;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}
.diagram-frame::after {
  content: "";
  position: absolute;
  bottom: -1px; right: -1px;
  width: 14px; height: 14px;
  border-bottom: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
}
.figcap {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 1rem;
  line-height: 1.55;
}
.figcap-num {
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  color: var(--ink);
  letter-spacing: .1em;
  margin-right: .5rem;
}

.sm-side, .ps-side {
  position: sticky;
  top: 7rem;
}
.sm-block, .ps-block {
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--ink-rule);
}
.sm-block:last-of-type, .ps-block:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}
.sm-block-head, .ps-block-head {
  display: flex;
  align-items: baseline;
  gap: .65rem;
  margin-bottom: .5rem;
}
.sm-block-num, .ps-block-num {
  font-family: var(--serif);
  font-style: italic;
  color: var(--bronze);
  font-size: 15px;
}
.sm-block-title, .ps-block-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--ink);
  letter-spacing: -.002em;
}
.sm-block p, .ps-block p {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0;
}

.sm-meta {
  /* Width of the label column, shared with the button row below. */
  --sm-meta-key: 90px;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ink-rule);
}
.sm-meta > div {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: .55rem 0;
  border-bottom: 1px dotted var(--ink-rule);
  font-size: 13px;
}
.sm-meta > div:last-child { border-bottom: 0; }
.sm-meta-k {
  flex: 0 0 var(--sm-meta-key);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.sm-meta-v {
  color: var(--ink-2);
  font-family: var(--serif);
}
.sm-meta-v a { color: var(--accent); border-bottom: 1px solid currentColor; padding-bottom: 1px; }

/* Inline buttons (e.g. the podsys.ai site link) */
.btn,
.sm-meta-v a.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .05em;
  white-space: nowrap;
  text-align: center;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: .5rem .95rem;
  box-shadow: 0 1px 2px rgba(26, 31, 46, .10);
  transition: background .2s var(--ease), border-color .2s var(--ease),
              color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover,
.sm-meta-v a.btn:hover {
  color: var(--bg);
  background: var(--accent-2);
  border-color: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(26, 31, 46, .16);
}
.btn:active,
.sm-meta-v a.btn:active { transform: translateY(0); }

/* GitHub action button: keeps the icon and label on one centred line. */
.btn-github {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.btn-github .btn-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: currentColor;
}

/* Demo action button: the label never changes (a text swap would resize the
   button and shift the GitHub button beside it), so the open / closed state is
   carried by a caret that rotates in place. */
.btn-demo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
}
.btn-demo .btn-caret {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s var(--ease);
}
.btn-demo[aria-expanded="true"] .btn-caret { transform: rotate(180deg); }

/* "Coming soon" toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.75rem;
  transform: translate(-50%, .75rem);
  max-width: min(92vw, 30rem);
  padding: .8rem 1.15rem;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--bg);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 12px 30px -12px rgba(26, 31, 46, .55);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom center;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  z-index: 1000;
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.feature-quote {
  margin-top: clamp(2.25rem, 4vw, 3.5rem);
  /* No side padding: the design principle runs the full width of the column. */
  padding: clamp(2rem, 4vw, 3rem) 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  text-align: center;
  position: relative;
}
.quote-mark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 4rem;
  line-height: .5;
  color: var(--bronze);
  margin: 0 0 -1rem;
}
.feature-quote blockquote {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  line-height: 1.45;
  color: var(--ink);
  font-style: italic;
  margin: 0;
  letter-spacing: -.005em;
}
.quote-attr {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 1rem 0 0;
}

/* PODsys layout — diagram on the right this time */
.ps-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;
}
/* Reset the <figure> UA margin so the diagram top-aligns with the
   text column instead of sitting a bit lower. */
.ps-diagram { margin: 0; }

/* ─── PODsys deployment console (terminal) ───────────────── */
/* Warm paper-toned terminal that matches the editorial palette
   instead of a near-black block. */
.terminal {
  margin-top: 1.5rem;
  border: 1px solid var(--ink-rule);
  border-radius: 6px;
  overflow: hidden;
  background: #FBFAF6;
  box-shadow: 0 14px 30px -24px rgba(26, 31, 46, .35);
}
.term-chrome {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .9rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--ink-rule);
}
.term-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.term-dot-r { background: #D08476; }
.term-dot-y { background: #D9B465; }
.term-dot-g { background: #7FA07F; }
.term-title {
  margin-left: .5rem;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--ink-4);
}
.term-body {
  font-family: var(--mono);
  font-size: clamp(10.5px, .8vw + 7px, 12px);
  line-height: 1.45;
  padding: .9rem 1rem 1rem;
  color: var(--ink-2);
  white-space: pre-wrap;
  /* Fixed size from the start: 20 lines (incl. blanks) x 1.45em + padding,
     so the window never grows as the log is typed out. */
  height: calc(29em + 2rem);
  overflow-y: hidden;
  overflow-x: auto;
}
.term-line { display: block; white-space: pre; }
.term-spacer { height: 1.45em; }
.term-line.banner { color: var(--accent); font-weight: 600; }
.term-line.dim { color: var(--ink-4); }
.term-line .ok { color: #4F7A57; }
.term-line .url { color: #2E5F8C; }
.term-line .key { color: var(--bronze); }
.term-line .prompt-user { color: #4F7A57; }
.term-line .prompt-sym { color: var(--ink-3); }
.term-cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 2px;
  background: var(--ink);
  vertical-align: text-bottom;
  animation: term-blink 1.1s steps(1) infinite;
}
@keyframes term-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .term-cursor { animation: none; }
}

/* ─── Publications ───────────────────────────────────────── */
.section-pubs {
  background: var(--bg-soft);
  border-top: 1px solid var(--ink-rule);
  /* Runs straight into Contact, so pull the bottom in — otherwise the two
     short sections stack their full default section padding back-to-back. */
  padding-bottom: clamp(2rem, 3.5vw, 3rem);
}
.pub-list {
  border-top: 1px solid var(--ink-rule);
}
.pub {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: clamp(1.5rem, 3vw, 3rem);
  padding: 2rem 0;
  border-bottom: 1px solid var(--ink-rule);
  align-items: start;
}
/* Explicit placement: the tag sits in the narrow left column and spans all
   three content rows, while title / meta / desc all flow in the wide right
   column. Without this, pub-meta (3rd child) falls back into the 110px
   column and the meta text wraps nearly one word per line. */
.pub-tag {
  grid-column: 1;
  grid-row: 1 / span 3;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: .35rem;
}
.pub-title { grid-column: 2; grid-row: 1; }
.pub-meta  { grid-column: 2; grid-row: 2; }
.pub-desc  { grid-column: 2; grid-row: 3; }
.pub-pending .pub-tag { color: var(--ink-3); }
.pub-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.35;
  margin: 0 0 .4rem;
  color: var(--ink);
  letter-spacing: -.005em;
}
.pub-meta {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 0 0 .65rem;
  font-family: var(--sans);
  letter-spacing: .02em;
}
.pub-meta a { color: var(--accent); border-bottom: 1px solid currentColor; }
.pub-desc {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0;
  max-width: 75ch;
}
.pub-pending .pub-title,
.pub-pending .pub-desc { color: var(--ink-3); font-style: italic; }

/* ─── Team ───────────────────────────────────────────────── */
.section-team {
  background: var(--bg-soft);
  border-top: 1px solid var(--ink-rule);
  border-bottom: 1px solid var(--ink-rule);
}
.team-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.team-side { position: sticky; top: 7rem; }
.team-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--ink-rule);
  border: 1px solid var(--ink-rule);
}
.team-card {
  background: var(--bg-card);
  padding: 1.75rem 1.5rem;
}
.team-card-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0 0 .65rem;
  color: var(--ink);
}
.team-card p {
  font-family: var(--serif);
  font-size: .975rem;
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0;
}
.team-card-cta {
  background: var(--accent);
  color: var(--bg);
}
.team-card-cta .team-card-title { color: var(--bg); }
.team-card-cta p { color: rgba(251, 250, 246, 0.82); }

/* ─── Contact ────────────────────────────────────────────── */
.section-contact {
  background: var(--bg);
  border-top: 1px solid var(--ink-rule);
}
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.contact-side { position: sticky; top: 7rem; }
.contact-body {
  border-top: 1px solid var(--ink-rule);
  /* Nudge the two rows on the right down so they line up visually with the
   "Get in touch." heading on the left. */
  margin-top: 2.75rem;
}
.contact-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--ink-rule);
  align-items: baseline;
}
.contact-k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.contact-v {
  font-family: var(--serif);
  font-size: 1.125rem;
  color: var(--ink);
}
.contact-v a { color: var(--accent); border-bottom: 1px solid currentColor; padding-bottom: 1px; }

/* ─── Footer ─────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-inverse);
  color: rgba(251, 250, 246, 0.7);
  padding: 3rem 0 2rem;
  margin-top: 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--bg);
}
.footer-brand .brand-mark {
  border-color: rgba(251, 250, 246, 0.4);
  color: var(--bg);
}
.footer-name-en {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--bg);
  font-weight: 500;
  letter-spacing: .3px;
}
.footer-meta {
  text-align: right;
  font-size: 12.5px;
  line-height: 1.7;
}
.footer-links a {
  color: rgba(251, 250, 246, 0.85);
  margin: 0 .35rem;
}
.footer-links a:hover { color: var(--bg); }
.footer-links .dot { color: rgba(251, 250, 246, 0.3); }

/* ─── Scroll-in animations ───────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 960px) {
  .about-grid,
  .team-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .about-side,
  .team-side,
  .contact-side,
  .sm-side,
  .ps-side {
    position: static;
  }
  .sm-layout,
  .ps-layout {
    grid-template-columns: 1fr;
  }
  .ps-layout { grid-template-areas: "diagram" "side"; }
  .ps-diagram { grid-area: diagram; }
  .ps-side { grid-area: side; }
  .research-grid {
    grid-template-columns: 1fr;
  }
  .research-card {
    border-right: 0;
  }
  .pub {
    grid-template-columns: 1fr;
    gap: .5rem;
  }
  .team-body {
    grid-template-columns: 1fr;
  }
  .contact-row {
    grid-template-columns: 1fr;
    gap: .35rem;
  }
  .hero-stats {
    grid-template-columns: 1fr;
  }
  .stat {
    border-right: 0;
    border-bottom: 1px solid var(--ink-rule);
    padding: 1.25rem 0;
  }
  .stat:not(:first-child) { padding-left: 0; }
  .stat:last-child { border-bottom: 0; padding-bottom: 0; }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-meta {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .nav { display: none; }
  .nav.is-open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--ink-rule);
    padding: .5rem var(--gutter) 1.25rem;
  }
  .nav.is-open a {
    padding: .65rem 0;
    border-bottom: 1px solid var(--ink-rule);
    width: 100%;
  }
  .nav.is-open a:last-child { border-bottom: 0; }
  .nav.is-open a::after { display: none; }
  .nav-toggle { display: inline-flex; }
  .header-inner { position: relative; }
  .site-header { position: relative; }
  .hero { padding-top: 4rem; }
  /* Two equal button columns no longer fit beside the label column. */
  .sm-meta-btns { grid-auto-flow: row; }
  .feature-quote blockquote { font-size: 1.25rem; }
}

/* ─── Print ──────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .nav-toggle { display: none; }
  body { background: white; color: black; }
  a { color: black; text-decoration: underline; }
}
