/* KitOps case study + gallery. Dark mode, built on the site's tokens, type scale and containers.
   Brand colors (--kit-*) are used only where the KitOps brand itself is shown. */

:root {
  color-scheme: dark;

  /* site palette, dark-derived */
  --bg: #161616;
  --ink: #f2f2f2;
  --muted: #a3a3a3;
  --accent: #ff00aa;
  --green: #99c460;
  --line: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.1);
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.08);
  --frame-line: transparent; /* set to var(--border) to outline every image */

  /* site type + layout */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --w-wide: 1120px;
  --w-narrow: 731px;
  --measure: calc(var(--w-narrow) - 48px);
  --section-py: clamp(64px, 11vw, 120px);
  --section-gap: clamp(32px, 6vw, 48px);

  /* KitOps brand (content only) */
  --kit-gold: #ffaf52;
  --kit-night: #121212;
  --kit-cornflower: #7a8cff;
  --kit-salmon: #ffa3af;
  --kit-ash: #bed8d4;
  --kit-brand: 'Major Mono Display', ui-monospace, monospace;
  --kit-display: 'Titillium Web', system-ui, sans-serif;
  --kit-body: 'Atkinson Hyperlegible', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
p, h1, h2, h3, h4, ul, dl, dd, figure { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

.wrap { width: 100%; max-width: calc(var(--w-wide) + 64px); margin: 0 auto; padding: 0 32px; }

/* ---------- Header ---------- */
.site-header { width: 100%; padding: 0 32px; }
.nav {
  max-width: var(--w-wide);
  margin: 0 auto;
  min-height: 80px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 16px 0;
}
.nav__home,
.nav__link {
  font-size: 12px;
  line-height: 20px;
  letter-spacing: 0.48px;
  color: var(--muted);
  text-decoration: none;
  transition: color 200ms ease;
}
.nav__home:hover,
.nav__link:hover { color: var(--ink); }
.nav__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 20px;
  letter-spacing: 0.48px;
  color: var(--muted);
  text-decoration: none;
}
.nav__back svg { flex-shrink: 0; transition: transform 200ms ease; }
.nav__back:hover { color: var(--ink); }
.nav__back:hover svg { transform: translateX(-3px); }
.nav__back:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  transition: transform 300ms ease, box-shadow 300ms ease;
}
.site-header.is-stuck { box-shadow: 0 1px 0 var(--line); }
.site-header.is-hidden { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) {
  .site-header { transition: none; }
}
.nav__end { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; }
.nav__status { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.nav__status span { font-size: 12px; font-weight: 500; color: var(--muted); }

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 9vw, 88px) 0 clamp(48px, 8vw, 72px); }
.hero .wrap { display: flex; flex-direction: column; gap: 24px; }
.eyebrow {
  font-size: 12px;
  line-height: 20px;
  letter-spacing: 0.48px;
  color: var(--accent);
}
.hero .eyebrow { margin-bottom: 56px; }
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.25rem, 6vw, 4rem);
  line-height: 1.05;
  color: var(--ink);
}
.lede { max-width: 760px; font-size: 16px; line-height: 26px; color: var(--ink); }
.meta { max-width: var(--measure); width: 100%; margin: 32px auto 0; display: flex; flex-direction: column; }
.meta > div { display: flex; gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.meta dt { flex: 0 0 180px; font-size: 14px; color: var(--muted); }
.meta dd { flex: 1 1 0; min-width: 0; font-size: 14px; line-height: 22px; color: var(--ink); }
.meta dd a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); transition: color 200ms ease, border-color 200ms ease; }
.meta dd a:hover { color: var(--accent); border-color: var(--accent); }
.hero-link { align-self: flex-start; }
.hero-img { border-radius: 8px; overflow: hidden; border: 1px solid var(--frame-line); }

/* ---------- Sections ---------- */
section { padding: var(--section-py) 0; }
.split { max-width: var(--measure); margin: 0 auto; display: flex; flex-direction: column; gap: var(--section-gap); }
.kicker { display: flex; align-items: baseline; margin-bottom: 80px; color: var(--accent); }
.kicker .t { font-size: 12px; line-height: 20px; letter-spacing: 0.48px; text-transform: lowercase; }
h2 { font-weight: 400; font-size: 30px; line-height: 36px; color: var(--ink); }
h3 { font-weight: 500; font-size: 18px; line-height: 26px; color: var(--ink); }
.prose { display: flex; flex-direction: column; gap: 16px; }
.prose p { font-size: 16px; line-height: 26px; color: var(--ink); }
.prose strong { font-weight: 700; }
.prose a,
.lede a {
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: color 200ms ease, border-color 200ms ease;
}
.prose a:hover,
.lede a:hover { color: var(--accent); border-color: var(--accent); }

.sub { margin-top: clamp(64px, 9vw, 112px); }
.sub > h3,
.sub > .intro { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.sub > h3 { font-weight: 400; font-size: 24px; line-height: 32px; margin-bottom: 12px; }
.sub > .intro { font-size: 16px; line-height: 26px; color: var(--muted); }

/* ---------- Figures ---------- */
figure .frame { border-radius: 8px; overflow: hidden; border: 1px solid var(--frame-line); background: var(--surface); }
figure .frame img { width: 100%; height: auto; }
figcaption { margin-top: 12px; font-size: 13px; line-height: 20px; color: var(--muted); text-align: center; }
a.lb { display: block; text-decoration: none; cursor: zoom-in; border-radius: 8px; }
a.lb .frame { transition: transform 200ms ease; }
a.lb:hover .frame { transform: translateY(-2px); }
a.lb:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.crop .frame { aspect-ratio: var(--ar, 16 / 10); }
.crop .frame img { height: 100%; object-fit: cover; object-position: top; }
.ar-720x512 { --ar: 720 / 512; }
.ar-3x4 { --ar: 3 / 4; }
.ar-1440x1300 { --ar: 1440 / 1300; }
.frame--sticker { aspect-ratio: 1200 / 780; }
.frame--sticker img { height: 100%; object-fit: cover; object-position: 75% 60%; }

.grid { display: grid; gap: 24px; margin-top: var(--section-gap); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.span2 { grid-column: span 2; }
.logos { margin-top: var(--section-gap); }

/* ---------- Lists ---------- */
.points { list-style: none; padding: 0; display: grid; gap: 14px; margin-top: 8px; }
.points li { position: relative; padding-left: 22px; font-size: 16px; line-height: 26px; }
.points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 8px;
  background: var(--kit-gold);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

/* ---------- Cards ---------- */
.cards { display: grid; gap: 24px; margin-top: var(--section-gap); }
.traits { grid-template-columns: repeat(3, 1fr); }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 32px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.card p { font-size: 14px; line-height: 22px; color: var(--muted); }
.card p strong { color: var(--ink); font-weight: 700; }
.card .tag {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 4px;
  color: var(--kit-night);
}
.tag--gold { background: var(--kit-gold); }
.tag--cornflower { background: var(--kit-cornflower); }
.tag--ash { background: var(--kit-ash); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips span { font-size: 13px; padding: 3px 10px; border-radius: 6px; background: var(--surface-2); color: var(--ink); }
.tension { max-width: var(--measure); margin: var(--section-gap) auto 0; }

/* ---------- Logo rounds ---------- */
.rounds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: var(--section-gap); }
.round .v { display: block; margin-top: 14px; font-family: var(--font-display); font-weight: 500; font-size: 14px; color: var(--accent); }
.round h4 { margin: 2px 0 4px; font-size: 18px; line-height: 26px; font-weight: 500; color: var(--ink); }
.round p { font-size: 14px; line-height: 22px; color: var(--muted); }

/* ---------- Palette ---------- */
.pal-group { margin-top: 32px; }
.pal-group--flush { margin-top: 0; }
.pal-row { margin-top: 32px; }
.pal-group h4 { margin-bottom: 12px; font-size: 12px; line-height: 20px; letter-spacing: 0.48px; color: var(--muted); font-weight: 400; }
.swatches { display: grid; gap: 12px; }
.s3 { grid-template-columns: repeat(3, 1fr); }
.sw { border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.sw .chip { height: 96px; }
.swatches--compact .sw .chip { height: 64px; }
.sw .info { padding: 10px 12px 12px; font-size: 13px; line-height: 20px; color: var(--muted); }
.sw .info b { display: block; font-size: 14px; font-weight: 500; color: var(--ink); }
.sw .info i { display: block; margin-top: 6px; font-style: normal; color: var(--ink); }
.chip--edge { border-bottom: 1px solid var(--line); }
.chip--gold { background: #ffaf52; }
.chip--night { background: #121212; }
.chip--white { background: #ffffff; }
.chip--cornflower { background: #7a8cff; }
.chip--salmon { background: #ffa3af; }
.chip--ash { background: #bed8d4; }
.chip--aero { background: #00c3e2; }
.chip--lavender { background: #bc7eff; }
.chip--mustard { background: #d4bf40; }
.chip--red { background: #db636a; }
.chip--zomp { background: #659e8b; }
.chip--tea { background: #def2c8; }
.chip--offwhite { background: #ececec; }
.chip--grey2 { background: #4d4d4f; }
.chip--black { background: #000000; }

/* ---------- Type specimens (brand typefaces live here) ---------- */
.type { display: grid; gap: 16px; margin-top: var(--section-gap); }
.spec { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 28px 32px; background: var(--surface); }
.spec .who b { display: block; font-size: 16px; font-weight: 500; color: var(--ink); }
.spec .who span { font-size: 14px; color: var(--muted); }
.spec .sample { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.15; color: var(--ink); overflow-wrap: anywhere; }
.sample--brand { font-family: var(--kit-brand); }
.sample--display { font-family: var(--kit-display); font-weight: 300; }
.sample--body { font-family: var(--kit-body); font-size: clamp(18px, 2vw, 22px); line-height: 1.5; }

/* ---------- Personality ---------- */
.archetypes { max-width: 760px; margin: var(--section-gap) auto 0; }
.pull-quote { max-width: var(--measure); margin: var(--section-gap) auto 0; padding: 0 0 0 24px; font-size: clamp(1.25rem, 2.6vw, 1.75rem); line-height: 1.45; color: var(--muted); }
.pull-quote { position: relative; }
.pull-quote::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; background: rgba(255, 255, 255, 0.22); }
.pull-quote strong { font-weight: 500; color: var(--ink); }
.pull-quote + .hoody { margin-top: var(--section-gap); }
.quote { max-width: var(--measure); margin: 32px auto 0; padding: 4px 0 4px 24px; border-left: 2px solid var(--kit-gold); }
.quote p.big { font-size: clamp(1.25rem, 2.6vw, 1.75rem); line-height: 1.45; color: var(--ink); }
.quote .src { margin-top: 16px; font-size: 14px; line-height: 22px; color: var(--muted); }

/* ---------- Mascot (brand being shown) ---------- */
.why { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: var(--section-gap); }
.why div { border: 1px solid var(--border); border-radius: 8px; padding: 24px; background: var(--surface); }
.why b { display: block; margin-bottom: 4px; font-size: 16px; font-weight: 500; color: var(--ink); }
.why span { font-size: 14px; line-height: 22px; color: var(--muted); }
.champ { grid-template-columns: minmax(0, 420px) 1fr; gap: clamp(24px, 5vw, 64px); align-items: center; margin-top: 48px; }

/* ---------- Stats + CTA ---------- */
.stats { max-width: var(--measure); margin-left: auto; margin-right: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: var(--section-gap); }
.stat { border-top: 2px solid var(--kit-gold); padding-top: 20px; }
.stat .n { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.75rem, 4.5vw, 2.5rem); line-height: 1; color: var(--ink); }
.stat p { margin-top: 12px; font-size: 14px; line-height: 22px; color: var(--muted); }

.cta { max-width: var(--measure); margin-left: auto; margin-right: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 20px; margin-top: var(--section-gap); padding: 0; }
.cta:first-child { margin-top: 0; }
.cta h3 { margin: 0; }
.cta p { margin-top: 4px; font-size: 14px; line-height: 22px; color: var(--muted); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  transition: color 200ms ease;
}
.btn svg { flex-shrink: 0; transition: transform 200ms ease; }
.btn:hover { color: var(--accent); }
.btn:hover svg { transform: translateX(4px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 2px; }

/* ---------- Next / back ---------- */
.next { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; padding: 48px 0 var(--section-py); border-top: 1px solid var(--line); }
.next a { text-decoration: none; font-size: 24px; line-height: 32px; color: var(--ink); transition: color 200ms ease; }
.next a:hover { color: var(--accent); }
.next small { display: block; margin-bottom: 4px; font-size: 12px; line-height: 20px; letter-spacing: 0.48px; color: var(--muted); text-transform: lowercase; }
.next__fwd { text-align: right; }

/* ---------- Footer ---------- */
.site-footer { border: 1px solid var(--border); padding: 40px 32px; }
.footer-inner {
  max-width: var(--w-wide);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  font-size: 14px;
  color: var(--muted);
}
@media (min-width: 701px) {
  .footer-inner { display: grid; grid-template-columns: 1fr auto 1fr; }
  .footer-inner > :last-child { justify-self: end; text-align: right; }
}
.footer-legal { max-width: var(--w-wide); margin: 20px auto 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 24px; font-size: 12px; color: var(--muted); }
.footer-legal a { color: inherit; text-decoration: none; transition: color 200ms ease; }
.footer-legal a:hover { color: var(--accent); }
.footer-legal a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Lightbox ---------- */
.lbx { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; background: rgba(10, 10, 10, 0.97); }
.lbx.open { display: flex; }
.lbx .stage { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; padding: 64px 16px 16px; }
.lbx .stage img { max-width: min(1400px, 100%); height: auto; margin: auto; border-radius: 8px; }
.lbx .bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px 18px; font-size: 13px; line-height: 20px; color: var(--muted); }
.lbx button { flex: none; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 20px; cursor: pointer; transition: border-color 200ms ease, color 200ms ease; }
.lbx button:hover { border-color: var(--accent); color: var(--accent); }
.lbx button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lbx .close { position: absolute; top: 12px; right: 16px; }
.lbx .cap { flex: 1; text-align: center; }

/* ---------- Gallery ---------- */
.gh { padding: clamp(48px, 9vw, 88px) 0 24px; }
.gh .wrap { display: flex; flex-direction: column; gap: 24px; }
.gh .eyebrow { margin-bottom: 56px; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.toc a { padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; line-height: 20px; text-decoration: none; color: var(--ink); transition: color 200ms ease, border-color 200ms ease; }
.toc a:hover { color: var(--accent); border-color: var(--accent); }
.gallery-section { padding: clamp(40px, 6vw, 72px) 0; scroll-margin-top: 24px; }
.gh-head { max-width: var(--measure); margin: 0 auto; }
.back-link { align-self: flex-start; }
.gallery-section h2 { margin-bottom: 8px; }
.lede-s { font-size: 14px; line-height: 22px; color: var(--muted); }
.masonry { columns: 3 300px; column-gap: 24px; margin-top: 32px; }
.tile-g { break-inside: avoid; margin-bottom: 24px; }
.tile-g .frame { max-height: 620px; }
.tile-g .frame img { object-fit: cover; object-position: top; }

/* ---------- Scroll reveal (same motion as the other pages) ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 700ms cubic-bezier(0.16, 1, 0.3, 1), transform 700ms cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  a.lb .frame, .btn svg { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .g2, .g3, .g4, .rounds, .traits, .why, .champ { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .span2 { grid-column: auto; }
  .spec { grid-template-columns: 1fr; gap: 10px; }
  .logos { grid-template-columns: 1fr 1fr; gap: 12px; }
  .masonry { columns: 2 240px; }
}
@media (max-width: 700px) {
  .meta > div { flex-direction: column; gap: 6px; }
  .meta dt { flex-basis: auto; }
  .card { padding: 24px; }
  .spec { padding: 24px; }
  .footer-inner { justify-content: center; text-align: center; }
}
@media (max-width: 520px) {
  .s3 { grid-template-columns: 1fr 1fr; }
  .sw .chip { height: 64px; }
  .masonry { columns: 1; }
  .hero .wrap, .wrap { padding: 0 24px; }
  .site-header, .site-footer { padding-left: 24px; padding-right: 24px; }
  .next a { font-size: 20px; line-height: 28px; }
}
