/* PipelineMedic — editorial minimal. Paper, ink, one red. */

:root {
  /* colour */
  --bg: #f4f2ee;
  --panel: #fbfaf7;
  --ink: #10131a;
  --ink-2: #5c6370;
  --muted: #8d8a82;
  --line: #dedbd4;
  --line-2: #cfcbc2;
  --accent: #ff3b14;
  --accent-bg: rgba(255, 59, 20, .10);
  --green: #1f9d57;
  --green-bg: rgba(31, 157, 87, .12);

  /* type: one family, three small sizes, one lead size, two headline sizes */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --fs-xs: 11px;                                   /* micro labels, tags, captions */
  --fs-sm: 13px;                                   /* UI: nav, buttons, meta, code */
  --fs-md: 15px;                                   /* body */
  --fs-lg: clamp(1.05rem, 1.55vw, 1.35rem);        /* lead, list rows */
  --fs-title: clamp(2.25rem, 4.4vw, 4.2rem);       /* page titles */
  --fs-display: clamp(2.25rem, 5.4vw, 5.2rem);     /* landing headline */
  --track-title: -0.045em;
  --track-text: -0.02em;
  --track-label: .04em;

  /* shape + layout */
  --radius: 6px;
  --nav-h: 64px;
  --pad: clamp(18px, 2.2vw, 32px);
  --cell: 64px;

  /* motion: short, calm, one curve */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur-fast: .2s;
  --dur: .3s;
  --dur-slow: .45s;
}

*, *::before, *::after { box-sizing: border-box; }

/* Reserve the scrollbar gutter on every page so the layout (and the nav) never shifts. */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
@supports not (scrollbar-gutter: stable) { html { overflow-y: scroll; } }

body {
  margin: 0;
  min-height: 100vh; min-height: 100svh;
  font-family: var(--font);
  font-size: var(--fs-md); line-height: 1.6;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }
a { color: inherit; text-decoration: none; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; font-size: var(--fs-sm); }
.skip:focus { top: 12px; }

.page { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }

/* Shared keyframes --------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes leave { to { opacity: 0; transform: translateY(-4px); } }
@keyframes blink { 50% { opacity: .25; } }

/* Geometric square background --------------------------------------- */
.bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(17,17,17,.075) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(17,17,17,.075) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
}
.bg i {
  position: absolute; width: var(--cell); height: var(--cell);
  background: rgba(17,17,17,.045); opacity: 0; animation: sq-in 1.2s ease forwards;
}
.bg i.r { background: rgba(255,59,20,.10); }
.bg.is-static i { animation: none; opacity: 1; }          /* already seen this session: no re-pop between pages */
.bg i.hover { background: rgba(255,59,20,.13); animation: none; opacity: 1; transition: opacity 1.1s ease; }
.bg i.hover.off { opacity: 0; }
@keyframes sq-in { to { opacity: 1; } }

/* Navigation: identical on every page -------------------------------- */
.nav {
  position: relative; z-index: 5; flex: none;
  display: grid; grid-template-columns: auto 1fr auto; align-items: stretch;
  height: var(--nav-h); border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 var(--pad); border-right: 1px solid var(--line);
  font-weight: 600; font-size: var(--fs-md); letter-spacing: var(--track-text);
}
.brand svg { color: var(--accent); flex: none; }

.nav__links { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 2.2vw, 32px); font-size: var(--fs-sm); font-weight: 500; }
.nav__links a { position: relative; padding: 8px 0; color: var(--ink-2); white-space: nowrap; transition: color var(--dur-fast); }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform var(--dur) var(--ease);
}
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); }
.nav__links a:hover::after, .nav__links a.is-active::after { transform: scaleX(1); }

.nav__cta { display: flex; align-items: center; gap: 12px; padding: 0 var(--pad); border-left: 1px solid var(--line); }
.menu-btn { display: none; width: 44px; height: 44px; background: none; border: 1.5px solid var(--ink); border-radius: var(--radius); cursor: pointer; position: relative; }
.menu-btn span { position: absolute; left: 12px; right: 12px; height: 1.5px; background: var(--ink); transition: transform var(--dur) var(--ease), top var(--dur) var(--ease); }
.menu-btn span:nth-child(1) { top: 16px; }
.menu-btn span:nth-child(2) { top: 25px; }
.nav.is-open .menu-btn span:nth-child(1) { top: 20.5px; transform: rotate(45deg); }
.nav.is-open .menu-btn span:nth-child(2) { top: 20.5px; transform: rotate(-45deg); }

/* Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  font: 500 var(--fs-sm)/1 var(--font); letter-spacing: .01em;
  padding: 13px 18px; border: 1.5px solid var(--ink); border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
[hidden] { display: none !important; }
.btn:not([disabled]):not([aria-disabled="true"]):active { transform: scale(.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:not([disabled]):hover { background: #2a2a2a; }
.btn__arrow { font-size: 1.25em; line-height: 1; transition: transform var(--dur) var(--ease); }
.btn--dark:hover .btn__arrow { transform: translateX(3px); }
.btn--line { background: transparent; color: var(--ink); }
.btn--line:not([disabled]):not([aria-disabled="true"]):hover { background: var(--ink); color: #fff; }
/* quiet tertiary action: text only, underline on hover */
.btn--text { border-color: transparent; background: transparent; color: var(--ink-2); padding: 8px 2px; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; transition: color var(--dur-fast), text-decoration-color var(--dur-fast); }
.btn--text:hover { color: var(--ink); text-decoration-color: var(--accent); }
.btn--sm { padding: 10px 14px; }
.btn--lg { padding: 17px 26px; font-size: var(--fs-md); }

/* Landing ------------------------------------------------------------ */
.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }

.wave {
  position: absolute; z-index: 0; left: 0; right: 0; top: 57%; transform: translateY(-50%);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, #000, #000 18%, rgba(0,0,0,.25) 38%, rgba(0,0,0,.25) 62%, #000 82%, #000);
          mask-image: linear-gradient(to right, #000, #000 18%, rgba(0,0,0,.25) 38%, rgba(0,0,0,.25) 62%, #000 82%, #000);
}
.wave canvas { display: block; width: 100%; height: 100%; }

.hero__body {
  position: relative; z-index: 1; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px var(--pad) 48px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2);
  padding: 8px 18px; border: 1px solid var(--line); border-radius: 999px; margin-bottom: 30px; background: rgba(255,255,255,.55);
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1.6s ease-in-out infinite; }

.hero__title { font-weight: 700; letter-spacing: var(--track-title); line-height: 1.03; font-size: var(--fs-display); }
.hero__title span { display: block; }
.hero__title em, .title i, .hero__title i { font-style: normal; color: var(--accent); }

.hero__sub { max-width: 40em; margin: 26px 0 34px; font-size: var(--fs-lg); line-height: 1.5; color: var(--ink-2); }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.hero__foot {
  position: relative; z-index: 1;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs); color: var(--muted);
  animation: rise var(--dur-slow) var(--ease) .3s backwards;
}
.hero__foot p { padding: 16px var(--pad); }

/* Page entrance: the nav stays put, only the content settles in. */
.hero__body > * { animation: rise var(--dur-slow) var(--ease) backwards; }
.hero__body > :nth-child(1) { animation-delay: .04s; }
.hero__body > :nth-child(2) { animation-delay: .1s; }
.hero__body > :nth-child(3) { animation-delay: .16s; }
.hero__body > :nth-child(4) { animation-delay: .22s; }

/* Inner pages -------------------------------------------------------- */
.split {
  flex: 1; width: 100%;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 7vw, 120px);
  align-content: start; padding: clamp(36px, 9vh, 110px) var(--pad);
}
.split__head { animation: rise var(--dur-slow) var(--ease) backwards; }
.split__body { animation: rise var(--dur-slow) var(--ease) .06s backwards; }
.page > .pager { animation: rise var(--dur-slow) var(--ease) .12s backwards; }

.num { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 14px; letter-spacing: var(--track-label); }
.num b { color: var(--accent); font-weight: 600; }
.title { font-weight: 700; letter-spacing: var(--track-title); line-height: 1.04; font-size: var(--fs-title); }

.split__body { padding-top: 6px; max-width: 780px; }
main:not(.split) { flex: 1; }
.split--next { border-top: 1px solid var(--line); }
main > .split + .split { padding-top: clamp(36px, 9vh, 110px); }
main > .split:first-child { padding-bottom: clamp(36px, 9vh, 110px); }

.list { counter-reset: n; }
.list li {
  counter-increment: n; position: relative;
  display: grid; grid-template-columns: 44px 1fr; gap: 4px;
  padding: 18px 0; border-top: 1px solid var(--line);
  font-size: var(--fs-lg); line-height: 1.4; letter-spacing: var(--track-text); font-weight: 500;
}
.list li:last-child { border-bottom: 1px solid var(--line); }
.list li::before { content: counter(n, decimal-leading-zero); font-size: var(--fs-sm); font-weight: 500; line-height: calc(var(--fs-lg) * 1.4); color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: var(--track-label); }

code { font-family: var(--mono); font-size: .86em; padding: 2px 7px; background: #e9e6df; border-radius: 4px; }

.lead { font-size: var(--fs-lg); line-height: 1.4; letter-spacing: var(--track-text); font-weight: 500; }
.lead + .lead { margin-top: 1em; }

.links li { border-top: 1px solid var(--line); }
.links li:last-child { border-bottom: 1px solid var(--line); }
.links a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 0; font-size: var(--fs-lg); font-weight: 500; letter-spacing: var(--track-text);
}
.links a > span:first-child { transition: transform var(--dur) var(--ease); }
.links a:hover > span:first-child { transform: translateX(10px); }
.links .arrow { color: var(--muted); transition: transform var(--dur) var(--ease), color var(--dur-fast); }
.links a:hover .arrow { transform: translate(-6px, -3px); color: var(--accent); }
.links .is-disabled { color: var(--muted); cursor: default; pointer-events: none; }
.soon { font-size: var(--fs-xs); font-weight: 500; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; letter-spacing: .02em; }

.pager { flex: none; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 20px var(--pad); transition: background-color var(--dur), color var(--dur); }
.pager a + a { border-left: 1px solid var(--line); text-align: right; align-items: flex-end; }
.pager span { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); letter-spacing: var(--track-label); transition: color var(--dur); }
.pager strong { font-weight: 500; font-size: var(--fs-lg); letter-spacing: var(--track-text); }
.pager a:hover { background: var(--ink); color: #fff; }
.pager a:hover span { color: var(--accent); }
/* "Next" is always dark so it reads as the primary action */
.pager a + a { background: var(--ink); color: #fff; border-left-color: var(--ink); }
.pager a + a span { color: var(--accent); }
.pager a + a:hover { background: #2a2a2a; }

/* Leaving a page: the content steps back, the nav does not move. */
body.is-leaving .split__head,
body.is-leaving .split__body,
body.is-leaving .page > .pager,
body.is-leaving .pg,
body.is-leaving .hero__body,
body.is-leaving .hero__foot { animation: leave var(--dur-fast) ease-in forwards; }

/* Responsive --------------------------------------------------------- */
@media (max-width: 880px) {
  .nav { grid-template-columns: 1fr auto; }
  .brand { border-right: 0; }
  .menu-btn { display: block; }
  .nav__cta { border-left: 0; }
  .nav__cta .btn { display: none; }
  .nav__links {
    position: absolute; top: calc(100% + 1px); left: 0; right: 0;
    flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px var(--pad) 16px; font-size: var(--fs-md);
    opacity: 0; visibility: hidden; transform: translateY(-6px); pointer-events: none;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility 0s linear var(--dur);
  }
  .nav.is-open .nav__links { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition-delay: 0s; }
  .nav__links a { padding: 12px 0; }
  .nav__links a::after { bottom: 8px; }
  .split { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 560px) {
  .hero__cta { width: 100%; flex-direction: column; }
  .hero__cta .btn { justify-content: center; }
  .eyebrow { padding: 7px 14px; }
  .pager a { padding: 16px var(--pad); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
}
