/* SquishPixel blog. Same tokens and parts as the main site (web/src/styles/
   global.css) so the two read as one brand: a grey page, white sheets divided
   by hairlines, square corners, Inter, ink buttons and one orange accent. */
@font-face {
  font-family: 'Inter Variable';
  src: url('/assets/fonts/inter-latin-wght.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --page: #f8f8f8;
  --surface: #ffffff;
  --soft: #fafafa;
  --sunken: #efefef;
  --ink: #0d0d0d;
  --ink-hover: #2b2b2b;
  --ink-2: #474747;
  --muted: #6e6e6e;
  --line: #e8e8e8;
  --line-strong: #cfcfcf;
  --dot: #e2e2e2;
  --accent: #ff5b35;
  --accent-ink: #b0320e;
  --accent-soft: #fff2ed;
  --accent-line: #ffd8cb;
  --on-accent: #0d0d0d;

  --foot-bg: #0d0d0d;
  --foot-ink: #ffffff;
  --foot-muted: rgb(255 255 255 / 64%);
  --foot-line: rgb(255 255 255 / 15%);

  --shadow: 0 10px 30px rgb(0 0 0 / 10%);

  --font: 'Inter Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --max: 1440px;
  --gutter: 48px;
  --gap: 32px;
  --pad-x: 64px;
  --cell: 48px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #141414;
    --surface: #0d0d0d;
    --soft: #121212;
    --sunken: #1c1c1c;
    --ink: #ededed;
    --ink-hover: #ffffff;
    --ink-2: #c4c4c4;
    --muted: #989898;
    --line: #222222;
    --line-strong: #3a3a3a;
    --dot: #1f1f1f;
    --accent: #ff7a59;
    --accent-ink: #ff9f86;
    --accent-soft: #29160f;
    --accent-line: #4a261a;

    --foot-bg: #fcfcfc;
    --foot-ink: #0d0d0d;
    --foot-muted: rgb(13 13 13 / 64%);
    --foot-line: rgb(13 13 13 / 12%);

    --shadow: 0 10px 30px rgb(0 0 0 / 55%);
  }
}

@media (max-width: 1199px) {
  :root {
    --gutter: 32px;
    --gap: 24px;
    --pad-x: 48px;
    --cell: 32px;
  }
}

/* Phones: sheets run edge to edge, with the grey page showing between them. */
@media (max-width: 809px) {
  :root {
    --gutter: 0px;
    --gap: 16px;
    --pad-x: clamp(20px, 6vw, 32px);
    --cell: clamp(20px, 6vw, 32px);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* Keeps focused and linked-to content clear of the floating header. */
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  padding-inline: var(--gutter);
  background: var(--page);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 1.2rem + 4.2vw, 4rem);
  line-height: 1.05;
}

h2 {
  font-size: clamp(1.875rem, 1rem + 3vw, 3.25rem);
}

h3 {
  font-size: 1.375rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.dim {
  color: var(--muted);
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

a:hover {
  text-decoration-color: currentColor;
}

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

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

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

.skip {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 30;
  background: var(--ink);
  color: var(--surface);
  padding: 10px 14px;
  font: 500 0.875rem/1.2 var(--font);
}

.skip:focus {
  top: 12px;
}

/* ---- Header -------------------------------------------------------------- */
.site-head {
  position: fixed;
  inset: 20px 0 auto;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding-inline: 16px;
  pointer-events: none;
}

.nav-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px;
  background: var(--soft);
  border: 1px solid var(--line);
  pointer-events: auto;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 37px;
  padding: 0 10px 0 8px;
  font: 600 0.9375rem/1 var(--font);
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

/* The brand mark: one pixel, squished. */
.logo-mark {
  flex: none;
  width: 22px;
  height: 14px;
  background: var(--accent);
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / 14%);
}

.logo-sub {
  font-weight: 400;
  color: var(--muted);
}

.site-nav {
  display: flex;
  gap: 2px;
}

.site-nav a,
.nav-menu nav a {
  display: flex;
  align-items: center;
  min-height: 37px;
  padding: 10px 12px;
  border: 1px solid transparent;
  font: 500 0.875rem/1.2 var(--font);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.15s,
    border-color 0.15s;
}

.site-nav a:hover {
  background: var(--surface);
  border-color: var(--line);
}

/* The menu for narrow screens is a plain <details>: no script needed. */
.nav-menu {
  display: none;
}

.nav-menu summary {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  list-style: none;
}

.nav-menu summary::-webkit-details-marker {
  display: none;
}

.burger {
  position: relative;
  display: block;
  width: 16px;
  height: 8px;
}

.burger::before,
.burger::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.2s;
}

.burger::before {
  top: 0;
}

.burger::after {
  bottom: 0;
}

.nav-menu[open] .burger::before {
  transform: translateY(3.25px) rotate(45deg);
}

.nav-menu[open] .burger::after {
  transform: translateY(-3.25px) rotate(-45deg);
}

.nav-menu nav {
  position: absolute;
  top: 100%;
  left: -1px;
  right: -1px;
  display: grid;
  gap: 2px;
  padding: 0 7px 7px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-top: 0;
}

.nav-menu nav a {
  padding: 12px 14px;
  background: var(--surface);
  border-color: var(--line);
}

@media (max-width: 639px) {
  .site-nav {
    display: none;
  }

  .nav-menu {
    display: block;
  }
}

@media (max-width: 809px) {
  .site-head {
    top: 16px;
  }
}

/* Phone width: a shorter label, so the bar never runs off the screen. */
@media (max-width: 480px) {
  .nav-long {
    display: none;
  }
}

@media (max-width: 359px) {
  .logo-sub {
    display: none;
  }
}

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 41px;
  padding: 11px 20px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--surface);
  font: 500 0.875rem/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}

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

.btn-quiet {
  background: var(--soft);
  color: var(--ink);
  border-color: var(--line);
}

.btn-quiet:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn.nav-cta {
  min-height: 37px;
  padding: 9px 14px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn.nav-cta:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

/* ---- Page frame: sheets and cells ---------------------------------------- */
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
  max-width: var(--max);
  margin-inline: auto;
}

.page + .page {
  margin-top: var(--gap);
}

.sheet {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  overflow: clip;
}

.sheet > * + * {
  border-top: 1px solid var(--line);
}

@media (max-width: 809px) {
  .sheet {
    border-inline: 0;
  }

  main > .sheet:first-child {
    border-top: 0;
  }
}

/* Small label that opens a section. */
.eyebrow,
.crumbs,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 6px 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  font: 500 0.75rem/1 var(--font);
  color: var(--ink);
}

.crumbs {
  flex-wrap: wrap;
  justify-content: center;
  line-height: 1.3;
  color: var(--muted);
}

.crumbs a {
  color: var(--ink);
  text-decoration: none;
}

.crumbs a:hover {
  text-decoration: underline;
}

/* ---- Hero ---------------------------------------------------------------- */
.hero {
  display: grid;
  justify-items: center;
  padding: clamp(112px, 13vw, 160px) var(--pad-x) clamp(40px, 5vw, 64px);
  text-align: center;
}

.hero h1 {
  max-width: 15em;
  margin-top: 28px;
}

.hero h1 .dim {
  display: block;
}

.lede {
  max-width: 46ch;
  margin-top: 16px;
  font-size: clamp(1rem, 0.92rem + 0.4vw, 1.125rem);
  color: var(--muted);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
}

/* A page with nothing but its heading, such as the 404, gets some height. */
.hero-tall {
  align-content: center;
  min-height: min(72vh, 640px);
  padding-bottom: clamp(72px, 10vw, 128px);
}

.empty {
  padding: var(--cell) var(--pad-x);
  color: var(--muted);
  text-align: center;
}

/* ---- Post list ----------------------------------------------------------- */
/* Each cell draws its own right and bottom hairline; the grid hangs one
   pixel over the sheet's edge so the outermost lines are clipped away. */
.post-list,
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 -1px -1px 0;
  padding: 0;
  list-style: none;
}

.post-list > *,
.cards > * {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--cell);
  text-decoration: none;
  transition: background-color 0.15s;
}

.post-card:hover {
  background: var(--soft);
}

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

.post-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font: 500 0.875rem/1.2 var(--font);
  color: var(--muted);
}

.post-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 630;
  margin-top: 20px;
  object-fit: cover;
  background: var(--sunken);
}

.post-card-body {
  display: grid;
  gap: 8px;
  margin-top: clamp(20px, 2.4vw, 32px);
}

.post-card-title {
  font: 500 clamp(1.25rem, 1.1rem + 0.4vw, 1.375rem) / 1.3 var(--font);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.post-card-dek {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.875rem;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.post-card-more {
  width: fit-content;
  margin-top: auto;
  padding-top: clamp(24px, 3vw, 40px);
  font: 500 0.875rem/1.2 var(--font);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 20px var(--pad-x);
}

@media (max-width: 959px) {
  .post-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 599px) {
  .post-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Section header and link cards --------------------------------------- */
.sheet-head {
  display: grid;
  gap: clamp(36px, 7vw, 96px);
  padding: clamp(24px, 4vw, 48px) var(--pad-x) clamp(28px, 5vw, 64px);
}

.sheet-title {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 48px;
}

.sheet-title > a {
  font: 500 0.875rem/1.2 var(--font);
  text-decoration-color: currentColor;
  text-underline-offset: 5px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: var(--cell);
  text-decoration: none;
  transition: background-color 0.15s;
}

.card h3 {
  font-size: clamp(1.25rem, 1.1rem + 0.4vw, 1.375rem);
}

.card p {
  font-size: 0.9375rem;
  color: var(--muted);
  text-wrap: pretty;
}

.card::after {
  content: '→';
  margin-top: auto;
  padding-top: 18px;
  font-size: 1.125rem;
  line-height: 1;
  color: var(--muted);
  transition:
    transform 0.15s,
    color 0.15s;
}

.card:hover {
  background: var(--soft);
}

.card:hover::after {
  color: var(--ink);
  transform: translateX(4px);
}

@media (max-width: 809px) {
  .cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Post ---------------------------------------------------------------- */
.post .hero h1 {
  max-width: 17em;
  font-size: clamp(2rem, 1.1rem + 3vw, 3.25rem);
  line-height: 1.1;
}

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

/* The cover sits on a quiet dotted floor, like the tools on the main site. */
.post-stage {
  padding: clamp(16px, 5vw, 72px);
  background:
    radial-gradient(80% 70% at 50% 118%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 72%),
    radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 0) 0 0 / 20px 20px,
    var(--soft);
}

.post-cover {
  display: block;
  width: 100%;
  max-width: 800px;
  margin-inline: auto;
  box-shadow: var(--shadow);
}

/* Article on the left; on the right a column whose card stays in view. */
.post-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
}

.post-body > * + * {
  border-left: 1px solid var(--line);
}

.post-side {
  padding: clamp(20px, 3vw, 40px);
  background: var(--soft);
}

.cta {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 12px;
  padding: clamp(20px, 2.4vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
}

.cta h2 {
  font-size: 1.375rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.cta p {
  font-size: 0.9375rem;
  color: var(--muted);
}

.cta .btn {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 999px) {
  .post-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-body > * + * {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .cta {
    position: static;
  }
}

.prose {
  max-width: calc(700px + var(--pad-x) * 2);
  padding: clamp(36px, 6vw, 80px) var(--pad-x);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.prose > :first-child {
  margin-top: 0;
}

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

.prose h2 {
  margin-top: 44px;
  margin-bottom: 14px;
  font-size: clamp(1.375rem, 1.15rem + 0.9vw, 1.75rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.prose h3 {
  margin-top: 30px;
  margin-bottom: 10px;
  font-size: 1.1875rem;
  color: var(--ink);
}

.prose ol + p,
.prose ul + p,
.prose pre + p,
.prose table + p {
  margin-top: 1.1em;
}

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

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

.prose li > ul,
.prose li > ol {
  margin-top: 0.5em;
}

.prose strong {
  font-weight: 500;
  color: var(--ink);
}

.prose a {
  color: var(--ink);
  text-decoration-color: var(--accent);
}

.prose code {
  padding: 0.1em 0.35em;
  background: var(--soft);
  border: 1px solid var(--line);
  font: 0.85em/1.4 var(--font-mono);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.prose pre {
  margin: 1.1em 0 0;
  padding: 16px 18px;
  background: var(--soft);
  border: 1px solid var(--line);
  overflow-x: auto;
}

.prose pre code {
  padding: 0;
  background: none;
  border: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  overflow-wrap: normal;
}

/* Wide tables scroll inside themselves instead of widening the page. */
.prose table {
  display: block;
  max-width: 100%;
  margin-top: 1.1em;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.prose th,
.prose td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  font-weight: 500;
  color: var(--ink);
  border-bottom-color: var(--line-strong);
  white-space: nowrap;
}

.takeaway {
  margin-top: 40px;
  padding: 22px 24px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--ink);
}

.takeaway h2 {
  margin: 0 0 8px;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--accent-ink);
}

.source {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ---- Newsletter ---------------------------------------------------------- */
.signup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 28px 64px;
  padding: clamp(24px, 4vw, 48px) var(--pad-x) clamp(28px, 5vw, 64px);
}

.signup > * + * {
  border-top: 0;
}

.signup h2 {
  margin-top: clamp(28px, 6vw, 72px);
  font-size: clamp(1.75rem, 1rem + 2.2vw, 2.75rem);
}

.signup-text p:not(.eyebrow) {
  max-width: 46ch;
  margin-top: 12px;
  color: var(--muted);
}

.signup form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.signup input[type='email'] {
  flex: 1 1 200px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 0.9375rem;
}

.signup input::placeholder {
  color: var(--muted);
}

.signup-status {
  min-height: 1.5em;
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--ink-2);
}

@media (max-width: 809px) {
  .signup {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Footer -------------------------------------------------------------- */
/* The page turned inside out: ink in light mode, paper in dark. */
.site-foot {
  max-width: var(--max);
  margin: var(--gap) auto 0;
  padding: clamp(40px, 5vw, 64px) var(--pad-x) 32px;
  background: var(--foot-bg);
  color: var(--foot-ink);
}

.foot-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px 64px;
}

.foot-brand .logo {
  padding: 0;
  min-height: 0;
  font-size: 1.0625rem;
}

.foot-brand .logo-sub {
  color: var(--foot-muted);
}

.foot-tag {
  max-width: 20em;
  margin-top: 20px;
  font: 500 1.375rem/1.3 var(--font);
  letter-spacing: -0.02em;
}

.foot-tag .dim {
  display: block;
  color: var(--foot-muted);
}

.foot-tag a {
  text-decoration-color: var(--foot-muted);
}

.foot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 24px;
}

.foot-grid h2 {
  margin-bottom: 14px;
  font: 500 0.875rem/1.3 var(--font);
  letter-spacing: 0;
}

.foot-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.foot-grid a {
  font-size: 0.875rem;
  color: var(--foot-muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

.foot-note {
  margin-top: clamp(32px, 5vw, 56px);
  padding-top: 24px;
  border-top: 1px solid var(--foot-line);
  font-size: 0.875rem;
  color: var(--foot-muted);
}

@media (max-width: 809px) {
  .foot-top {
    grid-template-columns: minmax(0, 1fr);
  }
}

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