/* ============================================
   PORTFOLIO — STYLES
   Minimal, near-monochrome: Poppins, a light hero band, centred section
   titles, alternating white / light-grey sections, underline-style links
   and form fields.
   ============================================ */

@font-face {
  font-family: 'Poppins';
  src: url('../assets/fonts/poppins-300.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Poppins';
  src: url('../assets/fonts/poppins-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Poppins';
  src: url('../assets/fonts/poppins-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Poppins';
  src: url('../assets/fonts/poppins-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Handwritten logo only */
@font-face {
  font-family: 'La Belle Aurore';
  src: url('../assets/fonts/la-belle-aurore.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colour: near-monochrome */
  --bg: #FFFFFF;
  --bg-alt: #F8F8F8;
  --bg-hero: #EDF1F5;
  --ink: #1F1F1F;
  --text: #2B2B2B;
  --text-muted: #666666;
  --text-subtle: #8C8C8C;
  --border: #E6E6E6;
  --border-strong: #CFCFCF;
  --success: #166534;
  --error: #B91C1C;

  /* Type */
  --font-sans: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --section-y: 76px;

  /* Layout */
  --container: 1320px;
  /* Shared alignment lines:
     --split-gap: gap of every half/half section (Hero, About, Open source, Contact),
                  so their right columns all start at the same x (page centre + half gap).
     --label-col: label column of Experience and Skills, so roles and skill items line up. */
  --split-gap: 64px;
  --label-col: 300px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --header-h: 80px;
  --radius: 4px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* ============================================
   BASE
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}

p {
  color: var(--text-muted);
}

a {
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.muted {
  color: var(--text-subtle);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  top: 1rem;
}

/* External link with a small arrow */
.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
}

.ext-link:hover {
  text-decoration-color: var(--ink);
}

.ext-link .icon {
  width: 0.8em;
  height: 0.8em;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease), height 0.2s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
}

.wordmark {
  font-family: 'La Belle Aurore', cursive;
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink);
  white-space: nowrap;
}

.wordmark:hover {
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: var(--s-6);
}

.nav-links a {
  display: block;
  padding: var(--s-2) 0;
  font-size: 0.78125rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #333;
}

.nav-links a:hover,
.nav-links a[aria-current="true"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 6px;
}

.menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  color: var(--ink);
}

/* ============================================
   HERO
   ============================================ */
.hero {
  position: relative;
  background: var(--bg-hero);
  overflow: hidden;
}

/* Social icons: under the links beside a portrait; centred at the bottom of the hero without one */
.hero-social {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-5);
}

.hero-social a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 1.0625rem;
  color: #444;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 50%;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.hero-social a:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}

.hero--no-photo .hero-social {
  position: absolute;
  left: 50%;
  bottom: var(--s-6);
  transform: translateX(-50%);
  margin: 0;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: var(--s-6);
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
}

.hero-text {
  align-self: center;
  padding: var(--s-8) 0;
}

.hero-hello,
.hero-title {
  font-size: clamp(1.375rem, 2.4vw, 1.875rem);
  font-weight: 300;
  line-height: 1.25;
  color: var(--ink);
}

.hero-name {
  font-size: clamp(2.75rem, 6vw, 4.25rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: var(--s-1) 0 var(--s-2);
}

.hero-stack {
  margin-top: var(--s-3);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-subtle);
}

.hero-desc {
  max-width: 34rem;
  text-wrap: pretty;
  margin-top: var(--s-5);
  font-size: 0.9375rem;
  line-height: 1.8;
}

/* At-a-glance details: an even 2 × 2 grid between two thin rules */
.hero-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4) var(--s-6);
  margin-top: var(--s-5);
  padding: var(--s-5) 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.hero-info dt {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
}

.hero-info dd {
  margin-top: 2px;
  font-size: 0.9375rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.hero-info a {
  color: var(--ink);
}

.hero-info a:hover {
  text-decoration: underline;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16A34A;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-4);
  margin-top: var(--s-6);
}

/* Hero actions: solid (primary) → outline (secondary) → text link (tertiary) */
.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 46px;
  padding: 0 22px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--ink);
  border-radius: 2px;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.hero-btn:hover {
  text-decoration: none;
}

.hero-btn--solid {
  background: var(--ink);
  color: #fff;
}

.hero-btn--solid:hover {
  background: #000;
  color: #fff;
}

.hero-btn--outline {
  background: transparent;
  color: var(--ink);
}

.hero-btn--outline:hover {
  background: var(--ink);
  color: #fff;
}

.hero-btn--outline:hover .muted {
  color: rgba(255, 255, 255, 0.7);
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  margin-left: var(--s-2);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
}

.hero-link span {
  transition: transform 0.15s var(--ease);
}

.hero-link:hover span {
  transform: translateX(3px);
}

.hero-photo {
  align-self: end;
  justify-self: center;
  max-width: 460px;
}

.hero-photo img {
  width: 100%;
  max-height: 540px;
  object-fit: cover;
  object-position: top;
  filter: grayscale(1);
}

/* No portrait yet: a single, centred text block */
.hero--no-photo .hero-inner {
  grid-template-columns: minmax(0, 1fr);
}

/* No portrait: the same content in two balanced columns —
   name and title on the left, details and links on the right. */
/* Divider: a centred 1px background line in the middle of the gap = page centre,
   the same axis as the icons below. (A background, not a positioned pseudo-element,
   so the icons stay anchored to the hero's bottom edge.) */
.hero--no-photo .hero-text {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--split-gap);
  align-items: center;
  background: linear-gradient(rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.12)) center / 1px calc(100% - 2 * var(--s-8)) no-repeat;
}

.hero--no-photo .hero-name {
  font-size: clamp(2.75rem, 5vw, 4.25rem);
}

.hero--no-photo .hero-details {
  padding: var(--s-5) 0;
}

.hero--no-photo .hero-desc {
  max-width: 36ch;
  margin-top: 0;
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  font-weight: 300;
  line-height: 1.35;
  color: var(--ink);
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
  padding: var(--section-y) 0;
}

.section--alt {
  background: var(--bg-alt);
}

/* Thin rule where two white sections meet (e.g. Skills → Contact) */
.section--ruled {
  border-top: 1px solid var(--border);
}

.section-title {
  margin: 0 0 var(--s-6);
}

.section-title h2 {
  font-size: clamp(1.625rem, 2.6vw, 2rem);
  font-weight: 500;
}

.section-title p {
  margin-top: var(--s-2);
  font-size: 0.875rem;
}

.section-foot {
  margin-top: var(--s-6);
  font-size: 0.875rem;
}

.block-title {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--s-5);
}

.block-title--sm {
  font-size: 0.875rem;
  margin-bottom: var(--s-3);
}

.bullets {
  display: grid;
  gap: var(--s-1);
}

.bullets li {
  position: relative;
  padding-left: 1.125rem;
  color: var(--text-muted);
}

.bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 6px;
  height: 1px;
  background: var(--text-subtle);
}

/* ============================================
   ABOUT
   ============================================ */
/* Lead paragraph across the top; remaining paragraphs | key strengths below, split on the centre line */
.about {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "lead lead"
    "bio  strengths";
  gap: var(--s-6) var(--split-gap);
  align-items: start;
}

.about-lead {
  grid-area: lead;
  max-width: 1080px;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
}

.about-bio {
  grid-area: bio;
  max-width: 68ch;
}

.about-bio p {
  font-size: 1rem;
  line-height: 1.85;
}

.about-bio p + p {
  margin-top: var(--s-4);
}

.strengths {
  grid-area: strengths;
}

.strengths .bullets {
  font-size: 0.9375rem;
  line-height: 1.75;
}

.strengths .bullets li + li {
  margin-top: var(--s-2);
}

/* ============================================
   EXPERIENCE
   ============================================ */
.jobs {
  max-width: none;
}

.job {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: var(--s-3) var(--split-gap);
  padding: var(--s-6) 0;
  border-top: 1px solid var(--border);
}

.job:first-child {
  border-top: 0;
  padding-top: 0;
}

.job-company h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.job-meta {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

.job-period {
  margin-top: var(--s-2);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
}

/* Right column: roles only (no separate date column) */
.role + .role {
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px dashed var(--border);
}

.role h4 {
  font-size: 0.9375rem;
  font-weight: 500;
}

.role-period {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

.role .bullets {
  margin-top: var(--s-2);
  font-size: 0.875rem;
}

/* ============================================
   SKILLS (one ruled row per group: name | items)
   ============================================ */
.skills {
  border-bottom: 1px solid var(--border);
}

.skill-group {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: var(--s-1) var(--split-gap);
  align-items: baseline;
  padding: var(--s-4) 0;
  border-top: 1px solid var(--border);
}

.skill-group dt {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.skill-group dd {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.skill-note {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

/* ============================================
   CONTACT
   ============================================ */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-7) var(--split-gap);
}

.contact-form {
  display: grid;
  gap: var(--s-4);
  max-width: 560px;
}

.form-row {
  display: grid;
  gap: 2px;
}

.form-row label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  min-height: 40px;
  padding: var(--s-2) 0;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.contact-form textarea {
  resize: vertical;
  min-height: 96px;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-bottom-color: var(--ink);
  box-shadow: 0 1px 0 0 var(--ink);
}

.contact-form [aria-invalid="true"] {
  border-bottom-color: var(--error);
}

.form-error {
  font-size: 0.8125rem;
  color: var(--error);
}

.form-error:empty {
  display: none;
}

.send-btn {
  justify-self: start;
  min-height: 44px;
  margin-top: var(--s-2);
  padding: 0 2px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
}

.send-btn:hover {
  opacity: 0.75;
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.form-status {
  font-size: 0.875rem;
}

.form-status:empty {
  display: none;
}

.form-status[data-state="success"] {
  color: var(--success);
}

.form-status[data-state="error"] {
  color: var(--error);
}

.turnstile:empty {
  display: none;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-intro {
  font-size: 0.9375rem;
  line-height: 1.85;
  margin-bottom: var(--s-6);
}

.quick-contact {
  display: grid;
  gap: var(--s-2);
  font-size: 0.875rem;
}

.quick-contact div {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--s-2);
}

.quick-contact dt {
  font-weight: 600;
  color: var(--ink);
}

.contact-sep {
  margin: 0 var(--s-2);
  color: var(--text-subtle);
}

.quick-contact dd {
  color: var(--text-muted);
  word-break: break-word;
}

.contact-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--s-5);
  margin-top: var(--s-5);
  font-size: 0.875rem;
}

.contact-social .ext-link {
  min-height: 44px;
}

/* ============================================
   FOOTER & BACK TO TOP
   ============================================ */
.site-footer {
  padding: var(--s-6) 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer p {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
}

.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 40;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease), visibility 0.2s;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ============================================
   REVEAL (only when JS is running)
   ============================================ */
.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
  :root {
    --split-gap: 48px;
    --label-col: 240px;
  }

  .nav-links {
    gap: var(--s-5);
  }
}

@media (max-width: 960px) {
  :root {
    --header-h: 64px;
    --section-y: 72px;
  }

  /* Menu replaces the inline nav. Flex, because <nav> stays in the flow
     (its list is positioned absolutely) and would otherwise take a grid cell. */
  .header-inner {
    gap: var(--s-3);
  }

  .wordmark {
    margin-right: auto;
  }

  .menu-btn {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: var(--s-2) var(--gutter) var(--s-4);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    padding: var(--s-3) 0;
    font-size: 0.8125rem;
  }

  .site-header:has(.nav-links.is-open) {
    border-bottom-color: var(--border);
  }

  /* About stacks: lead, paragraphs, then the key strengths */
  .about {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "lead" "bio" "strengths";
    gap: var(--s-5);
  }

  .hero--no-photo .hero-text {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-6);
  }

  .hero--no-photo .hero-text {
    background: none;
  }

  /* Stacked hero: icons follow the content instead of pinning to the bottom edge,
     so they can never overlap the buttons on short screens. */
  .hero--no-photo .hero-social {
    position: static;
    transform: none;
    margin-top: var(--s-6);
  }

  .hero--no-photo .hero-details {
    padding: var(--s-6) 0 0;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
  }
}

@media (max-width: 760px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    gap: 0;
  }

  .hero-text {
    padding: var(--s-7) 0 var(--s-6);
  }

  .hero-photo {
    max-width: 320px;
  }

  .hero-photo img {
    max-height: 380px;
  }

  .job {
    grid-template-columns: minmax(0, 1fr);
  }

  .skill-group,
  .contact-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  :root {
    --section-y: 56px;
  }


  .section-title {
    margin-bottom: var(--s-6);
  }

  .contact-form {
    max-width: none;
  }

  .hero-info {
    gap: var(--s-3) var(--s-4);
  }

  /* Short values (Based in, Status) stay side by side; email and phone get full rows */
  .hero-info > div:nth-child(n + 3) {
    grid-column: 1 / -1;
  }

  .hero-info dd {
    font-size: 0.875rem;
  }

  .hero--no-photo .hero-desc {
    max-width: none;
  }

  .hero-btn {
    flex: 1 1 0;
    justify-content: center;
    padding: 0 var(--s-3);
    white-space: nowrap;
  }

  /* The download icon already says it's a file */
  .hero-btn .muted {
    display: none;
  }

  .hero-link {
    margin-left: 0;
  }

}
