/* hootappi.com
   Strictly black and white, plus one grey for secondary text. */

:root {
  --black: #000;
  --white: #fff;
  --grey: #666; /* 5.7:1 on white, passes WCAG AA */
  --gutter: clamp(16px, 5vw, 64px);
  --max: 1312px;
  --font: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 4px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: 8px 12px;
  background: var(--black);
  color: var(--white);
  z-index: 10;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon-sm {
  width: 20px;
  height: 20px;
}

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

.hero {
  display: grid;
  gap: 40px;
  padding-top: clamp(56px, 10vw, 96px);
  padding-bottom: clamp(48px, 8vw, 96px);
}

h1 {
  font-size: clamp(3.25rem, 13.5vw, 7.25rem);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.lede {
  margin-top: clamp(24px, 4vw, 40px);
  font-size: clamp(1.375rem, 3vw, 2.125rem);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.02em;
  max-width: 24ch;
}

.intro {
  margin-top: 24px;
  max-width: 52ch;
  color: var(--grey);
}

.hero-visual {
  position: relative;
}

.portrait {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(1) contrast(1.05);
}

/* ---------- Exploded view ---------- */

.ev {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin-inline: auto;
  overflow: visible;
}

.ev path {
  stroke: var(--black);
  stroke-width: 0.55;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.ev .f {
  fill: var(--white);
}

.ev .l {
  fill: none;
  stroke-width: 0.4;
}

.ev .ev-axis {
  fill: none;
  stroke: var(--grey);
  stroke-width: 0.35;
  stroke-dasharray: 8 2 1.5 2; /* chain line, the drafting convention for axes */
}

.ev-label .ev-leader {
  fill: none;
  stroke-width: 0.35;
}

.ev-label circle {
  fill: var(--black);
}

.ev-label text {
  font-family: var(--font);
  font-size: 6.2px;
  letter-spacing: 0.04em;
  fill: var(--black);
}

.ev-label .ev-n {
  fill: var(--grey);
  font-variant-numeric: tabular-nums;
}

/* Line drawing on first load: each part draws in, top to bottom. */
.ev-draw .ev-part path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: ev-draw 1.5s cubic-bezier(0.6, 0, 0.2, 1) forwards;
  animation-delay: calc(var(--i) * 110ms + 150ms);
}

.ev-draw .ev-guides,
.ev-draw .ev-labels > g {
  animation: ev-fade 0.8s ease 1.1s backwards;
}

@keyframes ev-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes ev-fade {
  from {
    opacity: 0;
  }
}

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

.section {
  padding-top: clamp(56px, 9vw, 112px);
  padding-bottom: clamp(24px, 4vw, 48px);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--black);
  margin-bottom: clamp(24px, 4vw, 48px);
}

.section-num {
  color: var(--grey);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  min-width: 2ch;
}

h2 {
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}

/* Elsewhere */

.links a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--black);
  text-decoration: none;
  font-size: clamp(1.25rem, 2.4vw, 1.625rem);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.links a span {
  flex: 1;
}

.links a .icon-sm {
  transition: transform 0.2s ease;
}

.links a:hover .icon-sm,
.links a:focus-visible .icon-sm {
  transform: translate(3px, -3px);
}

/* Lab cards */

.cards {
  display: grid;
  gap: 16px;
}

.card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 220px;
  padding: clamp(24px, 3vw, 36px);
  border: 1px solid var(--black);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.card h3 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.card p {
  margin-top: 12px;
  margin-bottom: 32px;
  max-width: 34ch;
  color: var(--grey);
  transition: color 0.2s ease;
}

.card-arrow {
  margin-top: auto;
  width: 52px;
  height: 52px;
  stroke-width: 1.25;
  transition: transform 0.2s ease;
}

.card a:hover,
.card a:focus-visible {
  background: var(--black);
  color: var(--white);
}

.card a:hover p,
.card a:focus-visible p {
  color: var(--white);
}

.card a:hover .card-arrow,
.card a:focus-visible .card-arrow {
  transform: translateX(6px);
}

.card a:focus-visible {
  outline-offset: 3px;
}

/* ---------- Writing: post lists (homepage + /writing/) ---------- */

.post-list a {
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--black);
  text-decoration: none;
  font-size: clamp(1.125rem, 2.2vw, 1.5rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.post-list a span:first-child {
  flex: 1;
}

.post-list a:hover span:first-child,
.post-list a:focus-visible span:first-child {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.post-num {
  color: var(--grey);
  font-size: 0.875rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.more {
  margin-top: 24px;
}

.more a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  text-decoration: none;
}

.more a:hover,
.more a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* ---------- Writing: post pages (no animation) ---------- */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--black);
  font-weight: 500;
}

.site-header a {
  text-decoration: none;
}

.site-header a:hover,
.site-header a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.site-name {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-head,
.post-head {
  padding-top: clamp(40px, 8vw, 96px);
  margin-bottom: clamp(32px, 5vw, 56px);
}

.page-head h1,
.post-head h1 {
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  max-width: 18ch;
}

.post-dek {
  margin-top: 20px;
  max-width: 40ch;
  font-size: clamp(1.25rem, 2.6vw, 1.625rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.post-meta {
  margin-top: 20px;
  color: var(--grey);
  font-size: 0.9375rem;
}

/* Reading measure: about 65 characters per line. */
.prose {
  max-width: 65ch;
  font-size: 1.125rem;
  line-height: 1.65;
}

.prose > * + * {
  margin-top: 1.1em;
}

.prose h2,
.prose h3 {
  margin-top: 2.2em;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.prose h2 + *,
.prose h3 + * {
  margin-top: 0.6em;
}

.prose a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose ul {
  list-style: square;
}

.prose ol {
  list-style: decimal;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose li > p + p {
  margin-top: 0.4em;
}

.prose blockquote {
  margin: 1.6em 0;
  padding-left: 1em;
  border-left: 2px solid var(--black);
  font-size: 1.25rem;
  line-height: 1.45;
}

.prose blockquote + blockquote {
  margin-top: -1em;
}

.prose img {
  display: block;
  width: 100%;
  height: auto;
  margin-block: 2em;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--black);
  margin-block: 2.5em;
}

.post-back {
  margin-top: clamp(48px, 8vw, 96px);
  padding-top: 16px;
  border-top: 1px solid var(--black);
  font-weight: 500;
}

/* ---------- Footer ---------- */

.footer {
  padding-top: clamp(64px, 10vw, 128px);
  padding-bottom: 32px;
  color: var(--grey);
  font-size: 0.875rem;
}

/* ---------- Larger screens ---------- */

@media (min-width: 720px) {
  .links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 32px;
  }

  .links a {
    border-top: 0;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

@media (min-width: 1024px) {
  .hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: center;
    gap: 48px;
    min-height: min(88svh, 880px);
    padding-top: 64px;
    padding-bottom: 64px;
  }

  .ev {
    max-width: 620px;
  }
}

/* ---------- Reduced motion: static exploded drawing, no transitions ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .ev-draw .ev-part path {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }
}
