/* ==========================================================================
   siyangni.com — base, page chrome, and layout

   Content components (tiles, figure plates, dissertation blocks, code) live
   in content.css.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-5));
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
a:hover { color: var(--accent-hi); border-bottom-color: var(--accent-line-hi); }

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

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 500;
  line-height: var(--lh-snug);
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 var(--s-4); }
p:last-child { margin-bottom: 0; }

.skip {
  position: absolute;
  left: var(--s-4);
  top: -4rem;
  z-index: 100;
  background: var(--surface);
  color: var(--accent);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  transition: top var(--dur) var(--ease);
}
.skip:focus { top: var(--s-4); }

.shell {
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--shell-pad);
}
.measure { max-width: var(--measure); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ==========================================================================
   Header
   ========================================================================== */

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--rule-soft);
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: var(--header-h);
  flex-wrap: wrap;
}

/* Wordmark: a wide, heavy all-caps sans. Archivo is loaded at 125% width and
   subset to the letters of the name, so it costs a few kilobytes. */
.wordmark {
  font-family: 'Archivo', var(--font-sans);
  font-stretch: 125%;
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 0;
}
.wordmark:hover { color: var(--ink); opacity: .75; }

.nav__toggle {
  display: none;
  font: inherit;
  font-size: var(--t-small);
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: var(--s-2) var(--s-4);
  cursor: pointer;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__list { gap: var(--s-5); }
.nav__list a:not(.btn) {
  display: block;
  font-size: 1rem;
  color: var(--ink);
  border-bottom: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .3em;
  text-decoration-color: color-mix(in srgb, var(--ink) 55%, transparent);
  transition: text-decoration-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav__list a:not(.btn):hover { color: var(--accent); text-decoration-color: currentColor; }
.nav__list a[aria-current="page"] { text-decoration-thickness: 2px; text-decoration-color: var(--ink); }
.nav__list .btn { margin-left: var(--s-2); padding: .6rem 1.1rem; font-size: .95rem; }

@media (max-width: 52rem) {
  .nav__toggle { display: block; }
  /* nav.js clears [hidden] when it runs; without JS the list stays visible. */
  .nav__toggle[hidden] { display: none; }
  /* Without JS the list simply wraps under the wordmark. */
  .nav__list { flex-wrap: wrap; }
  .nav[data-collapsed] .nav__list li a:not(.btn) { padding-block: var(--s-3); }
  .nav[data-collapsed] .nav__list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--s-2) var(--shell-pad) var(--s-4);
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow-md);
  }
  .nav[data-collapsed] .nav__list .btn { display: flex; margin: var(--s-3) 0 0; justify-content: center; }
  .nav[data-collapsed="true"] .nav__list { display: none; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-sans);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.2;
  padding: .7rem 1.15rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--ink); }

.btn--sm { padding: .5rem .9rem; font-size: .9rem; }

.actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* ==========================================================================
   Labels and small type
   ========================================================================== */

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--t-label);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.meta { font-size: var(--t-small); color: var(--muted); line-height: 1.5; }
.meta a { color: var(--ink-soft); border-bottom-color: var(--rule); }
.meta a:hover { color: var(--accent); border-bottom-color: var(--accent-line-hi); }

.sep { color: var(--rule); padding-inline: .45em; }
/* A zero-width space after each separator lets long runs wrap on small screens. */
.sep::after { content: "\200B"; }

.status {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  font-family: var(--font-sans);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .2em .75em;
  white-space: nowrap;
}
.status--jmp { color: var(--accent); background: var(--accent-tint); border-color: var(--accent-line); }
.status--jmp::before {
  content: "";
  width: .45em;
  height: .45em;
  border-radius: 50%;
  background: currentColor;
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section { padding-block: var(--s-section); }
.section:not(.section--wash) + .section:not(.section--wash) { padding-top: 0; }
.section--wash { background: var(--wash-soft); }

.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--s-4) var(--s-6);
  margin-bottom: var(--s-6);
}
.sec-head > div:first-child { display: grid; gap: var(--s-2); max-width: 44rem; }
.sec-title { font-size: var(--t-h2); }
.sec-intro { color: var(--ink-soft); max-width: 62ch; margin: 0; }

.title   { font-size: var(--t-title); line-height: var(--lh-tight); }
.display { font-size: var(--t-display); line-height: var(--lh-tight); letter-spacing: -.005em; }
.h2      { font-size: var(--t-h2); }
.h3      { font-size: var(--t-h3); }

.lede {
  font-size: var(--t-lede);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 50ch;
  text-wrap: pretty;
}

/* Two columns on wide screens, stacked below. */
.split {
  display: grid;
  gap: var(--s-7);
  grid-template-columns: minmax(0, 1fr);
}
.split > * { min-width: 0; }
@media (min-width: 60rem) {
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-8); }
  .split--wide-left  { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .split--wide-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
  .split--center { align-items: center; }
  .sticky { position: sticky; top: calc(var(--header-h) + var(--s-5)); }
}

/* ==========================================================================
   Page hero (inner pages)
   ========================================================================== */

.page-hero {
  padding-block: clamp(3rem, 2rem + 4vw, 5.5rem) clamp(2.5rem, 2rem + 2vw, 4rem);
  border-bottom: 1px solid var(--rule-soft);
}
.page-hero__grid {
  display: grid;
  gap: var(--s-5) var(--s-8);
  grid-template-columns: minmax(0, 1fr);
}
.page-hero__grid > * { min-width: 0; }
.page-hero__title { display: grid; gap: var(--s-4); align-content: start; }
.page-hero__body > p { color: var(--ink-soft); }
.page-hero__body > .lede { color: var(--ink); margin-bottom: var(--s-4); }
@media (min-width: 60rem) {
  .page-hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: end; }
}

/* ==========================================================================
   Home hero
   ========================================================================== */

.hero { padding-block: clamp(3rem, 2rem + 4vw, 6rem) var(--s-section); }
.hero__grid {
  display: grid;
  gap: var(--s-7);
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}
.hero__grid > * { min-width: 0; }
.hero__text { display: grid; gap: var(--s-5); justify-items: start; }
.hero__text .lede { color: var(--ink); max-width: 46ch; margin: 0; }
.hero__text .actions { margin-top: var(--s-2); }

.hero__figure {
  position: relative;
  width: min(100% - 1.1rem, 16rem);
  justify-self: start;
}
/* An offset tile behind the portrait gives the hero some depth. */
.hero__figure::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translate(1.1rem, 1.1rem);
  border-radius: var(--radius-lg);
  background: var(--wash);
  border: 1px solid var(--rule-soft);
}
.hero__figure img {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

@media (min-width: 60rem) {
  .hero__grid { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: var(--s-8); }
  .hero__figure { justify-self: end; width: min(100%, 22rem); }
}

/* Key numbers under the hero */
.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: var(--s-7) 0 0;
  padding: 0;
  list-style: none;
  border-block: 1px solid var(--rule);
}
.facts li { padding: var(--s-5) var(--s-4) var(--s-5) 0; }
.facts li + li { padding-left: var(--s-4); border-left: 1px solid var(--rule-soft); }
.facts li:nth-child(3) { border-left: 0; padding-left: 0; }
.facts__n {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 1.4rem + 1.2vw, 2.3rem);
  line-height: 1.1;
  color: var(--ink);
}
.facts__l { display: block; margin-top: var(--s-1); font-size: var(--t-small); color: var(--muted); }
@media (max-width: 59.99rem) {
  .facts li:nth-child(n+3) { border-top: 1px solid var(--rule-soft); }
}
@media (min-width: 60rem) {
  .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .facts li:nth-child(3) { border-left: 1px solid var(--rule-soft); padding-left: var(--s-5); }
  .facts li + li { padding-left: var(--s-5); }
}

/* ==========================================================================
   Feature band (dark panel)
   ========================================================================== */

.feature {
  --ink: var(--band-ink);
  --body: var(--band-ink);
  --ink-soft: var(--band-muted);
  --muted: var(--band-muted);
  --accent: var(--band-accent);
  --accent-hi: #f3d0d0;
  --accent-line: rgba(227, 180, 180, .35);
  --accent-line-hi: rgba(243, 208, 208, .75);
  --rule: var(--band-rule);
  --surface: transparent;

  background: var(--band);
  color: var(--band-ink);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 1rem + 3vw, 4rem);
}
.feature .btn { background: var(--band-ink); border-color: var(--band-ink); color: var(--band); }
.feature .btn:hover { background: var(--band-accent); border-color: var(--band-accent); }
.feature .btn--ghost { background: transparent; color: var(--band-ink); border-color: var(--band-rule); }
.feature .btn--ghost:hover { border-color: var(--band-ink); background: transparent; color: var(--band-ink); }
.feature__text { display: grid; gap: var(--s-4); justify-items: start; }
.feature__text p { margin: 0; }
.feature__sub { font-size: var(--t-lede); color: var(--band-muted); line-height: 1.45; }

/* ==========================================================================
   Contact form
   ========================================================================== */

.form-card {
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 1rem + 1.5vw, 2.25rem);
  box-shadow: var(--shadow-sm);
}
.form { display: grid; gap: var(--s-4); }
.form__row { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 36rem) { .form__row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.field { display: grid; gap: var(--s-2); }
.field label { font-size: var(--t-small); font-weight: 600; color: var(--ink); }
.field input,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: .7rem .85rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input:hover,
.field textarea:hover { border-color: var(--muted); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-line);
}

.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.form__status { font-size: var(--t-small); color: var(--muted); margin: 0; }
.form__status[data-kind="ok"] { color: var(--ink); }
.form__status[data-kind="error"] { color: var(--accent); }

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  --accent: var(--band-accent);
  background: var(--band);
  color: var(--band-muted);
  padding-block: var(--s-8) var(--s-6);
  font-size: var(--t-small);
}
.footer__grid {
  display: grid;
  gap: var(--s-6);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}
.footer__brand { display: grid; gap: var(--s-3); align-content: start; }
@media (min-width: 60rem) {
  .footer__grid { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); }
}
.footer__name { font-family: var(--font-display); font-size: 1.5rem; color: var(--band-ink); }
.footer h2 {
  font-family: var(--font-sans);
  font-size: var(--t-label);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--band-ink);
  margin-bottom: var(--s-3);
}
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.footer p { margin: 0; }
.footer a { color: var(--band-muted); border-bottom: 0; }
.footer a:hover { color: var(--band-ink); }
.footer__colophon {
  margin-top: var(--s-7);
  padding-top: var(--s-4);
  border-top: 1px solid var(--band-rule);
}

/* ==========================================================================
   Media hero (teaching): text beside a looping, muted clip
   ========================================================================== */

@media (min-width: 60rem) {
  .hero__grid--media { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
}

.media { margin: 0; min-width: 0; }
.media__stack { position: relative; margin-right: 1.1rem; }
/* Same offset tile as the homepage portrait. */
.media__stack::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translate(1.1rem, 1.1rem);
  border-radius: var(--radius-lg);
  background: var(--wash);
  border: 1px solid var(--rule-soft);
}
.media__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--band);
  box-shadow: var(--shadow-md);
}
.media__video { display: block; width: 100%; height: 100%; object-fit: cover; }
.media__toggle {
  position: absolute;
  left: var(--s-3);
  bottom: var(--s-3);
  font-family: var(--font-sans);
  font-size: .8rem;
  font-weight: 600;
  color: #fff;
  background: rgba(20, 18, 15, .55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  padding: .35rem .85rem;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.media__toggle:hover { background: rgba(20, 18, 15, .8); }
.media figcaption {
  margin-top: calc(var(--s-4) + 1.1rem);
  font-size: var(--t-small);
  color: var(--muted);
}

.principles { margin-top: var(--s-8); }

/* Portrait photo in a hero (dissertation) */
@media (min-width: 60rem) {
  .hero__grid--portrait { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}
.media--portrait { width: min(100%, 26rem); justify-self: center; }
@media (min-width: 60rem) { .media--portrait { justify-self: end; } }
.media--portrait .media__frame { aspect-ratio: 4 / 5; }
.media__frame img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Wide photo banner (research). On narrow screens it is cropped around the speaker. */
.media--banner { margin-top: var(--s-7); }
.media--banner .media__frame { aspect-ratio: 16 / 9; }
.media--banner img { object-position: 55% 50%; }
@media (min-width: 40rem) {
  .media--banner .media__frame { aspect-ratio: 1400 / 349; }
}
.media--banner figcaption { margin-top: var(--s-3); }

/* Wide demo clip (software): the recording is 1280 x 596. The frame matches the clip's paper tone. */
.media--wide .media__frame { aspect-ratio: 1280 / 596; background: #f3eee4; }
