/* whoelse company page — one house, many sections */

:root {
  --paper: #f6f1eb;
  --paper-2: #efe8df;
  --ink: #1a1714;
  --muted: #4a463f;
  --rule: #d4cdc3;
  --rose: #df7b96;
  --rose-ink: #8e2a46;
  --blue: #9dc0e0;
  --blue-ink: #1f4e78;
  --sans: "Instrument Sans", "Segoe UI", "Helvetica Neue", sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  --measure: 40rem;
  --page: 72rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section-space: clamp(4.5rem, 10vw, 9rem);
  --focus: 2px solid var(--ink);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.75rem;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.011em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, p, ul, ol, dl, figure, pre, address, blockquote {
  margin: 0;
}

em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

strong {
  font-weight: 600;
}

a {
  color: var(--rose-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ink);
}

a:focus-visible,
.btn:focus-visible,
.wordmark:focus-visible,
.nav a:focus-visible,
.nav-menu-btn:focus-visible {
  outline: var(--focus);
  outline-offset: 3px;
}

::selection {
  background: var(--blue);
  color: var(--ink);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.85rem;
  text-decoration: none;
}

.skip:focus {
  top: 0.75rem;
  color: var(--paper);
  outline-color: var(--paper);
}

/* Masthead */

.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  flex-wrap: wrap;
  padding: 0.25rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(12px);
  min-width: 0;
  max-width: 100%;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--ink);
}

.wordmark .q {
  color: var(--rose-ink);
}

.nav-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.85rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  cursor: pointer;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
}

.nav-menu-btn .menu-open {
  display: none;
}

.nav-toggle:checked + .nav-menu-btn .menu-closed {
  display: none;
}

.nav-toggle:checked + .nav-menu-btn .menu-open {
  display: inline;
}

.nav-toggle:focus-visible + .nav-menu-btn {
  outline: var(--focus);
  outline-offset: 3px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  font-size: 0.92rem;
  font-weight: 500;
}

.nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.55rem;
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

@media (max-width: 767px) {
  .masthead {
    flex-wrap: wrap;
  }

  .nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.15rem 0 0.4rem;
    border-top: 1px solid var(--rule);
  }

  .nav-toggle:checked ~ .nav {
    display: flex;
  }

  .nav a {
    justify-content: flex-start;
    width: 100%;
    padding: 0 0.15rem;
  }
}

@media (min-width: 768px) {
  .nav-toggle,
  .nav-menu-btn {
    display: none;
  }

  .nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
  }
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: 1fr;
  border-bottom: 1px solid var(--rule);
  min-height: min(36rem, calc(100svh - 4rem));
}

.hero-copy {
  padding: clamp(2.5rem, 6vw, 6rem) var(--gutter) clamp(2.5rem, 5vw, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  max-width: 48rem;
  min-width: 0;
}

.kicker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 7.2vw, 5.15rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

.hero h1 .line {
  display: block;
}

.hero h1 em {
  color: var(--rose-ink);
}

.lede {
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  line-height: 1.5;
  max-width: 36rem;
  color: var(--ink);
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1.15rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover {
  background: var(--rose-ink);
  color: var(--paper);
}

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

.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.hero-pattern {
  background: #fff;
  min-height: 16rem;
  overflow: hidden;
  border-top: 1px solid var(--rule);
}

.hero-pattern img {
  width: 100%;
  height: 100%;
  min-height: 16rem;
  object-fit: cover;
  object-position: center;
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
    min-height: min(42rem, calc(100svh - 4rem));
  }

  .hero-copy {
    max-width: none;
    padding-right: 3rem;
  }

  .hero-pattern {
    border-top: 0;
    border-left: 1px solid var(--rule);
    min-height: 100%;
  }

  .hero-pattern img {
    min-height: 100%;
  }
}

/* Sections — one house */

.section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem 3.5rem;
  padding: var(--section-space) var(--gutter);
  border-bottom: 1px solid var(--rule);
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  min-width: 0;
  width: 100%;
}

.section-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.4vw, 3.15rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.section-index {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.section-index .num {
  color: var(--rose-ink);
  margin-right: 0.55rem;
}

.section-body {
  max-width: 52rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  min-width: 0;
  width: 100%;
}

.section-body > p {
  max-width: var(--measure);
}

@media (min-width: 960px) {
  .section {
    grid-template-columns: minmax(14rem, 20rem) minmax(0, 1fr);
    align-items: start;
  }

  .section-head {
    position: sticky;
    top: 5.5rem;
  }
}

/* Inline code in body copy */

.section-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  font-weight: 500;
}

.grammar pre,
.grammar pre code {
  font-size: max(13px, clamp(0.8125rem, 1.8vw, 0.98rem));
}

/* Grammar */

.grammar {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 1.25rem 1.35rem 1.15rem;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.grammar pre {
  overflow-x: auto;
  max-width: 100%;
  font-family: var(--mono);
  font-size: max(13px, clamp(0.8125rem, 1.8vw, 0.98rem));
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--ink);
  white-space: pre;
}

.grammar pre code {
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
}

@media (max-width: 759px) {
  .grammar pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

/* Parse table */

.parse {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  border-top: 1px solid var(--rule);
  font-size: 0.88rem;
  -webkit-overflow-scrolling: touch;
}

.parse-row {
  display: grid;
  gap: 0.65rem 0.9rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
  min-width: 0;
}

.parse-head {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.parse-row:not(.parse-head) span:first-child {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
}

.parse-row:not(.parse-head) span:not(:first-child) {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0;
}

@media (min-width: 760px) {
  .parse-row {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 0.7fr) minmax(3.5rem, 0.5fr) minmax(0, 1.2fr) minmax(6.5rem, 0.75fr);
    min-width: 0;
  }

  .parse-row span {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 759px) {
  .parse {
    overflow: visible;
    border-top: 0;
  }

  .parse-head {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .parse-row:not(.parse-head) {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1rem 0;
    min-width: 0;
  }

  .parse-row:not(.parse-head) span,
  .parse-row:not(.parse-head) span:first-child,
  .parse-row:not(.parse-head) span:not(:first-child) {
    display: grid;
    grid-template-columns: 5.25rem minmax(0, 1fr);
    column-gap: 0.75rem;
    align-items: baseline;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .parse-row:not(.parse-head) span:first-child {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.05rem;
  }

  .parse-row:not(.parse-head) span:not(:first-child) {
    font-family: var(--mono);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0;
  }

  .parse-row:not(.parse-head) span::before {
    content: attr(data-label);
    font-family: var(--sans);
    font-style: normal;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
  }
}

/* Protocol steps */

.protocol {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--rule);
  counter-reset: proto;
}

.protocol li {
  counter-increment: proto;
  padding: 1.15rem 0 1.2rem;
  border-bottom: 1px solid var(--rule);
  padding-left: 3rem;
  position: relative;
}

.protocol li::before {
  content: "0" counter(proto);
  position: absolute;
  left: 0;
  top: 1.25rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--rose-ink);
}

.protocol-name {
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.protocol p {
  max-width: var(--measure);
}

@media (min-width: 800px) {
  .protocol {
    grid-template-columns: 1fr 1fr;
    border-top: 0;
    column-gap: 2rem;
  }

  .protocol li {
    border-top: 1px solid var(--rule);
  }
}

/* Constraints */

.principles {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0;
  counter-reset: prin;
  border-top: 1px solid var(--rule);
}

.principles li {
  counter-increment: prin;
  padding: 1.4rem 0 1.5rem;
  border-bottom: 1px solid var(--rule);
  padding-left: 3.25rem;
  position: relative;
}

.principles li::before {
  content: "0" counter(prin);
  position: absolute;
  left: 0;
  top: 1.55rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--rose-ink);
}

.principles h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.principles p {
  color: var(--ink);
  max-width: var(--measure);
}

@media (min-width: 800px) {
  .principles {
    grid-template-columns: 1fr 1fr;
    column-gap: 2.5rem;
    border-top: 0;
  }

  .principles li {
    border-top: 1px solid var(--rule);
  }
}

/* Early proofs — quieter than the main argument */

.proofs {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--rule);
}

.proofs li {
  padding: 1.15rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.proof-name {
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.proto-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.2rem;
  margin-top: 0.35rem;
}

.proto-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  font-weight: 600;
}

@media (min-width: 800px) {
  .proofs {
    grid-template-columns: 1fr 1fr;
    column-gap: 2.5rem;
    border-top: 0;
  }

  .proofs li {
    border-top: 1px solid var(--rule);
  }
}

/* Team / contact */

.team {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
}

.team-name {
  font-family: var(--serif);
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.team-role {
  color: var(--muted);
  font-size: 1rem;
}

.programs {
  color: var(--muted);
  font-size: 1rem;
}

.contact-email {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.contact-email a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration-color: var(--rose);
}

.contact-email a:hover {
  color: var(--rose-ink);
}

/* Footer */

.colophon {
  padding: 2.5rem var(--gutter) 3rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
}

.colophon .wordmark {
  color: var(--ink);
}

.colophon a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  color: var(--muted);
}

.colophon a:hover {
  color: var(--ink);
}

/* Print */

@media print {
  .masthead,
  .hero-actions,
  .skip {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .hero,
  .section,
  .proofs li {
    break-inside: avoid;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #333;
  }
}
