/* =====================================================================
   x-base.css — Akshit Kumar Lall · design system "NOIR / CV"
   Foundation layer: fonts · tokens · reset · shared components · motion gates.
   OWNER: foundation. Section owners never edit this file — put section CSS in
   css/x-<group>.css and only consume the --x-* tokens and .x-* components.
   ===================================================================== */

/* ---------- 1. fonts (self-hosted, latin subset, variable) ---------- */
@font-face {
  font-family: "Archivo X";
  src: url("../assets/fonts/archivo-var.woff2") format("woff2-variations"),
       url("../assets/fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif X";
  src: url("../assets/fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- 2. tokens — dark is the default ---------- */
:root {
  color-scheme: dark;

  /* colour roles */
  --x-bg: #0b0a09;            /* page */
  --x-bg-2: #121110;          /* alternate band (reviews, footer) */
  --x-bg-3: #1b1917;          /* media placeholders, wells */
  --x-surface: #151311;       /* cards, panels */
  --x-surface-2: #1d1a17;     /* raised / hover */
  --x-ink: #efe8dc;           /* primary text   16.2:1 on bg */
  --x-ink-2: #bdb5a8;         /* secondary text  9.7:1 on bg — default for labels */
  --x-ink-3: #9a9286;         /* tertiary/meta   5.7:1 on bg-3 (never below) */
  --x-line: rgba(239, 232, 220, 0.14);
  --x-line-2: rgba(239, 232, 220, 0.28);
  --x-accent: #ff4f1f;        /* FILL colour (buttons, dots, tags, bars) */
  --x-accent-ink: #ff6a3d;    /* accent used as TEXT (6.9:1 on bg) */
  --x-on-accent: #0b0a09;     /* text on accent fill (6.0:1) */
  --x-accent-dim: rgba(255, 79, 31, 0.12);
  --x-glass: rgba(18, 17, 16, 0.66);
  --x-scrim: rgba(11, 10, 9, 0.72);

  /* hero name knockout */
  --x-name-ink: #efe8dc;      /* solid layer behind the portrait */
  --x-name-accent: #ff4f1f;   /* "Kumar" — solid, in front of the portrait */
  --x-name-stroke: #efe8dc;   /* front layer stroke where the portrait covers letters */
  --x-name-ghost: rgba(239, 232, 220, 0.10); /* front layer fill (letters read "behind glass") */

  /* computer-vision layer (detections, lens, lock brackets) */
  --x-lock: #ff4f1f;                          /* corner brackets */
  --x-lock-line: rgba(239, 232, 220, 0.55);   /* 1px box edge */
  --x-lock-halo: rgba(0, 0, 0, 0.35);         /* keeps the edge legible on bright photos */
  --x-lock-tag-bg: #ff4f1f;
  --x-lock-tag-ink: #0b0a09;
  --x-edge: #ff6a3d;                          /* Sobel edge colour (read by js/x-hero.js) */
  --x-media-filter: saturate(0.9) brightness(0.94); /* project/award media at rest — NEVER grayscale */

  /* hero shader palette (read by js/x-hero.js) */
  --x-gl-bg: #0b0a09;
  --x-gl-a: #ff4f1f;
  --x-gl-b: #ffb067;
  --x-gl-c: #240705;
  --x-gl-strength: 1;

  /* depth */
  --x-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  --x-shadow-sm: 0 12px 32px -14px rgba(0, 0, 0, 0.65);
  --x-grain-o: 0.07;

  /* type */
  --x-font-sans: "Archivo X", "Helvetica Neue", Arial, system-ui, sans-serif;
  --x-font-serif: "Instrument Serif X", "Times New Roman", Georgia, serif;
  --x-fs-mega: clamp(5.25rem, min(13.4vw, 21.5svh), 19rem);   /* hero name only */
  --x-fs-display: clamp(2.9rem, 8.2vw, 8.75rem);              /* section titles */
  --x-fs-h2: clamp(2.1rem, 4.6vw, 4.75rem);                   /* statements, contact */
  --x-fs-h3: clamp(1.5rem, 2.4vw, 2.35rem);                   /* feature titles */
  --x-fs-h4: clamp(1.15rem, 1.45vw, 1.4rem);                  /* card titles */
  --x-fs-lead: clamp(1.08rem, 1.35vw, 1.3rem);
  --x-fs-body: 1rem;
  --x-fs-small: 0.9375rem;    /* 15px */
  --x-fs-label: 0.8125rem;    /* 13px — floor for any uppercase tracked label */
  --x-fs-micro: 0.75rem;      /* 12px — detection tags only, never body copy */
  --x-lh-tight: 0.88;
  --x-lh-snug: 1.12;
  --x-lh-body: 1.6;
  --x-track-mega: -0.045em;
  --x-track-display: -0.035em;
  --x-track-label: 0.12em;
  --x-wdth-wide: 116%;        /* font-stretch for display */
  --x-wdth-label: 112%;

  /* space */
  --x-s-1: 4px; --x-s-2: 8px; --x-s-3: 12px; --x-s-4: 16px; --x-s-5: 24px;
  --x-s-6: 32px; --x-s-7: 48px; --x-s-8: 64px; --x-s-9: 96px; --x-s-10: 128px;
  --x-gutter: clamp(16px, 3.4vw, 52px);
  --x-section-y: clamp(72px, 9vw, 120px);
  --x-head-gap: clamp(36px, 4.5vw, 72px);    /* section header → content */
  --x-nav-h: 72px;
  --x-maxw: 1520px;

  /* shape */
  --x-r-xs: 2px; --x-r-sm: 6px; --x-r-md: 14px; --x-r-pill: 999px;

  /* z-index ladder (the ONLY values allowed) */
  --x-z-content: 1;
  --x-z-raised: 5;
  --x-z-pill: 850;       /* .quick-contact */
  --x-z-toast: 860;      /* #vhPop */
  --x-z-menu: 880;       /* #mobMenu */
  --x-z-nav: 900;        /* #nav */
  --x-z-progress: 910;   /* #progress */
  --x-z-tooltip: 950;    /* .drift-guide ×3 */
  --x-z-cursor: 960;     /* .x-cursor */
  --x-z-modal: 1000;     /* #projModal */
  --x-z-grain: 1100;     /* .x-grain (pointer-events:none) */
  --x-z-wipe: 1200;      /* theme wipe */
  --x-z-skip: 1300;      /* .x-skip */

  /* motion */
  --x-ease-out: cubic-bezier(0.16, 1, 0.3, 1);      /* reveals */
  --x-ease-inout: cubic-bezier(0.76, 0, 0.24, 1);   /* wipes, curtains */
  --x-ease-film: cubic-bezier(0.65, 0.05, 0, 1);    /* colour bleed */
  --x-ease-snap: cubic-bezier(0.2, 0.9, 0.1, 1);    /* detection lock */
  --x-dur-1: 0.2s; --x-dur-2: 0.45s; --x-dur-3: 0.9s; --x-dur-4: 1.4s;

  /* legacy aliases — keep unconverted legacy bits on-brand during the transition */
  --font-code: var(--x-font-sans);
  --font-pixel: var(--x-font-sans);
  --sans: var(--x-font-sans);
  --mono: var(--x-font-sans);
  --cur-arrow: auto;
  --cur-point: pointer;
}

@media (max-width: 760px) {
  :root { --x-nav-h: 64px; }
}

html[data-theme="light"] {
  color-scheme: light;
  --x-bg: #eee8de;
  --x-bg-2: #e6dfd3;
  --x-bg-3: #dcd4c6;
  --x-surface: #f6f1e8;
  --x-surface-2: #ece5d9;
  --x-ink: #12100e;           /* 15.6:1 */
  --x-ink-2: #3f3a33;         /*  9.2:1 */
  --x-ink-3: #5f584e;         /*  4.8:1 on bg-3 */
  --x-line: rgba(18, 16, 14, 0.14);
  --x-line-2: rgba(18, 16, 14, 0.30);
  --x-accent: #ff4f1f;
  --x-accent-ink: #a8300a;    /* 5.6:1 on bg, 4.6:1 on bg-3 */
  --x-on-accent: #0b0a09;
  --x-accent-dim: rgba(255, 79, 31, 0.14);
  --x-glass: rgba(238, 232, 222, 0.74);
  --x-scrim: rgba(238, 232, 222, 0.8);
  --x-name-ink: #12100e;
  --x-name-accent: #e8400c;   /* 3.3:1 on ivory, 4.8:1 on the black turtleneck (large text) */
  --x-name-stroke: #f6f1e8;   /* ivory stroke over the black turtleneck */
  --x-name-ghost: rgba(246, 241, 232, 0.16);
  --x-lock: #e8400c;
  --x-lock-line: rgba(255, 255, 255, 0.7);
  --x-lock-halo: rgba(18, 16, 14, 0.35);
  --x-edge: #b5340b;
  --x-media-filter: saturate(0.94) contrast(1.02);
  --x-gl-bg: #eee8de;
  --x-gl-a: #ff5a28;
  --x-gl-b: #ffc08a;
  --x-gl-c: #e9cdb9;
  --x-gl-strength: 0.8;
  --x-shadow: 0 30px 80px -24px rgba(60, 40, 20, 0.35);
  --x-shadow-sm: 0 12px 32px -16px rgba(60, 40, 20, 0.35);
  --x-grain-o: 0.05;
}

/* ---------- 3. reset + base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--x-bg);
  overflow-x: clip;              /* NEVER hidden: hidden breaks the sticky journey */
  scroll-behavior: auto;         /* Lenis owns smooth scrolling */
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: clip; }
html.x-locked { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--x-bg);
  color: var(--x-ink);
  font-family: var(--x-font-sans);
  font-size: var(--x-fs-body);
  line-height: var(--x-lh-body);
  font-weight: 400;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  cursor: auto;
  transition: background-color var(--x-dur-3) var(--x-ease-out), color var(--x-dur-3) var(--x-ease-out);
}
h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; padding: 0; }
ul[class], ol[class] { list-style: none; }
img, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
strong, b { font-weight: 650; }
em { font-style: italic; }
[hidden] { display: none !important; }
::selection { background: var(--x-accent); color: var(--x-on-accent); }
:focus-visible { outline: 2px solid var(--x-accent); outline-offset: 3px; border-radius: var(--x-r-xs); }
kbd {
  display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; padding: 0 0.4em;
  border-radius: var(--x-r-xs); box-shadow: inset 0 0 0 1px var(--x-line-2), 0 2px 0 var(--x-line);
  font: 600 0.8em/1 var(--x-font-sans); font-stretch: var(--x-wdth-label);
}

/* legacy safety nets (harmless after legacy CSS is unlinked) */
.rv, .rv-l, .rv-r { opacity: 1; transform: none; }   /* content is never gated by the old reveal */
.gc::before { display: none; }                        /* old black-on-black glow */

/* ---------- 4. utilities ---------- */
.x-wrap { width: 100%; max-width: var(--x-maxw); margin-inline: auto; padding-inline: var(--x-gutter); }
.x-section { position: relative; padding-block: var(--x-section-y); scroll-margin-top: 0; }
.x-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.x-skip {
  position: fixed; left: 12px; top: -80px; z-index: var(--x-z-skip);
  padding: 10px 16px; border-radius: var(--x-r-sm);
  background: var(--x-accent); color: var(--x-on-accent); font-weight: 650;
}
.x-skip:focus { top: 12px; }
.x-mask { display: inline-block; overflow: hidden; vertical-align: top; }
.x-num { font-variant-numeric: tabular-nums; }
.x-dot { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
/* input-modality switches: copy that differs between mouse and touch ("Hover for a live preview" / "Tap a project") */
@media (hover: hover) and (pointer: fine) { .x-touch-only { display: none !important; } }
@media not ((hover: hover) and (pointer: fine)) { .x-fine-only { display: none !important; } }
.x-acc { color: var(--x-accent-ink); }

/* type roles */
.x-serif { font-family: var(--x-font-serif); font-style: italic; font-weight: 400; font-stretch: 100%; letter-spacing: -0.01em; text-transform: none; }
.x-label {
  font-size: var(--x-fs-label); font-weight: 560; font-stretch: var(--x-wdth-label);
  letter-spacing: var(--x-track-label); text-transform: uppercase; line-height: 1.35;
  color: var(--x-ink-2); font-variant-numeric: tabular-nums;
}
.x-display {
  font-size: var(--x-fs-display); font-weight: 800; font-stretch: 112%;
  line-height: 0.9; letter-spacing: var(--x-track-display); text-transform: uppercase; text-wrap: balance;
}
.x-h2 { font-size: var(--x-fs-h2); font-weight: 650; font-stretch: 104%; line-height: 1.04; letter-spacing: -0.035em; text-wrap: balance; }
.x-h3 { font-size: var(--x-fs-h3); font-weight: 700; font-stretch: 108%; line-height: 1.02; letter-spacing: -0.03em; }
.x-h4 { font-size: var(--x-fs-h4); font-weight: 650; font-stretch: 104%; line-height: 1.18; letter-spacing: -0.02em; }
.x-lead { font-size: var(--x-fs-lead); line-height: 1.5; color: var(--x-ink-2); max-width: 46ch; text-wrap: pretty; }
.x-body { font-size: var(--x-fs-body); line-height: var(--x-lh-body); color: var(--x-ink-2); max-width: 62ch; }
.x-body strong, .x-lead strong { color: var(--x-ink); }

/* ---------- 5. components ---------- */

/* 5.1 section header — eyebrow + title (+ optional sub / meta on the right) */
.x-sec-head { margin-bottom: var(--x-head-gap); }
.x-eyebrow { display: flex; align-items: baseline; gap: 14px; margin-bottom: clamp(16px, 2vw, 28px); }
.x-eyebrow .x-idx { font-family: var(--x-font-serif); font-style: italic; font-size: 1.35rem; line-height: 1; color: var(--x-accent-ink); letter-spacing: 0; }
.x-eyebrow > :not(.x-idx) {
  font-size: var(--x-fs-label); font-weight: 560; font-stretch: var(--x-wdth-label);
  letter-spacing: var(--x-track-label); text-transform: uppercase; color: var(--x-ink-2);
}
.x-sec-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; }
.x-title { font-size: var(--x-fs-display); font-weight: 800; font-stretch: 112%; line-height: 0.9; letter-spacing: var(--x-track-display); text-transform: uppercase; }
/* serif-italic accent word: ONLY allowed in the 3 signature moments (hero name, about statement, contact headline) */
.x-title .x-serif, .x-h2 .x-serif { font-size: 1.06em; letter-spacing: -0.03em; color: var(--x-accent-ink); }
.x-sub { font-size: var(--x-fs-lead); line-height: 1.5; color: var(--x-ink-2); max-width: 40ch; }
.x-sec-head-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px 32px; flex-wrap: wrap; margin-top: clamp(24px, 3vw, 40px); padding-top: 22px; border-top: 1px solid var(--x-line); }

/* 5.2 buttons */
.x-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 28px; border-radius: var(--x-r-pill);
  font-size: 0.95rem; font-weight: 620; font-stretch: 108%; letter-spacing: -0.005em; line-height: 1;
  white-space: nowrap; isolation: isolate; overflow: hidden; text-align: center;
  transition: color var(--x-dur-2) var(--x-ease-out), box-shadow var(--x-dur-2);
}
.x-btn::before { /* fill floods in from below */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  transform: translateY(101%); transition: transform 0.6s var(--x-ease-out);
}
.x-btn:hover::before, .x-btn:focus-visible::before { transform: translateY(0); }
.x-btn-in { position: relative; display: inline-flex; align-items: center; gap: 10px; pointer-events: none; }
.x-btn--accent { background: var(--x-accent); color: var(--x-on-accent); }
.x-btn--accent::before { background: var(--x-ink); }
.x-btn--accent:hover, .x-btn--accent:focus-visible { color: var(--x-bg); }
.x-btn--accent:focus-visible { outline-color: var(--x-ink); }
.x-btn--ghost { box-shadow: inset 0 0 0 1px var(--x-line-2); color: var(--x-ink); }
.x-btn--ghost::before { background: var(--x-ink); }
.x-btn--ghost:hover, .x-btn--ghost:focus-visible { color: var(--x-bg); box-shadow: inset 0 0 0 1px var(--x-ink); }
.x-btn--sm { min-height: 44px; padding: 0 18px; font-size: 0.875rem; }
.x-btn--lg { min-height: 64px; padding: 0 34px; font-size: 1.05rem; }
.x-btn--block { display: flex; width: 100%; }
.x-btn .x-ico { width: 1em; height: 1em; transition: transform 0.5s var(--x-ease-out); }
.x-btn:hover .x-ico--ne, .x-btn:focus-visible .x-ico--ne { transform: rotate(45deg); }
.x-btn:hover .x-ico--e, .x-btn:focus-visible .x-ico--e { transform: translateX(3px); }

/* round icon button (theme toggle, close) */
.x-icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--x-line-2); color: var(--x-ink);
  transition: box-shadow var(--x-dur-2), background-color var(--x-dur-2);
}
.x-icon-btn:hover { box-shadow: inset 0 0 0 1px var(--x-ink); }

/* text link with underline wipe */
.x-link { position: relative; display: inline-flex; align-items: center; gap: 8px; font-weight: 560; padding-block: 4px; }
.x-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor;
  transform-origin: right; transition: transform 0.6s var(--x-ease-out);
}
.x-link:hover::after { transform: scaleX(0); animation: x-underline 0.9s var(--x-ease-out) 0.15s forwards; }
@keyframes x-underline { from { transform: scaleX(0); transform-origin: left; } to { transform: scaleX(1); transform-origin: left; } }

/* inline SVG icon: <svg class="x-ico x-ico--ne" viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 11.5l7-7M6 4.5h5.5V10"/></svg> */
.x-ico { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* 5.3 pills (status), tags (stack), chips (filters) */
.x-pill {
  display: inline-flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 14px;
  border-radius: var(--x-r-pill); box-shadow: inset 0 0 0 1px var(--x-line-2);
  font-size: var(--x-fs-label); font-weight: 560; font-stretch: var(--x-wdth-label);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--x-ink); white-space: nowrap;
}
.x-pulse {
  flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--x-accent);
  box-shadow: 0 0 0 0 rgba(255, 79, 31, 0.55); animation: x-pulse 2.2s infinite;
}
@keyframes x-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 79, 31, 0.55); } 70% { box-shadow: 0 0 0 10px rgba(255, 79, 31, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 79, 31, 0); } }

.x-tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.x-tag {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 11px; border-radius: var(--x-r-pill);
  box-shadow: inset 0 0 0 1px var(--x-line-2); font-size: var(--x-fs-label); font-weight: 500;
  line-height: 1; color: var(--x-ink-2); white-space: nowrap;
}
.x-tag--acc { box-shadow: inset 0 0 0 1px var(--x-accent); color: var(--x-accent-ink); }

.x-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--x-r-pill);
  box-shadow: inset 0 0 0 1px var(--x-line-2); font-size: 0.875rem; font-weight: 540; font-stretch: 106%;
  color: var(--x-ink-2); white-space: nowrap;
  transition: background-color 0.4s var(--x-ease-out), color 0.4s, box-shadow 0.4s;
}
.x-chip:hover { box-shadow: inset 0 0 0 1px var(--x-ink); color: var(--x-ink); }
.x-chip[aria-pressed="true"], .x-chip.active { background: var(--x-ink); color: var(--x-bg); box-shadow: none; }
.x-chip-n { font-size: 0.75rem; font-variant-numeric: tabular-nums; opacity: 0.7; }

/* 5.4 card surface */
.x-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--x-surface); border-radius: var(--x-r-sm); overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--x-line);
  transition: box-shadow var(--x-dur-2), transform var(--x-dur-3) var(--x-ease-out), background-color var(--x-dur-2);
}
.x-card:hover { box-shadow: inset 0 0 0 1px var(--x-line-2); }

/* 5.5 media frame + computer-vision detection layer */
.x-media { position: relative; overflow: hidden; background: var(--x-bg-3); isolation: isolate; }
.x-media > img, .x-media > video, .x-media > picture > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: var(--x-media-filter); transform: scale(1.001);
  transition: filter var(--x-dur-3) var(--x-ease-out), transform 1.2s var(--x-ease-out);
}
.x-media::after { /* hairline frame */
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(239, 232, 220, 0.08);
}

/* corner bracket — 4 per box: <i class="x-rc x-rc--tl"></i> … tr / bl / br */
.x-rc { position: absolute; width: var(--x-rc, 14px); height: var(--x-rc, 14px); border: 0 solid var(--x-lock); pointer-events: none; }
.x-rc--tl { left: -1px; top: -1px; border-top-width: 2px; border-left-width: 2px; }
.x-rc--tr { right: -1px; top: -1px; border-top-width: 2px; border-right-width: 2px; }
.x-rc--bl { left: -1px; bottom: -1px; border-bottom-width: 2px; border-left-width: 2px; }
.x-rc--br { right: -1px; bottom: -1px; border-bottom-width: 2px; border-right-width: 2px; }

/* detection tag (lowercase, Archivo, ≥12px) */
.x-det-tag {
  position: absolute; left: -1px; bottom: 100%; margin-bottom: 4px;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 5px 8px 4px; border-radius: 1px; background: var(--x-lock-tag-bg); color: var(--x-lock-tag-ink);
  font: 650 var(--x-fs-micro)/1 var(--x-font-sans); font-stretch: 108%; letter-spacing: 0.02em;
  text-transform: lowercase; font-variant-numeric: tabular-nums;
}

/* static detection box positioned in % of its (position:relative) parent:
   <div class="x-det" style="--x:36%;--y:17%;--w:33%;--h:35%"> 4×.x-rc + .x-det-tag </div> */
.x-det {
  position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h);
  border: 1px solid var(--x-lock-line); box-shadow: 0 0 0 1px var(--x-lock-halo);
  pointer-events: none; z-index: 4;
}

/* hover/focus/touch "lock-on" bracket that snaps onto a card's media.
   Markup inside .x-media:  <span class="x-lock" aria-hidden="true">4×.x-rc<span class="x-det-tag">furti_ai · ai agent</span></span>
   Trigger: any ancestor with .x-lockable (card) on :hover, :focus-within, or .is-active (touch, set by JS). */
.x-lock {
  position: absolute; inset: 12px; z-index: 4; pointer-events: none;
  border: 1px solid var(--x-lock-line); box-shadow: 0 0 0 1px var(--x-lock-halo);
  opacity: 0; transform: scale(1.06);
  transition: opacity var(--x-dur-1), transform 0.5s var(--x-ease-snap);
}
.x-lock .x-det-tag { top: 10px; left: 10px; bottom: auto; margin: 0; }
.x-lockable:hover .x-lock, .x-lockable:focus-within .x-lock, .x-lockable.is-active .x-lock { opacity: 1; transform: none; }
.x-lockable:hover .x-media > img, .x-lockable:hover .x-media > video,
.x-lockable:focus-within .x-media > img, .x-lockable:focus-within .x-media > video,
.x-lockable.is-active .x-media > img, .x-lockable.is-active .x-media > video { filter: none; transform: scale(1.035); }

/* 5.6 dividers */
.x-rule { height: 1px; border: 0; margin: 0; background: var(--x-line); }
.x-rule--accent { width: 48px; height: 2px; background: var(--x-accent); }

/* 5.7 form fields (underline style) */
.x-field { display: grid; gap: 8px; }
.x-field-label {
  font-size: var(--x-fs-label); font-weight: 560; font-stretch: var(--x-wdth-label);
  letter-spacing: var(--x-track-label); text-transform: uppercase; color: var(--x-ink-2);
}
.x-input, .x-textarea {
  width: 100%; min-height: 52px; padding: 12px 0; border: 0; border-radius: 0;
  border-bottom: 1px solid var(--x-line-2); background: transparent; color: var(--x-ink);
  font-size: 1.125rem; line-height: 1.4; outline: none;
  transition: border-color var(--x-dur-2), box-shadow var(--x-dur-2);
}
.x-textarea { min-height: 132px; resize: vertical; }
.x-input::placeholder, .x-textarea::placeholder { color: var(--x-ink-3); opacity: 1; }
.x-input:hover, .x-textarea:hover { border-bottom-color: var(--x-ink-3); }
.x-input:focus-visible, .x-textarea:focus-visible { border-bottom-color: var(--x-accent); box-shadow: 0 1px 0 0 var(--x-accent); outline: none; }
.x-input:user-invalid, .x-textarea:user-invalid { border-bottom-color: var(--x-accent-ink); }
.x-field-hint { font-size: var(--x-fs-label); color: var(--x-ink-3); }

/* 5.8 tooltip shared by #portraitGuide, #skillsGuide, #driftGuide (JS sets left/top) */
.drift-guide {
  position: fixed; left: -9999px; top: -9999px; z-index: var(--x-z-tooltip);
  max-width: min(300px, calc(100vw - 24px)); padding: 10px 14px;
  border: 0; border-radius: var(--x-r-sm) var(--x-r-sm) var(--x-r-sm) 2px;
  background: var(--x-ink); color: var(--x-bg);
  font: 600 0.875rem/1.4 var(--x-font-sans); letter-spacing: 0; white-space: nowrap;
  box-shadow: var(--x-shadow-sm); pointer-events: none;
  opacity: 0; transform: translateY(6px) scale(0.98);
  transition: opacity 0.2s, transform 0.35s var(--x-ease-out);
}
.drift-guide::after { display: none; }
.drift-guide.visible { opacity: 1; transform: none; }
.drift-guide-caret { display: inline-block; width: 2px; height: 1em; margin-left: 3px; vertical-align: -0.14em; background: var(--x-accent); animation: x-blink 0.8s steps(1) infinite; }
#skillsGuide, #portraitGuide { white-space: normal; max-width: min(340px, calc(100vw - 24px)); }
@keyframes x-blink { 50% { opacity: 0; } }

/* 5.9 film grain (markup: <div class="x-grain" aria-hidden="true"></div> before </body>) */
.x-grain {
  position: fixed; inset: -80px; z-index: var(--x-z-grain); pointer-events: none; opacity: var(--x-grain-o);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.94  0 0 0 0 0.91  0 0 0 0 0.86  0 0 0 1.6 -0.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 260px 260px;
}
html[data-theme="light"] .x-grain {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.08  0 0 0 0 0.06  0 0 0 1.6 -0.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .x-grain { animation: x-grain 0.9s steps(7) infinite; }
}
@keyframes x-grain {
  0% { transform: translate(0, 0); } 14% { transform: translate(-31px, 18px); } 28% { transform: translate(22px, -40px); }
  42% { transform: translate(-50px, -12px); } 57% { transform: translate(44px, 30px); } 71% { transform: translate(-12px, 52px); }
  85% { transform: translate(36px, -22px); } 100% { transform: translate(0, 0); }
}

/* 5.10 media-label cursor (fine pointer only; ADDITIVE — the native cursor always stays) */
.x-cursor {
  position: fixed; left: 0; top: 0; z-index: var(--x-z-cursor); pointer-events: none;
  display: grid; place-items: center; width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%;
  background: var(--x-accent); color: var(--x-on-accent);
  font-size: 0.8125rem; font-weight: 650; font-stretch: 112%; letter-spacing: 0.1em; text-transform: uppercase;
  opacity: 0; transform: scale(0.4); transition: opacity 0.3s, transform 0.5s var(--x-ease-out);
}
.x-cursor.is-on { opacity: 1; transform: none; }

/* ---------- 6. motion gates ----------
   html.x-motion is set pre-paint by the boot script when JS runs and motion is allowed.
   Elements are hidden ONLY under x-motion and ONLY until js/x-core.js adds .is-in.
   Never put data-x-reveal on anything inside the first viewport (hero). */
html.x-motion [data-x-reveal]:not(.is-in) { opacity: 0; }
html.x-motion [data-x-reveal="stagger"]:not(.is-in) { opacity: 1; }
html.x-motion [data-x-reveal="stagger"]:not(.is-in) > * { opacity: 0; }
html.x-motion [data-x-reveal="clip"]:not(.is-in) { opacity: 1; clip-path: inset(100% 0 0 0); }
@media print { html.x-motion [data-x-reveal] { opacity: 1 !important; clip-path: none !important; } }

/* ---------- 7. reduced motion: everything instant ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
  .x-pulse { animation: none; }
}
