/* ==========================================================================
   CodeROG Design System — Base
   Reset, typography classes, layout grid, section rhythm, utilities.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 24px); }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--fw-book);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul[class], ol[class] { list-style: none; padding: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: var(--fw-medium); color: var(--text-strong); text-wrap: balance; }
p { text-wrap: pretty; }
::selection { background: var(--brand-600); color: #fff; }
:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 3px; border-radius: var(--r-sm); }
hr { border: 0; border-top: 1px solid var(--border-subtle); }

/* ---------- Typography ---------- */
.t-display-1, .t-display-2, .t-display-3, .t-display-4 {
  font-family: var(--font-display);
  font-weight: var(--fw-medium);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--text-strong);
}
.t-display-1 { font-size: var(--display-1); }
.t-display-2 { font-size: var(--display-2); }
.t-display-3 { font-size: var(--display-3); }
.t-display-4 { font-size: var(--display-4); }
.t-light { font-weight: var(--fw-book); }

.t-h1, .t-h2, .t-h3, .t-h4, .t-h5, .t-h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-medium);
  color: var(--text-strong);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.t-h1 { font-size: var(--heading-1); line-height: 1.1; }
.t-h2 { font-size: var(--heading-2); }
.t-h3 { font-size: var(--heading-3); }
.t-h4 { font-size: var(--heading-4); }
.t-h5 { font-size: var(--heading-5); line-height: 1.2; letter-spacing: 0; }
.t-h6 { font-size: var(--heading-6); line-height: 1.2; letter-spacing: 0; }
.t-title { font-size: var(--text-base); font-weight: var(--fw-medium); line-height: 1.35; color: var(--text-strong); }

.t-body-1 { font-size: clamp(var(--text-base), 0.9rem + 0.45vw, var(--text-lg)); line-height: 1.35; }
.t-body-2 { font-size: clamp(var(--text-sm), 0.82rem + 0.3vw, var(--text-md)); line-height: 1.35; }
.t-body-3 { font-size: var(--text-sm); line-height: 1.4; letter-spacing: 0.01em; font-weight: var(--fw-regular); }
.t-body-4 { font-size: var(--text-xs); line-height: 1.4; letter-spacing: 0.02em; font-weight: var(--fw-regular); }
.t-mono { font-family: var(--font-mono); font-size: 0.875em; letter-spacing: 0; }

.t-eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-8);
  font-size: var(--text-xs); font-weight: var(--fw-medium);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-primary);
}
.t-eyebrow--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.t-strong { color: var(--text-strong); }
.t-subdued { color: var(--text-subdued); }
.t-primary { color: var(--text-primary); }
.t-center { text-align: center; }
.t-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
[data-theme="light"] .t-gradient { background-image: var(--gradient-brand); }

/* ---------- Layout ---------- */
.cr-container {
  width: 100%;
  max-width: var(--grid-max);
  margin-inline: auto;
  padding-inline: var(--grid-margin);
}
.cr-container--narrow { max-width: 880px; }
.cr-container--wide { max-width: 1680px; }

.cr-section { padding-block: var(--section-y); position: relative; }
.cr-section--sm { padding-block: var(--gap-3xl); }
.cr-section--flush-top { padding-top: 0; }
.cr-section--flush-bottom { padding-bottom: 0; }

/* 12-col grid (4 cols on mobile) */
.cr-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: var(--grid-gutter);
  row-gap: var(--gap-lg);
}
.cr-grid > * { grid-column: 1 / -1; }
@media (min-width: 768px) {
  .cr-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .cr-col-3 { grid-column: span 3; }
  .cr-col-4 { grid-column: span 4; }
  .cr-col-5 { grid-column: span 5; }
  .cr-col-6 { grid-column: span 6; }
  .cr-col-7 { grid-column: span 7; }
  .cr-col-8 { grid-column: span 8; }
  .cr-col-start-2 { grid-column-start: 2; }
  .cr-col-start-3 { grid-column-start: 3; }
  .cr-col-start-7 { grid-column-start: 7; }
  .cr-col-start-8 { grid-column-start: 8; }
}

/* simple equal-column grids */
.cr-cols { display: grid; gap: var(--grid-gutter); grid-template-columns: 1fr; }
@media (min-width: 640px) { .cr-cols--2, .cr-cols--3, .cr-cols--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) {
  .cr-cols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cr-cols--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.cr-stack { display: flex; flex-direction: column; gap: var(--gap-sm); }
.cr-stack--xs { gap: var(--gap-xs); }
.cr-stack--lg { gap: var(--gap-xl); }
.cr-stack--center { align-items: center; text-align: center; }
.cr-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-12); }
.cr-row--between { justify-content: space-between; }
.cr-row--center { justify-content: center; }

/* section heading block */
.cr-section-head { display: flex; flex-direction: column; gap: var(--s-16); max-width: 760px; margin-bottom: var(--gap-2xl); }
.cr-section-head--center { align-items: center; text-align: center; margin-inline: auto; }
.cr-section-head--split { max-width: none; }
@media (min-width: 900px) {
  .cr-section-head--split { flex-direction: row; justify-content: space-between; align-items: flex-end; gap: var(--gap-2xl); }
  .cr-section-head--split > :first-child { max-width: 640px; }
  .cr-section-head--split > :last-child { max-width: 440px; }
}

/* ---------- Utilities ---------- */
.u-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.u-hide-mobile { display: none; }
@media (min-width: 900px) { .u-hide-mobile { display: revert; } .u-hide-desktop { display: none !important; } }
.u-mt-sm { margin-top: var(--gap-sm); } .u-mt-md { margin-top: var(--gap-lg); } .u-mt-lg { margin-top: var(--gap-2xl); }
.u-maxw-prose { max-width: 60ch; }
.u-full { width: 100%; }

.cr-icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ==========================================================================
   Motion primitives (driven by assets/js/coderog.js)
   [data-reveal]            fade + rise when scrolled into view
   [data-reveal="fade|blur|scale|left|right"]
   [data-stagger]           children reveal one after another
   [data-split]             headline reveals line by line
   ========================================================================== */
.js [data-reveal],
.js [data-stagger] > * {
  opacity: 0;
  translate: 0 var(--reveal-distance);
  transition:
    opacity var(--dur-reveal) var(--ease-smooth) var(--reveal-delay, 0s),
    translate var(--dur-reveal) var(--ease-smooth) var(--reveal-delay, 0s),
    scale var(--dur-reveal) var(--ease-smooth) var(--reveal-delay, 0s),
    filter var(--dur-reveal) var(--ease-smooth) var(--reveal-delay, 0s);
  will-change: opacity, translate;
}
.js [data-reveal="fade"] { translate: none; }
.js [data-reveal="blur"] { translate: 0 16px; filter: blur(12px); }
.js [data-reveal="scale"] { translate: none; scale: 0.94; }
.js [data-reveal="left"] { translate: calc(var(--reveal-distance) * -1) 0; }
.js [data-reveal="right"] { translate: var(--reveal-distance) 0; }
.js [data-reveal].is-in,
.js [data-stagger].is-in > * { opacity: 1; translate: none; scale: 1; filter: none; }

/* split headline: each word slides up out of a mask */
[data-split] .cr-word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
[data-split] .cr-word > span { display: inline-block; }
.js [data-split] .cr-word > span {
  translate: 0 110%; opacity: 0;
  transition: translate 0.9s var(--ease-smooth) calc(var(--i) * 45ms + var(--reveal-delay, 0s)),
              opacity 0.9s var(--ease-smooth) calc(var(--i) * 45ms + var(--reveal-delay, 0s));
}
.js [data-split].is-in .cr-word > span { translate: none; opacity: 1; }

@keyframes cr-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cr-slide-up { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0; } }
@keyframes cr-pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cr-spin { to { transform: rotate(360deg); } }
@keyframes cr-marquee { to { translate: calc(-50% - var(--marquee-gap) / 2) 0; } }
@keyframes cr-shine { from { mask-position: 120% 0; -webkit-mask-position: 120% 0; } to { mask-position: -120% 0; -webkit-mask-position: -120% 0; } }
@keyframes cr-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes cr-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes cr-aurora { 0% { transform: translate3d(-4%, -2%, 0) rotate(0deg) scale(1); } 50% { transform: translate3d(4%, 3%, 0) rotate(8deg) scale(1.08); } 100% { transform: translate3d(-4%, -2%, 0) rotate(0deg) scale(1); } }
@keyframes cr-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes cr-progress { from { scale: 0 1; } to { scale: 1 1; } }

@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; }
  .js [data-reveal], .js [data-stagger] > *, .js [data-split] .cr-word > span { opacity: 1; translate: none; scale: 1; filter: none; }
}
