/* =========================================================
   Webloon Studio — Design System
   Editorial, technical, restrained
   ========================================================= */

/* Self-hosted fonts (latin) — served from origin, no third-party round-trip */
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-serif-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-serif-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/assets/fonts/inter-tight-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/inter-tight-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/inter-tight-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/inter-tight-600.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-500.woff2') format('woff2');
}

:root {
  /* Base palette — warm off-white / graphite */
  --paper: oklch(97.8% 0.006 80); /* warm off-white */
  --paper-2: oklch(95.6% 0.008 82); /* card */
  --paper-3: oklch(93.2% 0.01 82); /* hairline/raised */
  --ink: oklch(22% 0.01 80); /* near-black, warm */
  --ink-2: oklch(38% 0.01 80); /* body */
  --ink-3: oklch(55% 0.008 80); /* secondary */
  --ink-4: oklch(72% 0.006 80); /* tertiary / mono labels */
  --rule: oklch(88% 0.008 80); /* fine hairlines */
  --rule-2: oklch(82% 0.008 80);

  /* Single restrained accent — muted bronze/ochre */
  --accent: oklch(56% 0.085 60); /* deep bronze */
  --accent-ink: oklch(98% 0.005 80);
  --accent-wash: oklch(92% 0.025 65);

  /* Dark inversion (used selectively for contrast blocks) */
  --ink-block-bg: oklch(19% 0.008 80);
  --ink-block-fg: oklch(95% 0.006 80);

  /* Type */
  --f-display: "Instrument Serif", "Times New Roman", serif;
  --f-sans: "Inter Tight", "Inter", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  /* Scale */
  --step--2: 11px;
  --step--1: 13px;
  --step-0: 15px;
  --step-1: 17px;
  --step-2: 22px;
  --step-3: 30px;
  --step-4: 44px;
  --step-5: 64px;
  --step-6: 92px;
  --step-7: 128px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --dur: 480ms;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
body {
  font-family: var(--f-sans);
  font-size: var(--step-0);
  line-height: 1.5;
  color: var(--ink-2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

/* Typography ------------------------------------------------ */
h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.01em;
}
.display {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.96;
}
.serif {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: -0.015em;
}
.mono {
  font-family: var(--f-mono);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.mono--ink {
  color: var(--ink-3);
}
.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
p {
  margin: 0;
  text-wrap: pretty;
}
a {
  color: inherit;
  text-decoration: none;
}

/* Layout ---------------------------------------------------- */
.shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 48px;
}
.shell--narrow {
  max-width: 1120px;
}
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}
.rule {
  height: 1px;
  background: var(--rule);
  width: 100%;
}
.rule--strong {
  background: var(--rule-2);
}

/* Nav ------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(12px);
  background: color-mix(in oklch, var(--paper) 82%, transparent);
  border-bottom: 1px solid var(--rule);
}
/* Reserve the nav's height so the JS-injected nav doesn't push content
   down on load (prevents the CLS the report flagged on <main>). */
[data-partial="nav"] {
  min-height: 65px;
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--f-display);
  font-size: 22px;
  letter-spacing: -0.01em;
}
.logo__img {
  height: 30px;
  width: auto;
  display: block;
}
.logo--footer .logo__img {
  height: 34px;
}
.logo__mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  position: relative;
  top: -1px;
}
.logo__tag {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-4);
  text-transform: uppercase;
  margin-left: 4px;
}
.nav__links {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav__link {
  font-size: 14px;
  color: var(--ink-2);
  position: relative;
  padding: 6px 0;
  transition: color 0.2s var(--ease);
}
.nav__link:hover {
  color: var(--ink);
}
.nav__link.is-active {
  color: var(--ink);
}
.nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--ink);
}
.nav__cta {
  font-size: 13px;
  padding: 9px 16px;
  border: 1px solid var(--ink);
  color: var(--ink);
  border-radius: 999px;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.nav__cta:hover {
  background: var(--ink);
  color: var(--paper);
}

/* Buttons --------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.25s var(--ease);
  letter-spacing: -0.005em;
}
.btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.btn--primary:hover {
  background: oklch(32% 0.012 80);
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-2);
}
.btn--ghost:hover {
  border-color: var(--ink);
}
.btn__arrow {
  display: inline-block;
  width: 14px;
  height: 1px;
  background: currentColor;
  position: relative;
  transition: width 0.25s var(--ease);
}
.btn__arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
  transform-origin: center;
}
.btn:hover .btn__arrow {
  width: 22px;
}

/* Section ---------------------------------------------------- */
.section {
  padding: 128px 0;
}
.section--tight {
  padding: 96px 0;
}
.section--pad-top {
  padding-top: 128px;
  padding-bottom: 0;
}
.section__head {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  margin-bottom: 64px;
  align-items: start;
}
.section__index {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.section__index .eyebrow {
  color: var(--ink-3);
}
.section__title {
  font-family: var(--f-display);
  font-size: var(--step-5);
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 900px;
}
.section__lede {
  font-size: 20px;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 640px;
  margin-top: 20px;
}

/* Card utilities -------------------------------------------- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 6px;
  transition:
    border-color 0.3s var(--ease),
    transform 0.3s var(--ease),
    background 0.3s var(--ease);
}
.card:hover {
  border-color: var(--rule-2);
}

/* Placeholder (striped SVG-style via gradient) -------------- */
.placeholder {
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(
      135deg,
      oklch(91% 0.01 82) 0 1px,
      transparent 1px 10px
    ),
    oklch(94% 0.01 82);
  border: 1px solid var(--rule);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-4);
}
.placeholder__label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 10px;
  background: color-mix(in oklch, var(--paper) 80%, transparent);
  border: 1px solid var(--rule);
}

/* Dark block ------------------------------------------------ */
.ink-block {
  background: var(--ink-block-bg);
  color: var(--ink-block-fg);
}
.ink-block .eyebrow,
.ink-block .mono {
  color: oklch(70% 0.008 80);
}
.ink-block h1,
.ink-block h2,
.ink-block h3,
.ink-block h4 {
  color: var(--ink-block-fg);
}

/* Footer ---------------------------------------------------- */
.footer {
  border-top: 1px solid var(--rule);
  padding: 80px 0 40px;
  background: var(--paper);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 72px;
}
.footer__col h2 {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 16px;
  font-weight: 400;
}
.footer__col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer__col a {
  color: var(--ink-2);
  font-size: 14px;
}
.footer__col a:hover {
  color: var(--ink);
}
.footer__social {
  display: flex;
  gap: 12px;
  align-items: center;
}
.footer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  color: var(--ink-3);
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}
.footer__social a:hover {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}
.footer__base {
  display: flex;
  justify-content: space-between;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.footer__legal {
  display: flex;
  gap: 10px;
  align-items: center;
}
.footer__legal a {
  color: var(--ink-4);
  transition: color 0.2s var(--ease);
}
.footer__legal a:hover {
  color: var(--ink);
}

/* Reveal animation ----------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.9s var(--ease),
    transform 0.9s var(--ease);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* Above-the-fold heroes animate in on load via CSS (not gated on the
   reveal-on-scroll JS) so the LCP element paints immediately. */
.hero .reveal,
.cs-hero .reveal,
.page-hero .reveal,
.ab-hero .reveal,
.ct-left .reveal {
  animation: reveal-load 0.7s var(--ease) both;
}
@keyframes reveal-load {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero .reveal,
  .cs-hero .reveal,
  .page-hero .reveal,
  .ab-hero .reveal,
  .ct-left .reveal {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

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

/* Number column / indexed lists ---------------------------- */
.indexed {
  counter-reset: idx;
}
.indexed__item {
  counter-increment: idx;
  position: relative;
}
.indexed__item::before {
  content: counter(idx, decimal-leading-zero);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-4);
}

/* Utility --------------------------------------------------- */
.col-span-3 {
  grid-column: span 3;
}
.col-span-4 {
  grid-column: span 4;
}
.col-span-5 {
  grid-column: span 5;
}
.col-span-6 {
  grid-column: span 6;
}
.col-span-7 {
  grid-column: span 7;
}
.col-span-8 {
  grid-column: span 8;
}
.col-span-9 {
  grid-column: span 9;
}
.col-span-12 {
  grid-column: span 12;
}
.text-ink {
  color: var(--ink);
}
.text-ink-2 {
  color: var(--ink-2);
}
.text-ink-3 {
  color: var(--ink-3);
}
.text-ink-4 {
  color: var(--ink-4);
}
.mt-8 {
  margin-top: 8px;
}
.mt-16 {
  margin-top: 16px;
}
.mt-24 {
  margin-top: 24px;
}
.mt-32 {
  margin-top: 32px;
}
.mt-48 {
  margin-top: 48px;
}
.mt-64 {
  margin-top: 64px;
}

/* Skip-to-content link ------------------------------------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 999;
  transition: top 0.2s var(--ease);
}
.skip-link:focus {
  top: 12px;
}

/* Mobile nav burger ---------------------------------------- */
.nav__burger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  padding: 9px 16px;
  transition: all 0.2s var(--ease);
  z-index: 60;
}
.nav__burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition:
    transform 0.3s var(--ease),
    opacity 0.3s var(--ease),
    background 0.2s var(--ease);
}
.nav__burger:hover {
  background: var(--ink);
}
.nav__burger:hover span {
  background: var(--paper);
}
.nav__burger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav__burger.is-open span:nth-child(2) {
  opacity: 0;
}
.nav__burger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile drawer -------------------------------------------- */
.nav__drawer {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  padding: 48px 24px;
  gap: 0;
  z-index: 49;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.4s var(--ease),
    opacity 0.3s var(--ease);
}
.nav__drawer.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.nav__drawer .nav__link {
  font-family: var(--f-sans);
  font-size: 14px;
  color: var(--ink-2);
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  letter-spacing: -0.005em;
  transition: color 0.2s var(--ease);
}
.nav__drawer .nav__link:hover {
  color: var(--ink);
}
.nav__drawer .nav__cta {
  align-self: flex-start;
  margin-top: 24px;
}

/* Responsive quick fixes ----------------------------------- */
@media (max-width: 960px) {
  .shell {
    padding: 0 24px;
  }
  .section {
    padding: 80px 0;
  }
  .section__head {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 40px;
  }
  .section__title {
    font-size: var(--step-4);
  }
  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .footer__grid > .footer__col:first-child {
    grid-column: 1 / -1;
    margin-bottom: 16px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--rule);
  }
  .footer__base {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    text-align: left;
  }
  .footer__legal {
    flex-wrap: wrap;
  }
  .grid-12 {
    gap: 16px;
  }
  .nav__links {
    display: none;
  }
  .nav__burger {
    display: flex;
  }
}
