/* ============================================================================
   Portfolio — Ashraful Hoque Miraj
   Plain CSS, no framework. Organised as:
   1. Design tokens   2. Reset   3. Layout   4. Components
   5. Sections        6. Responsive   7. Motion & print
   ========================================================================== */

/* ------------------------------------------------------------ 1. TOKENS */
:root {
  /* Colour — light is the default theme */
  --bg:            #f6f8fb;
  --bg-alt:        #ffffff;
  --surface:       #ffffff;
  --surface-2:     #f1f5fa;
  --border:        #dfe6f0;
  --text:          #101a2b;
  --text-muted:    #4b5c74;
  --text-faint:    #5f7189;   /* 4.7:1 on the light surfaces */
  --accent:        #0369a1;
  --accent-strong: #075985;
  --accent-soft:   rgba(3, 105, 161, 0.09);
  --success:       #067a52;
  --meter-track:   #7dd3fc;
  --warning:       #b45309;
  --danger:        #b91c1c;
  --shadow:        0 1px 2px rgba(16,26,43,.06), 0 12px 30px rgba(16,26,43,.08);
  --shadow-sm:     0 1px 2px rgba(16,26,43,.06);

  /* Typography */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
  --step--1: clamp(0.82rem, 0.79rem + 0.14vw, 0.9rem);
  --step-0:  clamp(0.98rem, 0.94rem + 0.2vw, 1.08rem);
  --step-1:  clamp(1.15rem, 1.08rem + 0.35vw, 1.35rem);
  --step-2:  clamp(1.4rem, 1.26rem + 0.7vw, 1.85rem);
  --step-3:  clamp(1.75rem, 1.5rem + 1.25vw, 2.6rem);
  --step-4:  clamp(2.2rem, 1.7rem + 2.4vw, 3.9rem);

  /* Space & shape */
  --space-1: .25rem; --space-2: .5rem;  --space-3: .75rem; --space-4: 1rem;
  --space-5: 1.5rem; --space-6: 2rem;   --space-7: 3rem;   --space-8: 4.5rem;
  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --container: 1140px;
  --header-h:  68px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* The visitor can switch to dark; the choice is remembered. */
:root[data-theme="dark"] {
  --bg:            #0b1220;
  --bg-alt:        #0e1729;
  --surface:       #121c30;
  --surface-2:     #16223a;
  --border:        #1f2f4d;
  --text:          #e6edf7;
  --text-muted:    #9fb0c9;
  --text-faint:    #6b7f9e;
  --accent:        #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-soft:   rgba(56, 189, 248, 0.12);
  --success:       #34d399;
  --meter-track:   #24618a;
  --warning:       #fbbf24;
  --danger:        #f87171;
  --shadow:        0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.35);
  --shadow-sm:     0 1px 2px rgba(0,0,0,.25);
}

/* ------------------------------------------------------------- 2. RESET */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; }
p { text-wrap: pretty; }

/* Japanese and Bangla: tight tracking crowds Japanese glyphs and breaks Bangla's
   joined letter forms, and Bangla's tall vowel signs need more line height. */
:lang(ja) :is(h1, h2, h3, h4, .section-kicker, .subhead),
:lang(bn) :is(h1, h2, h3, h4, .section-kicker, .subhead) { letter-spacing: normal; }
:lang(ja) :is(h1, h2, h3) { word-break: auto-phrase; }
:lang(bn) :is(h1, h2, h3, h4) { line-height: 1.4; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
ul[role="list"] { list-style: none; padding: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }

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

::selection { background: var(--accent); color: #fff; }
:root[data-theme="dark"] ::selection { color: #04121f; }

.skip-link {
  position: absolute;
  left: 1rem; top: -100px;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 1rem; }

/* ------------------------------------------------------------ 3. LAYOUT */
.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.section { padding-block: var(--space-8); }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }

.section-head { max-width: 46rem; margin-bottom: var(--space-7); }
.section-kicker {
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.section-title { font-size: var(--step-3); text-wrap: balance; }
.section-sub { color: var(--text-muted); margin-top: var(--space-3); font-size: var(--step-1); }
.accent { color: var(--accent); }

/* ------------------------------------------------------------ 4. HEADER */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--border); }

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}

.nav-list { display: flex; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block;
  padding: .45rem .7rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--step--1);
  font-weight: 550;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.nav-list a:hover { color: var(--text); background: var(--surface-2); }
.nav-list a.is-active { color: var(--accent); background: var(--accent-soft); }

.header-actions { display: flex; align-items: center; gap: var(--space-2); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.nav-toggle { display: none; }

/* Language picker: a native select dressed like the icon buttons */
.lang-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
}
.lang-picker svg { position: absolute; left: .7rem; pointer-events: none; }
.lang-picker select {
  appearance: none;
  height: 38px;
  padding: 0 .8rem 0 2.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.lang-picker:hover { color: var(--accent); }
.lang-picker select:hover { border-color: var(--accent); }
.lang-picker option { color: var(--text); background: var(--surface); }
@media (max-width: 480px) {
  /* Globe only on small phones; the native list still names every language. */
  .lang-picker select { width: 38px; padding: 0; color: transparent; }
  .lang-picker svg { left: 50%; transform: translateX(-50%); }
}

/* Show the sun in light mode, the moon in dark mode */
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
:root[data-theme="dark"] .icon-sun { display: none; }

.scroll-progress {
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width .1s linear;
}

/* -------------------------------------------------------------- 5. HERO */
.hero {
  position: relative;
  padding-block: clamp(3.5rem, 7vw, 6.5rem) var(--space-8);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -30% 40% 40% -10%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: .25;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  pointer-events: none;
}
.hero > * { position: relative; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
/* Grid and flex children default to min-width:auto, which lets wide content
   (the terminal's <pre>) stretch the track and scroll the whole page. */
.hero-grid > *, .about-grid > *, .contact-grid > *, .timeline-body { min-width: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .35rem .8rem;
  border-radius: 999px;
  margin-bottom: var(--space-5);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero-title { font-size: var(--step-4); letter-spacing: -0.035em; text-wrap: balance; }
.hero-lede {
  color: var(--text-muted);
  font-size: var(--step-1);
  max-width: 34rem;
  margin-top: var(--space-4);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }

/* Three equal columns: longer translated labels wrap inside their column
   instead of pushing a stat onto a row of its own. */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  list-style: none;
  padding-inline: 0;
}
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong {
  font-size: var(--step-2);
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.hero-stats span { font-size: var(--step--1); color: var(--text-faint); }

/* Terminal */
.terminal {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0d1526;
  box-shadow: var(--shadow);
  overflow: hidden;
}
:root[data-theme="dark"] .terminal { background: #0a1120; }
.terminal-bar {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .7rem .9rem;
  background: #0e1729;
  border-bottom: 1px solid #1c2b47;
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-red { background: #ff5f57; } .dot-amber { background: #febc2e; } .dot-green { background: #28c840; }
.terminal-title {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: .74rem;
  color: #6b7f9e;
}
.terminal-body {
  margin: 0;
  padding: var(--space-5);
  font-family: var(--font-mono);
  font-size: clamp(.72rem, .55rem + .45vw, .82rem);
  line-height: 1.75;
  color: #cfe0f5;
  overflow-x: auto;
}
.c-prompt { color: #38bdf8; } .c-cmd { color: #e6edf7; font-weight: 600; }
.c-ok { color: #34d399; } .c-dim { color: #7d90ad; }
.cursor {
  display: inline-block;
  width: 8px; height: 1em;
  background: #38bdf8;
  vertical-align: text-bottom;
  animation: blink 1.1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

/* --------------------------------------------------------- 6. COMPONENTS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .72rem 1.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: var(--step--1);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s var(--ease), background .15s var(--ease),
              border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 20px -8px var(--accent);
}
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .btn-primary:hover { color: #04121f; }
.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-weight: 600;
  font-size: var(--step--1);
  text-decoration: none;
}
.text-link svg { transition: transform .15s var(--ease); }
.text-link:hover svg { transform: translateX(3px); }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; }
.tags li {
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: .22rem .55rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.tags.subtle li { background: var(--surface-2); color: var(--text-faint); border-color: var(--border); }

/* ------------------------------------------------------------- METERS */
/* Each meter is one ratio against a fixed limit, direct-labelled with its
   own number. The rings are read individually; the bars share one scale so
   the areas can be compared against each other. */
.subhead {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: var(--space-5);
}
.meters { margin-bottom: var(--space-7); }

/* Rings */
.rings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: var(--space-5) var(--space-4);
  margin: 0;
  padding: 0;
}
.ring-item { text-align: center; }
.ring {
  position: relative;
  display: block;
  width: clamp(104px, 11vw, 128px);
  margin: 0 auto var(--space-3);
  aspect-ratio: 1;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; stroke-width: 7; }
.ring-track { stroke: var(--meter-track); }
.ring-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  /* 2·π·r with r = 52 */
  --circumference: 326.726;
  stroke-dasharray: var(--circumference);
  stroke-dashoffset: calc(var(--circumference) - var(--circumference) * var(--pct) / 100);
}
.ring-figure {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.ring-figure .num {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--text);
}
.ring-figure .unit { font-size: .62em; color: var(--text-faint); margin-left: 1px; }
.ring-name { font-weight: 600; font-size: var(--step--1); }
.ring-meta { font-size: .75rem; color: var(--text-faint); }

/* Bars */
.bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: var(--space-5) var(--space-6);
  margin: 0;
  padding: 0;
}
.bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: .45rem;
}
.bar-name { font-weight: 600; font-size: var(--step--1); }
.bar-value {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.bar-value .unit { color: var(--text-faint); }
.bar-track {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--meter-track);
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  width: calc(var(--pct) * 1%);
  border-radius: 999px;
  background: var(--accent);
}
.bar-meta { font-size: .75rem; color: var(--text-faint); margin-top: .4rem; }

/* Without JavaScript the meters render at their final value. With it, they
   start empty and fill when scrolled into view. */
.js .ring-fill { stroke-dashoffset: var(--circumference); }
.js .is-shown .ring-fill {
  stroke-dashoffset: calc(var(--circumference) - var(--circumference) * var(--pct) / 100);
  transition: stroke-dashoffset 1.1s var(--ease);
}
.js .bar-fill { width: 0; }
.js .is-shown .bar-fill {
  width: calc(var(--pct) * 1%);
  transition: width .9s var(--ease);
}

/* Expertise — a tinted band with a circular glyph per tool, echoing the
   card grid it replaced but naming the actual technologies. */
.section-accent {
  background:
    radial-gradient(ellipse 70% 60% at 50% 0%, var(--accent-soft), transparent 70%),
    var(--bg-alt);
  border-block: 1px solid var(--border);
}
.section-head-center { margin-inline: auto; text-align: center; }
.section-head-center .section-sub { margin-inline: auto; }

.expertise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: clamp(2rem, 4vw, 3rem) var(--space-6);
  margin: 0;
  padding: 0;
}
.expertise-item { text-align: center; }
.expertise-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 6%, transparent);
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.expertise-item:hover .expertise-icon {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 10%, transparent);
}
.expertise-name {
  font-size: var(--step-1);
  margin-bottom: var(--space-2);
  transition: color .2s var(--ease);
}
.expertise-item:hover .expertise-name { color: var(--accent); }

/* Icons draw themselves once as their card reveals. main.js sets --len to
   each stroke's length; without it the icons simply render in full. */
.js .expertise-icon svg > * {
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
  transition: stroke-dashoffset 1.1s var(--ease) .25s;
}
.js .expertise-item.is-visible .expertise-icon svg > * { stroke-dashoffset: 0; }
.expertise-desc {
  color: var(--text-muted);
  font-size: var(--step--1);
  max-width: 34ch;
  margin-inline: auto;
}

/* ---------------------------------------------------------- 7. SECTIONS */
/* About */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
.about-copy p { color: var(--text-muted); margin-bottom: var(--space-4); max-width: 60ch; }
.about-points { margin-top: var(--space-5); display: grid; gap: .6rem; }
.about-points li {
  position: relative;
  padding-left: 1.6rem;
  color: var(--text-muted);
  font-size: var(--step--1);
}
.about-points li::before {
  content: "";
  position: absolute;
  left: 0; top: .55em;
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
}

.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
}
.about-card h3 { font-size: var(--step-0); text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); margin-bottom: var(--space-4); }
.facts { display: grid; gap: .75rem; margin-bottom: var(--space-5); }
.facts > div { display: grid; grid-template-columns: 6.5rem 1fr; gap: .75rem; align-items: baseline; }
.facts dt { font-size: var(--step--1); color: var(--text-faint); }
.facts dd { margin: 0; font-size: var(--step--1); font-weight: 550; }

/* Timeline — a centre spine with entries alternating either side. Below
   900px it collapses to a single left-hand rail. */
.timeline {
  --spine: 2px;
  --gutter: clamp(1.75rem, 4vw, 3rem);
  position: relative;
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline::before {
  content: "";
  position: absolute;
  top: .35rem;
  bottom: .35rem;
  left: 50%;
  width: var(--spine);
  transform: translateX(-50%);
  background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 15%, transparent));
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  width: calc(50% - var(--gutter));
}
.timeline-item:nth-child(odd) {
  justify-self: start;
  text-align: right;
}
.timeline-item:nth-child(even) { justify-self: end; }

.timeline-marker {
  position: absolute;
  top: .3rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 2px solid var(--accent);
}
.timeline-item:nth-child(odd) .timeline-marker { right: calc(var(--gutter) * -1 - 9px); }
.timeline-item:nth-child(even) .timeline-marker { left: calc(var(--gutter) * -1 - 9px); }
.timeline-item.is-current .timeline-marker {
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-faint);
  letter-spacing: .04em;
}
.timeline-role { font-size: var(--step-2); margin-top: .3rem; }
.timeline-company {
  font-size: var(--step-0);
  font-weight: 600;
  color: var(--accent);
  margin-top: .15rem;
}
.timeline-summary {
  color: var(--text-muted);
  margin: var(--space-4) 0;
  max-width: 46ch;
}
.timeline-item:nth-child(odd) .timeline-summary { margin-left: auto; }
.timeline-item:nth-child(odd) .tags { justify-content: flex-end; }

.bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4);
  display: grid;
  gap: .5rem;
  max-width: 46ch;
}
.bullets li {
  position: relative;
  padding-left: 1.4rem;
  color: var(--text-muted);
  font-size: var(--step--1);
}
.bullets li::before {
  content: "\25B8";
  position: absolute;
  left: 0;
  color: var(--accent);
}
/* Mirror the markers on the left-hand column so they point at the spine. */
.timeline-item:nth-child(odd) .bullets { margin-left: auto; }
.timeline-item:nth-child(odd) .bullets li { padding-left: 0; padding-right: 1.4rem; }
.timeline-item:nth-child(odd) .bullets li::before { content: "\25C2"; left: auto; right: 0; }

@media (max-width: 900px) {
  .timeline { --gutter: 1.6rem; gap: var(--space-7); }
  .timeline::before { left: 8px; transform: none; }
  .timeline-item,
  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    width: 100%;
    justify-self: stretch;
    text-align: left;
    padding-left: 2.5rem;
  }
  .timeline-item:nth-child(odd) .timeline-marker,
  .timeline-item:nth-child(even) .timeline-marker { left: 0; right: auto; }
  .timeline-item:nth-child(odd) .timeline-summary { margin-left: 0; }
  .timeline-item:nth-child(odd) .tags { justify-content: flex-start; }
  .timeline-item:nth-child(odd) .bullets { margin-left: 0; }
  .timeline-item:nth-child(odd) .bullets li { padding-left: 1.4rem; padding-right: 0; }
  .timeline-item:nth-child(odd) .bullets li::before { content: "\25B8"; left: 0; right: auto; }
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: var(--space-4);
}
.project {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.project:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow);
}
.project-head { display: flex; align-items: center; gap: .75rem; }
.project-glyph {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.project-title { font-size: var(--step-1); }
.project-desc { color: var(--text-muted); font-size: var(--step--1); flex: 1; }
.project-links {
  display: flex;
  gap: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.project-links a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: none;
}
.project-links a:hover { text-decoration: underline; }

/* Certifications */
.certs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
  gap: var(--space-4);
}
.cert {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
}
.cert-badge {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  flex: none;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.cert h3 { font-size: var(--step-0); }
.cert p { font-size: var(--step--1); color: var(--text-faint); }

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: var(--space-6);
  align-items: start;
}
.contact-side { display: grid; gap: var(--space-3); }
.contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.contact-item:hover { border-color: var(--accent); transform: translateX(3px); color: var(--text); }
.contact-icon {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.contact-item span:last-child { display: grid; font-size: var(--step--1); color: var(--text-muted); word-break: break-word; }
.contact-item strong { color: var(--text); font-size: var(--step--1); }
.contact-note { font-size: var(--step--1); color: var(--text-faint); padding: var(--space-2) var(--space-1); }

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: grid;
  gap: var(--space-4);
}
.field { display: grid; gap: .4rem; }
.field label { font-size: var(--step--1); font-weight: 600; color: var(--text-muted); }
.field input, .field textarea {
  width: 100%;
  padding: .7rem .85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--step--1);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--danger); }
.error { font-size: .78rem; color: var(--danger); }
.form-status { font-size: var(--step--1); color: var(--text-muted); min-height: 1.2em; }
.form-status.is-success { color: var(--success); }
.form-status.is-error { color: var(--danger); }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding-block: var(--space-6); background: var(--bg); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.footer-brand { font-weight: 700; letter-spacing: -0.02em; }
.footer-copy { font-size: var(--step--1); color: var(--text-faint); }
.footer-links { display: flex; gap: var(--space-4); list-style: none; margin: 0; padding: 0; }
.footer-links a { font-size: var(--step--1); color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* Back to top */
.back-to-top {
  position: fixed;
  right: 1.25rem; bottom: 1.25rem;
  z-index: 90;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  transition: opacity .2s var(--ease), transform .2s var(--ease), color .15s var(--ease);
}
.back-to-top:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.back-to-top[hidden] { display: none; }

/* -------------------------------------------------------- 8. RESPONSIVE */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .about-card { position: static; }
}

@media (max-width: 720px) {
  :root { --space-8: 3.25rem; }

  .nav-toggle { display: grid; }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: grid;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height .25s var(--ease), visibility .25s var(--ease);
  }
  .nav.is-open { max-height: 22rem; visibility: visible; }
  .nav-list { flex-direction: column; gap: 0; padding: var(--space-3); }
  .nav-list a { padding: .8rem 1rem; font-size: var(--step-0); }

  .hero-stats { gap: var(--space-5); }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
  .hero-cta .btn { width: 100%; }
  .hero-stats { gap: var(--space-4); }
  .hero-stats strong { font-size: var(--step-1); }
  .facts > div { grid-template-columns: 1fr; gap: 0; }
}

/* --------------------------------------------------- 9. MOTION & PRINT */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .back-to-top, .hero-visual, .contact-form, .hero-cta { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding-block: 1.5rem; break-inside: avoid; }
  a::after { content: " (" attr(href) ")"; font-size: .75em; color: #555; }
  a[href^="#"]::after { content: ""; }
}
