/* ═══════════════════════════════════════════════════════════════════════════
   uday.ojha portfolio — hand-written CSS, no framework, no build step.
   Extended v2 (2026-07): vetlock scanner section + polish pass.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tokens live at design/tokens.css. This file only defines behavior + layout on top of tokens. */

/* ── base ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse 100% 60% at 50% -10%, var(--accent-dim), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.mono { font-family: var(--mono); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--panel-2); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); }
kbd { font-family: var(--mono); font-size: 0.8em; background: var(--panel-2); color: var(--text); padding: 2px 7px; border-radius: 5px; border: 1px solid var(--line-strong); box-shadow: 0 1px 0 var(--line-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip {
  position: absolute; left: -999px; top: 0; z-index: 99;
  background: var(--accent); color: var(--color-on-accent); padding: 8px 14px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* Visually hidden but exposed to assistive tech — used for aria-live status regions
   (e.g. copy-to-clipboard success/error announcements) that must not affect layout. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

main { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
section { padding: 64px 0 12px; }
/* When a nav link scrolls to a section, keep the section heading below
   the sticky .nav (position:sticky, ~72px tall including padding + border).
   Without this the sticky nav overlaps the top of the target section. */
section[id] { scroll-margin-top: 72px; }

h1 { font-size: clamp(2.4rem, 6.5vw, 3.8rem); line-height: 1.06; margin: 10px 0 20px; letter-spacing: -0.025em; font-weight: 700; }
h1 .accent { color: var(--accent); }
h2 { font-size: 1.55rem; margin: 0 0 22px; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
h3 { font-size: 1.08rem; margin: 0 0 8px; }
.h-idx { color: var(--accent); font-size: 0.85em; margin-right: 4px; }
.tag { font-size: 0.7rem; padding: 3px 10px; border-radius: 999px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 6px; }
.tag.live { color: var(--danger); border-color: var(--danger-dim); }
.tag-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); animation: pulse 1.6s infinite; box-shadow: 0 0 8px var(--danger); }

/* ── nav ────────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); font-family: var(--mono); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); animation: pulse 2.4s infinite; }
.nav nav { display: flex; gap: 18px; margin-left: auto; overflow-x: auto; }
.nav nav a { color: var(--muted); font-size: 0.92rem; white-space: nowrap; }
.nav nav a:hover { color: var(--text); text-decoration: none; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ── buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px;
  background: var(--accent); color: var(--color-on-accent); font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  font-family: var(--sans);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); background: var(--accent-2); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; background: var(--accent); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: transparent; box-shadow: none; }
.btn.small { padding: 6px 14px; font-size: 0.85rem; }
/* Mobile tap target: every .btn.small inside the scanner is a one-handed
   thumb target on 375-wide phones (Copy JSON, Copy link, Try your own scan,
   Retry, and the dynamically-injected #sr-share / #sr-cli-copy). Bare
   .btn.small renders ~28px tall which fails WCAG 2.5.5 AAA (44x44 CSS px)
   and Apple HIG. Scope the bump to .scan-wrap so we don't inflate every
   small button sitewide — this also picks up #scan-readonly-banner since
   the banner lives inside .scan-wrap in index.html. */
.scan-wrap .btn.small {
  min-height: 44px;
  padding: max(8px, var(--space-2)) var(--space-3);
}
.btn.danger { color: var(--danger); border-color: var(--danger-dim); }
.btn.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ── hero ───────────────────────────────────────────────────────────── */
.hero {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 40px; align-items: center;
  min-height: 78vh; padding-top: 48px;
}
.kicker { color: var(--accent); font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.06em; text-transform: lowercase; margin: 0; }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 34em; }
.lede strong { color: var(--text); }
.lede em { color: var(--accent); font-style: normal; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

/* ── console panel ──────────────────────────────────────────────────── */
.console {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow);
  position: relative;
  /* Reserve the panel's final box on first paint (P1 CLS fix). Without this,
     Lighthouse's mobile emulation measures a ~380px downward shift as
     .hero-copy resolves its height under the render-blocking stylesheet chain.
     `contain: layout` isolates future parent reflows. */
  min-height: 303px;
  contain: layout;
}
.console::before {
  /* Subtle CRT-scanline flourish. Rendered behind content via ::before + pointer-events none. */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, var(--scanline) 0 2px, transparent 2px 4px);
  z-index: 1;
  border-radius: inherit;
}
.console > * { position: relative; z-index: 2; }
.console-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.console-title { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.console-fmt {
  margin-left: auto; padding: 2px 8px; border-radius: 6px; font-size: 0.7rem;
  color: var(--accent); background: var(--accent-dim); cursor: pointer; user-select: none;
  border: 1px solid transparent; transition: border-color 0.15s;
}
.console-fmt:hover { border-color: var(--accent); }
.console-up { font-size: 0.78rem; color: var(--accent); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); animation: pulse 1.8s infinite; }
.feed {
  height: 300px; overflow-y: auto; padding: 12px 14px;
  font-size: 0.78rem; line-height: 1.9;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.feed::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-track { background: transparent; }
.feed::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.feed::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }
.evt { display: flex; gap: 10px; white-space: nowrap; }
.evt .t { color: var(--muted); }
.evt .n { color: var(--accent); }
.evt .d { color: var(--blue); overflow: hidden; text-overflow: ellipsis; }
.feed.json .evt { display: block; white-space: pre; color: var(--muted); }
.feed.json .evt::before { content: attr(data-json); color: inherit; }
.feed.json .evt > * { display: none; }
.console-foot { padding: 8px 14px; border-top: 1px solid var(--line); font-size: 0.72rem; color: var(--muted); }

/* ── vetlock scanner ────────────────────────────────────────────────── */
/* The scanner section (#scan) sits well below the fold and its structural
   CSS previously lived here — the .scan-wrap card, .dropzone, .sp-* progress
   bar, .sr-* result panel, .se-* error panel, and .fr-* finding rows. They
   were moved into /design/scan.css as part of the P3 LCP fix so the deferred
   stylesheet carries their bytes instead of style.css, which is render-
   blocking and delays first paint of the hero. See docs/BUDGETS.md for the
   measured impact. Any NEW scanner-only selector should be added to
   scan.css, never here. */

/* Any explicit `display:` value beats the browser default
   `[hidden] { display: none }`, so a JS-set element.hidden = true has no
   effect on .scan-error, .btn, .scan-progress, .scan-result, or .dz-meta
   unless we re-establish it here. Kept in style.css (render-blocking) so
   any element with the `hidden` attribute is hidden on first paint —
   including scan panels — without waiting for the deferred scan.css. */
[hidden] { display: none !important; }

/* ── stats ──────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding-top: 20px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.stat:hover { transform: translateY(-2px); border-color: var(--accent); }
.stat .num { display: block; font-family: var(--mono); font-size: 1.7rem; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; }
.stat .lbl { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 6px; line-height: 1.45; }

/* ── cards ──────────────────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.cards.grid2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.card p { color: var(--muted); font-size: 0.92rem; margin: 0 0 14px; }
.card p em { color: var(--accent); font-style: normal; }
.card p strong { color: var(--text); }
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-hover); }
.card.accent-border { border-color: var(--accent-dim); position: relative; }
.card.accent-border::before {
  content: ""; position: absolute; top: 0; left: 20px; right: 20px; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px 2px 0 0;
}
a.card:hover { text-decoration: none; }
.proj h3 { display: flex; justify-content: space-between; align-items: baseline; color: var(--text); }
.arrow { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips span {
  font-family: var(--mono); font-size: 0.72rem; color: var(--accent);
  background: var(--accent-dim); border-radius: 999px; padding: 3px 10px;
}

@media (min-width: 950px) {
  #systems .cards { grid-template-columns: repeat(4, 1fr); }
  #projects .cards.grid2 { grid-template-columns: repeat(3, 1fr); }
}

/* ── timeline ───────────────────────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 26px 18px; }
.timeline li::before {
  content: ""; position: absolute; left: -27px; top: 8px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim);
}
.t-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.t-date { color: var(--muted); font-size: 0.8rem; margin-left: auto; }
.timeline p { color: var(--muted); font-size: 0.92rem; margin: 6px 0 0; max-width: 60em; }
.edu { color: var(--muted); margin-top: 18px; }

/* ── skills ─────────────────────────────────────────────────────────── */
.skills { display: grid; gap: 14px; }
.skill-row { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start; }
.skill-label { color: var(--muted); font-size: 0.8rem; padding-top: 4px; }

/* ── writing ────────────────────────────────────────────────────────── */
.writing { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.writing a { font-weight: 600; }
.writing span { color: var(--muted); font-size: 0.94rem; }

/* ── contact / footer ───────────────────────────────────────────────── */
.contact-lede { color: var(--muted); max-width: 40em; }
footer { border-top: 1px solid var(--line); margin-top: 70px; padding: 26px 24px 40px; text-align: center; }
footer p { margin: 4px 0; font-size: 0.78rem; color: var(--muted); }
footer .dim { opacity: 0.7; }

/* ── keyboard help dialog ───────────────────────────────────────────── */
dialog.kbd-help {
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--panel);
  color: var(--text); padding: 0; box-shadow: var(--shadow-hover); min-width: 320px; max-width: 90vw;
}
dialog.kbd-help::backdrop { background: var(--alpha-black-50); backdrop-filter: blur(2px); }
.kh-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.kh-head .mono { flex: 1; color: var(--muted); font-size: 0.85rem; }
.kh-close { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.kh-close:hover { color: var(--danger); border-color: var(--danger); }
.kh-body { padding: 14px 16px 18px; border-collapse: separate; border-spacing: 0 6px; font-size: 0.85rem; width: 100%; }
.kh-body td:first-child { padding-right: 20px; white-space: nowrap; }
.kh-body td:last-child { color: var(--muted); }

/* ── reveal animation ───────────────────────────────────────────────── */
/* .reveal is defined in design/primitives.css with a JS-gated hidden state
   (`.js .reveal:not(.in):not(.is-visible)` → opacity:0), so no-JS clients
   see revealed content by default and screenshot/scrape tools that don't
   scroll still capture readable content. The earlier unconditional
   `opacity: 0` here silently broke that fallback — removed 2026-07-14.
   The .reveal.in matcher below stays: primitives.css defines both `.in`
   and `.is-visible`, and this rule is a no-op belt-and-suspenders in case
   primitives.css is missing (defensive). */
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .dot, .pulse, .tag-dot, .proof-dot { animation: none; }
  .btn, .card, .stat, .sp-fill, .dropzone { transition: none; }
  .console::before { display: none; }
}

/* ── responsive ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav nav { display: none; }
  .nav { gap: 12px; justify-content: space-between; }
  main { padding: 0 16px; }
  section { padding: 48px 0 8px; }
}
@media (max-width: 480px) {
  /* (scanner-only overrides for narrow viewports moved to design/scan.css) */
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; gap: 28px; }
  /* Reserve .hero-copy's final rendered height on mobile so late CSS
     resolution doesn't push .console-col down after first paint (P1 CLS
     fix — covers kicker + fluid H1 + lede + CTA row at mobile scale). */
  .hero-copy { min-height: 520px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards, .cards.grid2 { grid-template-columns: 1fr; }
  .feed { height: 220px; }
  .console { min-height: 260px; }  /* narrower panel + smaller feed */
  .skill-row { grid-template-columns: 1fr; gap: 4px; }
  .t-date { margin-left: 0; width: 100%; }
  /* (scanner grid overrides moved to design/scan.css) */
}

/* ── proof strip ────────────────────────────────────────────────────
   Rendered by design/proof.js — a lazy-loaded module that fetches each
   tile's value from a live source and hides the tile on any error,
   missing data, or below-threshold value (packet rule #4: never fake
   a number). Tiles start [hidden] and JS reveals only what verified.

   Empty state: with JS OFF or every fetch failing, the .proof-strip is
   an empty grid — no visual claim is made. That's the correct
   progressive-enhancement behavior for an "honest" section.

   The strip sits between #scan and the .stats highlights. On mobile
   it collapses to 2 columns, then 1. No fixed heights: if only two
   tiles survive fetch, the row centers them; grid tracks size to
   content. */
.proof { padding-top: 24px; padding-bottom: 8px; }
.proof-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.proof-h {
  font-size: 1.35rem; letter-spacing: -0.01em; margin: 0;
  display: inline-flex; align-items: baseline; gap: 10px;
}
.proof-h .accent { color: var(--accent); }
.proof-sub-lede { color: var(--muted); font-size: 0.82rem; margin: 0; }

.proof-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.proof-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
  transition: transform var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard);
}
.proof-tile:hover { transform: translateY(-2px); border-color: var(--accent); }
/* Number: uses the same monospace + accent color language as .stat .num
   so the two rows read as one system. */
.proof-num {
  font-size: 1.55rem; font-weight: 700; color: var(--accent);
  letter-spacing: -0.02em; line-height: 1.1;
  display: inline-flex; align-items: center; gap: 8px;
}
.proof-sub { color: var(--text); font-size: 0.85rem; }
.proof-src { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.02em; }

/* Health tile paints its own dot in the number slot rather than a
   count. The dot pulses to make "live" legible without a caption. */
.proof-tile--health .proof-num { font-size: 1.05rem; text-transform: lowercase; }
.proof-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  animation: pulse 2.4s infinite;
}

@media (max-width: 900px) {
  .proof-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .proof-strip { grid-template-columns: 1fr; }
}

/* ── LCP protection: below-fold sections deferred from initial paint ──
   The original blanket `content-visibility: auto` across #systems, #red-team,
   #projects, #experience, #how-it-works, #proof produced a real LCP win but
   broke every non-scrolling capture:
     • Playwright fullPage screenshots showed intrinsic-size placeholders
       (empty boxes) for every off-screen section — visible ghost boxes.
     • LinkedIn / Twitter / Discord share-preview scrapers render one
       viewport without scrolling, so their previews rendered the same
       ghost-empty page users report as "the site looks broken."
     • SEO indexers that don't execute scroll heuristics saw the same.

   Scoped down 2026-07-14 (perfection follow-up): retain content-visibility
   only where the perf win is largest AND the content is not share-critical.
   #how-it-works is a 6-stage scrollytelling section with heavy inline SVGs
   and only becomes meaningful during scroll — keep. #proof is JS-populated
   so it's inert at first paint anyway — keep, small intrinsic size.
   #systems, #red-team, #projects, #experience — the marquee content of
   the portfolio, MUST render in first-viewport captures. Removed.

   Also: force `visible` for print + reduced-motion + no-JS clients so
   PDF exports, screenshot users, and accessibility tools see everything. */
#how-it-works {
  content-visibility: auto;
  contain-intrinsic-size: 1px 1200px;
}
#proof {
  content-visibility: auto;
  contain-intrinsic-size: 1px 200px;
}
@media print, (prefers-reduced-motion: reduce) {
  #how-it-works,
  #proof {
    content-visibility: visible;
  }
}
/* When JS is off, force visibility on the two remaining c-v:auto sections
   so no-JS visitors + share-preview scrapers see the full page. */
html:not(.js) #how-it-works,
html:not(.js) #proof {
  content-visibility: visible;
}

/* ── print ──────────────────────────────────────────────────────────── */
@media print {
  .nav, .console, #scan, dialog.kbd-help, footer { display: none !important; }
  body { background: var(--color-bg-print); color: var(--color-text-print); }
  section { padding: 20px 0; page-break-inside: avoid; }
  a { color: var(--color-text-print); text-decoration: underline; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
