/* Responsive system: preserve the editorial identity while adapting every route. */

html {
  -webkit-text-size-adjust: 100%;
}

html.dark-page {
  background: #1c2125;
  color-scheme: dark;
}

body,
main,
section,
article,
aside,
.container,
.layout,
.page-shell,
.quiet-about-layout,
.contact-organized {
  min-width: 0;
}

img,
video,
svg,
canvas {
  max-width: 100%;
}

.citation,
.publication-meta,
.side-card dd,
.form-note,
.learning-topic-body,
.footer-grid {
  overflow-wrap: anywhere;
}

@supports (padding-left: max(0px)) {
  .container,
  .nav-wrap,
  .site-footer {
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
  }

  .nav-wrap::after {
    left: max(var(--gutter), env(safe-area-inset-left));
    right: max(var(--gutter), env(safe-area-inset-right));
  }

  .home .quiet-hero.has-home-film,
  .home .quiet-gateway {
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
  }
}

@media (max-width: 1100px) and (min-width: 901px) {
  .grid-3:not(.research-interests-page .grid-3) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    gap: 24px;
  }
}

/* The navigation changes as soon as its labels become crowded, not only on phones. */
@media (max-width: 900px) {
  :root {
    --gutter: clamp(22px, 5vw, 42px);
  }

  body.menu-open {
    overflow: hidden;
  }

  .nav-wrap {
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    min-width: 82px;
    min-height: 44px;
    padding: 8px 0 8px 12px;
    border: 0;
    background: none;
    font-size: 14px;
    touch-action: manipulation;
  }

  .menu-button span {
    font-size: 22px;
    line-height: 1;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    max-height: calc(100dvh - 76px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 12px max(var(--gutter), env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(var(--gutter), env(safe-area-inset-left));
    border-bottom: 1px solid var(--ink);
    background: var(--paper);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: clamp(19px, 3.3vw, 23px);
    line-height: 1.25;
    letter-spacing: -0.03em;
  }

  .nav-links a::after {
    display: none;
  }

  .page-shell,
  .layout,
  .quiet-about-layout,
  .contact-hero-grid,
  .contact-organized {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .layout,
  .quiet-about-layout {
    gap: 40px;
  }

  .layout > .card:first-child {
    max-width: 72ch;
  }

  .layout .side-card,
  .quiet-about-portrait {
    position: static;
  }

  .quiet-about-portrait {
    order: -1;
    width: min(100%, 440px);
  }

  .quiet-about-portrait .about-photo img {
    width: 100%;
  }

  .contact-hero-grid {
    align-items: start;
    gap: 30px;
  }

  .contact-page .contact-hero .lead {
    max-width: 56ch;
  }

  .contact-organized {
    gap: 56px;
  }

  .contact-page .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .research-interests-page .grid-3 {
    column-gap: 36px;
  }

  .topic-nav a {
    max-width: 48%;
  }

  .site-footer {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }
}

@media (max-width: 680px) {
  :root {
    --gutter: 22px;
  }

  .page-hero,
  .publication-detail .hero {
    padding-top: 34px;
    padding-bottom: 26px;
  }

  .page-hero h1,
  .research-interests-page .page-hero h1 {
    font-size: clamp(38px, 11.8vw, 54px);
    line-height: 1.04;
    text-wrap: balance;
  }

  .publication-detail h1 {
    font-size: clamp(30px, 9.2vw, 44px);
    line-height: 1.1;
    overflow-wrap: anywhere;
    text-wrap: pretty;
  }

  .section {
    padding-top: 18px;
    padding-bottom: 48px;
  }

  .lead {
    font-size: 18px;
  }

  .grid-3,
  .research-interests-page .grid-3,
  .contact-page .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .research-interests-page .content-card {
    grid-template-columns: 32px minmax(0, 1fr);
    column-gap: 16px;
  }

  .research-interests-page .content-card > a {
    grid-column: 2;
  }

  .topic-row {
    grid-template-columns: 30px minmax(0, 1fr) 18px;
    gap: 12px;
    padding: 20px 0;
  }

  .pen-title {
    font-size: clamp(22px, 7vw, 30px);
  }

  .publication-item {
    padding: 25px 0 25px 36px;
  }

  .publication-item .title-arrow,
  .publication-item .publication-title-link .title-arrow {
    position: static;
    display: inline;
    margin-left: 7px;
  }

  .publication-item h3 {
    font-size: clamp(22px, 6.4vw, 28px);
    overflow-wrap: anywhere;
  }

  .publication-links {
    gap: 10px 22px;
  }

  .publication-links a,
  .text-link,
  .button,
  .topic-nav a,
  .footer-links a {
    min-height: 44px;
  }

  .topic-nav {
    flex-direction: column;
    gap: 6px;
  }

  .topic-nav a {
    width: 100%;
    max-width: none;
  }

  details > summary {
    min-height: 44px;
  }

  .prototype-figure {
    margin: 30px 0;
    padding: 14px 0;
  }

  .figure-original::after {
    display: none;
  }

  .viewer-controls button,
  .viewer-pagination button {
    min-width: 44px;
    min-height: 44px;
  }

  .viewer-header {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .viewer-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .footer-grid {
    display: block;
    padding-top: 20px;
  }

  .footer-grid small {
    display: block;
    max-width: 48ch;
    margin-top: 7px;
  }

  .footer-links {
    margin-top: 20px;
    gap: 4px 20px;
    align-items: center;
  }

  .footer-links a,
  .footer-links span {
    display: inline-flex;
    align-items: center;
  }

  .contact-page .contact-hero {
    padding-top: 36px;
  }

  .contact-page .contact-hero h1 {
    font-size: clamp(46px, 15vw, 66px);
  }

  .contact-workflow {
    padding-top: 50px;
    padding-bottom: 72px;
  }

  .contact-form-actions {
    align-items: flex-start;
    gap: 6px 24px;
  }
}

@media (max-width: 480px) {
  :root {
    --gutter: 20px;
  }

  .brand {
    font-size: 14px;
  }

  .quiet-about-heading h1 {
    font-size: clamp(38px, 12vw, 46px);
  }

  .quiet-about-story > p,
  .quiet-about-story > p:first-child,
  .quiet-about-story .about-perspective p {
    font-size: 16px;
    line-height: 1.72;
  }

  .quiet-about-story > .actions {
    align-items: flex-start;
    gap: 4px 20px;
  }

  .contact-scope h2 {
    font-size: 30px;
  }

  .collaboration-summary li {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
  }

  .form-field.full,
  .form-field {
    grid-column: 1;
  }

  .focus-system .fs-index-heading,
  .activities-page .process-heading {
    align-items: flex-start;
  }

  .focus-system .learning-topic > summary {
    min-height: 72px;
  }
}

/* Short phone landscape: keep the hero readable and allow natural vertical scrolling. */
@media (max-width: 900px) and (max-height: 600px) and (orientation: landscape) {
  html.home-sections {
    scroll-snap-type: none;
  }

  .home #main-content > section {
    min-height: auto;
  }

  .home .quiet-hero.has-home-film {
    min-height: calc(100svh - 76px);
    padding-top: 22px;
    padding-bottom: 14px;
  }

  .home .has-home-film .quiet-hero-grid {
    max-width: 610px;
    margin-top: 20px !important;
    margin-bottom: 24px;
    gap: 18px;
  }

  .home .has-home-film .quiet-identity h1 {
    font-size: clamp(36px, 7vw, 50px);
  }

  .home .has-home-film .quiet-introduction .lead {
    font-size: 16px;
    line-height: 1.5;
  }

  .home .has-home-film .quiet-hero-foot {
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Simple reading layer: preserve every feature while reducing visual noise. */
:root {
  --simple-paper: #f7f7f4;
  --simple-ink: #202326;
  --simple-muted: #667078;
  --simple-line: #d5d9d8;
  --simple-blue: #2854c5;
}

body:not(.home) {
  --paper: var(--simple-paper);
  --ink: var(--simple-ink);
  --muted: var(--simple-muted);
  --line: var(--simple-line);
  --blue: var(--simple-blue);
  --max: 1440px;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
}

body:not(.home) .site-header {
  background: rgba(247, 247, 244, .96);
  backdrop-filter: blur(10px);
}

body:not(.home) .nav-wrap,
.home .nav-wrap {
  padding-top: 17px;
  padding-bottom: 17px;
}

body:not(.home) .nav-links,
.home .nav-links {
  gap: clamp(16px, 1.8vw, 28px);
}

body:not(.home) .nav-links a,
.home .nav-links a {
  font-size: 13px;
}

body:not(.home) .page-hero {
  padding-top: clamp(40px, 6vw, 64px);
  padding-bottom: 28px;
}

body:not(.home) .page-hero h1,
body:not(.home) .quiet-about-heading h1,
body:not(.home) .contact-hero h1 {
  max-width: 1000px;
  font-size: clamp(42px, 5vw, 72px);
  line-height: 1.04;
  letter-spacing: -.05em;
}

body:not(.home) .lead,
body:not(.home) .quiet-about-story > p,
body:not(.home) .contact-hero .lead {
  max-width: 72ch;
  font-size: clamp(17px, 1.35vw, 20px);
  line-height: 1.65;
}

body:not(.home) .section {
  padding-top: 28px;
  padding-bottom: clamp(48px, 7vw, 78px);
}

body:not(.home) .eyebrow,
body:not(.home) .publication-type,
body:not(.home) .technical-label,
body:not(.home) figcaption {
  letter-spacing: .025em;
}

body:not(.home) .button,
body:not(.home) .text-link,
body:not(.home) input,
body:not(.home) select,
body:not(.home) textarea {
  border-radius: 0;
  box-shadow: none;
}

body:not(.home) .publication-item,
body:not(.home) .selected-row,
body:not(.home) .topic-row,
body:not(.home) .collaboration-row {
  background: transparent;
}

body:not(.home) .publication-title-link:hover,
body:not(.home) .topic-row:hover .pen-title,
body:not(.home) .research-thread summary:hover h3,
body:not(.home) .learning-topic summary:hover h2 {
  transform: none;
}

body:not(.home) .publication-item {
  padding-top: 25px;
  padding-bottom: 25px;
}

body:not(.home) .publication-item h3 {
  max-width: 900px;
  font-size: clamp(22px, 2.15vw, 32px);
  line-height: 1.2;
}

body:not(.home) .layout .card p,
body:not(.home) .layout .card li,
body:not(.home) .doctoral-copy p,
body:not(.home) .thread-copy p {
  max-width: 72ch;
  line-height: 1.72;
}

body:not(.home) .content-card,
body:not(.home) .connect-form,
body:not(.home) .layout .side-card,
body:not(.home) .research-thread,
body:not(.home) .learning-topic {
  box-shadow: none;
}

.focus-system .fs-core {
  box-shadow: none;
}

.focus-system .fs-node,
.focus-system .fs-wire,
.focus-system .fs-core > span {
  transition-duration: .15s;
}

.activities-page .page-hero h1 {
  font-size: clamp(42px, 5vw, 68px);
}

.activities-page .page-hero .lead {
  max-width: 64ch;
}

.home .has-home-film .quiet-hero-grid {
  max-width: 620px;
}

.home .has-home-film .quiet-introduction .lead {
  max-width: 41ch;
}

.home-index-row:hover,
.home-index-row:focus-visible {
  padding-left: 0;
  padding-right: 0;
  background: transparent;
}

@media (max-width: 780px) {
  body:not(.home) .nav-wrap,
  .home .nav-wrap {
    padding-top: 15px;
    padding-bottom: 15px;
  }

  body:not(.home) .nav-links {
    background: var(--paper);
  }

  body:not(.home) .page-hero {
    padding-top: 34px;
    padding-bottom: 22px;
  }

  body:not(.home) .page-hero h1,
  body:not(.home) .quiet-about-heading h1,
  body:not(.home) .contact-hero h1 {
    font-size: clamp(38px, 12vw, 52px);
  }

  body:not(.home) .publication-item {
    padding-top: 22px;
    padding-bottom: 22px;
  }
}

@media print {
  body:not(.home) .site-header {
    background: white;
    backdrop-filter: none;
  }
}

/* Keep long-form copy aligned evenly across the site's reading surfaces. */
body main p,
body main li,
body main td,
body main figcaption,
body main blockquote,
body .site-footer p,
body .site-footer small {
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
  hyphens: auto;
}
