/* ============================================================
   workbench.css — site-wide "Workbench" design system
   Tokens, ground, nav, type, buttons, section chrome, motion.
   Loads after showcasy.min.css (and case-studies.css where used);
   equal-specificity rules here win by order.
   Page-specific layers: home.css (homepage), case-studies.css
   (case-study + about components), per-page inline styles.
   ============================================================ */

:root {
  /* system tokens */
  --ground: #f4f5f4;
  --paper: #ffffff;
  --ink: #17181a;
  --ink-60: #55585e;
  --ink-40: #94979d;
  --rule: rgba(23, 24, 26, 0.16);
  --rule-soft: rgba(23, 24, 26, 0.08);
  --rule-faint: rgba(23, 24, 26, 0.03);
  --rule-light: rgba(247, 247, 245, 0.18);
  --signal: #ff4a00;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease-mech: cubic-bezier(0.3, 0, 0.05, 1);
  --ease-quiet: cubic-bezier(0.3, 0, 0.05, 1); /* legacy alias used by shared partial + page css */
  --dur-fast: 150ms;
  --dur-base: 220ms;

  /* remap template neutrals so shared components inherit the palette */
  --neutral--100: #17181a;
  --neutral--90: #1e2023;
  --neutral--80: #2a2c30;
  --neutral--70: #4a4d53;
  --neutral--60: #55585e;
  --neutral--50: #7d8087;
  --neutral--40: #a9acb2;
  --neutral--30: #c9cbcf;
  --neutral--20: #e3e4e2;
  --neutral--10-101: #ededeb;
  --neutral--0: #f7f7f5;
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--signal);
  color: #fff;
}

/* --- Ground + exposed grid --------------------------------- */
/* Vertical hairlines at the container edges and quarter columns.
   Painted on body so content naturally sits on top; solid section
   backgrounds (dark CTA, footer, chapter intros) cover them. */
body {
  /* Grid frame sits ~40px outside the 1296px content box (72px container
     padding) so content breathes inside the lines instead of landing on them. */
  --colw: min(100vw - 64px, 1376px);
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--ground);
  background-image:
    linear-gradient(var(--rule-soft), var(--rule-soft)),
    linear-gradient(var(--rule-soft), var(--rule-soft)),
    linear-gradient(var(--rule-faint), var(--rule-faint)),
    linear-gradient(var(--rule-faint), var(--rule-faint)),
    linear-gradient(var(--rule-faint), var(--rule-faint));
  background-repeat: no-repeat;
  background-size: 1px 100%;
  background-position:
    calc(50% - var(--colw) / 2) 0,
    calc(50% + var(--colw) / 2) 0,
    calc(50% - var(--colw) / 4) 0,
    50% 0,
    calc(50% + var(--colw) / 4) 0;
}
@media (max-width: 767px) {
  body {
    background-image: none;
  }
}

h1, h2, h3, h4, h5, h6,
.text-xxl, .text-xl, .text-l, .text-m, .text-r, .text-s, .text-xs {
  font-family: var(--sans);
}
h1, h2, h3 {
  text-wrap: balance;
}
p, blockquote {
  text-wrap: pretty;
}

/* signal accent for single glyphs (e.g. the hero's full stop) */
.sig {
  color: var(--signal);
}

.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;
}

/* --- Mono microcopy: section title blocks ------------------- */
.sec-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin-bottom: 48px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-60);
}
/* ink tick anchors the section rule at its origin */
.sec-head::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 32px;
  height: 3px;
  background: var(--ink);
}
.sec-head-light::before {
  background: var(--neutral--0);
}
.sec-head .sec-num {
  color: var(--ink);
}
.sec-head-light {
  border-top-color: var(--rule-light);
  color: var(--neutral--40);
}
.sec-head-light .sec-num {
  color: var(--neutral--0);
}
@media (max-width: 767px) {
  .sec-head {
    margin-bottom: 32px;
  }
}

/* --- Navbar -------------------------------------------------- */
/* !important: the exported markup carries inline background/color. */
.navbar {
  background-color: var(--ground) !important;
  color: var(--ink) !important;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--rule-soft);
}
.navbar.is-scrolled {
  background-color: rgba(244, 245, 244, 0.8) !important;
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom-color: var(--rule);
}
.navbar-nav-link .text-r {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.navbar-nav-link {
  color: var(--ink-60);
  opacity: 1; /* hierarchy via color, not the shared css opacity model */
  transition: color var(--dur-fast) var(--ease-mech);
}
.navbar-nav-link:hover {
  color: var(--ink);
}
.navbar-nav-link[aria-current="page"] {
  color: var(--ink);
}
.navbar-nav-link[aria-current="page"] .text-r::before {
  content: "\25A0\00a0";
  color: var(--signal);
  font-size: 8px;
  vertical-align: 2px;
}
.navbar .w-nav-button {
  border-radius: 3px;
  background-color: transparent !important;
  border-color: transparent !important;
}
.navbar .w-nav-button[aria-expanded="true"] {
  border-color: rgb(3, 7, 18) !important;
}
.navbar-cta {
  display: flex;
  align-items: center;
  gap: 20px;
}
@media (max-width: 767px) {
  .navbar:has(.w-nav-button[aria-expanded="true"]) .navbar-nav-links {
    background: var(--ground);
    border-bottom-color: var(--rule);
    box-shadow: 0 12px 24px -16px rgba(23, 24, 26, 0.18);
  }
}
section[id] {
  scroll-margin-top: 96px;
}

/* --- Buttons + links: switches, not pills -------------------- */
.button {
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 20px;
  transition:
    background-color var(--dur-fast) var(--ease-mech),
    color var(--dur-fast) var(--ease-mech),
    border-color var(--dur-fast) var(--ease-mech),
    transform var(--dur-fast) var(--ease-mech);
}
.button.button-outline-black {
  border-color: var(--ink);
  color: var(--ink);
}
.button.button-outline-black:hover {
  background-color: var(--ink);
  color: var(--neutral--0);
}
.button:active {
  transform: translateY(1px);
}
.button .svg-icon,
.link-text .svg-icon {
  transition: transform var(--dur-base) var(--ease-mech);
}
.button:hover .svg-icon,
.link-text:hover .svg-icon {
  transform: translateX(3px);
}
.link-text {
  font-family: var(--mono);
  letter-spacing: 0.04em;
  font-weight: 500;
}
.link-text .text-r {
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* underline draw on text links */
.link-text > div:first-child,
.link-text-with-underline > div:first-child {
  position: relative;
  display: inline-block;
}
.link-text > div:first-child::after,
.link-text-with-underline > div:first-child::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-base) var(--ease-mech);
}
.link-text:hover > div:first-child::after,
.link-text-with-underline:hover > div:first-child::after {
  transform: scaleX(1);
}

.prose-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(23, 24, 26, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast) var(--ease-mech);
}
.prose-link:hover {
  text-decoration-color: var(--signal);
}

/* --- Section headings (shared scale) -------------------------- */
.section-heading h2 {
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

/* --- CTA + footer (dark ink; tokens already remapped) ----------- */
.section.cta-v3-section {
  border-bottom: 1px solid var(--neutral--80);
  position: relative;
  z-index: 1;
}
.cta-v3-section .sec-head {
  width: 100%;
  margin-bottom: 56px;
}
.cta-v3-content-wrapper .text-xxl {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--neutral--40);
}
.cta-v3-text h3 {
  font-size: clamp(40px, 6.5vw, 88px);
  font-weight: 600;
  letter-spacing: -0.03em;
}
.cta-mail-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 3px;
  text-underline-offset: 12px;
  transition: text-decoration-color var(--dur-base) var(--ease-mech);
}
.cta-mail-link:hover {
  text-decoration-color: var(--signal);
}
.cta-button {
  background-color: transparent;
  border: 1px solid rgba(247, 247, 245, 0.25);
  border-radius: 6px;
  transition:
    background-color var(--dur-fast) var(--ease-mech),
    border-color var(--dur-fast) var(--ease-mech),
    transform var(--dur-fast) var(--ease-mech);
}
.cta-button:hover {
  background-color: var(--signal);
  border-color: var(--signal);
}
.cta-button:active {
  transform: translateY(1px);
}
.section.footer-v3-section {
  position: relative;
  z-index: 1;
}
.footer-v3-section .link-text {
  font-family: var(--mono);
}
.footer-v3-section .link-text > div:first-child {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.footer-v3-content .text-r {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* --- Scroll-in reveals ------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal-in:not(.reveal-group) {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms var(--ease-mech), transform 400ms var(--ease-mech);
  }
  .reveal-in:not(.reveal-group).is-visible {
    opacity: 1;
    transform: translateY(0);
  }
  .reveal-group.reveal-in .reveal-child {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 350ms var(--ease-mech), transform 350ms var(--ease-mech);
  }
  .reveal-group.reveal-in .reveal-child[data-step="1"] { transition-delay: 0ms; }
  .reveal-group.reveal-in .reveal-child[data-step="2"] { transition-delay: 60ms; }
  .reveal-group.reveal-in .reveal-child[data-step="3"] { transition-delay: 120ms; }
  .reveal-group.reveal-in .reveal-child[data-step="4"] { transition-delay: 180ms; }
  .reveal-group.reveal-in .reveal-child[data-step="5"] { transition-delay: 240ms; }
  .reveal-group.reveal-in.is-visible .reveal-child {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Focus states (keyboard-only) --------------------------------- */
a:focus {
  outline: none;
}
.link-text:focus-visible,
.link-text-with-underline:focus-visible,
.button:focus-visible,
.cta-button:focus-visible,
.navbar-brand-dark:focus-visible,
.navbar-nav-link:focus-visible,
.cs-back-link:focus-visible,
.terminal-replay:focus-visible,
.w-nav-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 3px;
}
.text-field:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* --- Reduced motion + ?flat screenshot mode ------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
body.is-flat .reveal-in,
body.is-flat .reveal-group.reveal-in .reveal-child {
  opacity: 1 !important;
  transform: none !important;
}
