/* ============================================================
   Karthik Palani — Portfolio v3
   "Paper sketch" — ink on sketchbook paper.

   The hand-drawn look is one trick used consistently: every
   border is drawn by a pseudo-element and pushed through the
   #rough SVG turbulence filter defined in index.html. Text is
   never filtered, so it stays crisp and selectable.
   ============================================================ */

:root {
  /* canvas ground — white primed cotton, with pure white panels on top */
  --paper:      #f8f8f6;
  --paper-2:    #f1f1ee;
  --paper-3:    #eaeae7;
  --card:       #ffffff;

  /* ink */
  --ink:        #17181c;
  --ink-2:      #3a3d45;
  --ink-3:      #6b6f7a;
  --ink-4:      #9aa0ab;

  /* rules and pens */
  --rule:       #e3e4e7;
  --rule-2:     #c8cad0;

  /* the marker set — each section picks one, so the page reads as a
     sketchbook worked in several pens rather than one muted brown */
  --pen-indigo: #4338ca;   /* the main pen */
  --pen-blue:   #2563eb;
  --pen-violet: #7c3aed;
  --pen-teal:   #0d9488;
  --pen-green:  #15803d;
  --pen-rose:   #e11d48;
  --pen-amber:  #ca8a04;
  --pen-ochre:  #a8a29e;   /* graphite, for the smudge */
  --highlight:  #dfe3ff;   /* highlighter wash, tinted to the main pen */

  --accent: var(--pen-indigo);

  --display: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  --sans:    'Geist', system-ui, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;
  --serif:   'Newsreader', Georgia, serif;
  --hand:    'Caveat', 'Segoe Script', cursive;

  --maxw:  1280px;
  --pad-x: clamp(20px, 5vw, 68px);
  --r:     14px;   /* nominal corner radius for sketch frames */
}

html[data-theme="dark"] {
  --paper:      #131418;
  --paper-2:    #1a1c21;
  --paper-3:    #23262c;
  --card:       #191b20;

  --ink:        #eceef2;
  --ink-2:      #c9cdd6;
  --ink-3:      #8e94a0;
  --ink-4:      #626873;

  --rule:       #262930;
  --rule-2:     #3b3f48;

  --pen-indigo: #a5b4fc;
  --pen-blue:   #7dabf8;
  --pen-violet: #c4a5fd;
  --pen-teal:   #4fd1c5;
  --pen-green:  #6ee7a8;
  --pen-rose:   #fb7185;
  --pen-amber:  #fbbf24;
  --pen-ochre:  #78716c;
  --highlight:  #2b3172;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background-color: var(--paper);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--ink);
  background-color: var(--paper);
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  transition: color .3s ease, background-color .3s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
::selection { background: var(--accent); color: var(--paper); }

:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: 3px;
}

/* filter defs live in the DOM but must never take up space */
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ------------------------------------------------------------
   PAPER: grain + ruled grid
   ------------------------------------------------------------ */
.paper-grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  opacity: .05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' seed='11'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .75 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
html[data-theme="dark"] .paper-grain {
  opacity: .08; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' seed='11'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* gesso mottle and the darkening toward a stretched canvas's edges */
.canvas-weave {
  position: fixed; inset: 0; pointer-events: none; z-index: 9998;
  opacity: .07;
  mix-blend-mode: multiply;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='500' height='500'><filter id='m'><feTurbulence type='fractalNoise' baseFrequency='.011' numOctaves='4' seed='3'/><feColorMatrix values='0 0 0 0 .44  0 0 0 0 .45  0 0 0 0 .47  0 0 0 .5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23m)'/></svg>"),
    radial-gradient(ellipse 125% 95% at 50% 42%,
      transparent 52%,
      color-mix(in oklab, var(--ink) 4%, transparent) 100%);
  background-size: 500px 500px, cover;
}
html[data-theme="dark"] .canvas-weave { opacity: .55; }

/* coffee ring — every real sketchbook has one */
.coffee-ring {
  position: absolute; pointer-events: none; z-index: 0;
  width: 168px; height: 152px;
  border-radius: 50%;
  border: 7px solid color-mix(in oklab, var(--pen-ochre) 20%, transparent);
  filter: url(#rough-loose) blur(.4px);
  opacity: .5;
  transform: rotate(-12deg);
}
html[data-theme="dark"] .coffee-ring { opacity: .3; }

/* the weave: warp and weft threads, plus coarser slubs at a different period
   so it never resolves into a regular grid. Sits behind content, so it can be
   stronger than an overlay would allow. */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    repeating-linear-gradient(90deg,
      color-mix(in oklab, var(--ink) 4%, transparent) 0 1px,
      transparent 1px 5px),
    repeating-linear-gradient(0deg,
      color-mix(in oklab, var(--ink) 3%, transparent) 0 1px,
      transparent 1px 5px),
    repeating-linear-gradient(90deg,
      color-mix(in oklab, var(--ink) 4%, transparent) 0 2px,
      transparent 2px 17px),
    repeating-linear-gradient(0deg,
      color-mix(in oklab, var(--ink) 3%, transparent) 0 2px,
      transparent 2px 23px);
  opacity: .45;
}
html[data-theme="dark"] body::before { opacity: .6; }

.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px;
  width: 0%; background: var(--accent);
  z-index: 100; transition: width .12s linear;
}

/* ------------------------------------------------------------
   SKETCH FRAME
   .sketch-box draws its border in ::before so the wobble filter
   never touches the text inside.
   ------------------------------------------------------------ */
.sketch-box {
  position: relative;
  background: var(--card);
  border-radius: var(--r);
  border: none;
}
.sketch-box::before {
  content: ""; position: absolute; inset: 0;
  border: 1.8px solid var(--ink-3);
  border-radius: var(--r);
  filter: url(#rough);
  pointer-events: none;
  opacity: .75;
  transition: opacity .25s ease, border-color .25s ease;
}
/* second, offset stroke — reads as a pencil line gone over twice */
.sketch-box::after {
  content: ""; position: absolute; inset: 2px -1px -2px 1px;
  border: 1.2px solid var(--ink-4);
  border-radius: var(--r);
  filter: url(#rough-loose);
  pointer-events: none;
  opacity: .3;
  transition: opacity .25s ease;
}
.sketch-box:hover::before { opacity: 1; border-color: var(--ink-2); }
.sketch-box:hover::after  { opacity: .5; }

/* torn-paper divider — replaces the flat rule between sections */
.paper-edge {
  position: absolute; top: -1px; left: 0; right: 0;
  height: 9px; overflow: hidden;
  pointer-events: none; color: var(--rule-2);
}
.paper-edge svg { width: 100%; height: 100%; display: block; }

/* hand-drawn illustration sitting beside a section heading */
.section-art {
  color: var(--ink-3);
  opacity: .55;
  align-self: center;
  justify-self: end;
  flex-shrink: 0;
  transition: opacity .3s ease, color .3s ease;
}
.section-art svg { display: block; }
.section:hover .section-art { opacity: .85; color: var(--accent); }

/* doodles parked in the outer margin */
.margin-doodle {
  position: absolute; pointer-events: none; z-index: 1;
  color: var(--accent); opacity: .3;
}
.margin-doodle svg { display: block; }

/* thumbtack */
.pin {
  position: absolute; top: -11px; left: 50%;
  transform: translateX(-50%); z-index: 4;
  color: var(--accent);
}

/* ------------------------------------------------------------
   TOP BAR
   ------------------------------------------------------------ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 12px var(--pad-x);
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 12px;
}

.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.logo-badge { display: inline-flex; color: var(--accent); }
.logo-initials {
  font-family: var(--display); font-weight: 700; font-size: 13px;
  fill: currentColor; letter-spacing: -.02em;
}
.logo-name {
  font-family: var(--hand); font-size: 21px; font-weight: 600;
  color: var(--ink); letter-spacing: .01em; line-height: 1;
}

.topnav { display: flex; align-items: center; gap: 2px; }
.topnav a {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px;
  color: var(--ink-3);
  transition: color .2s;
}
.topnav a .n { font-size: 9px; color: var(--ink-4); letter-spacing: .08em; }
.topnav a::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 3px;
  height: 2px; background: var(--accent);
  border-radius: 2px; filter: url(#rough-fine);
  opacity: 0; transform: scaleX(.4);
  transition: opacity .2s, transform .2s;
}
.topnav a:hover { color: var(--ink); }
.topnav a:hover::after,
.topnav a.is-active::after { opacity: 1; transform: scaleX(1); }
.topnav a.is-active { color: var(--ink); }
.topnav a.is-active .n { color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.clock { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 11px; }

.theme-toggle {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  color: var(--ink-2);
  transition: color .2s;
}
.theme-toggle::before {
  content: ""; position: absolute; inset: 0;
  border: 1.6px solid var(--ink-3); border-radius: 10px;
  filter: url(#rough-fine); opacity: .7;
  transition: opacity .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle:hover::before { opacity: 1; border-color: var(--accent); }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ------------------------------------------------------------
   HERO
   ------------------------------------------------------------ */
.hero {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: 132px var(--pad-x) 40px;
}

/* name on the left, the reading matter on the right, meta spanning under both */
.hero-split {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 76px);
  align-items: start;
  margin-bottom: 44px;
}
.hero-textcol { padding-top: 8px; }

.hero-kicker {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  color: var(--ink-3); text-transform: uppercase;
  margin-bottom: 22px;
}
.hero-kicker .kicker-mark { color: var(--accent); font-size: 14px; }
.hero-kicker .kicker-sep { color: var(--ink-4); }

.hero-name {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(56px, 9.5vw, 132px);
  line-height: .92; letter-spacing: -.04em;
  margin: 0; color: var(--ink);
  font-variation-settings: "opsz" 96;
}
.hero-name .name-row { display: block; position: relative; width: fit-content; }
.hero-name .name-ital {
  font-style: italic; font-weight: 600; color: var(--accent);
}
.hero-name .name-underline {
  position: absolute; left: 0; right: -4%; bottom: -.1em;
  width: 104%; height: .17em;
  color: var(--accent); opacity: .7;
}

.hero-role {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(21px, 2.5vw, 32px);
  line-height: 1.28; letter-spacing: -.015em;
  color: var(--ink); margin: 0 0 22px;
  text-wrap: pretty;
}

.mark-hl {
  background: linear-gradient(180deg, transparent 56%, var(--highlight) 56%, var(--highlight) 94%, transparent 94%);
  padding: 0 3px; border-radius: 2px;
}

.hero-intro {
  font-size: clamp(15px, 1.35vw, 17px);
  line-height: 1.72; color: var(--ink-2);
  margin: 0 0 30px; max-width: 60ch; text-wrap: pretty;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px;
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  color: var(--ink);
  transition: transform .2s ease, color .2s;
}
.btn::before {
  content: ""; position: absolute; inset: 0;
  border: 1.8px solid var(--ink-2); border-radius: 12px;
  filter: url(#rough); opacity: .8;
  transition: opacity .2s, border-color .2s;
}
.btn:hover { transform: translate(-1px, -2px); }
.btn:hover::before { opacity: 1; }
.btn-primary { color: var(--accent); }
.btn-primary::before { border-color: var(--accent); border-width: 2px; }
.btn-primary::after {
  content: ""; position: absolute; inset: 3px -3px -3px 3px;
  border: 1.4px solid var(--accent); border-radius: 12px;
  filter: url(#rough-loose); opacity: .3;
}

.hero-meta {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 20px; margin: 0;
  padding: 20px 0 4px;
  border-top: 2px solid var(--ink);
}
.meta-cell { min-width: 0; }
.meta-cell dt {
  font-family: var(--mono); font-size: 9.5px;
  color: var(--ink-3); text-transform: uppercase;
  letter-spacing: .13em; margin-bottom: 7px;
}
.meta-cell dd {
  margin: 0;
  font-family: var(--display); font-weight: 500;
  font-size: 16px; color: var(--ink); letter-spacing: -.01em;
}
.now-dot {
  display: inline-block; color: var(--accent);
  font-size: 9px; vertical-align: 3px; margin-left: 3px;
  animation: pulse 2.4s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
@media (prefers-reduced-motion: reduce) { .now-dot { animation: none; } }

.hero-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 48px; padding-top: 18px;
  border-top: 1px dashed var(--rule-2);
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); letter-spacing: .1em; text-transform: uppercase;
}
.scroll-cue { display: inline-flex; align-items: center; gap: 9px; }
.scroll-cue svg { animation: nudge 2.6s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: translateY(0) } 50% { transform: translateY(4px) } }
@media (prefers-reduced-motion: reduce) { .scroll-cue svg { animation: none; } }
.hero-foot-sig {
  font-family: var(--hand); font-size: 19px;
  text-transform: none; letter-spacing: 0; color: var(--ink-4);
}

/* ------------------------------------------------------------
   SECTION SHELL
   ------------------------------------------------------------ */
.section {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: 72px var(--pad-x);
  border-top: 1px solid var(--rule);
  scroll-margin-top: 76px;
}
.section-head {
  display: grid; grid-template-columns: 140px 1fr auto;
  gap: clamp(20px, 4vw, 48px);
  margin-bottom: 44px; align-items: start;
}
.section-marker { padding-top: 10px; }
.marker-num {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--accent); letter-spacing: .14em;
}
.marker-rule {
  display: block; margin-top: 10px;
  height: 2px; width: 54px;
  background: var(--accent);
  border-radius: 2px;
  filter: url(#rough-fine);
}
.section-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(38px, 5.2vw, 76px);
  line-height: .98; letter-spacing: -.03em;
  margin: 0; color: var(--ink);
  font-variation-settings: "opsz" 72;
}
.section-title .caret { color: var(--accent); }
.section-title .title-ital,
.title-ital { font-style: italic; font-weight: 500; color: var(--accent); }
.section-sub {
  font-size: 15.5px; line-height: 1.68;
  color: var(--ink-3); max-width: 600px;
  margin: 14px 0 0; text-wrap: pretty;
}
.section-note {
  margin: 12px 0 0;
  font-family: var(--hand); font-size: 20px;
  color: var(--accent); transform: rotate(-1.5deg);
}

/* one pen per section — set on the section so every accent inside it,
   from the marker rule to the chips, changes together */
#currently    { --accent: var(--pen-blue);   }
#ai           { --accent: var(--pen-violet); }
#architecture { --accent: var(--pen-indigo); }
#experience   { --accent: var(--pen-teal);   }
#work         { --accent: var(--pen-rose);   }
#stack        { --accent: var(--pen-green);  }
#contact      { --accent: var(--pen-violet); }

/* ------------------------------------------------------------
   CURRENTLY
   ------------------------------------------------------------ */
.now-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.now-card {
  padding: 24px;
  transition: transform .25s ease;
}
.now-card:hover { transform: translateY(-3px); }
.now-card.big  { grid-column: span 2; }
.now-card.wide { grid-column: span 4; background: color-mix(in oklab, var(--highlight) 34%, var(--card)); }

.now-tag {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: var(--accent); letter-spacing: .14em;
  text-transform: uppercase; margin-bottom: 14px;
}
.now-card p {
  font-family: var(--display); font-weight: 400;
  font-size: 20px; line-height: 1.36; letter-spacing: -.012em;
  color: var(--ink); margin: 0; text-wrap: pretty;
}
.now-card.big p  { font-size: 25px; }
.now-card.wide p { font-size: 27px; max-width: 900px; }
.now-card p strong { font-weight: 600; }

/* inline link, underlined like a pen stroke */
.link-pen {
  color: var(--pen-blue);
  box-shadow: inset 0 -2px 0 color-mix(in oklab, var(--pen-blue) 40%, transparent);
  transition: box-shadow .2s, color .2s;
}
.link-pen:hover {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.doodle-star {
  position: absolute; top: 16px; right: 20px;
  color: var(--accent); opacity: .4;
}

/* ------------------------------------------------------------
   AI SYSTEMS
   ------------------------------------------------------------ */
.section-ai { padding-bottom: 84px; }
.ai-list { display: flex; flex-direction: column; gap: 26px; }

.ai-entry { padding: 32px clamp(22px, 3vw, 38px) 26px; }

.ai-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start; gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--rule-2);
  margin-bottom: 22px;
}
.ai-index {
  font-family: var(--display); font-weight: 700;
  font-size: 40px; line-height: .85;
  color: var(--accent); opacity: .32;
  letter-spacing: -.04em;
  font-variation-settings: "opsz" 48;
}
.ai-heading { min-width: 0; }
.ai-name {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(26px, 3.1vw, 40px);
  line-height: 1.04; letter-spacing: -.025em;
  margin: 0 0 6px; color: var(--ink);
  font-variation-settings: "opsz" 54;
}
.ai-tagline {
  font-family: var(--serif); font-style: italic;
  font-size: 16.5px; line-height: 1.4;
  color: var(--ink-3); margin: 0;
}

.ai-repo {
  position: relative; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  color: var(--pen-blue);
  transition: transform .2s;
}
.ai-repo::before {
  content: ""; position: absolute; inset: 0;
  border: 1.6px solid var(--pen-blue); border-radius: 10px;
  filter: url(#rough-fine); opacity: .6;
  transition: opacity .2s;
}
.ai-repo:hover { transform: translate(-1px, -1px); }
.ai-repo:hover::before { opacity: 1; }
.ai-repo.is-private { color: var(--ink-4); cursor: default; }
.ai-repo.is-private::before { border-color: var(--ink-4); border-style: dashed; }

.ai-lede {
  font-size: 16px; line-height: 1.72;
  color: var(--ink-2); margin: 0 0 24px;
  max-width: 76ch; text-wrap: pretty;
}

.ai-caps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.ai-caps.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 32px; }
.ai-caps li {
  display: grid; grid-template-columns: 168px 1fr; gap: 18px;
  padding-left: 16px; position: relative;
}
.ai-caps li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 7px; height: 7px;
  border: 1.5px solid var(--accent); border-radius: 50%;
  filter: url(#rough-fine);
}
.cap-k {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  color: var(--ink); letter-spacing: .02em;
  padding-top: 2px;
}
.cap-v {
  font-size: 14.5px; line-height: 1.62;
  color: var(--ink-3); text-wrap: pretty;
}

/* flow strip — the TestRail → agent → Playwright diagram */
.flow-strip {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px 12px;
  padding: 18px 20px; margin: 0 0 24px;
  background: var(--paper-2);
  border-radius: 12px;
  border: 1px dashed var(--rule-2);
}
.flow-node {
  display: flex; flex-direction: column; gap: 3px;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--ink);
}
.flow-node em {
  font-family: var(--sans); font-style: normal;
  font-size: 11px; color: var(--ink-3); letter-spacing: 0;
}
.flow-arrow { color: var(--accent); opacity: .65; display: inline-flex; }

.ai-foot { margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--rule-2); }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  position: relative;
  display: inline-block; padding: 5px 11px;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-2); letter-spacing: .02em;
}
.chip::before {
  content: ""; position: absolute; inset: 0;
  border: 1.3px solid var(--rule-2); border-radius: 8px;
  filter: url(#rough-fine); opacity: .85;
}

/* ------------------------------------------------------------
   EXPERIENCE
   ------------------------------------------------------------ */
.exp-list { display: flex; flex-direction: column; }
.exp-row {
  display: grid; grid-template-columns: 148px 1fr;
  gap: clamp(20px, 4vw, 48px);
  padding: 34px 0;
  border-top: 1px solid var(--rule);
  position: relative;
  transition: padding-left .25s ease;
}
.exp-row:last-child { border-bottom: 1px solid var(--rule); }
.exp-row:hover { padding-left: 12px; }
.exp-row.current::before {
  content: ""; position: absolute; left: -12px; top: 42px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s infinite;
}
@media (prefers-reduced-motion: reduce) { .exp-row.current::before { animation: none; } }

.exp-year { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.exp-year .y-from {
  font-family: var(--display); font-weight: 600;
  font-size: 34px; line-height: 1; color: var(--ink);
  letter-spacing: -.025em;
  font-variation-settings: "opsz" 48;
}
.exp-year .y-to { margin-top: 5px; }
.exp-year .y-tag {
  position: relative; display: inline-block; margin-top: 10px;
  font-size: 9px; font-weight: 600; letter-spacing: .14em;
  color: var(--accent); padding: 4px 9px;
}
.exp-year .y-tag::before {
  content: ""; position: absolute; inset: 0;
  border: 1.4px solid var(--accent); border-radius: 6px;
  filter: url(#rough-fine);
}

.exp-role {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(23px, 2.6vw, 32px); line-height: 1.12;
  letter-spacing: -.02em; color: var(--ink);
  margin: 0 0 5px;
}
.exp-company {
  font-family: var(--serif); font-style: italic;
  font-size: 17px; color: var(--accent); margin-bottom: 14px;
}
.exp-company .exp-loc { color: var(--ink-3); font-style: normal; font-family: var(--sans); font-size: 14px; }
.exp-desc {
  font-size: 15px; line-height: 1.7;
  color: var(--ink-2); margin: 0 0 16px;
  max-width: 74ch; text-wrap: pretty;
}
.exp-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.exp-tags span {
  position: relative; display: inline-block;
  font-family: var(--mono); font-size: 10px;
  color: var(--ink-2); padding: 4px 10px;
}
.exp-tags span::before {
  content: ""; position: absolute; inset: 0;
  border: 1.3px solid var(--rule-2); border-radius: 7px;
  filter: url(#rough-fine); opacity: .85;
}

/* ------------------------------------------------------------
   INFRASTRUCTURE WORK
   ------------------------------------------------------------ */
.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.work-card {
  padding: 30px;
  display: flex; flex-direction: column;
  min-height: 300px;
  transition: transform .25s ease;
}
.work-card:hover { transform: translateY(-3px); }
.work-card.feature,
.work-card.span2 { grid-column: span 2; min-height: auto; }
.work-card.feature::before { border-color: var(--accent); border-width: 2px; opacity: .8; }
.work-card.feature .work-id { color: var(--accent); }

.work-meta {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: .12em;
  text-transform: uppercase; margin-bottom: 20px;
}
.work-meta .work-id { color: var(--accent); font-weight: 600; }
.work-meta .work-dot { color: var(--accent); }

.work-title {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(23px, 2.6vw, 32px);
  line-height: 1.12; letter-spacing: -.022em;
  margin: 0 0 14px; color: var(--ink);
  font-variation-settings: "opsz" 48;
}
.work-card.feature .work-title { font-size: clamp(28px, 3.4vw, 42px); }
.work-body {
  font-size: 14.5px; line-height: 1.7;
  color: var(--ink-2); margin: 0 0 22px;
  max-width: 74ch; flex-grow: 1; text-wrap: pretty;
}
.work-stats {
  display: flex; gap: 30px; flex-wrap: wrap;
  border-top: 1px dashed var(--rule-2);
  padding-top: 16px;
}
.work-stats > div { display: flex; flex-direction: column; gap: 3px; }
.work-stats .v {
  font-family: var(--display); font-weight: 600;
  font-size: 20px; color: var(--ink); letter-spacing: -.02em;
}
.work-stats .k {
  font-family: var(--mono); font-size: 9.5px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .12em;
}

/* ------------------------------------------------------------
   STACK
   ------------------------------------------------------------ */
.stack-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 34px 40px; }
.stack-label {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: var(--accent); letter-spacing: .14em; text-transform: uppercase;
  padding-bottom: 11px; margin-bottom: 12px;
  border-bottom: 1.5px solid color-mix(in oklab, var(--accent) 55%, transparent);
}
.stack-list { list-style: none; padding: 0; margin: 0; }
.stack-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 0;
  font-family: var(--display); font-weight: 400;
  font-size: 16px; color: var(--ink); letter-spacing: -.01em;
}
/* pencil-line depth meter */
.dots {
  flex-shrink: 0;
  display: inline-block; width: 40px; height: 3px;
  border-radius: 3px;
  filter: url(#rough-fine);
  background: linear-gradient(to right, var(--accent) 0 var(--fill, 60%), var(--rule-2) var(--fill, 60%) 100%);
}
.dots[data-level="3"] { --fill: 55%; }
.dots[data-level="4"] { --fill: 78%; }
.dots[data-level="5"] { --fill: 100%; }

/* ------------------------------------------------------------
   CONTACT
   ------------------------------------------------------------ */
.section-contact { padding-bottom: 52px; }
.big-email {
  position: relative; display: block;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(28px, 6.2vw, 82px);
  line-height: 1.06; letter-spacing: -.035em;
  color: var(--ink);
  padding: 30px 0 40px;
  border-top: 1px solid var(--rule);
  margin-bottom: 40px;
  transition: color .2s;
  font-variation-settings: "opsz" 96;
  word-break: break-word;
}
.big-email .at { color: var(--accent); font-style: italic; }
.email-scribble {
  position: absolute; left: 0; bottom: 18px;
  width: 100%; height: 14px;
  color: var(--accent);
  opacity: 0; transform: scaleX(.3); transform-origin: left;
  transition: opacity .3s ease, transform .45s ease;
}
.big-email:hover { color: var(--accent); }
.big-email:hover .email-scribble { opacity: .8; transform: scaleX(1); }

.contact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.contact-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px;
  transition: transform .2s ease;
}
.contact-card:hover { transform: translateY(-3px); }
.cc-label {
  font-family: var(--mono); font-size: 9.5px;
  color: var(--ink-3); letter-spacing: .13em; text-transform: uppercase;
}
.cc-value {
  font-family: var(--display); font-weight: 500;
  font-size: 16px; color: var(--ink); word-break: break-word;
}
.cc-arrow {
  position: absolute; top: 15px; right: 16px;
  font-size: 13px; color: var(--ink-4);
  transition: transform .2s, color .2s;
}
.contact-card:hover .cc-arrow { transform: translate(3px, -3px); color: var(--accent); }

/* ------------------------------------------------------------
   FOOTER
   ------------------------------------------------------------ */
.footer {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: 30px var(--pad-x) 52px;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: flex-end; gap: 40px;
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); line-height: 1.75;
}
.colophon { max-width: 620px; }
.colophon strong { color: var(--ink); font-weight: 600; }
.footer-right { display: flex; flex-direction: column; gap: 7px; text-align: right; flex-shrink: 0; }
.footer-sig {
  font-family: var(--hand); font-size: 24px;
  color: var(--ink-2); letter-spacing: 0;
}
.footer-right a { color: var(--ink-3); transition: color .2s; }
.footer-right a:hover { color: var(--accent); }

/* ------------------------------------------------------------
   SCROLL REVEAL
   ------------------------------------------------------------ */
.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity .6s cubic-bezier(.22,.7,.3,1), transform .6s cubic-bezier(.22,.7,.3,1);
}
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 1180px) {
  .topnav { display: none; }
}

@media (max-width: 1024px) {
  .hero { padding-top: 112px; }
  .hero-split { grid-template-columns: 1fr; gap: 26px; margin-bottom: 36px; }
  .hero-textcol { padding-top: 0; }
  .now-grid { grid-template-columns: repeat(2, 1fr); }
  .now-card.big, .now-card.wide { grid-column: span 2; }
  .work-grid { grid-template-columns: 1fr; }
  .work-card.feature, .work-card.span2 { grid-column: span 1; }
  .stack-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
  .ai-caps.two-up { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar { padding: 10px 18px; }
  .logo-name { display: none; }
  .clock { display: none; }

  .section { padding: 52px var(--pad-x); }
  .section-head { grid-template-columns: 1fr; gap: 14px; }
  .section-art, .margin-doodle, .coffee-ring { display: none; }
  .section-marker { padding-top: 0; }
  .marker-rule { display: inline-block; margin: 0 0 0 12px; vertical-align: 4px; width: 40px; }

  .hero-meta { grid-template-columns: repeat(2, 1fr); gap: 18px; }

  .exp-row { grid-template-columns: 1fr; gap: 14px; }
  .exp-year { display: flex; align-items: baseline; gap: 10px; }
  .exp-year .y-from { font-size: 28px; }
  .exp-year .y-tag { margin-top: 0; }

  .ai-entry { padding: 24px 20px 22px; }
  .ai-head { grid-template-columns: auto 1fr; gap: 14px; }
  .ai-repo { grid-column: 1 / -1; justify-self: start; }
  .ai-caps li { grid-template-columns: 1fr; gap: 4px; }
  .cap-k { color: var(--accent); }

  .now-grid { grid-template-columns: 1fr; }
  .now-card.big, .now-card.wide { grid-column: span 1; }
  .now-card.big p, .now-card.wide p { font-size: 21px; }

  .stack-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }

  .footer { flex-direction: column; align-items: flex-start; gap: 24px; }
  .footer-right { text-align: left; }
}

/* the wobble filter is expensive on very small/low-power devices */
@media (max-width: 480px) {
  .sketch-box::after { display: none; }
}

@media print {
  .topbar, .scroll-progress, .paper-grain, .theme-toggle, .hero-foot { display: none; }
  body::before { display: none; }
  .reveal { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------
   ARCHITECTURE
   ------------------------------------------------------------ */
.section-arch { padding-bottom: 84px; }

.arch-diagram {
  margin: 0 0 26px;
  padding: 26px clamp(18px, 2.6vw, 34px) 30px;
}
.arch-cap {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px;
  padding-bottom: 18px; margin-bottom: 22px;
  border-bottom: 1px dashed var(--rule-2);
}
.arch-cap-hand {
  font-family: var(--hand); font-size: 22px;
  color: var(--accent); line-height: 1;
}
.arch-cap-sub {
  font-size: 14px; color: var(--ink-3); line-height: 1.5;
}

/* the diagram must be able to scroll on its own rather than push the page wide */
.arch-svg-wrap { overflow-x: auto; }
.arch-svg {
  display: block;
  width: 100%; min-width: 720px; height: auto;
  color: var(--ink-2);
}
.arch-svg .d-box path {
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linejoin: round;
  filter: url(#rough-fine);
}
.arch-svg .d-accent path { stroke: var(--accent); stroke-width: 2.4; }
.arch-svg .d-dashed path { stroke-dasharray: 9 7; opacity: .8; }
/* no filter here: a straight H/V path has a zero-area bbox, which collapses an
   objectBoundingBox filter region and makes the line vanish. The wobble is
   drawn into the path data instead. */
.arch-svg .d-link path {
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: .6;
}
.arch-svg text { text-anchor: middle; }
.arch-svg .t-lead {
  font-family: var(--mono); font-size: 15px; font-weight: 500;
  fill: var(--ink);
}
.arch-svg .t-title {
  font-family: var(--display); font-size: 20px; font-weight: 600;
  letter-spacing: -.015em; fill: var(--ink);
}
.arch-svg .t-sub {
  font-family: var(--sans); font-size: 12.5px;
  fill: var(--ink-3);
}

.arch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.arch-card {
  padding: 26px 24px;
  transition: transform .25s ease;
}
.arch-card:hover { transform: translateY(-3px); }
.arch-card.wide { grid-column: span 3; }
.arch-q {
  font-family: var(--display); font-weight: 600;
  font-size: 20px; line-height: 1.22; letter-spacing: -.02em;
  color: var(--ink); margin-bottom: 12px;
  padding-left: 20px; position: relative;
}
.arch-q::before {
  content: ""; position: absolute; left: 0; top: .42em;
  width: 9px; height: 9px;
  border: 1.6px solid var(--accent);
  filter: url(#rough-fine);
}
.arch-card p {
  margin: 0; font-size: 14.5px; line-height: 1.7;
  color: var(--ink-2); text-wrap: pretty;
}
.arch-card p em { font-style: italic; color: var(--ink); }
.arch-card.wide p { max-width: 88ch; }

@media (max-width: 1024px) {
  .arch-grid { grid-template-columns: repeat(2, 1fr); }
  .arch-card.wide { grid-column: span 2; }
}
@media (max-width: 760px) {
  .arch-grid { grid-template-columns: 1fr; }
  .arch-card.wide { grid-column: span 1; }
  .arch-cap { flex-direction: column; gap: 4px; }
}
