/* ============================================================================
   Cloud Engineer Portfolio — stylesheet
   ----------------------------------------------------------------------------
   Organisation:
     1.  Design tokens (dark default + light override)
     2.  Reset & base
     3.  Utilities (container, mono, sr-only, reveal animation)
     4.  Buttons, icons, tags, cards
     5.  Navbar
     6.  Hero + terminal
     7.  Sections: about, skills, certifications, projects, experience, writing
     8.  Contact form
     9.  Footer
     10. Responsive breakpoints
     11. Reduced motion / print
   Accent colour lives in a single token: --accent. Change it once, done.
   ========================================================================= */

/* ---------------------------------------------------------------------------
   1. DESIGN TOKENS
   Dark is the default theme (declared on :root). Light is an override applied
   via [data-theme="light"], which the inline head script + toggle set.
   ------------------------------------------------------------------------ */
:root {
  /* Accent — "cloud blue" */
  --accent:         #3b82f6;
  --accent-strong:  #60a5fa;
  --accent-soft:    rgba(59, 130, 246, 0.14);
  --accent-border:  rgba(59, 130, 246, 0.38);

  /* Surfaces & text (dark) */
  --bg:             #0b1120;
  --bg-alt:         #0e1627;
  --surface:        #121c31;
  --surface-hover:  #16233d;
  --border:         #1f2d49;
  --text:           #e8eefc;
  --text-muted:     #9fb0cc;
  --text-faint:     #6f82a3;

  /* Semantic */
  --ok:             #34d399;
  --err:            #f87171;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Shape & depth */
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .55);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .7);

  /* Layout */
  /* Translucent navbar backdrop + hero bloom (explicit per theme so no
     color-mix() support is required) */
  --bg-blur:    rgba(11, 17, 32, .82);
  --accent-dim: rgba(59, 130, 246, .24);
  --ok-ring:    rgba(52, 211, 153, .22);

  --nav-h:  66px;
  --maxw:   1140px;

  color-scheme: dark;
}

:root[data-theme='light'] {
  --accent:         #2563eb;
  --accent-strong:  #1d4ed8;
  --accent-soft:    rgba(37, 99, 235, 0.09);
  --accent-border:  rgba(37, 99, 235, 0.28);

  --bg:             #f7f9fc;
  --bg-alt:         #eef2f9;
  --surface:        #ffffff;
  --surface-hover:  #f3f6fc;
  --border:         #dbe3ef;
  --text:           #0d1626;
  --text-muted:     #4a5a74;
  --text-faint:     #76859c;

  --ok:             #059669;
  --err:            #dc2626;

  --shadow:    0 1px 2px rgba(16, 32, 64, .06), 0 10px 28px -14px rgba(16, 32, 64, .18);
  --shadow-lg: 0 24px 56px -22px rgba(16, 32, 64, .26);

  --bg-blur:    rgba(247, 249, 252, .82);
  --accent-dim: rgba(37, 99, 235, .16);
  --ok-ring:    rgba(5, 150, 105, .18);

  color-scheme: light;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .25s ease, color .25s ease;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
p  { margin: 0 0 1rem; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: none; }

code { font-family: var(--font-mono); font-size: .88em; }

/* Visible, consistent keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link for keyboard & screen-reader users */
.skip-link {
  position: fixed;
  top: -200%;
  left: 12px;
  z-index: 200;
  padding: .7rem 1.1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.skip-link:focus { top: 0; }

/* ---------------------------------------------------------------------------
   3. UTILITIES
   ------------------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}

.mono { font-family: var(--font-mono); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.grad {
  background: linear-gradient(100deg, var(--accent-strong), #22d3ee 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Fade-in-on-scroll. JS adds .is-visible via IntersectionObserver.
   Scoped to .js so content is never hidden when scripts don't run. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s cubic-bezier(.22, 1, .36, 1),
              transform .6s cubic-bezier(.22, 1, .36, 1);
  will-change: opacity, transform;
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------------------------------------------------------------------------
   4. BUTTONS / ICONS / TAGS / CARDS
   ------------------------------------------------------------------------ */
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .78rem 1.3rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .18s ease, background-color .18s ease,
              border-color .18s ease, box-shadow .18s ease;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px -12px var(--accent);
}
.btn--primary:hover { background: var(--accent-strong); transform: translateY(-2px); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { border-color: var(--accent-border); background: var(--accent-soft); transform: translateY(-2px); }
.btn--block { width: 100%; justify-content: center; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent-border); background: var(--accent-soft); }

/* Theme toggle shows the icon for the theme you'd switch *to* */
.icon--sun  { display: none; }
:root[data-theme='light'] .icon--moon { display: none; }
:root[data-theme='light'] .icon--sun  { display: block; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .2rem; }
.tag {
  padding: .22rem .6rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .01em;
  white-space: nowrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease, background-color .22s ease;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--text-muted);
  font-size: .87rem;
  font-weight: 600;
  transition: color .18s ease, gap .18s ease;
}
.link-arrow:hover { color: var(--accent-strong); gap: .6rem; }

.grid { display: grid; gap: 1.1rem; }

/* ---------------------------------------------------------------------------
   5. NAVBAR
   ------------------------------------------------------------------------ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-blur);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, box-shadow .25s ease;
}
/* JS adds .is-scrolled once the page moves, so the bar gains an edge */
.nav.is-scrolled { border-bottom-color: var(--border); box-shadow: 0 8px 24px -20px rgba(0,0,0,.9); }

.nav__inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav__brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  letter-spacing: -.02em;
}
.nav__brand-prompt { color: var(--accent); }

.nav__links { display: flex; align-items: center; gap: .25rem; }
.nav__links a {
  padding: .5rem .72rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: color .18s ease, background-color .18s ease;
}
.nav__links a:hover { color: var(--text); background: var(--surface-hover); }
/* Current section, set by the scroll-spy observer */
.nav__links a.is-active { color: var(--accent-strong); background: var(--accent-soft); }

.nav__actions { display: flex; align-items: center; gap: .5rem; }
.nav__burger { display: none; }

/* ---------------------------------------------------------------------------
   6. HERO + TERMINAL
   ------------------------------------------------------------------------ */
.hero { position: relative; padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem); overflow: hidden; }

/* Soft accent bloom behind the hero */
.hero__glow {
  position: absolute;
  top: -28%; left: 50%;
  width: min(1100px, 130vw);
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 50%, var(--accent-dim) 0%, transparent 62%);
  pointer-events: none;
  z-index: 0;
}

.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1.1rem;
  padding: .32rem .75rem .32rem .6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: .76rem;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-ring);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

.hero__title { font-size: clamp(2.3rem, 6.2vw, 4rem); font-weight: 800; margin-bottom: .35rem; }
.hero__subtitle {
  margin: 0 0 1.1rem;
  font-size: clamp(1.02rem, 2.3vw, 1.3rem);
  font-weight: 600;
  color: var(--text-muted);
}
.hero__subtitle .sep { color: var(--accent); margin: 0 .35rem; }
.hero__value { max-width: 48ch; font-size: 1.04rem; color: var(--text-muted); }
.hero__meta { display: flex; align-items: center; gap: .45rem; color: var(--text-faint); font-size: .82rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.6rem; }

/* --- terminal window --- */
.terminal {
  background: #080d18;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
:root[data-theme='light'] .terminal { border-color: #cbd5e6; }

.terminal__bar {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .6rem .85rem;
  background: #0d1424;
  border-bottom: 1px solid #1b2742;
}
.terminal__dot { width: 11px; height: 11px; border-radius: 50%; }
.terminal__dot--red   { background: #ff5f57; }
.terminal__dot--amber { background: #febc2e; }
.terminal__dot--green { background: #28c840; }
.terminal__title { margin-left: .6rem; color: #64748b; font-size: .74rem; }

.terminal__body {
  margin: 0;
  padding: 1.1rem 1.2rem;
  min-height: 310px;
  max-height: 340px;
  overflow: hidden;
  color: #cbd5e1;
  font-size: .8rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
/* Syntax-ish colouring for the typed lines */
.t-prompt  { color: #22d3ee; }
.t-cmd     { color: #e2e8f0; }
.t-ok      { color: #34d399; }
.t-info    { color: #94a3b8; }
.t-warn    { color: #fbbf24; }
.t-accent  { color: var(--accent-strong); }
.t-cursor {
  display: inline-block;
  width: 7px;
  background: #22d3ee;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------------------------------------------------------------------------
   7. SECTIONS
   ------------------------------------------------------------------------ */
.section { padding: clamp(3.2rem, 7vw, 5.5rem) 0; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border); }

.section__head { max-width: 62ch; margin-bottom: clamp(1.8rem, 4vw, 2.8rem); }
.section__kicker {
  margin: 0 0 .5rem;
  color: var(--accent);
  font-size: .76rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.section__title { font-size: clamp(1.7rem, 4vw, 2.4rem); }
.section__lede { margin: .6rem 0 0; color: var(--text-muted); }

/* --- About --- */
.about { display: grid; grid-template-columns: 300px 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.about__photo { margin: 0; }
.about__photo img {
  width: 100%;
  aspect-ratio: 7 / 8;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.about__photo figcaption { margin-top: .6rem; color: var(--text-faint); font-size: .74rem; text-align: center; }
.about__body p { color: var(--text-muted); }
.about__body strong { color: var(--text); font-weight: 600; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .8rem;
  margin-top: 1.8rem;
}
.fact {
  padding: .95rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}
.fact dt { color: var(--text-faint); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; }
.fact dd { margin: .15rem 0 0; }
.fact__num { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; color: var(--text); }

/* --- Skills --- */
.grid--skills { grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); }
.card--skill { padding: 1.3rem; }
.card--skill:hover { transform: translateY(-4px); border-color: var(--accent-border); box-shadow: var(--shadow-lg); }
.card--skill h3 { font-size: 1.02rem; margin-bottom: .8rem; }
.card__icon {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  margin-bottom: .85rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 11px;
  color: var(--accent-strong);
}
.card__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* --- Certifications ---
   Capped track width + left-aligned (not 1fr-stretched) so a single badge
   doesn't balloon to the full container width with a mostly-empty card. */
.grid--certs { grid-template-columns: repeat(auto-fit, minmax(252px, 320px)); justify-content: start; }
.card--cert {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'badge meta' 'badge link';
  gap: .2rem 1rem;
  padding: 1.25rem;
  align-items: start;
}
.card--cert:hover { transform: translateY(-4px); border-color: var(--accent-border); box-shadow: var(--shadow-lg); }
.cert__badge {
  grid-area: badge;
  display: grid;
  place-items: center;
  width: 54px; height: 54px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .82rem;
  color: #fff;
}
.cert__badge--aws   { background: linear-gradient(145deg, #ff9900, #d97706); }
.cert__badge--azure { background: linear-gradient(145deg, #2f80ed, #0b5bd3); }
.cert__badge--k8s   { background: linear-gradient(145deg, #326ce5, #1d4ed8); font-size: .72rem; }
.cert__meta { grid-area: meta; }
.card--cert h3 { font-size: .98rem; margin-bottom: .15rem; }
.cert__issuer { margin: 0; color: var(--text-muted); font-size: .85rem; }
.cert__date { margin: .1rem 0 .55rem; color: var(--text-faint); font-size: .74rem; }
.card--cert .link-arrow { grid-area: link; }

/* --- Projects carousel ---
   Two cards per page on desktop/tablet, one per page on narrow screens (matches the
   .projects-carousel__track > .card--project rule below). Native scroll-snap does the
   paging; js/main.js only adds the arrow buttons, dots and keyboard support on top —
   the carousel still works (full horizontal swipe/scroll) with JS disabled. */
.projects-carousel__viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  /* Scrolling still works without a visible scrollbar — the arrow buttons and dots
     are the primary affordance; this just keeps the card edges clean. */
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-radius: var(--radius);
}
.projects-carousel__viewport::-webkit-scrollbar { display: none; }

.projects-carousel__track {
  display: flex;
  gap: 1.1rem;
}

.projects-carousel__track > .card--project {
  flex: 0 0 calc(50% - .55rem);
  min-width: 0; /* let long diagram alt/caption text wrap instead of forcing overflow */
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

@media (max-width: 760px) {
  .projects-carousel__track > .card--project { flex-basis: 100%; }
}

.projects-carousel__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  margin-top: 1.4rem;
}

.projects-carousel__arrow:disabled {
  opacity: .35;
  cursor: not-allowed;
  border-color: var(--border);
  background: transparent;
  color: var(--text-muted);
  transform: none;
}

.projects-carousel__dots { display: flex; align-items: center; gap: .5rem; }
.projects-carousel__dot {
  width: 8px; height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background-color .18s ease, transform .18s ease;
}
.projects-carousel__dot:hover { background: var(--accent-border); }
.projects-carousel__dot.is-active { background: var(--accent); transform: scale(1.3); }

.card--project { display: flex; flex-direction: column; overflow: hidden; }
.card--project:hover { transform: translateY(-5px); border-color: var(--accent-border); box-shadow: var(--shadow-lg); }

.project__figure {
  display: block;
  border-bottom: 1px solid var(--border);
  background: #0d1424;
  overflow: hidden;
}
.project__figure img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform .4s cubic-bezier(.22, 1, .36, 1);
}
.card--project:hover .project__figure img { transform: scale(1.035); }

/* Some architecture exports are much wider than 16:9 (a banner-style diagram
   rather than a 3:2-ish screenshot) — cropping those to 'cover' would cut off
   the labelled regions at both edges. 'contain' letterboxes instead, so the
   whole diagram stays legible in the thumbnail. */
.project__figure--contain img { object-fit: contain; }

.project__body { display: flex; flex-direction: column; gap: .85rem; padding: 1.25rem; flex: 1; }
.project__body h3 { font-size: 1.1rem; margin: 0; }
.project__desc { margin: 0; color: var(--text-muted); font-size: .92rem; }
.project__desc strong { color: var(--text); }
.project__desc code { color: var(--accent-strong); }
.project__links { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: auto; padding-top: .3rem; }

/* --- Experience timeline --- */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  top: .4rem; bottom: .4rem; left: 7px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--border) 85%);
}
.timeline__item { position: relative; padding-bottom: 1.2rem; }
.timeline__marker {
  position: absolute;
  top: 1.45rem; left: calc(-2rem + 1px);
  width: 14px; height: 14px;
  background: var(--bg);
  border: 3px solid var(--accent);
  border-radius: 50%;
}
.section--alt .timeline__marker { background: var(--bg-alt); }
.timeline__card { padding: 1.3rem 1.4rem; }
.timeline__card:hover { border-color: var(--accent-border); }
.timeline__dates { margin: 0 0 .3rem; color: var(--accent); font-size: .76rem; letter-spacing: .04em; }
.timeline__card h3 { font-size: 1.08rem; margin-bottom: .7rem; }
.timeline__company { color: var(--text-muted); font-weight: 500; }

.bullets { display: grid; gap: .45rem; }
.bullets li {
  position: relative;
  padding-left: 1.15rem;
  color: var(--text-muted);
  font-size: .93rem;
}
.bullets li::before {
  content: '▸';
  position: absolute; left: 0;
  color: var(--accent);
  font-size: .8rem;
}
.bullets strong { color: var(--text); font-weight: 600; }

/* --- Writing --- */
.posts { display: grid; gap: .8rem; }
.post > a {
  display: block;
  position: relative;
  padding: 1.15rem 3rem 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  transition: transform .2s ease, border-color .2s ease, background-color .2s ease;
}
.post > a:hover { transform: translateX(5px); border-color: var(--accent-border); background: var(--surface-hover); }
.post__meta { display: block; color: var(--text-faint); font-size: .74rem; }
.post h3 { font-size: 1.02rem; margin: .2rem 0 .25rem; }
.post p { margin: 0; color: var(--text-muted); font-size: .9rem; }
.post__arrow {
  position: absolute;
  top: 50%; right: 1.2rem;
  transform: translateY(-50%);
  color: var(--text-faint);
  transition: color .2s ease;
}
.post > a:hover .post__arrow { color: var(--accent-strong); }

/* ---------------------------------------------------------------------------
   8. CONTACT
   ------------------------------------------------------------------------ */
.contact { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1.6rem; align-items: start; }
.contact__form { padding: 1.5rem; display: grid; gap: 1rem; }

.field { display: grid; gap: .35rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.field input, .field textarea {
  width: 100%;
  padding: .7rem .85rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .94rem;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field textarea { resize: vertical; min-height: 120px; }
.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(--err); }
.field__error { margin: 0; min-height: 1rem; color: var(--err); font-size: .78rem; }
/* Honeypot — hidden from humans without display:none (some bots skip those) */
.field--hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form__status { margin: 0; min-height: 1.2rem; font-size: .87rem; }
.form__status[data-state='ok']   { color: var(--ok); }
.form__status[data-state='err']  { color: var(--err); }
.form__status[data-state='info'] { color: var(--text-muted); }

.contact__aside { padding: .2rem 0 0; }
.contact__aside h3 { font-size: 1rem; margin-bottom: .9rem; }
.contact__links { display: grid; gap: .6rem; }
.contact__links a {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: transform .18s ease, border-color .18s ease, background-color .18s ease;
}
.contact__links a:hover { transform: translateX(4px); border-color: var(--accent-border); background: var(--surface-hover); }
.contact__links .icon { flex: none; color: var(--accent-strong); }
.contact__links span { display: grid; }
.contact__links strong { font-size: .9rem; font-weight: 600; }
.contact__links em { color: var(--text-faint); font-size: .78rem; font-style: normal; }
.contact__note { margin: 1.2rem 0 0; color: var(--text-faint); font-size: .84rem; }
.contact__note strong { color: var(--text-muted); }

/* ---------------------------------------------------------------------------
   9. FOOTER
   ------------------------------------------------------------------------ */
.footer { padding: 1.8rem 0; border-top: 1px solid var(--border); background: var(--bg-alt); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; }
.footer__copy { margin: 0; color: var(--text-faint); font-size: .82rem; }
.footer__counter { display: flex; align-items: center; gap: .45rem; margin: 0; color: var(--text-faint); font-size: .8rem; }
.footer__counter .icon { color: var(--accent); }
#visitor-count { color: var(--text); font-weight: 700; }
#visitor-count[data-state='loading'] { color: var(--text-faint); font-weight: 400; }
#visitor-count[data-state='error']   { color: var(--text-faint); font-weight: 400; }

/* ---------------------------------------------------------------------------
   10. RESPONSIVE
   ------------------------------------------------------------------------ */
@media (max-width: 980px) {
  .hero__inner { grid-template-columns: 1fr; }
  .terminal { order: 2; }
  .about    { grid-template-columns: 1fr; }
  .about__photo { max-width: 260px; }
  .contact  { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  /* Collapse the nav into a slide-down panel */
  .nav__burger { display: inline-grid; }
  .nav__links {
    position: absolute;
    top: var(--nav-h); left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: .15rem;
    padding: .7rem 16px 1.1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    /* Hidden by default; .is-open reveals it */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
  }
  .nav__links.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav__links a { padding: .7rem .8rem; font-size: .96rem; }

  .hero { padding-top: 2.6rem; }
  .hero__cta .btn { flex: 1 1 auto; justify-content: center; }
  .terminal__body { min-height: 230px; max-height: 260px; font-size: .72rem; padding: .9rem 1rem; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 460px) {
  .facts { grid-template-columns: 1fr 1fr; }
  .card--cert { grid-template-columns: 1fr; grid-template-areas: 'badge' 'meta' 'link'; gap: .7rem; }
  .timeline { padding-left: 1.5rem; }
  .timeline__marker { left: calc(-1.5rem + 1px); }
}

/* ---------------------------------------------------------------------------
   11. REDUCED MOTION & PRINT
   ------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html, .projects-carousel__viewport { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  /* Never leave content invisible when animations are off */
  .js .reveal { opacity: 1 !important; transform: none !important; }
}

@media print {
  .nav, .hero__glow, .terminal, .contact__form, .footer__counter, .skip-link { display: none !important; }
  .projects-carousel__nav { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .post > a { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  a[href^='http']::after { content: ' (' attr(href) ')'; font-size: .75em; color: #555; }
  /* Printing can't scroll — lay every project out in one column instead of clipping
     whichever page the carousel happened to be on. */
  .projects-carousel__viewport { overflow: visible; }
  .projects-carousel__track { flex-direction: column; }
  .projects-carousel__track > .card--project { flex-basis: auto; }
}
