/* ============================================================
   Jethwa B — murals & studio, Nairobi
   Composition: black/white + one colour per section, stacked
   headline breaking baseline, staggered line reveal on scroll,
   broken bento grid, audio-visualizer bars, patterned SVG tile.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --ink: #0a0a0a;
  --paper: #f2f0ea;
  --s1: #0a0a0a;
  --s2: #e10600;
  --s3: #003c8a;
  --s4: #f4ff33;

  --on-s1: #f4ff33;
  --on-s2: #ffffff;
  --on-s3: #ffffff;
  --on-s4: #0a0a0a;

  --rule: rgba(10, 10, 10, 0.18);
  --muted: rgba(10, 10, 10, 0.62);

  --font-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --pad: clamp(1.25rem, 5vw, 4.5rem);
  --maxw: 78rem;

  --tile: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'><circle cx='2' cy='2' r='1' fill='%230a0a0a' fill-opacity='0.16'/></svg>");
  --tile-inv: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'><circle cx='2' cy='2' r='1' fill='%23ffffff' fill-opacity='0.22'/></svg>");
}

html[data-theme="dark"] {
  --ink: #f2f0ea;
  --paper: #0a0a0a;
  --s1: #0a0a0a;
  --s2: #b00500;
  --s3: #00306e;
  --s4: #d8e62b;

  --on-s1: #f4ff33;
  --on-s2: #ffffff;
  --on-s3: #ffffff;
  --on-s4: #0a0a0a;

  --rule: rgba(242, 240, 234, 0.22);
  --muted: rgba(242, 240, 234, 0.66);

  --tile: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'><circle cx='2' cy='2' r='1' fill='%23f2f0ea' fill-opacity='0.18'/></svg>");
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: var(--tile);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-weight: 800; line-height: 0.95; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; }

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

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem var(--pad);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.mark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-decoration: none;
  white-space: nowrap;
}
.nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav a { text-decoration: none; padding: 0.5rem 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--s2); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  background: transparent;
  color: inherit;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.theme-toggle__icon {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset -4px -3px 0 0 var(--paper);
}
html[data-theme="dark"] .theme-toggle__icon {
  background: var(--s4);
  box-shadow: none;
}

/* ---------- section shell ---------- */
section { padding: clamp(3.5rem, 9vw, 7rem) var(--pad); }
section > * { max-width: var(--maxw); margin-inline: auto; }

/* ---------- hero ---------- */
.hero {
  background-color: var(--s1);
  background-image: var(--tile-inv);
  background-size: 22px 22px;
  color: var(--on-s1);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--on-s1);
  opacity: 0.85;
  margin-bottom: 1.5rem;
}
.stack {
  font-size: clamp(2.75rem, 12vw, 9rem);
  text-transform: uppercase;
  margin-bottom: clamp(1.75rem, 4vw, 3rem);
}
.stack span { display: block; }
.stack span:nth-child(2) { margin-left: 0.18em; }
.stack span:nth-child(3) { margin-left: -0.06em; color: var(--s4); }

.hero__meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: 46rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  padding-top: 1.5rem;
}
.hero__lede { font-size: clamp(1.05rem, 1rem + 0.5vw, 1.35rem); }
.hero__note {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  opacity: 0.8;
}

/* ---------- visualizer ---------- */
.viz {
  max-width: var(--maxw);
  margin: clamp(2.5rem, 6vw, 4rem) auto 0;
}
.viz__bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: clamp(48px, 9vw, 96px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 2px;
}
.viz__bars i {
  flex: 1 1 0;
  min-width: 2px;
  background: var(--s4);
  height: 20%;
  transform-origin: bottom;
  animation: pulse 1.6s ease-in-out infinite alternate;
}
.viz__caption {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-top: 0.75rem;
}
@keyframes pulse {
  from { height: 12%; }
  to   { height: 100%; }
}

/* ---------- work ---------- */
.work { background-color: var(--s2); color: var(--on-s2); }
.work__head {
  display: grid;
  gap: 1rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.work h2 { font-size: clamp(2rem, 6vw, 4.5rem); text-transform: uppercase; }
.work__intro { max-width: 38rem; opacity: 0.95; }
.work__note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  opacity: 0.85;
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  max-width: 44rem;
}

.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(0.75rem, 2vw, 1.5rem);
}
.card {
  grid-column: 1 / 7;
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex;
  flex-direction: column;
}
.card__media { overflow: hidden; }
.card__media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
  transition: filter 0.5s ease, transform 0.6s ease;
}
.card:hover .card__media img,
.card:focus-within .card__media img {
  filter: grayscale(0) contrast(1);
  transform: scale(1.03);
}
.card__body { padding: clamp(1rem, 2.5vw, 1.6rem); }
.card__meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 0.6rem;
}
.card h3 {
  font-size: clamp(1.25rem, 3vw, 1.9rem);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.card p:last-child { font-size: 0.95rem; }
.bento__gap { display: none; }

/* ---------- studio ---------- */
.studio { background-color: var(--s3); color: var(--on-s3); }
.studio__grid { display: grid; gap: clamp(2rem, 5vw, 4rem); }
.studio h2 { font-size: clamp(2rem, 6vw, 4.5rem); text-transform: uppercase; margin-bottom: 1.5rem; }
.studio__text p + p { margin-top: 1.1rem; }
.studio__text p { max-width: 42rem; }
.studio__facts {
  border-top: 2px solid rgba(255, 255, 255, 0.5);
  padding-top: 1.25rem;
  align-self: start;
}
.studio__facts h3 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 1rem;
}
.studio__facts dl { margin: 0; display: grid; gap: 0.85rem; }
.studio__facts div { display: grid; gap: 0.15rem; }
.studio__facts dt {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.75;
}
.studio__facts dd { margin: 0; font-size: 0.95rem; }

/* ---------- process ---------- */
.process { background-color: var(--s4); color: var(--on-s4); }
.process h2 { font-size: clamp(2rem, 6vw, 4.5rem); text-transform: uppercase; margin-bottom: clamp(2rem, 5vw, 3rem); }
.process__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
}
.process__list li {
  border-top: 2px solid var(--on-s4);
  padding-top: 1rem;
}
.process__num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  display: block;
  margin-bottom: 0.5rem;
}
.process__list h3 { font-size: clamp(1.2rem, 3vw, 1.75rem); text-transform: uppercase; margin-bottom: 0.5rem; }
.process__list p { max-width: 40rem; font-size: 0.95rem; }

/* ---------- now ---------- */
.now { background-color: var(--s1); color: var(--on-s1); }
.now__grid { display: grid; gap: clamp(2rem, 5vw, 3.5rem); }
.now h2 { font-size: clamp(2rem, 6vw, 4.5rem); text-transform: uppercase; }
.now__date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-top: 0.75rem;
}
.now__items { display: grid; gap: clamp(1.5rem, 4vw, 2.25rem); }
.now__items article { border-top: 1px solid rgba(255, 255, 255, 0.3); padding-top: 1rem; }
.now__items h3 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--s4);
}
.now__items p { font-size: 0.95rem; }

/* ---------- contact ---------- */
.contact { background-color: var(--paper); color: var(--ink); }
.contact__grid { display: grid; gap: clamp(2rem, 5vw, 4rem); }
.contact h2 { font-size: clamp(2rem, 6vw, 4.5rem); text-transform: uppercase; margin-bottom: 1rem; }
.contact__intro > p { max-width: 34rem; }
.contact__note {
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  max-width: 30rem;
}

.contact__form {
  display: grid;
  gap: 1.1rem;
  align-content: start;
}
.field { display: grid; gap: 0.4rem; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.field__hint { text-transform: none; letter-spacing: 0.02em; opacity: 0.8; }
.field input,
.field textarea {
  width: 100%;
  padding: 0.85rem 0.9rem;
  min-height: 44px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 0;
}
.field textarea { resize: vertical; }
.field input:focus,
.field textarea:focus { border-color: var(--s2); }
.contact__form button {
  justify-self: start;
  min-height: 48px;
  padding: 0.85rem 1.75rem;
  background: var(--s2);
  color: #fff;
  border: 2px solid var(--s2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.contact__form button:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.contact__form button[disabled] { opacity: 0.6; cursor: progress; }
.form-status {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* ---------- footer ---------- */
.site-footer {
  background-color: var(--s1);
  color: var(--on-s1);
  padding: clamp(2rem, 5vw, 3rem) var(--pad) clamp(3rem, 6vw, 4rem);
  display: grid;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}
.site-footer__name { text-transform: uppercase; }
.site-footer__links a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.site-footer .attribution {
  position: static;
  opacity: 0.6;
  font-size: 0.7rem;
  margin-top: 0.75rem;
}
.site-footer .attribution a { color: inherit; }

/* ---------- staggered line reveal ---------- */
@keyframes riseIn {
  from { opacity: 0; translate: 0 22px; }
  to   { opacity: 1; translate: 0 0; }
}
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .hero__meta > *,
    .work__head > *,
    .card,
    .studio__text > *,
    .studio__facts,
    .process__list li,
    .now__lead > *,
    .now__items article,
    .contact__intro > *,
    .contact__form > * {
      animation: riseIn linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 38%;
    }
    .card:nth-child(2) { animation-range: entry 0% cover 46%; }
    .card:nth-child(3) { animation-range: entry 0% cover 52%; }
    .process__list li:nth-child(2) { animation-range: entry 0% cover 44%; }
    .process__list li:nth-child(3) { animation-range: entry 0% cover 50%; }
    .process__list li:nth-child(4) { animation-range: entry 0% cover 56%; }
    .process__list li:nth-child(5) { animation-range: entry 0% cover 62%; }
  }
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .nav { display: none; }
  .theme-toggle { margin-left: auto; }
  .stack span:nth-child(2) { margin-left: 0.1em; }
}

@media (min-width: 720px) {
  .hero__meta { grid-template-columns: 1.6fr 1fr; align-items: start; }
  .studio__grid { grid-template-columns: 1.7fr 1fr; }
  .now__grid { grid-template-columns: 1fr 1.6fr; }
  .contact__grid { grid-template-columns: 1fr 1.1fr; }
  .process__list { grid-template-columns: repeat(2, 1fr); }
  .process__list li:nth-child(5) { grid-column: 1 / 2; }
}

@media (min-width: 900px) {
  /* broken bento: irregular spans, one intentional empty cell */
  .card { grid-column: span 2; }
  .card--wide { grid-column: 1 / 4; }
  .card--tall { grid-column: 4 / 7; grid-row: span 2; }
  .card--offset { grid-column: 2 / 5; }
  .bento__gap { display: block; grid-column: 5 / 7; }
  .process__list { grid-template-columns: repeat(3, 1fr); }
  .process__list li:nth-child(5) { grid-column: 2 / 3; }
}
