/* CodeMunch Labs — one stylesheet, every page */

:root {
  --bg: #0b0e1a;
  --surface: #141827;
  --surface-2: #1b2033;
  --border: #262c42;
  --accent: #ffb020;
  --accent-soft: #ffb02033;
  --accent-2: #4fd8f5;
  --text: #e8eaf2;
  --muted: #8b91a8;

  --max: 1140px;
  --gut: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 14px;

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

  color-scheme: dark;
}

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

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

h1, h2, h3 {
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 0.5em;
  font-weight: 700;
}

h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h3 { font-size: 1.18rem; letter-spacing: -0.015em; }

p { margin: 0 0 1.1em; }

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

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

.eyebrow {
  font: 600 0.74rem/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 1.1rem;
}

/* ---------- skip link ---------- */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #0b0e1a;
  padding: 0.7rem 1.1rem;
  font-weight: 700;
  z-index: 100;
}
.skip:focus { left: 0; }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 14, 26, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-in {
  max-width: var(--max);
  margin-inline: auto;
  padding: 0.85rem var(--gut);
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-right: auto;
}
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; object-fit: contain; }

.nav a.navlink {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 500;
}
.nav a.navlink:hover { color: var(--text); text-decoration: none; }

@media (max-width: 640px) {
  .nav a.navlink { display: none; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.82rem 1.5rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.97rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease,
    background 0.16s ease, border-color 0.16s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }

.btn-primary {
  background: var(--accent);
  color: #17120a;
  box-shadow: 0 0 0 0 var(--accent-soft);
}
.btn-primary:hover { box-shadow: 0 10px 34px -8px var(--accent); }

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .btn:hover { transform: none; }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  padding: clamp(5rem, 14vh, 9rem) 0 clamp(4rem, 10vh, 7rem);
  overflow: hidden;
}

/* parallax layers — moved by scroll-driven animation, no JS */
.hero-glow,
.hero-grid {
  position: absolute;
  inset: -25% -10% auto;
  height: 150%;
  z-index: -1;
  pointer-events: none;
}

.hero-glow {
  background:
    radial-gradient(50% 44% at 68% 28%, #ffb02040 0%, transparent 68%),
    radial-gradient(42% 40% at 22% 62%, #4fd8f526 0%, transparent 70%);
}

.hero-grid {
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 62px 62px;
  opacity: 0.32;
  mask-image: radial-gradient(70% 55% at 50% 35%, #000 0%, transparent 78%);
}

.hero h1 { margin-bottom: 0.35em; }

.hero h1 .glow {
  background: linear-gradient(96deg, var(--accent) 12%, #ffd980 52%, var(--accent-2) 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lede {
  font-size: clamp(1.06rem, 2.1vw, 1.28rem);
  color: var(--muted);
  max-width: 47ch;
  margin-bottom: 2.2rem;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.85rem; }

.hero-mark {
  width: clamp(88px, 13vw, 132px);
  margin-bottom: 1.8rem;
  filter: drop-shadow(0 0 34px #ffb02055);
}

/* ---------- stat bar ---------- */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.6rem, 5vw, 3.6rem);
  padding: 1.9rem 0;
  border-block: 1px solid var(--border);
}

.stat b {
  display: block;
  font: 800 clamp(1.5rem, 3vw, 2rem)/1 var(--font);
  color: var(--accent);
  letter-spacing: -0.03em;
}
.stat span {
  font: 600 0.72rem/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- sections ---------- */

.section { padding: clamp(4rem, 10vh, 7rem) 0; }

.section-head { max-width: 60ch; margin-bottom: 3rem; }
.section-head p { color: var(--muted); margin: 0; }
.section-head p + p { margin-top: 1.05em; }

/* ---------- app grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.4rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.7rem;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-4px);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin-bottom: 1.1rem;
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex: none;
}

.card h3 { margin: 0 0 0.15rem; }

.card .cat {
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.card .hook {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.card .blurb {
  color: var(--muted);
  font-size: 0.945rem;
  margin-bottom: 1.4rem;
}

.card .more {
  margin-top: auto;
  font-weight: 650;
  font-size: 0.94rem;
}

/* whole card clickable, link text stays the accessible name */
.card .more::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.tag {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  font: 600 0.66rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.38rem 0.6rem;
}

@media (prefers-reduced-motion: reduce) {
  .card:hover { transform: none; }
}

/* ---------- divider band (parallax) ---------- */

.band {
  position: relative;
  height: clamp(150px, 22vh, 240px);
  overflow: hidden;
  border-block: 1px solid var(--border);
}

.band-layer {
  position: absolute;
  inset: -40% 0 auto;
  height: 180%;
  background:
    radial-gradient(46% 50% at 30% 50%, #ffb02026 0%, transparent 70%),
    radial-gradient(40% 46% at 76% 46%, #4fd8f51f 0%, transparent 72%);
}

.band-code {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 600 0.78rem/2.1 var(--mono);
  color: #2c334c;
  letter-spacing: 0.3em;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- detail page ---------- */

.appbar {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  padding: clamp(2.6rem, 7vh, 4.4rem) 0 clamp(2.2rem, 5vh, 3.2rem);
}

.appbar-glow {
  position: absolute;
  inset: -50% 0 auto;
  height: 200%;
  z-index: 0;
  background: radial-gradient(44% 46% at 24% 40%, #ffb02033 0%, transparent 70%);
  pointer-events: none;
}

.appbar .wrap { position: relative; z-index: 1; }

.apphead {
  display: flex;
  gap: clamp(1.2rem, 3vw, 2rem);
  align-items: flex-start;
  flex-wrap: wrap;
}

.apphead img {
  width: clamp(84px, 12vw, 112px);
  height: clamp(84px, 12vw, 112px);
  border-radius: 22px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface);
  flex: none;
}

.apphead h1 {
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  margin-bottom: 0.2em;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.4rem;
  font: 600 0.74rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.meta .on { color: var(--accent-2); }

.apphead-body { min-width: min(100%, 280px); flex: 1; }

.apphead .tagline {
  font-size: clamp(1.02rem, 2vw, 1.2rem);
  color: var(--muted);
  max-width: 52ch;
  margin-bottom: 1.6rem;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* ---------- screenshot strip ---------- */

.shots {
  display: flex;
  gap: 1.1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0.5rem var(--gut) 1.6rem;
  max-width: var(--max);
  margin-inline: auto;
  scrollbar-color: var(--border) transparent;
}

.shots img {
  scroll-snap-align: center;
  height: clamp(360px, 52vh, 520px);
  width: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  flex: none;
}

.shots.wide img { height: clamp(210px, 34vh, 340px); }

.strip-label {
  font: 600 0.72rem/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 1.6rem 0 0.9rem;
}

.shots-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 3.2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

/* ---------- content columns ---------- */

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

@media (max-width: 820px) {
  .cols { grid-template-columns: 1fr; }
}

.feats { list-style: none; margin: 0; padding: 0; }

.feats li {
  position: relative;
  padding-left: 1.7rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.feats li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.2rem;
}

.panel h3 { margin-bottom: 0.9rem; font-size: 1rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.chip {
  font: 500 0.8rem/1 var(--mono);
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.44rem 0.6rem;
}

details.install {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.1rem 1.5rem;
  margin-top: 2.5rem;
}

details.install summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--accent);
  list-style: none;
}
details.install summary::-webkit-details-marker { display: none; }
details.install summary::before { content: "▸ "; }
details.install[open] summary::before { content: "▾ "; }
details.install ol { color: var(--muted); margin: 1rem 0 0.4rem; padding-left: 1.3rem; }
details.install li { margin-bottom: 0.5rem; }

.backlink { display: inline-block; margin-top: 3rem; color: var(--muted); font-weight: 600; }
.backlink:hover { color: var(--accent); }

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--border);
  padding: 3rem 0 3.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.foot-in {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  justify-content: space-between;
  align-items: center;
}

/* ================================================================
   Motion — parallax + reveal. Scroll-driven, no JS, no libraries.
   Entirely inside prefers-reduced-motion: no-preference. Parallax
   is a documented vestibular-migraine trigger; the OS setting must
   switch all of it off.
   Browsers without scroll-driven animation support simply render
   everything static and fully visible, which is the correct
   degradation.
   ================================================================ */

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {

    @keyframes drift-slow { to { transform: translateY(14%); } }
    @keyframes drift-fast { to { transform: translateY(26%); } }
    @keyframes rise {
      from { opacity: 0; transform: translateY(26px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .hero-glow,
    .appbar-glow {
      animation: drift-slow linear both;
      animation-timeline: scroll(root);
      animation-range: 0 90vh;
    }

    .hero-grid {
      animation: drift-fast linear both;
      animation-timeline: scroll(root);
      animation-range: 0 90vh;
    }

    .band-layer {
      animation: drift-fast linear both;
      animation-timeline: view();
      animation-range: cover 0% cover 100%;
    }

    .card,
    .section-head {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 5% cover 26%;
    }
  }
}
