/* =========================================================
   Anthony Awad: portfolio
   Art direction: "field notes for systems". Warm paper, ink,
   one signal color (vermilion) and one data color (teal).
   ========================================================= */

:root {
  --paper: #f3efe6;
  --paper-2: #ebe5d8;
  --card: #fbf9f4;
  --ink: #15171a;
  --ink-2: #3b3f45;
  --muted: #6b6a64;
  --line: #d9d2c2;
  --signal: #e4572e;
  --signal-ink: #b93f1c;
  --data: #2d6a73;
  --data-soft: #d7e6e4;
  --dark: #15171a;
  --dark-2: #1f2226;
  --on-dark: #f3efe6;
  --on-dark-muted: #a7a59d;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1180px;
  --radius: 14px;
  color-scheme: light;
}

/* Dark tokens apply when the OS prefers dark (unless the visitor picked light),
   or when the visitor picked dark with the theme switch. Keep both blocks in sync. */
:root[data-theme="dark"] {
  --paper: #0f1113; --paper-2: #16191c; --card: #1a1d21; --ink: #eeeae1; --ink-2: #c9c5bb;
  --muted: #8f8d86; --line: #2c3035; --signal: #f06a43; --signal-ink: #ff8a66; --data: #6fb3b8;
  --data-soft: #1d2e31; --dark: #08090a; --dark-2: #121417;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1113;
    --paper-2: #16191c;
    --card: #1a1d21;
    --ink: #eeeae1;
    --ink-2: #c9c5bb;
    --muted: #8f8d86;
    --line: #2c3035;
    --signal: #f06a43;
    --signal-ink: #ff8a66;
    --data: #6fb3b8;
    --data-soft: #1d2e31;
    --dark: #08090a;
    --dark-2: #121417;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.02; letter-spacing: -0.01em; margin: 0; }
h1 em, h2 em { color: var(--signal); }
p { margin: 0 0 1em; }
code { font: 500 .86em var(--mono); background: var(--paper-2); padding: .1em .35em; border-radius: 5px; }

.shell { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 4px; }

.label, .kicker, .p-num, .stamp, .now-tag, .glance dt, .role dt, .facts span, .readout dt {
  font: 500 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}

/* ---------- Masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.identity { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.monogram {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--ink); color: var(--paper); font: italic 17px/1 var(--serif); position: relative;
}
.monogram::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--signal); border: 2px solid var(--paper); }
nav { display: flex; gap: clamp(12px, 3vw, 28px); font-size: 15px; }
nav a { text-decoration: none; color: var(--ink-2); padding: 4px 0; border-bottom: 1.5px solid transparent; }
nav a:hover, nav a[aria-current] { color: var(--ink); border-color: var(--signal); }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 999px; font-weight: 500; font-size: 15px; text-decoration: none;
  border: 1.5px solid var(--ink); transition: transform .15s, background .15s, color .15s;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.text-link { font-weight: 500; color: var(--signal-ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.text-link:hover { text-decoration-thickness: 2px; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(28px, 5vw, 64px);
  padding-top: clamp(40px, 8vw, 96px); padding-bottom: clamp(40px, 6vw, 72px); align-items: center;
}
.kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 22%, transparent); animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--signal) 0%, transparent); } }
.hero h1 { font-size: clamp(46px, 7.4vw, 96px); margin-bottom: 26px; }
.hero h1 em { display: block; color: var(--ink-2); font-size: .62em; line-height: 1.08; margin-top: .25em; }
.hero h1 em::first-line { color: var(--ink-2); }
.lede { font-size: clamp(17px, 1.6vw, 19px); color: var(--ink-2); max-width: 36em; margin-bottom: 30px; }

.hero-visual {
  position: relative; margin: 0; aspect-ratio: 5 / 6; border-radius: 22px; overflow: hidden;
  background: radial-gradient(120% 80% at 80% 0%, #2a2f35 0%, var(--dark) 60%);
  box-shadow: 0 30px 60px -30px rgba(20, 22, 26, .45);
  isolation: isolate;
}
.hero-fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(8, 9, 10, .55)); pointer-events: none; }
.hero-tag { position: absolute; left: 18px; bottom: 16px; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.hero-tag span { font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--on-dark); background: rgba(243, 239, 230, .1); border: 1px solid rgba(243, 239, 230, .22); padding: 7px 10px; border-radius: 999px; backdrop-filter: blur(6px); }
.g-grid { stroke: rgba(243, 239, 230, .05); stroke-width: 1; }
.g-wick { stroke: rgba(243, 239, 230, .28); stroke-width: 1; }
.g-up { fill: #6fb3b8; opacity: .85; }
.g-down { fill: #e4572e; opacity: .85; }
.g-path { fill: none; stroke: rgba(243, 239, 230, .55); stroke-width: 1.4; stroke-dasharray: 3 5; }
.g-edge { stroke: rgba(243, 239, 230, .22); stroke-width: 1; }
.g-node { fill: #f3efe6; }
.g-hot { fill: #e4572e; }

.glance {
  grid-column: 1 / -1; margin: 8px 0 0; display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.glance div { padding: 18px 18px 18px 0; border-right: 1px solid var(--line); }
.glance div + div { padding-left: 18px; }
.glance div:last-child { border-right: 0; }
.glance dd { margin: 6px 0 0; font-weight: 500; font-size: 15px; line-height: 1.35; }

/* ---------- Section heads ---------- */
section { scroll-margin-top: 72px; }
.section-head h2 { font-size: clamp(40px, 5.6vw, 72px); margin: 10px 0 12px; }

/* ---------- Now ---------- */
.now { padding: clamp(56px, 9vw, 110px) 0; }
.now-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(28px, 6vw, 80px); align-items: start; }
.now .section-head { position: sticky; top: 100px; }
.stamp { color: var(--data); }
.now-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.now-list li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 20px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.now-tag { padding-top: 6px; color: var(--signal-ink); }
.now-list h3 { font-size: 30px; margin-bottom: 6px; }
.now-list p { color: var(--ink-2); margin: 0; }
.now-list a { color: var(--signal-ink); text-underline-offset: 3px; white-space: nowrap; }

/* ---------- Work ---------- */
.work { padding-bottom: clamp(40px, 6vw, 80px); }
.work-head { border-top: 1px solid var(--ink); padding-top: 28px; }
.work-index { list-style: none; margin: 18px 0 clamp(40px, 6vw, 72px); padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.work-index a {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 12px; text-decoration: none; font-weight: 500; line-height: 1.25; background: var(--card); transition: border-color .15s, transform .15s;
}
.work-index a:hover { border-color: var(--ink); transform: translateY(-2px); }
.work-index span { font: 500 12px var(--mono); color: var(--signal); }
.work-index small { font-size: 13px; color: var(--muted); font-weight: 400; }

.project { padding: clamp(56px, 8vw, 104px) 0; scroll-margin-top: 64px; }
.p-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.p-num { font: italic 400 clamp(64px, 8vw, 104px)/.8 var(--serif); letter-spacing: 0; text-transform: none; color: var(--signal); margin-bottom: 14px; }
.project h3 { font-size: clamp(44px, 5.6vw, 72px); margin: 8px 0 18px; }
.p-lede { font-size: 20px; line-height: 1.45; color: var(--ink); font-weight: 500; }
.p-copy > p:not(.p-lede):not(.label):not(.p-num) { color: var(--ink-2); }

.role { margin: 26px 0 0; border-top: 1px solid var(--line); }
.role div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.role dt { padding-top: 3px; }
.role dd { margin: 0; font-weight: 500; }

/* Fixly flow */
.flow { margin: 0; padding: clamp(22px, 3vw, 34px); background: var(--card); border: 1px solid var(--line); border-radius: 20px; position: relative; }
.flow-nodes { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; position: relative; z-index: 1; }
.node { position: relative; padding: 18px 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--paper); display: flex; flex-direction: column; gap: 4px; }
.node strong { font-size: 15px; }
.node > span:last-child { font-size: 13px; color: var(--muted); line-height: 1.35; }
.node-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.node-mine { border-color: var(--signal); background: color-mix(in srgb, var(--signal) 8%, var(--paper)); }
.node-mine .node-icon { color: var(--signal); }
.mine-badge { position: absolute; top: -11px; left: 12px; font: 500 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; background: var(--signal); color: #fff; padding: 5px 8px; border-radius: 999px; }
.flow-wires { display: grid; gap: 10px; margin-top: 20px; }
.wire { position: relative; height: 26px; border-radius: 999px; background: var(--paper-2); overflow: hidden; display: flex; align-items: center; padding: 0 14px; }
.wire em { font: 500 11.5px var(--mono); font-style: normal; color: var(--muted); position: relative; z-index: 1; }
.wire-req { justify-content: flex-start; }
.wire-res { justify-content: flex-end; }
.wire::before { content: ""; position: absolute; inset: 50% 14px auto; border-top: 1.5px dashed var(--line); }
.packet { position: absolute; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; }
.wire-req .packet { background: var(--signal); animation: req 3.2s cubic-bezier(.6, 0, .4, 1) infinite; }
.wire-res .packet { background: var(--data); animation: res 3.2s cubic-bezier(.6, 0, .4, 1) infinite 1.6s; left: 100%; }
@keyframes req { 0% { left: 2%; opacity: 0; } 10% { opacity: 1; } 45% { left: 96%; opacity: 1; } 50%, 100% { left: 96%; opacity: 0; } }
@keyframes res { 0% { left: 96%; opacity: 0; } 10% { opacity: 1; } 45% { left: 2%; opacity: 1; } 50%, 100% { left: 2%; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .wire-req .packet { left: 50%; } .wire-res .packet { left: 50%; } }
.flow-note { margin: 16px 0 0; font-size: 14px; color: var(--muted); }

/* 8-puzzle: dark lab panel */
.p-puzzle { background: var(--dark); color: var(--on-dark); }
.p-puzzle .label, .p-puzzle .board-hint, .p-puzzle .lab-foot, .p-puzzle .readout dt { color: var(--on-dark-muted); }
.p-puzzle .p-lede { color: var(--on-dark); }
.p-puzzle .p-copy > p:not(.p-lede):not(.label):not(.p-num) { color: #cfcbc1; }
.p-puzzle code { background: #262a2f; color: var(--on-dark); }
.p-puzzle .text-link { color: #ff8a66; }
.formula { font: 500 clamp(12px, 1.25vw, 14px)/1.5 var(--mono); padding: 14px 16px; border-left: 3px solid var(--signal); background: #1c1f23; border-radius: 0 10px 10px 0; margin: 0 0 22px; overflow-x: auto; white-space: nowrap; }
.lab { background: var(--dark-2); border: 1px solid #2c3035; border-radius: 22px; padding: clamp(18px, 3vw, 28px); }
.lab-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lab-top label { margin-right: auto; }
.lab select, .lab button {
  font: 500 14px var(--sans); color: var(--on-dark); background: #262a2f; border: 1px solid #3a3f45;
  border-radius: 10px; min-height: 40px; padding: 0 12px; cursor: pointer;
}
.lab button:hover:not(:disabled), .lab select:hover { border-color: var(--on-dark-muted); }
.lab button:disabled { opacity: .35; cursor: default; }
.board-wrap { margin: 20px 0 14px; }
.board {
  --size: min(100%, 330px); --gap: 8px;
  position: relative; width: var(--size); aspect-ratio: 1; margin: 0 auto; padding: var(--gap);
  background: #0b0c0e; border-radius: 16px; border: 1px solid #2c3035; transition: box-shadow .3s;
}
.board.solved { box-shadow: 0 0 0 2px var(--data), 0 0 40px -6px color-mix(in srgb, var(--data) 70%, transparent); }
.tile {
  position: absolute; width: calc((100% - 4 * var(--gap)) / 3); height: calc((100% - 4 * var(--gap)) / 3);
  left: calc(var(--gap) + var(--c) * ((100% - 4 * var(--gap)) / 3 + var(--gap)));
  top: calc(var(--gap) + var(--r) * ((100% - 4 * var(--gap)) / 3 + var(--gap)));
  display: grid; place-items: center; border-radius: 12px; background: #f3efe6; color: #15171a;
  transition: left .28s cubic-bezier(.3, .7, .2, 1), top .28s cubic-bezier(.3, .7, .2, 1), background .2s;
}
.tile b { font: 400 clamp(34px, 6vw, 46px)/1 var(--serif); }
.tile i { position: absolute; right: 8px; bottom: 6px; font: 500 11px var(--mono); font-style: normal; color: var(--signal-ink); }
.tile.home { background: #d7e6e4; }
.tile.home i { color: #2d6a73; }
.board-hint { text-align: center; font-size: 13px; margin: 12px 0 0; }
.readout { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 14px; }
.readout div { background: #262a2f; border-radius: 10px; padding: 10px 12px; }
.readout dt { font-size: 10.5px; text-transform: none; letter-spacing: .02em; }
.readout dd { margin: 2px 0 0; font: 500 20px var(--mono); }
.controls { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; }
.controls .play { background: var(--signal); border-color: var(--signal); color: #fff; }
.controls .play:hover { background: #ff6a3d; }
.lab-foot { font-size: 13px; margin: 14px 0 0; text-align: center; }

/* AI trading: research notebook */
.p-trading { background: var(--paper-2); }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status-wip { color: var(--signal-ink); }
.status-wip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); animation: pulse 2.6s infinite; }
.notebook {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: 0 20px 40px -30px rgba(20, 22, 26, .35);
}
.nb-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); font: 500 12px var(--mono); color: var(--muted); background: var(--paper); }
.nb-head .status { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.nb-body {
  padding: 22px clamp(18px, 3vw, 28px) 26px;
  background-image: repeating-linear-gradient(transparent 0 31px, color-mix(in srgb, var(--data) 14%, transparent) 31px 32px);
}
.nb-q, .nb-results { font-family: var(--serif); font-size: 24px; line-height: 1.25; margin-bottom: 18px; }
.nb-q span, .nb-results span { display: block; font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--data); margin-bottom: 6px; }
.nb-results { margin: 22px 0 0; color: var(--muted); font-style: italic; }
.concepts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; padding: 0; }
.concepts li { font: 500 13px var(--mono); padding: 6px 12px; border-radius: 999px; background: var(--data-soft); color: var(--data); }
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pipeline li { display: grid; grid-template-columns: 34px 1fr; gap: 14px; align-items: start; padding: 12px; border-radius: 12px; border: 1px dashed var(--line); background: var(--card); }
.pipeline b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); font: 500 14px var(--mono); color: var(--muted); }
.pipeline strong { display: block; font-size: 15px; }
.pipeline span { font-size: 14px; color: var(--muted); }
.pipeline li.active { border-style: solid; border-color: var(--signal); }
.pipeline li.active b { background: var(--signal); border-color: var(--signal); color: #fff; }

/* Imitation game */
.p-imitation .p-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.turing { position: relative; padding: clamp(24px, 4vw, 40px); border-radius: 22px; background: #2d6a73; color: #f3efe6; overflow: hidden; min-height: 360px; display: flex; flex-direction: column; justify-content: space-between; }
.turing::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% 10%, rgba(255,255,255,.18), transparent 45%); }
.turing-q { position: relative; font: italic 400 clamp(44px, 5.4vw, 68px)/.95 var(--serif); }
.turing-q span { display: block; font: 500 12px var(--mono); font-style: normal; letter-spacing: .1em; text-transform: uppercase; opacity: .7; margin: 10px 0; }
.bubbles { position: relative; display: grid; gap: 10px; margin-top: 30px; }
.b { margin: 0; max-width: 78%; padding: 11px 15px; border-radius: 18px; font-size: 15px; line-height: 1.35; }
.b-left { background: rgba(243, 239, 230, .14); border-bottom-left-radius: 6px; }
.b-right { justify-self: end; background: #f3efe6; color: #15171a; border-bottom-right-radius: 6px; }
.b-typing { display: flex; gap: 5px; width: fit-content; }
.b-typing i { width: 7px; height: 7px; border-radius: 50%; background: #f3efe6; opacity: .5; animation: blink 1.2s infinite; }
.b-typing i:nth-child(2) { animation-delay: .2s; } .b-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; transform: translateY(-2px); } }
.checklist { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checklist li { position: relative; padding: 12px 14px 12px 40px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; font-weight: 500; background: var(--card); }
.p-link { margin: 22px 0 0; }
.checklist li::before { content: "✓"; position: absolute; left: 14px; top: 11px; color: var(--data); font-weight: 600; }

/* WebCareSolutions */
.p-webcare { padding-top: 0; }
.browser { display: block; text-decoration: none; border: 1.5px solid var(--ink); border-radius: 20px; overflow: hidden; background: var(--card); transition: transform .2s, box-shadow .2s; }
.browser:hover { transform: translateY(-3px); box-shadow: 0 24px 40px -28px rgba(20, 22, 26, .5); }
.browser-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1.5px solid var(--ink); background: var(--paper-2); }
.browser-bar i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--ink); }
.browser-bar i:first-child { background: var(--signal); border-color: var(--signal); }
.browser-bar span { margin-left: 12px; font: 500 13px var(--mono); color: var(--muted); background: var(--card); padding: 4px 14px; border-radius: 999px; flex: 0 1 340px; }
.browser-body { display: grid; grid-template-columns: minmax(0, 1.4fr) auto; gap: 18px 40px; padding: clamp(24px, 4vw, 44px); align-items: end; }
.browser-body h3 { margin-bottom: 12px; }
.browser-body p { color: var(--ink-2); margin: 0; max-width: 34em; }
.browser-body .text-link { grid-column: 1 / -1; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.steps li { font: italic 400 26px/1 var(--serif); padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; }
.steps li:nth-child(2) { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- About ---------- */
.about { padding: clamp(56px, 9vw, 110px) 0; border-top: 1px solid var(--line); }
.about-grid { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.portrait { position: relative; margin: 0; aspect-ratio: 4 / 5; border-radius: 22px; overflow: hidden; background: var(--ink); }
.portrait-fallback { position: absolute; inset: 0; display: grid; place-items: center; font: italic 400 clamp(90px, 14vw, 160px)/1 var(--serif); color: #f3efe6; background: radial-gradient(circle at 30% 20%, #2d6a73, transparent 60%), var(--dark); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.about-copy h2 { font-size: clamp(40px, 5.6vw, 72px); margin: 10px 0 22px; }
.about-copy > p { color: var(--ink-2); font-size: 18px; }
.facts { list-style: none; margin: 26px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.facts li { padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line); font-weight: 500; font-size: 15px; }
.facts span { display: block; margin-bottom: 3px; }

/* ---------- Contact / footer ---------- */
.contact { background: var(--ink); color: var(--paper); padding: clamp(64px, 10vw, 120px) 0; text-align: center; }
.contact h2 { font-size: clamp(48px, 8vw, 110px); margin-bottom: 18px; }
.contact p { color: color-mix(in srgb, var(--paper) 70%, transparent); font-size: 18px; margin-bottom: 30px; }
.contact .actions { justify-content: center; }
.contact .btn { border-color: var(--paper); }
.contact .btn-primary { background: var(--paper); color: var(--ink); }
.contact .btn-primary:hover { background: var(--signal); border-color: var(--signal); color: #fff; }
.contact .btn-ghost { color: var(--paper); }
.contact .btn-ghost:hover { background: var(--paper); color: var(--ink); }
.footer { display: flex; justify-content: space-between; gap: 16px; padding-block: 28px 40px; font-size: 14px; color: var(--muted); }
.footer a { color: var(--ink-2); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .work-index { grid-template-columns: repeat(3, 1fr); }
  .glance { grid-template-columns: repeat(2, 1fr); }
  .glance div:nth-child(2) { border-right: 0; }
  .glance div:nth-child(3) { padding-left: 0; }
  .glance div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .hero, .now-grid, .p-grid, .p-imitation .p-grid, .about-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-visual { aspect-ratio: 16 / 10; }
  .now .section-head { position: static; }
  .p-imitation .turing { order: 2; min-height: 300px; }
  .browser-body { grid-template-columns: minmax(0, 1fr); }
  .portrait { max-width: 360px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  nav a[href^="https"] { display: none; }
  .identity span:last-child { display: none; }
  .work-index { grid-template-columns: 1fr 1fr; }
  .work-index li:last-child { grid-column: 1 / -1; }
  .now-list li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .now-tag { padding-top: 0; }
  .flow-nodes { grid-template-columns: minmax(0, 1fr); }
  .readout { grid-template-columns: repeat(2, 1fr); }
  .checklist, .facts { grid-template-columns: minmax(0, 1fr); }
  .steps li { font-size: 21px; padding: 11px 13px; }
  .footer { flex-direction: column; }
}

/* =========================================================
   Motion & interaction layer (effects.js)
   Everything is gated on html.motion, which is only set when
   the visitor has NOT asked for reduced motion.
   ========================================================= */

/* ---------- Theme switch ---------- */
.theme-toggle {
  width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); display: grid; place-items: center; cursor: pointer;
  transition: border-color .2s, translate .25s cubic-bezier(.3,.7,.2,1);
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; transition: transform .6s cubic-bezier(.6,0,.2,1); }
.theme-toggle svg path { fill: currentColor; stroke: none; }
.theme-toggle[data-mode="dark"] svg { transform: rotate(180deg); }
nav { align-items: center; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }

/* ---------- Scroll progress ---------- */
.masthead { position: sticky; }
.progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--signal);
  transform-origin: 0 50%; transform: scaleX(0); pointer-events: none;
}

/* ---------- Kicker clock ---------- */
.clock time { font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- Avatar inside the headline ---------- */
.avatar {
  display: inline-block; width: .86em; height: .86em; margin: 0 .14em 0 .04em; vertical-align: -.1em;
  border-radius: 50%; overflow: hidden; border: 2px solid var(--signal);
  box-shadow: 0 8px 24px -10px color-mix(in srgb, var(--signal) 70%, transparent);
  transition: transform .4s cubic-bezier(.3,1.6,.4,1);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.avatar:hover { transform: rotate(-8deg) scale(1.12); }

/* ---------- Headline word rise ---------- */
.motion .hero h1.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 .06em .1em 0; margin: 0 -.06em -.1em 0; }
.motion .hero h1.split .w > span { display: inline-block; transform: translateY(110%) rotate(4deg); transition: transform 1s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--i) * 55ms + 120ms); }
.motion .hero h1.split.in .w > span { transform: none; }
.motion .hero h1.split .avatar { transform: scale(0) rotate(-40deg); transition: transform .9s cubic-bezier(.3,1.6,.4,1); transition-delay: calc(var(--i) * 55ms + 250ms); }
.motion .hero h1.split.in .avatar { transform: none; }
.motion .hero h1.split.in .avatar:hover { transform: rotate(-8deg) scale(1.12); transition-delay: 0s; }

/* ---------- Reveals ---------- */
.motion .reveal {
  opacity: 0; transform: translateY(26px); filter: blur(6px);
  transition: opacity .8s ease, transform .95s cubic-bezier(.2,.8,.2,1), filter .8s ease;
  transition-delay: var(--d, 0ms);
}
.motion .reveal.shown { opacity: 1; transform: none; filter: none; }
.motion .p-num.reveal { opacity: 1; transform: none; filter: none; clip-path: inset(0 100% 0 0); transition: clip-path 1.1s cubic-bezier(.7,0,.2,1); }
.motion .p-num.reveal.shown { clip-path: inset(0 -10% 0 0); }
.motion .section-head h2.reveal em, .motion .contact h2.reveal em { display: inline-block; transition: transform 1s cubic-bezier(.3,1.5,.4,1) .25s; transform: translateY(.3em) rotate(-6deg); }
.motion .section-head h2.reveal.shown em, .motion .contact h2.reveal.shown em { transform: none; }

/* ---------- Hero visual: tilt, spotlight, particle canvas ---------- */
.hero-visual { transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s cubic-bezier(.2,.8,.2,1); will-change: transform; }
.hero-media { transform: scale(1.08) translate(calc(var(--mx, 0) * -16px), calc(var(--my, 0) * -16px)); transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.hero-visual::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(360px circle at calc((var(--mx, 0) + .5) * 100%) calc((var(--my, 0) + .5) * 100%), rgba(240,106,67,.22), transparent 60%);
  opacity: 0; transition: opacity .4s;
}
.hero-visual:hover::before { opacity: 1; }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.hero-tag { z-index: 3; }
.motion .hero-visual { animation: heroIn 1.4s cubic-bezier(.2,.8,.2,1) both .2s; }
@keyframes heroIn { from { clip-path: inset(12% 12% 12% 12% round 22px); opacity: 0; } to { clip-path: inset(0 0 0 0 round 22px); opacity: 1; } }

/* ---------- Marquee ---------- */
.marquee { overflow: hidden; border-block: 1px solid var(--line); padding: 18px 0; margin-top: clamp(8px, 2vw, 16px); -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; width: max-content; align-items: center; gap: 28px; font: italic 400 clamp(26px, 3.4vw, 40px)/1 var(--serif); color: var(--ink); white-space: nowrap; }
.marquee-track i { font-style: normal; font-size: .5em; color: var(--signal); }
.motion .marquee-track { animation: marquee 38s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(calc(-50% - 14px)); } }
@media (prefers-reduced-motion: reduce) { .marquee-track { flex-wrap: wrap; width: auto; white-space: normal; justify-content: center; padding: 0 16px; } .marquee-track > :nth-child(n+19) { display: none; } .marquee { mask-image: none; -webkit-mask-image: none; } }

/* ---------- Now list hover ---------- */
.now-list li { position: relative; transition: padding-left .35s cubic-bezier(.2,.8,.2,1); }
.now-list li::before { content: ""; position: absolute; left: 0; top: 0; bottom: -1px; width: 2px; background: var(--signal); transform: scaleY(0); transform-origin: top; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
@media (hover: hover) { .now-list li:hover { padding-left: 14px; } .now-list li:hover::before { transform: scaleY(1); } }

/* ---------- Work index cards: lift + glow ---------- */
.work-index a { position: relative; overflow: hidden; }
.work-index a::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: var(--signal); transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.work-index a:hover::after { transform: scaleX(1); }

/* ---------- Fixly: nodes light up in sync with the packets ---------- */
.motion .flow.shown .node { animation: nodePulse 3.2s infinite; }
.motion .flow.shown .node:nth-child(2) { animation-delay: .7s; }
.motion .flow.shown .node:nth-child(3) { animation-delay: 1.4s; }
@keyframes nodePulse { 0%, 30%, 100% { box-shadow: 0 0 0 0 transparent; } 10% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 25%, transparent), 0 10px 30px -12px var(--signal); } }

/* ---------- Imitation game: conversation plays in ---------- */
.motion .turing .b { opacity: 0; transform: translateY(12px) scale(.94); transition: opacity .5s ease, transform .6s cubic-bezier(.3,1.4,.4,1); }
.motion .turing.shown .b { opacity: 1; transform: none; }
.motion .turing.shown .b:nth-child(1) { transition-delay: .4s; }
.motion .turing.shown .b:nth-child(2) { transition-delay: 1.3s; }
.motion .turing.shown .b:nth-child(3) { transition-delay: 2.2s; }
.turing-q { transition: letter-spacing 1.2s cubic-bezier(.2,.8,.2,1); }
.motion .turing:not(.shown) .turing-q { letter-spacing: .08em; }

/* ---------- Puzzle: solve celebration ---------- */
.board.solved .tile { animation: tilePop .7s cubic-bezier(.3,1.6,.4,1) both; animation-delay: calc(var(--n, 0) * 55ms); }
@keyframes tilePop { 0% { transform: scale(1); } 40% { transform: scale(1.1); background: #f06a43; color: #fff; } 100% { transform: scale(1); } }

/* ---------- WebCare browser: subtle shimmer on hover ---------- */
.browser { position: relative; }
.browser::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 40%, color-mix(in srgb, var(--signal) 10%, transparent) 50%, transparent 60%); transform: translateX(-100%); transition: transform 0s; }
.browser:hover::after { transform: translateX(100%); transition: transform 1.1s ease; }

/* ---------- Sign-off ---------- */
.contact .signoff { margin: 44px 0 0; font: italic 400 clamp(40px, 6vw, 64px)/1 var(--serif); color: var(--signal); }
.motion .signoff.reveal { opacity: 1; filter: none; transform: none; clip-path: inset(0 100% 0 0); transition: clip-path 1.6s cubic-bezier(.6,0,.2,1) .3s; }
.motion .signoff.reveal.shown { clip-path: inset(-10% -5% -10% 0); }

/* ---------- Cursor ring ---------- */
.cursor-ring {
  position: fixed; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px; z-index: 200;
  border: 1.5px solid var(--signal); border-radius: 50%; pointer-events: none; opacity: 0;
  transition: opacity .25s, width .3s cubic-bezier(.2,.8,.2,1), height .3s cubic-bezier(.2,.8,.2,1), margin .3s cubic-bezier(.2,.8,.2,1), background .3s;
}
.cursor-ring.on { opacity: .9; }
.cursor-ring.hover { width: 58px; height: 58px; margin: -29px 0 0 -29px; background: color-mix(in srgb, var(--signal) 14%, transparent); }

/* Magnetic buttons use the independent translate property */
.btn { transition: transform .15s, background .15s, color .15s, translate .3s cubic-bezier(.3,.7,.2,1); }
.clock { white-space: pre; }
@media (max-width: 560px) {
  .kicker { flex-wrap: wrap; row-gap: 6px; }
  .clock { flex-basis: 100%; padding-left: 18px; }
  .clock .sep { display: none; }
}

/* WebCareSolutions: real homepage screenshot inside the browser frame */
.browser-shot { overflow: hidden; border-bottom: 1.5px solid var(--ink); background: #0b1630; aspect-ratio: 1600 / 931; }
.browser-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 1.2s cubic-bezier(.2,.8,.2,1); }
@media (hover: hover) { .browser:hover .browser-shot img { transform: scale(1.03); } }
