/* ==========================================================================
   PRO.CSS — the serious site. SaaS-scale type, FigJam-dot canvas, Figma
   cursors. Mobile-first throughout; same brand seeds as the desktop.
   ========================================================================== */

@import url('desktop/css/tokens.css');

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: #FBF9F5;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- the FigJam canvas ---------- */

.canvas-dots {
  position: fixed;
  inset: -120px 0;
  background-image: radial-gradient(circle,
    color-mix(in oklab, var(--espresso) 16%, transparent) 1.3px, transparent 1.3px);
  background-size: 26px 26px;
  pointer-events: none;
  /* negative z: behind all content, above the propagated body background.
     (The old approach — position:relative on every body child — silently
     broke the topbar's sticky and the FAB's fixed. Never again.) */
  z-index: -1;
  will-change: transform;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 20px;
  background: color-mix(in srgb, #FBF9F5 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid color-mix(in oklab, var(--espresso) 12%, transparent);
  z-index: 100;
}

.wordmark {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
}

.topnav { display: none; }

.topbar-desktop-cta { margin-left: auto; font-size: 13.5px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast), box-shadow var(--t-fast);
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--primary-600);
  color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary-600) 30%, transparent);
}
.btn-primary:hover { background: var(--primary-700); }

.btn-ghost {
  color: var(--primary-600);
  border-color: color-mix(in oklab, var(--primary-600) 35%, transparent);
  background: color-mix(in srgb, #fff 55%, transparent);
}
.btn-ghost:hover { background: var(--primary-050); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 56px 22px 40px;
  max-width: 1120px;
  margin: 0 auto;
}

.eyebrow {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--olive);
  margin: 0 0 10px;
}

.headline {
  font-size: clamp(40px, 9vw, 76px);
  line-height: 1.04;
  letter-spacing: -.035em;
  font-weight: 800;
  margin: 0 0 18px;
}

/* accent words — the one word each headline is really about */
.accent-word { color: var(--primary-600); }
h2 .accent-word { color: var(--primary-600); }

.hero-sub {
  font-size: clamp(16px, 2.2vw, 19px);
  color: color-mix(in oklab, var(--ink) 76%, white);
  max-width: 52ch;
  margin: 0 0 24px;
}

/* marker-swipe highlights on the experience line — sweep in after typing */
.hero-sub mark {
  color: inherit;
  font-weight: 700;
  padding: 0 3px;
  background: linear-gradient(120deg,
    color-mix(in srgb, var(--warning) 38%, transparent),
    color-mix(in srgb, var(--warning) 26%, transparent));
  background-repeat: no-repeat;
  background-position: 0 62%;
  background-size: 0% 46%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 700ms var(--ease-out);
}
body.hero-ready .hero-sub mark { background-size: 100% 46%; }
body.hero-ready .hero-sub mark:nth-of-type(1) { transition-delay: 400ms; }
body.hero-ready .hero-sub mark:nth-of-type(2) { transition-delay: 950ms; }

.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-footnote {
  font-size: 13px;
  color: color-mix(in oklab, var(--ink) 50%, white);
  margin: 12px 0 0;
}

.hero-art {
  position: relative;
  align-self: center;
  width: min(78vw, 360px);
}

/* the portrait sits ON the canvas — no card, no frame. Multiply blends the
   illustration's baked background into the paper; the mask fades him in
   from the dots like hero art, not a headshot in a picture frame. */
.hero-art img {
  width: 100%;
  display: block;
  mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 98%);
  mask-image: linear-gradient(to bottom, #000 78%, transparent 98%);
}

/* idle float — the portrait breathes instead of sitting dead on the canvas */
body.hero-ready .hero-art img { animation: art-float 7s ease-in-out infinite; }

@keyframes art-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

/* the doodle layer — cursors draw here, strokes fade like a shared canvas */
.doodles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}
.doodles polyline {
  fill: none;
  stroke-width: 4.5;          /* FigJam marker weight */
  stroke-linecap: round;
  stroke-linejoin: round;
}
.doodles g {
  opacity: .9;
  transition: opacity 1600ms ease;
}
.doodles g.fade { opacity: 0; }

.portrait-fallback { display: none; }
.hero-art.noimg img { display: none; }
.hero-art.noimg .portrait-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 18px;
  background: linear-gradient(160deg, var(--primary-600), var(--primary-800));
  color: #fff;
  font-size: 84px;
  font-weight: 800;
  letter-spacing: -.03em;
}

/* headline selection box — a cursor "selected" these words */
.hl-select { position: relative; white-space: nowrap; }

.sel-box {
  position: absolute;
  inset: -4px -10px -8px -6px;
  border: 2px solid var(--primary-400);
  background: color-mix(in srgb, var(--primary-400) 10%, transparent);
  border-radius: 4px;
  animation: sel-blink 5.5s ease-in-out infinite;
  pointer-events: none;
}

.sel-box::after {                 /* resize handle, Figma-style */
  content: '';
  position: absolute;
  right: -5px; bottom: -5px;
  width: 8px; height: 8px;
  background: #fff;
  border: 2px solid var(--primary-400);
  border-radius: 2px;
}

@keyframes sel-blink {
  0%, 12%  { opacity: 0; }
  18%, 78% { opacity: 1; }
  88%, 100%{ opacity: 0; }
}

/* ---------- multiplayer cursors ---------- */

.cursor {
  position: absolute;
  display: flex;
  align-items: flex-start;
  gap: 2px;
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 2px 5px rgba(46,36,28,.25));
}

.cursor svg { width: 18px; height: 18px; }

.cursor span {
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  padding: 3px 8px;
  border-radius: 999px;
  margin-top: 12px;
  white-space: nowrap;
}

/* cursors are JS-driven (waypoints + easing in pro.js). They hide until the
   headline finishes typing, then fade in and start moving. */
/* FigJam-bright cursor identities (ink in pro.js matches) */
.c1 { top: 16%; left: 58%; }
.c1 svg path { fill: #4C82F7; }
.c1 span { background: #4C82F7; }

.c2 { top: 52%; left: 8%; }
.c2 svg path { fill: #5DBB63; }
.c2 span { background: #5DBB63; }

.c3 { top: 34%; left: 44%; }
.c3 svg path { fill: #F59E2C; }
.c3 span { background: #F59E2C; }

html.typing .cursor { opacity: 0; }
body.hero-ready .cursor { opacity: 1; transition: opacity 700ms var(--ease-out); }

/* typed headline: text occupies its final space from first paint (visibility
   hides it, layout stays) — characters reveal one by one with zero CLS */
html.typing .headline [data-type] { visibility: hidden; }
html.typing .headline [data-type].typed { visibility: visible; }
html.typing .headline .ch { visibility: hidden; }
html.typing .headline .ch.on { visibility: visible; }
html.typing .sel-box { animation: none; opacity: 0; }
html.typing body.hero-ready .sel-box { animation: sel-blink 5.5s ease-in-out infinite; }

.type-caret {
  display: inline-block;
  width: .08em;
  height: .92em;
  margin-left: 2px;
  background: var(--primary-600);
  vertical-align: -0.08em;
  animation: caret-blink 900ms steps(1) infinite;
}

@keyframes caret-blink { 50% { opacity: 0; } }

/* ---------- metrics band ---------- */

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: color-mix(in oklab, var(--espresso) 12%, transparent);
  border-block: 1px solid color-mix(in oklab, var(--espresso) 12%, transparent);
}

.metric {
  background: #FBF9F5;
  padding: 26px 20px;
  text-align: center;
}

.metric b {
  display: block;
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--primary-600);
}

.metric span {
  font-size: 13px;
  color: color-mix(in oklab, var(--ink) 62%, white);
}

/* ---------- sections shared ---------- */

main, .leadership, .process, .side {
  max-width: 880px;
  margin: 0 auto;
  padding: 56px 22px 8px;
}

.section-kicker {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--olive);
  margin: 0 0 18px;
}

h2 {
  font-size: clamp(26px, 4.6vw, 40px);
  line-height: 1.12;
  letter-spacing: -.025em;
  font-weight: 800;
  margin: 0 0 16px;
}

/* ---------- case studies ---------- */

.case {
  padding: 34px 26px;
  margin-bottom: 34px;
  background: #fff;
  border: 1px solid color-mix(in oklab, var(--espresso) 10%, transparent);
  border-radius: 16px;
  box-shadow: 0 10px 34px rgba(46,36,28,.07);
}

.case-meta {
  font-size: 13px;
  font-weight: 600;
  color: color-mix(in oklab, var(--ink) 52%, white);
  margin: 0 0 8px;
}

.case p { margin: 0 0 14px; }

.honest {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  font-size: 14.5px;
  margin: 18px 0;
}

.case-link {
  display: inline-block;
  margin-top: 12px;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1.5px solid color-mix(in oklab, var(--primary-600) 35%, transparent);
  background: color-mix(in srgb, #fff 55%, transparent);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--primary-600);
  text-decoration: none;
  transition: background var(--t-fast);
}
.case-link:hover { background: var(--primary-050); }

/* case visuals — inline SVG diagrams and video */
.case-visual {
  margin: 22px 0;
  padding: 0;
}
.case-visual svg { width: 100%; height: auto; display: block; }
.case-visual video {
  width: 100%;
  display: block;
  border-radius: 12px;
  border: 1px solid color-mix(in oklab, var(--espresso) 12%, transparent);
}
.case-visual figcaption {
  font-size: 12.5px;
  color: color-mix(in oklab, var(--ink) 48%, white);
  margin-top: 8px;
}
.case-visual figcaption a { color: var(--primary-600); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 22px 0;
}
.stat-grid .stat {
  background: var(--primary-050);
  border: 1px solid color-mix(in oklab, var(--primary-600) 14%, transparent);
  border-radius: 12px;
  padding: 18px 16px;
  text-align: center;
}
.stat-grid b {
  display: block;
  font-size: clamp(26px, 3.6vw, 36px);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--primary-600);
}
.stat-grid span {
  font-size: 12.5px;
  color: color-mix(in oklab, var(--ink) 62%, white);
}

/* full case study — expands in place, so nobody is thrown onto the desktop
   mid-read */
.case-full {
  margin: 20px 0 16px;
  border-top: 1px solid color-mix(in oklab, var(--espresso) 10%, transparent);
}
/* button hierarchy: expanding the story is the PRIMARY action; hopping to
   the desktop is secondary. Summary dresses as the primary button. */
.case-full { padding-top: 18px; }
.case-full summary {
  cursor: pointer;
  list-style: none;
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  background: var(--primary-600);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  user-select: none;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary-600) 30%, transparent);
  transition: background var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.case-full summary:hover { background: var(--primary-700); }
.case-full summary:active { transform: scale(.97); }
.case-full summary::-webkit-details-marker { display: none; }
.case-full summary::after {
  content: '＋';
  margin-left: 8px;
  font-weight: 800;
}
.case-full[open] summary::after { content: '－'; }
.case-full[open] summary { margin-bottom: 10px; }
.case-full h3 {
  font-size: 18px;
  letter-spacing: -.01em;
  margin: 26px 0 8px;
}
.case-full > p { margin: 0 0 14px; }

/* ---------- process ---------- */

.process-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.p-card {
  background: #fff;
  border: 1px solid color-mix(in oklab, var(--espresso) 10%, transparent);
  border-radius: 14px;
  padding: 20px 22px;
}

.p-card h3 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.01em; }
.p-card p { margin: 0; font-size: 14.5px; color: color-mix(in oklab, var(--ink) 72%, white); }

/* ---------- side projects ---------- */

.side-row { display: grid; gap: 14px; }

.side-card {
  display: block;
  background: #fff;
  border: 1px solid color-mix(in oklab, var(--espresso) 10%, transparent);
  border-radius: 14px;
  padding: 18px 22px;
  text-decoration: none;
  color: var(--ink);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast);
}

.side-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(46,36,28,.10); }
.side-card b { display: block; margin-bottom: 4px; }
.side-card span { font-size: 14px; color: color-mix(in oklab, var(--ink) 66%, white); }

/* ---------- contact ---------- */

.contact {
  max-width: 880px;
  margin: 0 auto;
  padding: 64px 22px 90px;
  text-align: center;
}

.contact-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 22px 0 26px;
}

.fineprint { font-size: 13px; color: color-mix(in oklab, var(--ink) 48%, white); }
.fineprint a { color: var(--primary-600); }

/* ---------- reveal on scroll ---------- */

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* Apple-ish settle: visuals scale in a beat after their card arrives */
.reveal .case-visual { opacity: 0; transform: scale(.955); transition: opacity 700ms var(--ease-out) 180ms, transform 700ms var(--ease-out) 180ms; }
.reveal.in .case-visual { opacity: 1; transform: none; }

/* ---------- Nick.ai FAB + sheet ---------- */

.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--primary-600);
  color: #fff;
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--primary-600) 45%, transparent);
  z-index: 300;
  transition: transform var(--t-fast) var(--ease-out);
}
.fab:hover { transform: scale(1.06); }
.fab .fab-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--light-max);
  border: 2px solid #fff;
}

.chat-sheet {
  position: fixed;
  right: 0; bottom: 0; left: 0;
  height: min(72dvh, 560px);
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -14px 50px rgba(46,36,28,.25);
  z-index: 310;
  display: flex;
  flex-direction: column;
  transform: translateY(calc(100% + 30px));
  /* display gate: an offscreen-transformed fixed element still counts toward
     scrollable overflow (phantom page bottom) — so the sheet only exists in
     layout while open. JS mounts it a frame early so the slide still animates. */
  display: none;
  transition: transform 320ms var(--ease-out);
}
.chat-sheet.mounted { display: flex; }
.chat-sheet.open { transform: none; }

.chat-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid color-mix(in oklab, var(--espresso) 10%, transparent);
  font-size: 14px;
}
.chat-head span { color: color-mix(in oklab, var(--ink) 55%, white); font-size: 12.5px; }
.chat-close { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--ink); font-size: 15px; }

.chat-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 10px;
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.chat-msg.user { margin-left: auto; background: var(--primary-600); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { background: var(--primary-050); border-bottom-left-radius: 4px; }
.chat-msg.typing::after { content: '…'; }

.chat-form { display: flex; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid color-mix(in oklab, var(--espresso) 10%, transparent); }
.chat-input { flex: 1; border: 1.5px solid color-mix(in oklab, var(--espresso) 18%, transparent); border-radius: 10px; padding: 10px 14px; font: inherit; font-size: 15px; }
.chat-input:focus { outline: 2px solid var(--primary-400); border-color: transparent; }
.chat-send { border: 0; border-radius: 10px; background: var(--primary-600); color: #fff; font-weight: 700; padding: 0 18px; cursor: pointer; }

/* ---------- ≥760px ---------- */

@media (min-width: 760px) {
  .topbar { padding: 14px 34px; }
  .topnav { display: flex; gap: 22px; margin-left: 26px; }
  .topnav a { color: color-mix(in oklab, var(--ink) 72%, white); text-decoration: none; font-size: 14.5px; font-weight: 600; }
  .topnav a:hover { color: var(--primary-600); }

  .hero {
    flex-direction: row;
    align-items: center;
    gap: 48px;
    padding: 96px 34px 72px;
  }
  .hero-copy { flex: 1.25; }
  .hero-art { flex: 1; align-self: auto; width: auto; max-width: 400px; }

  .metrics { grid-template-columns: repeat(4, 1fr); }
  .process-grid { grid-template-columns: 1fr 1fr; }
  .side-row { grid-template-columns: 1fr 1fr; }
  .case { padding: 42px 46px; }

  .chat-sheet {
    left: auto;
    right: 22px;
    bottom: 88px;
    width: 400px;
    border-radius: 18px;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .cursor, .sel-box { animation: none; }
  .sel-box { opacity: 1; }
  .canvas-dots { transform: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
