/* Landing page layout. Colours only through tokens.css / tokyo-night.css. */
*, *::before, *::after { box-sizing: border-box; }
body.landing {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: clip;
  background: var(--bg); color: var(--body);
  font: 16px/1.6 var(--font-sans); -webkit-font-smoothing: antialiased;
}
.landing h1, .landing h2, .landing h3 { color: var(--text); margin: 0; letter-spacing: -.02em; }
:where(.landing a) { color: var(--accent); }
:where(.landing a:hover) { color: var(--cyan); }
.sx-btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero { position: relative; isolation: isolate; padding: 72px 0 88px; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero-bg .grid {
  position: absolute; inset: -1px;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--border) 40%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--border) 40%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  animation: grid-pan 30s linear infinite;
}
.hero-bg .glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .32; will-change: transform; }
.hero-bg .g1 { width: 520px; height: 520px; left: -120px; top: -140px; background: var(--accent); animation: drift1 18s ease-in-out infinite alternate; }
.hero-bg .g2 { width: 460px; height: 460px; right: -120px; top: 40px; background: var(--accent2); opacity: .26; animation: drift2 22s ease-in-out infinite alternate; }
.hero-bg .g3 { width: 380px; height: 380px; left: 38%; bottom: -220px; background: var(--cyan); opacity: .16; animation: drift1 26s ease-in-out infinite alternate-reverse; }
@keyframes grid-pan { to { background-position: 44px 44px; } }
@keyframes drift1 { to { transform: translate3d(80px, 60px, 0) scale(1.08); } }
@keyframes drift2 { to { transform: translate3d(-90px, 50px, 0) scale(.94); } }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--body); font: 600 13px/1.3 var(--font-mono);
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green-line); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--green-line); } 80%, 100% { box-shadow: 0 0 0 10px transparent; } }
.hero h1 { font-size: clamp(2.1rem, 1.2rem + 3.6vw, 3.6rem); line-height: 1.08; font-weight: 800; letter-spacing: -.035em; }
.grad { padding-right: .06em; background: linear-gradient(100deg, var(--accent) 10%, var(--cyan) 50%, var(--accent2) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { margin: 22px 0 30px; max-width: 58ch; font-size: 1.1rem; color: var(--body); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.facts { list-style: none; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, auto); gap: 8px 28px; justify-content: start; }
.facts li { display: grid; }
.facts strong { color: var(--text); font: 700 1.35rem/1.2 var(--font-mono); }
.facts span { color: var(--muted); font-size: 13px; }

/* Terminal sample panel */
.term {
  margin: 0; min-width: 0; border-radius: 18px; overflow: hidden;
  background: color-mix(in srgb, var(--sink) 88%, transparent);
  border: 1px solid var(--border);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .75), 0 0 0 1px var(--glass-border) inset;
}
.term-head { display: flex; align-items: center; gap: 14px; padding: 8px 12px 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border-soft); }
.term-dots { display: flex; gap: 6px; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--red); opacity: .85; }
.term-dots i:nth-child(2) { background: var(--yellow); }
.term-dots i:nth-child(3) { background: var(--green); }
.term-tabs { display: flex; gap: 4px; margin-left: auto; }
.term-tabs button {
  min-height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid transparent; cursor: pointer;
  background: none; color: var(--muted); font: 600 12.5px/1 var(--font-mono);
}
.term-tabs button:hover { color: var(--text); }
.term-tabs button[aria-selected="true"] { color: var(--text); background: var(--surface2); border-color: var(--border); }
.term-body { position: relative; min-height: 230px; }
.term-pane {
  margin: 0; padding: 20px 20px 24px; border: 0; border-radius: 0; background: none;
  font: 13px/1.75 var(--font-mono); color: var(--body); white-space: pre; overflow-x: auto;
}
.term-pane.typing::after { content: ''; display: inline-block; width: .55em; height: 1.1em; margin-left: 1px; vertical-align: -.2em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.s-seg { color: var(--yellow); font-weight: 700; }
.s-pipe { color: var(--muted); }
.s-val { color: var(--green); }
.s-tag { color: var(--cyan); }
.s-key { color: var(--accent); }
.s-dim { color: var(--muted); font-style: italic; }

/* ── Sections ─────────────────────────────────────────────────────────── */
.section { padding: 88px 0; position: relative; }
.section-head { max-width: 760px; margin-bottom: 36px; }
.kicker { margin: 0 0 10px; color: var(--accent); font: 700 12px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; }
.section h2 { font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.5rem); line-height: 1.15; font-weight: 800; }
.lede { margin: 14px 0 0; font-size: 1.05rem; color: var(--body); }

/* Filter chips */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--body); font: 600 14px/1 var(--font-sans);
  transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--sx-ease);
}
.chip:hover { color: var(--text); border-color: var(--accent-line); transform: translateY(-1px); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip-n { font: 600 12px/1 var(--font-mono); opacity: .85; }
.chip-n:empty { display: none; }

/* Tool cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.card { min-width: 0; perspective: 1100px; }
.card[hidden] { display: none; }
.card.is-filtered-in { animation: card-in .45s var(--sx-ease) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.card-in {
  --rx: 0deg; --ry: 0deg;
  height: 100%; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-soft);
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d;
  transition: transform .35s var(--sx-ease), box-shadow .35s var(--sx-ease), border-color .35s;
}
.card-in:hover, .card-in:focus-within {
  border-color: color-mix(in srgb, var(--tint) 45%, transparent);
  box-shadow: 0 28px 60px -28px rgba(0, 0, 0, .8), 0 0 0 1px color-mix(in srgb, var(--tint) 20%, transparent);
  transform: translateY(-6px) rotateX(var(--rx)) rotateY(var(--ry));
}
.card-shot {
  position: relative; display: block; width: 100%; padding: 0; margin: 0; border: 0; cursor: zoom-in;
  aspect-ratio: 16 / 10; overflow: hidden; background: var(--sink);
  border-bottom: 1px solid var(--border-soft);
}
.card-shot::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, color-mix(in srgb, var(--surface) 75%, transparent)); pointer-events: none; }
.card-shot:focus-visible { outline-offset: -3px; }
.shot-desk { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; transition: transform .6s var(--sx-ease), filter .6s; }
.shot-phone {
  position: absolute; right: 14px; bottom: -40%; width: 26%; aspect-ratio: 200 / 433;
  border-radius: 12px; overflow: hidden; border: 3px solid var(--surface2);
  box-shadow: 0 18px 30px -10px rgba(0, 0, 0, .8);
  opacity: 0; transform: translateY(10px) rotate(4deg); z-index: 1;
  transition: opacity .45s var(--sx-ease), transform .55s var(--sx-ease), bottom .55s var(--sx-ease);
}
.shot-phone img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.shot-hint {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; background: color-mix(in srgb, var(--sink) 85%, transparent);
  border: 1px solid var(--border); color: var(--text); font: 600 12px/1 var(--font-sans);
  opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s var(--sx-ease);
}
.card-in:hover .shot-desk, .card-shot:focus-visible .shot-desk { transform: scale(1.06); filter: saturate(1.1) brightness(.88); }
.card-in:hover .shot-phone, .card-shot:focus-visible .shot-phone { opacity: 1; bottom: 10px; transform: none; }
.card-in:hover .shot-hint, .card-shot:focus-visible .shot-hint { opacity: 1; transform: none; }

.card-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.card-kind { margin: 0 0 6px; color: var(--tint); font: 700 11.5px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.card h3 { font-size: 1.2rem; line-height: 1.3; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--tint); }
.card-desc { margin: 8px 0 0; font-size: .95rem; color: var(--body); }
.card-note { margin: 10px 0 0; font-size: .85rem; color: var(--yellow); }
.tags { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { padding: 4px 9px; border-radius: 7px; background: var(--surface2); color: var(--text); font: 600 12px/1.2 var(--font-mono); }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 20px; }
.card-actions .sx-btn { flex: 1 1 auto; }

/* How it works */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; counter-reset: s; }
.steps li { position: relative; padding: 26px 24px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border-soft); overflow: hidden; }
.steps li::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent2)); opacity: .7; }
.step-n { display: block; margin-bottom: 14px; color: var(--accent); font: 800 1.6rem/1 var(--font-mono); }
.steps h3 { font-size: 1.1rem; }
.steps p { margin: 8px 0 0; font-size: .95rem; }
.privacy {
  display: flex; gap: 18px; align-items: flex-start; margin-top: 20px; padding: 22px 24px; border-radius: 18px;
  background: var(--yellow-bg); border: 1px solid var(--yellow-line);
}
.privacy-ico { flex: none; color: var(--yellow); }
.privacy h3 { font-size: 1.05rem; }
.privacy p { margin: 6px 0 0; color: var(--text); }

/* Repos */
.repo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.repo {
  display: flex; flex-direction: column; min-width: 0; padding: 22px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border-soft);
  transition: transform .3s var(--sx-ease), border-color .3s;
}
.repo:hover, .repo:focus-within { transform: translateY(-4px); border-color: var(--accent-line); }
.repo-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.repo-lang { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font: 600 12px/1 var(--font-mono); }
.repo-lang::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); }
.repo-lang[data-lang="JavaScript"]::before { background: var(--yellow); }
.repo h3 { font-size: 1.02rem; line-height: 1.35; overflow-wrap: anywhere; }
.repo h3 a { color: var(--text); text-decoration: none; }
.repo h3 a:hover { color: var(--accent); }
.repo-owner { color: var(--muted); font-weight: 500; }
.repo p { margin: 8px 0 0; font-size: .92rem; }
.repo-live { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: auto; padding-top: 8px; font-weight: 600; font-size: 14px; text-decoration: none; }

/* ── Lightbox ─────────────────────────────────────────────────────────── */
.lb {
  width: min(1180px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  background: var(--surface); color: var(--body);
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .85);
}
.lb::backdrop { background: rgba(0, 0, 0, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lb[open] { animation: lb-in .35s var(--sx-ease); }
.lb[open]::backdrop { animation: fade .35s ease; }
@keyframes lb-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
.lb-in { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.lb-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--border-soft); }
.lb-head h2 { flex: 1; min-width: 0; font-size: 1.05rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-views { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--sink); border: 1px solid var(--border-soft); }
.lb-views button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: 600 13px/1 var(--font-sans); cursor: pointer; }
.lb-views button[aria-pressed="true"] { background: var(--surface2); color: var(--text); }
.lb-close { width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: var(--text); font-size: 28px; line-height: 1; cursor: pointer; }
.lb-close:hover { background: var(--surface2); }
.lb-stage { position: relative; display: flex; align-items: safe center; justify-content: center; min-height: 0; flex: 1; padding: 16px 64px; background: var(--sink); overflow: auto; }
.lb-fig { margin: 0; display: grid; justify-items: center; gap: 10px; min-width: 0; }
.lb-img { display: block; max-width: 100%; height: auto; max-height: calc(100dvh - 260px); width: auto; border-radius: 10px; border: 1px solid var(--border-soft); transition: opacity .25s; }
.lb-img.is-mobile { max-height: calc(100dvh - 260px); }
.lb-img.is-loading { opacity: 0; }
.lb-cap { font-size: 13px; color: var(--muted); text-align: center; max-width: 80ch; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 26px; line-height: 1; cursor: pointer;
}
.lb-nav:hover { border-color: var(--accent); color: var(--accent); }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
.lb-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 14px 20px; border-top: 1px solid var(--border-soft); }
.lb-uses { flex: 1 1 420px; min-width: 0; font-size: 14px; }
.lb-uses ul { margin: 0; padding-left: 18px; }
.lb-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lb-lock { overflow: hidden; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1040px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .repo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .hero { padding: 44px 0 56px; }
  .section { padding: 60px 0; }
  .facts { grid-template-columns: repeat(2, auto); }
  .cards, .steps, .repo-grid { grid-template-columns: minmax(0, 1fr); }
  .term-head { flex-wrap: wrap; }
  .term-tabs { margin-left: 0; }
  .term-pane { font-size: 12px; padding: 16px; }
  .lb { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 14px; }
  .lb-in { max-height: calc(100dvh - 18px); }
  .lb-stage { padding: 12px; }
  .lb-nav { top: auto; bottom: 10px; transform: none; }
  .lb-head h2 { font-size: .95rem; }
  .lb-views button { padding: 0 10px; }
  .lb-img, .lb-img.is-mobile { max-height: calc(100dvh - 210px); }
  .lb-uses { display: none; }
  .lb-foot { padding: 10px 12px; }
  .lb-actions { width: 100%; }
  .lb-actions .sx-btn { flex: 1 1 auto; }
  .lb-stage { padding-bottom: 64px; }
}
/* Touch screens: no hover, so show the phone preview and hint permanently */
@media (hover: none) {
  .shot-phone { opacity: 1; bottom: 10px; transform: none; }
  .shot-hint { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-bg .grid, .hero-bg .glow, .eyebrow .dot, .term-pane.typing::after { animation: none !important; }
  .card-in, .card-in:hover, .card-in:focus-within, .repo:hover { transform: none !important; }
  .shot-desk, .shot-phone, .shot-hint, .card-in, .chip, .repo, .lb-img { transition: none !important; }
  .card.is-filtered-in, .lb[open], .lb[open]::backdrop { animation: none !important; }
  .card-in:hover .shot-desk { transform: none; }
}

/* Bigger hit areas for the in-card title links and repo links on touch screens */
@media (pointer: coarse) {
  .card h3 a, .repo h3 a { display: inline-block; padding-block: 11px; margin-block: -11px; }
}
