/* ==========================================================================
   NBApps — black & white bento
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.12);
  --tile: #f5f5f7;
  --tile-fg: #000000;
  --tile-muted: #6e6e73;
  --inv: #000000;
  --inv-fg: #ffffff;
  --inv-muted: #a1a1a6;
  --accent: #0071e3;
  --accent-fg: #ffffff;
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.35);

  --font: "Archivo", ui-sans-serif, -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius: 28px;
  --radius-sm: 14px;
  --gap: 12px;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1440px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #a1a1a6;
  --line: rgba(255, 255, 255, 0.16);
  --tile: #161617;
  --tile-fg: #ffffff;
  --tile-muted: #a1a1a6;
  --inv: #ffffff;
  --inv-fg: #000000;
  --inv-muted: #6e6e73;
  --accent: #2997ff;
  --accent-fg: #000000;
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

/* No-JS fallback: follow the system */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #000000; --fg: #ffffff; --muted: #a1a1a6; --line: rgba(255,255,255,.16);
    --tile: #161617; --tile-fg: #ffffff; --tile-muted: #a1a1a6;
    --inv: #ffffff; --inv-fg: #000000; --inv-muted: #6e6e73;
    --accent: #2997ff; --accent-fg: #000000;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.display {
  font-stretch: 125%;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.88;
  margin: 0;
}
.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.logo { font-stretch: 125%; font-weight: 800; font-size: 22px; letter-spacing: -0.04em; }
.logo span { color: var(--muted); font-weight: 500; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  font-size: 15px; font-weight: 500;
  padding: 8px 12px; border-radius: 999px;
  transition: background-color .2s, color .2s;
}
.nav a:hover { background: var(--tile); }
.nav a[aria-current="page"] { background: var(--fg); color: var(--bg); }

.theme-toggle {
  width: 40px; height: 40px; margin-left: 6px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: transparent; cursor: pointer;
  transition: transform .6s var(--ease), border-color .2s;
}
.theme-toggle:hover { border-color: var(--fg); }
.theme-toggle svg { width: 20px; height: 20px; transition: transform .6s var(--ease); }
:root[data-theme="dark"] .theme-toggle svg { transform: rotate(180deg); }

@media (max-width: 640px) {
  .nav a.nav-hide-sm { display: none; }
  .nav a { padding: 8px 9px; font-size: 14px; }
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(48px, 10vw, 140px) clamp(40px, 6vw, 72px); }
.hero .eyebrow { color: var(--muted); margin-bottom: clamp(20px, 3vw, 36px); }
.hero h1 { font-size: clamp(56px, 13.5vw, 216px); }
.hero h1 .line { display: block; overflow: hidden; padding-bottom: .16em; margin-bottom: -.12em; }
.hero h1 .line > span { display: inline-block; animation: rise 1.1s var(--ease) both; }
.hero h1 .line:nth-child(2) > span { animation-delay: .08s; }
.hero h1 .accent-dot { color: var(--accent); }
.hero__row {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-top: clamp(28px, 4vw, 56px);
  animation: fade-up 1s .35s var(--ease) both;
}
.lede { font-size: clamp(19px, 2vw, 26px); line-height: 1.3; max-width: 30ch; margin: 0; font-weight: 450; }
.lede strong { font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px;
  background: var(--fg); color: var(--bg);
  font-weight: 600; font-size: 16px;
  transition: transform .3s var(--ease), background-color .2s;
}
.btn:hover { transform: translateY(-2px); background: var(--accent); color: #fff; }
.btn svg { width: 16px; height: 16px; }

/* ---------- Icon marquee ---------- */
.marquee {
  border-block: 1px solid var(--line);
  overflow: hidden; padding: 18px 0;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track { display: flex; gap: 18px; width: max-content; animation: marquee 60s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee img { width: 56px; height: 56px; border-radius: 13px; }

/* ---------- Section head ---------- */
.section { padding-block: clamp(56px, 8vw, 112px); }
.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: clamp(24px, 3vw, 40px);
}
.section-head h2 { font-size: clamp(48px, 9vw, 136px); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  padding: 9px 16px; border-radius: 999px; font-size: 15px; font-weight: 500;
  transition: background-color .2s, color .2s, border-color .2s;
}
.chip:hover { border-color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .count { opacity: .5; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Bento ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(290px, auto);
  grid-auto-flow: dense;
  gap: var(--gap);
}
.tile {
  position: relative;
  grid-column: span 1;
  grid-row: span 2;
  border-radius: var(--radius);
  background: var(--tile);
  color: var(--tile-fg);
  --t-muted: var(--tile-muted);
  padding: 28px;
  overflow: hidden;
  display: flex; flex-direction: column;
  isolation: isolate;
}
.tile.t-invert { background: var(--inv); color: var(--inv-fg); --t-muted: var(--inv-muted); }
.tile.t-accent { background: var(--accent); color: #fff; --t-muted: rgba(255,255,255,.75); }
.tile--wide { grid-column: span 2; }
.tile--hero { grid-column: 1 / -1; }
.tile--stat { grid-row: span 1; justify-content: space-between; }
.tile--stat-wide { grid-column: span 2; }

/* reveal on scroll */
.js .reveal { opacity: 0; transform: translateY(28px) scale(.985); }
.js .reveal.is-in { opacity: 1; transform: none; transition: opacity .9s var(--ease), transform .9s var(--ease); }

/* tile header */
.tile__head { display: flex; align-items: center; gap: 14px; position: relative; z-index: 2; }
.tile__icon {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  box-shadow: 0 0 0 1px var(--line);
}
.tile__meta { min-width: 0; }
.tile__meta .eyebrow { color: var(--t-muted); font-size: 11.5px; display: flex; gap: 8px; align-items: center; }
.tile__name {
  margin: 18px 0 0;
  font-stretch: 108%;
  font-weight: 800;
  font-size: clamp(20px, 1.6vw, 25px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
  position: relative; z-index: 2;
}
.tile__sub { margin: 4px 0 0; color: var(--t-muted); font-size: 15px; line-height: 1.3; position: relative; z-index: 2; }
.page-hero h1.post-title { font-size: clamp(40px, 6vw, 92px); }
.tile__blurb { margin: 12px 0 0; font-size: 15.5px; line-height: 1.4; color: var(--t-muted); max-width: 46ch; position: relative; z-index: 2; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: #fff; letter-spacing: .06em;
}

.tile__foot {
  margin-top: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: relative; z-index: 3;
}
.badge { display: inline-block; height: 40px; transition: transform .3s var(--ease), opacity .2s; }
.badge:hover { transform: translateY(-2px); }
.badge img { height: 40px; width: auto; }
.badge .on-dark { display: none; }
/* Light surfaces show the black badge, dark surfaces the white one */
:root[data-theme="light"] .t-invert .badge .on-light,
:root[data-theme="dark"] .t-base .badge .on-light,
:root[data-theme="dark"] .surface-page .badge .on-light { display: none; }
:root[data-theme="light"] .t-invert .badge .on-dark,
:root[data-theme="dark"] .t-base .badge .on-dark,
:root[data-theme="dark"] .surface-page .badge .on-dark { display: block; }
.t-accent .badge .on-light { display: none !important; }
.t-accent .badge .on-dark { display: block !important; }

.ext {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  transition: background-color .2s, color .2s, border-color .2s, transform .3s var(--ease);
}
.ext svg { width: 15px; height: 15px; }
.ext:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: rotate(-45deg); }

/* ---------- Screenshots ---------- */
.shots { position: relative; flex: 1; min-height: 0; margin: 22px -28px 0; }
.shots img {
  border-radius: 14px;
  box-shadow: var(--shadow);
  background: #000;
}

/* Fan of three portrait screens (tall tiles) */
.shots--fan { min-height: 280px; margin-top: 8px; }
.shots--fan img {
  position: absolute; left: 50%; top: 14px;
  width: 48%; max-width: 200px;
  transition: transform .8s var(--ease);
}
.shots--fan img:nth-child(1) { transform: translateX(-50%); z-index: 3; }
.shots--fan img:nth-child(2) { transform: translateX(-96%) translateY(30px) rotate(-7deg) scale(.86); z-index: 2; }
.shots--fan img:nth-child(3) { transform: translateX(-4%) translateY(30px) rotate(7deg) scale(.86); z-index: 1; }
.tile:hover .shots--fan img:nth-child(1) { transform: translateX(-50%) translateY(-10px); }
.tile:hover .shots--fan img:nth-child(2) { transform: translateX(-108%) translateY(18px) rotate(-10deg) scale(.86); }
.tile:hover .shots--fan img:nth-child(3) { transform: translateX(8%) translateY(18px) rotate(10deg) scale(.86); }

/* Row of portrait screens (wide + hero) */
.shots--row {
  display: flex; justify-content: center; align-items: flex-start; gap: 14px;
  padding: 0 28px; margin-bottom: -60px;
}
.shots--row img { width: calc((100% - 28px) / 3); max-width: 200px; transition: transform .8s var(--ease); }
.shots--row img:nth-child(2) { transform: translateY(28px); }
.tile:hover .shots--row img:nth-child(1) { transform: translateY(-8px); }
.tile:hover .shots--row img:nth-child(2) { transform: translateY(14px); }
.tile:hover .shots--row img:nth-child(3) { transform: translateY(-8px); }

/* Cascade of landscape screens (Mac / Vision Pro) */
.shots--cascade { min-height: 260px; }
.shots--cascade img {
  position: absolute; width: 74%; left: 50%; border-radius: 10px;
  transition: transform .8s var(--ease);
}
.shots--cascade img:nth-child(1) { bottom: -18px; transform: translateX(-50%); z-index: 3; }
.shots--cascade img:nth-child(2) { bottom: 26px; transform: translateX(-56%) scale(.9); z-index: 2; opacity: .55; }
.shots--cascade img:nth-child(3) { bottom: 60px; transform: translateX(-44%) scale(.8); z-index: 1; opacity: .3; }
.shots--cascade img:only-child { bottom: -18px; transform: translateX(-50%); opacity: 1; }
.tile:hover .shots--cascade img:nth-child(1) { transform: translateX(-50%) translateY(-8px); }
.tile:hover .shots--cascade img:nth-child(2) { transform: translateX(-60%) translateY(-6px) scale(.9); }
.tile:hover .shots--cascade img:nth-child(3) { transform: translateX(-40%) translateY(-10px) scale(.8); }

/* Fallback: big centered icon when no screenshots */
.shots--icon { display: grid; place-items: center; }
.shots--icon img { width: 45%; max-width: 160px; border-radius: 22%; }

/* ---------- Hero tile ---------- */
.tile--hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 32px; padding: clamp(28px, 4vw, 56px); min-height: 600px;
}
.tile--hero .hero-copy { display: flex; flex-direction: column; position: relative; z-index: 2; }
.tile--hero .tile__name {
  font-stretch: 125%; font-size: clamp(44px, 6vw, 96px); line-height: .9; letter-spacing: -0.045em;
  margin: 18px 0 0;
}
.tile--hero .tile__sub { font-size: clamp(19px, 1.8vw, 24px); margin-top: 14px; color: var(--t-muted); }
.tile--hero .tile__blurb { font-size: 17px; margin-top: 18px; }
.tile--hero .tile__foot { margin-top: auto; padding-top: 24px; justify-content: flex-start; }
.tile--hero .shots { margin: 0 calc(-1 * clamp(28px, 4vw, 56px)) calc(-1 * clamp(28px, 4vw, 56px)) 0; display: flex; align-items: flex-end; }
.tile--hero .shots--row { padding: 0 clamp(16px, 3vw, 40px) 0 0; margin-bottom: -40px; align-self: stretch; align-items: center; }
.tile--hero .shots--row img { max-width: 240px; }

/* ---------- Stat tiles ---------- */
.stat-num {
  font-stretch: 125%; font-weight: 800; letter-spacing: -0.05em; line-height: .85;
  font-size: clamp(56px, 5.6vw, 96px); margin: 0; white-space: nowrap;
}
.stat-label { margin: 0; font-size: 16px; line-height: 1.35; color: var(--t-muted); max-width: 26ch; }
.stat-label strong { color: currentColor; font-weight: 600; }
.tile--stat .eyebrow { color: var(--t-muted); }
.stat-num--handle { white-space: normal; overflow-wrap: anywhere; font-size: clamp(28px, 4.2vw, 64px) !important; }
.tile--link { transition: transform .5s var(--ease); }
.tile--link:hover { transform: translateY(-4px); }
.tile--link .arrow {
  position: absolute; top: 24px; right: 24px;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  transition: transform .5s var(--ease), background-color .2s;
}
.tile--link .arrow svg { width: 16px; height: 16px; }
.tile--link:hover .arrow { transform: rotate(-45deg); background: currentColor; }
.tile--link:hover .arrow svg { color: var(--tile); }
.t-invert.tile--link:hover .arrow svg { color: var(--inv); }
.t-accent.tile--link:hover .arrow svg { color: var(--accent); }
.platform-list { display: flex; flex-wrap: wrap; gap: 6px 12px; font-stretch: 100%; font-weight: 700; font-size: clamp(17px, 1.6vw, 24px); letter-spacing: -0.03em; line-height: 1.1; margin: 0; padding: 0; list-style: none; }
.platform-list li { white-space: nowrap; }
.platform-list li:not(:last-child)::after { content: "·"; margin-left: 12px; color: var(--t-muted); }

.is-hidden { display: none !important; }

/* ---------- Responsive bento ---------- */
@media (max-width: 1180px) {
  .bento { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1181px) and (max-width: 1360px) {
  .tile { padding: 24px; }
  .shots { margin-inline: -24px; }
}
@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile--hero { grid-template-columns: 1fr; min-height: 0; }
  .tile--hero .shots { margin: 8px calc(-1 * clamp(28px, 4vw, 56px)) calc(-1 * clamp(28px, 4vw, 56px)); justify-content: center; }
  .tile--hero .shots--row { padding: 0 24px; min-height: 360px; }
  .tile--hero .tile__foot { margin-top: 24px; }
}
@media (max-width: 600px) {
  :root { --radius: 24px; }
  .bento { grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(220px, auto); }
  .tile, .tile--wide, .tile--stat-wide { grid-column: 1 / -1; }
  .tile { padding: 24px; }
  .shots { margin-inline: -24px; }
  .shots--fan { min-height: 340px; }
  .shots--row { padding: 0 24px; }
  .tile--stat { grid-row: span 1; }
}

/* ---------- Generic page content ---------- */
.page-hero { padding-block: clamp(48px, 9vw, 128px) clamp(32px, 5vw, 64px); }
.page-hero h1 { font-size: clamp(52px, 12vw, 184px); }
.page-hero h1 .line { display: block; overflow: hidden; padding-bottom: .16em; margin-bottom: -.12em; }
.page-hero h1 .line > span { display: inline-block; animation: rise 1.1s var(--ease) both; }
.page-hero .lede { margin-top: 28px; color: var(--muted); animation: fade-up 1s .3s var(--ease) both; }
.page-hero .eyebrow { color: var(--muted); margin-bottom: 24px; }

.team { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.person { min-height: 460px; padding: clamp(28px, 4vw, 48px); grid-row: auto; }
.person h2 { font-size: clamp(44px, 6vw, 88px); margin: auto 0 0; }
.person .role { margin: 12px 0 0; font-size: clamp(16px, 1.5vw, 19px); font-weight: 600; }
.person p.bio { margin: 18px 0 0; color: var(--t-muted); font-size: 17px; max-width: 48ch; }
.person .initial {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  font-stretch: 125%; font-weight: 800; font-size: 30px;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
}
@media (max-width: 760px) { .team { grid-template-columns: 1fr; } .person { min-height: 380px; } }

.prose { max-width: 720px; font-size: 19px; line-height: 1.65; }
.prose h2 { font-stretch: 112%; font-weight: 800; letter-spacing: -0.03em; font-size: clamp(26px, 3vw, 34px); line-height: 1.1; margin: 2.2em 0 .5em; }
.prose h3 { font-weight: 700; font-size: 21px; margin: 1.8em 0 .4em; }
.prose p { margin: 0 0 1.1em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose ul { padding-left: 1.2em; }
.prose .meta { color: var(--muted); font-size: 15px; margin-bottom: 2em; }

.posts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.post-card { min-height: 380px; grid-row: auto; }
.post-card h2 { font-stretch: 118%; font-weight: 800; font-size: clamp(30px, 3.6vw, 52px); line-height: .95; letter-spacing: -0.04em; margin: auto 0 0; padding-right: 56px; }
.post-card p { color: var(--t-muted); margin: 14px 0 0; max-width: 44ch; }
.post-card .eyebrow { color: var(--t-muted); }
@media (max-width: 760px) { .posts { grid-template-columns: 1fr; } }

.ext-posts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: dense; gap: var(--gap); }
.ext-post {
  display: flex; flex-direction: column; gap: 10px;
  padding: 24px; border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  transition: background-color .25s, border-color .25s, transform .4s var(--ease);
}
.ext-post h3 { margin: 0; font-stretch: 105%; font-weight: 750; font-size: 19px; line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
.ext-post p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.ext-post__src { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); transition: color .2s; }
.ext-post__src svg { width: 12px; height: 12px; transition: transform .3s var(--ease); }
.ext-post:hover { background: var(--tile); border-color: transparent; transform: translateY(-3px); }
.ext-post:hover .ext-post__src { color: var(--accent); }
.ext-post:hover .ext-post__src svg { transform: translate(2px, -2px); }
/* two wide cards so 28 guides fill complete rows of 3 */
@media (min-width: 1001px) {
  .ext-post:nth-child(1), .ext-post:nth-child(5) { grid-column: span 2; background: var(--inv); color: var(--inv-fg); border-color: transparent; }
  .ext-post:nth-child(1) p, .ext-post:nth-child(5) p, .ext-post:nth-child(1) .ext-post__src, .ext-post:nth-child(5) .ext-post__src { color: var(--inv-muted); }
  .ext-post:nth-child(1) h3, .ext-post:nth-child(5) h3 { font-size: clamp(24px, 2.2vw, 32px); font-stretch: 112%; max-width: 22ch; }
  .ext-post:nth-child(1):hover, .ext-post:nth-child(5):hover { background: var(--inv); }
}
@media (max-width: 1000px) { .ext-posts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .ext-posts { grid-template-columns: 1fr; } }

/* ---------- Contact form ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--gap); align-items: start; }
.contact-aside { min-height: 0; grid-row: auto; gap: 18px; }
.contact-aside h2 { font-stretch: 118%; font-weight: 800; letter-spacing: -0.04em; font-size: clamp(30px, 3vw, 44px); line-height: 1; margin: 0; }
.contact-aside p { color: var(--t-muted); margin: 0; }
.contact-aside a.mail { font-weight: 700; font-size: 20px; text-decoration: underline; text-underline-offset: 4px; }
#form { scroll-margin-top: 88px; }
.btn--ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.btn--ghost:hover { background: var(--fg); color: var(--bg); }
.form { grid-row: auto; padding: clamp(24px, 3.5vw, 44px); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 600; }
.field input, .field textarea, .field select {
  font: inherit; font-size: 17px; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 16px; width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 180px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form button.btn { border: 0; cursor: pointer; align-self: flex-start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.notice { padding: 16px 18px; border-radius: var(--radius-sm); font-weight: 500; }
.notice--ok { background: var(--accent); color: #fff; }
.notice--err { border: 1px solid #ff3b30; color: #ff3b30; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } .form .row { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--inv); color: var(--inv-fg); margin-top: clamp(56px, 8vw, 112px); padding: clamp(48px, 6vw, 80px) 0 28px; overflow: hidden; }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; }
.footer-top p { margin: 0; max-width: 32ch; font-size: 20px; line-height: 1.3; }
.footer-links { display: flex; gap: 48px; flex-wrap: wrap; }
.footer-links ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-links .eyebrow { color: var(--inv-muted); margin-bottom: 12px; font-size: 12px; }
.footer-links a { font-weight: 500; transition: color .2s; }
.footer-links a:hover { color: var(--accent); }
.site-footer .wrap { container-type: inline-size; }
.wordmark {
  font-stretch: 125%; font-weight: 800; letter-spacing: -0.06em; line-height: 1;
  font-size: 21cqi;
  margin: clamp(40px, 6vw, 80px) 0 0; padding-bottom: .04em; white-space: nowrap;
}
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 20px; border-top: 1px solid color-mix(in srgb, var(--inv-fg) 18%, transparent); color: var(--inv-muted); font-size: 14px; }

/* ---------- 404 ---------- */
.notfound { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; }
.notfound h1 { font-size: clamp(120px, 30vw, 420px); }

/* ---------- Motion ---------- */
@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes marquee { to { transform: translateX(-50%); } }

::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-wipe .7s var(--ease); }
@keyframes theme-wipe { from { clip-path: circle(0 at var(--vt-x, 100%) var(--vt-y, 0)); } to { clip-path: circle(150vmax at var(--vt-x, 100%) var(--vt-y, 0)); } }

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