/* The Projects catalog (/projects) and its project pages (/projects/<slug>).
   Tokens and the header and footer match the chapter pages, which carry the same values inline.
   Pages are generated by tools/build-projects.mjs. Bump ?v= in that script when this file changes. */
:root {
  --bg: #020617;
  --panel: rgba(15, 23, 42, 0.55);
  --line: #1e293b;
  --line-2: #334155;
  --text: #e2e8f0;
  --strong: #f8fafc;
  --muted: #94a3b8;
  --dim: #64748b;
  --cyan: #22d3ee;
  --cyan-2: #67e8f9;
  --indigo: #818cf8;
  --emerald: #34d399;
  --amber: #fbbf24;
  --accent: #22d3ee;
  --sans: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body {
  font-family: var(--sans);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--cyan-2); }
img { display: block; max-width: 100%; }
::selection { background: rgba(34, 211, 238, 0.25); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: rgba(51, 65, 85, 0.6) rgba(15, 23, 42, 0.5); }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }

@keyframes nx-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- site header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap {
  min-height: 64px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px; padding-top: 8px; padding-bottom: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; letter-spacing: 0.14em; color: var(--strong); }
.brand:hover { color: var(--strong); }
.brand i { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px rgba(34, 211, 238, 0.7); animation: nx-pulse 1.6s ease-in-out infinite; }
.brand b { color: var(--cyan); font-weight: 700; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.nav a { font-size: 13px; font-weight: 500; color: var(--muted); padding: 7px 12px; border-radius: 8px; border: 1px solid transparent; white-space: nowrap; }
.nav a:hover { color: var(--text); border-color: var(--line); }
.nav a.on { color: var(--text); border-color: rgba(34, 211, 238, 0.3); background: linear-gradient(90deg, rgba(34, 211, 238, 0.14), rgba(59, 130, 246, 0.14)); }
.nav a.on:hover { color: var(--cyan-2); border-color: rgba(34, 211, 238, 0.55); }
.live { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid rgba(16, 185, 129, 0.3); border-radius: 999px; font: 400 10px var(--mono); letter-spacing: 0.12em; color: #6ee7b7; }
.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); animation: nx-pulse 1.6s ease-in-out infinite; }

/* ---------- catalog: heading ---------- */
.hero { padding: 36px 0 28px; border-bottom: 1px solid var(--line); }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font: 400 11px var(--mono); letter-spacing: 0.18em; color: var(--dim); }
.eyebrow b { color: var(--indigo); font-weight: 400; }
.eyebrow i { width: 24px; height: 1px; background: var(--line); }
h1 { margin: 0; max-width: 17ch; font-size: clamp(34px, 6vw, 58px); line-height: 1.05; letter-spacing: -0.03em; font-weight: 700; color: var(--strong); }

.sec { padding: 40px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 72px; }
.sec:last-of-type { border-bottom: 0; padding-bottom: 56px; }
.sec-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 26px; }
.sec-head .bar { flex: none; width: 3px; height: 26px; border-radius: 2px; background: linear-gradient(180deg, var(--indigo), var(--cyan)); }
.sec-head h2 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; color: var(--strong); }

/* ---------- image frame on a card ---------- */
.media {
  position: relative; overflow: hidden; aspect-ratio: 5 / 3;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(120% 100% at 15% 0%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 62%),
    linear-gradient(180deg, #0d1526, #070c18);
}
.media .win {
  position: absolute; left: 7%; right: 7%; top: 13%; bottom: 0;
  border: 1px solid rgba(148, 163, 184, 0.22); border-bottom: 0; border-radius: 10px 10px 0 0;
  overflow: hidden; background: #0b1220; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.media .win img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.media .phone {
  position: absolute; left: 50%; top: 11%; width: 35%; transform: translateX(-50%);
  border: 1px solid rgba(148, 163, 184, 0.3); border-radius: 16px; overflow: hidden;
  background: #0b1220; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}
.media .phone img { width: 100%; }
/* a project with no image yet: the outline of a wall tablet, nothing more */
.media .tablet {
  position: absolute; left: 50%; top: 50%; width: 46%; aspect-ratio: 4 / 3; transform: translate(-50%, -50%);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 12px;
  background: rgba(2, 6, 23, 0.45); box-shadow: 0 0 60px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* three frames that crossfade */
.loop img { opacity: 0; animation: frame 12s infinite; }
.loop img:nth-child(1) { animation-delay: -1s; }
.loop img:nth-child(2) { animation-delay: 3s; }
.loop img:nth-child(3) { animation-delay: 7s; }
@keyframes frame { 0% { opacity: 0; } 4% { opacity: 1; } 33% { opacity: 1; } 38% { opacity: 0; } 100% { opacity: 0; } }

/* ---------- status labels: one fixed set ---------- */
.status {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px;
  font: 500 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap;
  color: var(--st); border: 1px solid color-mix(in srgb, var(--st) 45%, transparent);
  background: rgba(2, 6, 23, 0.78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--st); }
.media .status { position: absolute; left: 12px; top: 12px; z-index: 2; }
.st-live, .st-daily { --st: #34d399; }
.st-daily i { animation: nx-pulse 1.6s ease-in-out infinite; }
.st-beta { --st: #38bdf8; }
.st-build { --st: #fbbf24; }
.st-home { --st: #a78bfa; }
.st-season { --st: #94a3b8; }

/* ---------- catalog: the five to start with ---------- */
.hl-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.hl {
  display: flex; flex-direction: column; overflow: hidden; color: inherit;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  transition: border-color 0.2s, transform 0.2s;
}
.hl:hover { color: inherit; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }
.hl .media { aspect-ratio: 4 / 3; }
.hl .media .phone { width: 40%; }
.hl-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; }
.hl-num { font: 500 10.5px var(--mono); letter-spacing: 0.14em; color: var(--accent); }
.hl h3 { margin: 0; font-size: 15.5px; font-weight: 600; color: var(--strong); }
.hl p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }

/* ---------- catalog: every project ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip { font: 500 12.5px var(--sans); color: var(--muted); padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: rgba(15, 23, 42, 0.5); cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip[aria-pressed="true"] { color: var(--strong); border-color: rgba(34, 211, 238, 0.45); background: rgba(34, 211, 238, 0.1); }
.chip small { margin-left: 6px; font: 500 10.5px var(--mono); color: var(--dim); }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card {
  display: flex; flex-direction: column; overflow: hidden; color: inherit;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.card:hover { color: inherit; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35); }
.card[hidden] { display: none; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 18px 20px; }
.card-head { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 19px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; color: var(--strong); }
.form { font: 500 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.card-more { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 18px; font-size: 13.5px; font-weight: 500; color: var(--cyan); }
.card-more span:last-child { transition: transform 0.2s; }
.card:hover .card-more span:last-child { transform: translateX(4px); }

/* ---------- the labeled list: problem, solution, and on a project page the four that follow ---------- */
.ps { margin: 0; padding-left: 18px; }
.ps dt { position: relative; font: 500 10px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; }
.ps dt::before { content: ""; position: absolute; left: -18px; top: 2px; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ps dt.p { color: var(--amber); }
.ps dt.s { color: var(--cyan); }
.ps dd { margin: 5px 0 14px; font-size: 14.5px; line-height: 1.58; }
.ps dd.p { position: relative; color: var(--muted); }
.ps dd.p::before { content: ""; position: absolute; left: -15px; top: -5px; bottom: -15px; width: 1px; background: linear-gradient(180deg, rgba(251, 191, 36, 0.55), rgba(34, 211, 238, 0.55)); }
.ps dd.s { margin-bottom: 0; color: var(--text); }

.story { margin-top: 22px; }
.story dt { color: var(--indigo); }
.story dd { position: relative; margin-bottom: 18px; font-size: 17px; line-height: 1.6; color: var(--muted); }
.story dd.s { margin-bottom: 18px; color: var(--text); }
.story dd::before { content: ""; position: absolute; left: -15px; top: -5px; bottom: -19px; width: 1px; background: var(--line-2); }
.story dd.p::before { bottom: -19px; background: linear-gradient(180deg, rgba(251, 191, 36, 0.55), rgba(34, 211, 238, 0.55)); }
.story dd.s::before { background: linear-gradient(180deg, rgba(34, 211, 238, 0.55), rgba(129, 140, 248, 0.55)); }
.story dd:last-child { margin-bottom: 0; }
.story dd:last-child::before { display: none; }

/* ---------- project page ---------- */
.crumb { padding: 22px 0 0; font-size: 13.5px; }
.d-page { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: start; padding: 26px 0 56px; }
.d-page.solo { grid-template-columns: minmax(0, 720px); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.tag { font: 500 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; }
.d-head h1 { max-width: none; font-size: clamp(34px, 5vw, 52px); }
.d-media { display: grid; gap: 28px; }
.d-media.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }

.shot { margin: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #0b1220; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(138, 180, 248, 0.06); }
.shot-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: rgba(15, 23, 42, 0.8); }
.shot-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.shot-bar span { margin-left: 8px; font: 500 11px var(--mono); color: var(--dim); }
.shot-view { position: relative; aspect-ratio: 5 / 3; }
.shot-view img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.shot .cap { padding: 11px 14px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.5; color: var(--dim); text-align: center; }
.levels { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.levels em { font: 500 11px var(--mono); font-style: normal; letter-spacing: 0.08em; color: var(--dim); margin-right: 6px; }
.levels span { font: 500 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); animation: pill 12s infinite; }
.levels span:nth-of-type(1) { animation-delay: -1s; }
.levels span:nth-of-type(2) { animation-delay: 3s; }
.levels span:nth-of-type(3) { animation-delay: 7s; }
@keyframes pill { 0%, 38%, 100% { color: var(--dim); background: transparent; border-color: var(--line); } 4%, 33% { color: #04121a; background: var(--accent); border-color: var(--accent); } }

.phone-fig { margin: 0; justify-self: center; width: 100%; max-width: 290px; }
.phone-fig .frame { border: 1px solid var(--line-2); border-radius: 28px; overflow: hidden; background: #0b1220; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.phone-fig img { width: 100%; }
.phone-fig figcaption { margin-top: 14px; font-size: 13px; line-height: 1.5; color: var(--dim); text-align: center; }

/* ---------- the one form on a project page ---------- */
.tell {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: start;
  padding: 30px 32px 32px; border: 1px solid rgba(34, 211, 238, 0.25); border-radius: 16px; scroll-margin-top: 88px;
  background: radial-gradient(90% 140% at 0% 0%, rgba(34, 211, 238, 0.12), transparent 60%), rgba(15, 23, 42, 0.5);
}
.tell h2 { margin: 0; font-size: 28px; letter-spacing: -0.02em; color: var(--strong); }
.tell form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tell label { display: grid; gap: 6px; font: 500 10.5px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.tell input, .tell textarea { width: 100%; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(2, 6, 23, 0.6); color: var(--text); font: 400 15px var(--sans); }
.tell textarea { min-height: 92px; resize: vertical; }
.tell .wide { grid-column: 1 / -1; }
.tell-status { margin: 0; padding: 10px 13px; border-radius: 8px; font-size: 14px; }
.tell-status.ok { color: #22c55e; background: rgba(34, 197, 94, 0.14); }
.tell-status.bad { color: #f87171; background: rgba(239, 68, 68, 0.14); }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 8px; font: 500 14px var(--sans); color: var(--text); border: 1px solid var(--line); background: rgba(15, 23, 42, 0.5); cursor: pointer; }
.btn:hover { border-color: var(--line-2); color: var(--strong); }
.btn.primary { color: #04121a; font-weight: 600; border-color: transparent; background: linear-gradient(90deg, #22d3ee, #60a5fa); }
.btn.primary:hover { color: #04121a; filter: brightness(1.08); }
.btn[disabled] { opacity: 0.6; cursor: default; }

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 36px 0 56px; }

/* ---------- site footer ---------- */
.site-foot { border-top: 1px solid var(--line); background: rgba(2, 6, 23, 0.6); }
.site-foot .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; padding-top: 32px; padding-bottom: 32px; }
.site-foot .l { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.site-foot .l b { font-weight: 700; font-size: 12px; letter-spacing: 0.14em; color: var(--text); }
.site-foot .l b span { color: var(--cyan); }
.site-foot .l > span { font-size: 13px; color: var(--dim); }
.site-foot .r { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 12px; color: #475569; }
.site-foot .r a { color: var(--dim); }
.site-foot .r a:hover { color: var(--text); }

/* ---------- narrower screens ---------- */
@media (max-width: 1080px) {
  .hl-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; margin-right: calc(-1 * clamp(16px, 4vw, 32px)); padding-right: clamp(16px, 4vw, 32px); }
  .hl { flex: 0 0 220px; scroll-snap-align: start; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  /* one column: name, first screenshot, the six paragraphs, second screenshot */
  .d-page, .d-page.solo { display: flex; flex-direction: column; align-items: stretch; gap: 30px; padding-bottom: 44px; }
  .d-text, .d-media { display: contents; }
  .d-head { order: 1; }
  .d-media > :first-child { order: 2; }
  .story { order: 3; margin-top: 0; }
  .d-media > :nth-child(2) { order: 4; }
  .d-media .phone-fig { align-self: center; }
  .tell { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 720px) {
  .site-head { position: static; }
  .site-head .wrap { gap: 8px 12px; }
  .nav { order: 3; flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * clamp(16px, 4vw, 32px)); padding: 0 clamp(16px, 4vw, 32px) 4px; width: calc(100% + 2 * clamp(16px, 4vw, 32px)); scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .sec { padding: 34px 0; }
  .grid { grid-template-columns: 1fr; }
  .tell { padding: 24px; }
  .tell form { grid-template-columns: 1fr; }
  .levels em { flex-basis: 100%; margin: 0; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .loop img, .levels span, .brand i, .live i, .st-daily i { animation: none; }
  .loop img:last-child { opacity: 1; }
  .levels span:nth-of-type(3) { color: #04121a; background: var(--accent); border-color: var(--accent); }
  .card, .hl, .card-more span:last-child { transition: none; }
}
