/* ============================================================
   COSMOS — design studio, Nairobi
   Composition: rotating section palette · editorial serif
   · scroll-driven line reveal · broken bento · drag band
   · patterned SVG ground
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --ink: #0a0a0a;
  --paper: #f6f4ef;
  --red: #e10600;
  --blue: #003c8a;
  --acid: #f4ff33;

  --bg: var(--paper);
  --fg: var(--ink);
  --rule: color-mix(in srgb, var(--fg) 22%, transparent);
  --muted: color-mix(in srgb, var(--fg) 62%, transparent);

  --serif: "Fraunces", "Cormorant Garamond", Georgia, serif;
  --sans: "DM Sans", "Inter", system-ui, -apple-system, sans-serif;

  --gut: clamp(1.15rem, 4vw, 4.5rem);
  --maxw: 1440px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- reset ---------- */
*, *::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(--sans);
  font-size: 1.05rem;
  line-height: 1.7;
  font-optical-sizing: auto;
  overflow-x: hidden;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}
img, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.02; margin: 0; letter-spacing: -0.02em; }
p { margin: 0 0 1.05em; max-width: 68ch; text-wrap: pretty; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

::selection { background: var(--acid); color: var(--ink); }

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- patterned SVG ground ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'><g fill='none' stroke='%230a0a0a' stroke-width='0.7' opacity='0.5'><circle cx='13' cy='13' r='1.15' fill='%230a0a0a' stroke='none'/><path d='M0 13h26M13 0v26'/></g></svg>");
  background-size: 26px 26px;
  transition: opacity 0.5s var(--ease);
}
body[data-theme="dark"]::before { opacity: 0.28; }
body[data-theme="dark"]::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'><g fill='none' stroke='%23f6f4ef' stroke-width='0.7' opacity='0.5'><circle cx='13' cy='13' r='1.15' fill='%23f6f4ef' stroke='none'/><path d='M0 13h26M13 0v26'/></g></svg>");
}

/* ---------- shell ---------- */
.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gut);
}

/* ---------- header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.site-head .wrap {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 3vw, 2.5rem);
  min-height: 68px;
  padding-block: 0.6rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  margin-right: auto;
}
.brand svg { width: 34px; height: 34px; flex: none; }
.brand .word {
  font-family: var(--serif);
  font-size: 1.32rem;
  letter-spacing: 0.02em;
  line-height: 1;
}
.brand .word small {
  display: block;
  font-family: var(--sans);
  font-size: 0.58rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.28rem;
}
.nav {
  display: flex;
  align-items: center;
  gap: clamp(0.4rem, 1.6vw, 1.5rem);
}
.nav a {
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.7rem 0.35rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.nav a:hover { border-bottom-color: currentColor; }
.nav a.cta {
  border: 1px solid currentColor;
  padding-inline: 1rem;
  border-radius: 999px;
}
.nav a.cta:hover { background: var(--fg); color: var(--bg); }

.theme-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  flex: none;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.theme-toggle:hover { border-color: currentColor; transform: rotate(18deg); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .moon { display: none; }
body[data-theme="dark"] .theme-toggle .sun { display: none; }
body[data-theme="dark"] .theme-toggle .moon { display: block; }

@media (max-width: 860px) {
  .nav .hide-sm { display: none; }
}

/* ---------- section base ---------- */
.sec {
  position: relative;
  background: var(--sec-bg, var(--bg));
  color: var(--sec-fg, var(--fg));
  padding-block: clamp(3.5rem, 9vw, 8rem);
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}
.sec--ink  { --sec-bg: var(--ink);   --sec-fg: var(--paper); }
.sec--red  { --sec-bg: var(--red);   --sec-fg: #fff8f6; }
.sec--blue { --sec-bg: var(--blue);  --sec-fg: #eef3ff; }
.sec--acid { --sec-bg: var(--acid);  --sec-fg: var(--ink); }
.sec--paper{ --sec-bg: var(--paper); --sec-fg: var(--ink); }

body[data-theme="dark"] .sec--paper { --sec-bg: #121212; --sec-fg: #f2efe9; }
body[data-theme="dark"] .sec--ink   { --sec-bg: #050505; --sec-fg: #f2efe9; }
body[data-theme="dark"] .sec--red   { --sec-bg: #b00500; --sec-fg: #fff6f4; }
body[data-theme="dark"] .sec--blue  { --sec-bg: #002f6d; --sec-fg: #e9f0ff; }
body[data-theme="dark"] .sec--acid  { --sec-bg: #d8e600; --sec-fg: #0a0a0a; }

.sec .rule { border: 0; border-top: 1px solid color-mix(in srgb, currentColor 26%, transparent); margin: 0; }

.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  opacity: 0.72;
  margin: 0 0 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

/* ---------- broken bento grid ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(1.1rem, 2.6vw, 2.4rem);
  align-items: start;
}
.c1 { grid-column: 1 / 4; }
.c2 { grid-column: 3 / 7; }
.c3 { grid-column: 2 / 5; }
.c4 { grid-column: 4 / 7; }
.c5 { grid-column: 1 / 3; }
.c6 { grid-column: 3 / 7; }
.c-full { grid-column: 1 / -1; }
.c-off { grid-column: 5 / 7; }

@media (max-width: 820px) {
  .bento { grid-template-columns: 1fr; }
  .bento > * { grid-column: 1 / -1 !important; }
}

/* ---------- hero ---------- */
.hero { padding-block: clamp(3rem, 8vw, 7rem) clamp(2.5rem, 6vw, 5rem); }
.hero h1 {
  font-size: clamp(2.9rem, 10.5vw, 8.6rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin-bottom: 1.6rem;
}
.hero h1 em {
  font-style: italic;
  font-variation-settings: "SOFT" 60, "WONK" 1;
}
.hero .lede {
  font-size: clamp(1.05rem, 1.9vw, 1.35rem);
  line-height: 1.6;
  max-width: 46ch;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-top: 2.4rem;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 0.5rem; }
.hero-meta span::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }

.hero-figure { margin: 0; }
.hero-figure img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
}
.hero-figure figcaption {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.66;
  margin-top: 0.85rem;
}

/* ---------- section headings ---------- */
.sec-h {
  font-size: clamp(2rem, 5.4vw, 4.2rem);
  margin-bottom: 1.5rem;
}
.sec-h em { font-style: italic; font-variation-settings: "SOFT" 80, "WONK" 1; }

/* ---------- offer list ---------- */
.offer { border-top: 1px solid color-mix(in srgb, currentColor 26%, transparent); }
.offer li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.4rem 1.6rem;
  padding: 1.55rem 0;
  border-bottom: 1px solid color-mix(in srgb, currentColor 26%, transparent);
  align-items: baseline;
}
.offer .num {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  opacity: 0.6;
  padding-top: 0.5rem;
}
.offer h3 {
  font-size: clamp(1.25rem, 2.4vw, 1.85rem);
  margin-bottom: 0.45rem;
}
.offer p { margin: 0; font-size: 0.98rem; opacity: 0.86; max-width: 60ch; }
.offer .tags {
  grid-column: 2;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-top: 0.7rem;
}
@media (max-width: 620px) {
  .offer li { grid-template-columns: 1fr; }
  .offer .tags { grid-column: 1; }
}

/* ---------- process ---------- */
.process { counter-reset: step; }
.step {
  padding: 1.6rem 0 1.6rem 0;
  border-top: 1px solid color-mix(in srgb, currentColor 26%, transparent);
}
.step:last-child { border-bottom: 1px solid color-mix(in srgb, currentColor 26%, transparent); }
.step h3 {
  font-size: clamp(1.15rem, 2.1vw, 1.6rem);
  margin-bottom: 0.5rem;
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
}
.step h3::before {
  counter-increment: step;
  content: "0" counter(step);
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  opacity: 0.6;
}
.step p { margin: 0; font-size: 0.97rem; opacity: 0.88; }

/* ---------- drag band ---------- */
.band-sec { padding-block: clamp(3rem, 7vw, 6rem); }
.band-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.8rem;
}
.band-head .hint {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.62;
  margin: 0;
}
.band {
  display: flex;
  gap: clamp(0.9rem, 2vw, 1.6rem);
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  padding-bottom: 1.1rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.band::-webkit-scrollbar { display: none; }
.band.is-dragging { cursor: grabbing; scroll-behavior: auto; }
.band.is-dragging * { pointer-events: none; }
.card {
  flex: 0 0 clamp(230px, 30vw, 380px);
  margin: 0;
}
.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: grayscale(1) contrast(1.06);
  transition: filter 0.5s var(--ease);
}
.card:hover img { filter: grayscale(0) contrast(1); }
.card figcaption {
  margin-top: 0.85rem;
  font-size: 0.86rem;
  line-height: 1.5;
}
.card .kicker {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 0.35rem;
}

/* ---------- about / studio ---------- */
.about-body p { font-size: 1.06rem; }
.about-body p:first-of-type::first-letter {
  font-family: var(--serif);
  float: left;
  font-size: 3.6rem;
  line-height: 0.78;
  padding: 0.12em 0.12em 0 0;
}
.facts { border-top: 1px solid color-mix(in srgb, currentColor 26%, transparent); }
.facts div {
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid color-mix(in srgb, currentColor 26%, transparent);
  font-size: 0.88rem;
}
.facts dt { opacity: 0.62; letter-spacing: 0.06em; }
.facts dd { margin: 0; text-align: right; }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(1.2rem, 3vw, 2.6rem); }
.contact-grid .form-col { grid-column: 1 / 5; }
.contact-grid .info-col { grid-column: 5 / 7; }
@media (max-width: 820px) {
  .contact-grid { grid-template-columns: 1fr; }
  .contact-grid .form-col, .contact-grid .info-col { grid-column: 1 / -1; }
}
.field { margin-bottom: 1.15rem; }
.field label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.72;
  margin-bottom: 0.5rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, currentColor 40%, transparent);
  padding: 0.7rem 0.1rem;
  border-radius: 0;
  transition: border-color 0.25s var(--ease);
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-bottom-color: currentColor;
  border-bottom-width: 2px;
}
.field select option { color: #0a0a0a; background: #f6f4ef; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 48px;
  padding: 0.85rem 1.7rem;
  background: none;
  border: 1px solid currentColor;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.btn:hover { background: currentColor; }
.btn:hover span { color: var(--sec-bg, var(--bg)); }
.btn[disabled] { opacity: 0.5; cursor: progress; }
.form-status {
  margin: 1.1rem 0 0;
  font-size: 0.92rem;
  min-height: 1.4em;
}
.contact-info p { font-size: 0.95rem; }
.contact-info a { text-decoration: none; border-bottom: 1px solid color-mix(in srgb, currentColor 45%, transparent); }
.contact-info a:hover { border-bottom-color: currentColor; }
.contact-info .block { margin-bottom: 1.7rem; }
.contact-info .block h3 {
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.66;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* ---------- footer ---------- */
.site-foot {
  background: var(--ink);
  color: var(--paper);
  padding-block: clamp(2.5rem, 5vw, 4rem) 5rem;
  position: relative;
  z-index: 1;
}
body[data-theme="dark"] .site-foot { background: #050505; }
.site-foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem 2.5rem;
  align-items: flex-end;
  justify-content: space-between;
}
.site-foot .mark {
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0;
}
.site-foot .mark em { font-style: italic; }
.site-foot .colophon {
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  opacity: 0.66;
  margin: 0;
  max-width: 34ch;
}
.site-foot .colophon a { text-decoration: none; border-bottom: 1px solid currentColor; }

/* ---------- attribution (free tier) ---------- */
.attribution {
  position: fixed;
  bottom: 0.5rem;
  right: 0.75rem;
  z-index: 60;
  font-size: 0.7rem;
  opacity: 0.55;
  font-family: var(--sans);
  margin: 0;
}
.attribution a { color: inherit; text-decoration: none; }
.attribution a:hover { text-decoration: underline; }

/* ---------- scroll-driven reveal ---------- */
@keyframes riseIn {
  from { opacity: 0; translate: 0 22px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes wipeIn {
  from { opacity: 0; clip-path: inset(0 0 100% 0); }
  to   { opacity: 1; clip-path: inset(0 0 0 0); }
}

@supports (animation-timeline: view()) {
  .reveal {
    animation: riseIn linear both;
    animation-timeline: view();
    animation-range: entry 5% cover 38%;
  }
  .reveal-img {
    animation: wipeIn linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 45%;
  }
  .stagger > * {
    animation: riseIn linear both;
    animation-timeline: view();
    animation-range: entry 5% cover 42%;
  }
  .stagger > *:nth-child(2) { animation-range: entry 8% cover 46%; }
  .stagger > *:nth-child(3) { animation-range: entry 11% cover 50%; }
  .stagger > *:nth-child(4) { animation-range: entry 14% cover 54%; }
  .stagger > *:nth-child(5) { animation-range: entry 17% cover 58%; }
  .stagger > *:nth-child(6) { animation-range: entry 20% cover 62%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .reveal-img, .stagger > * { opacity: 1 !important; translate: none !important; clip-path: none !important; }
}
