/* ==========================================================================
   Sanju Balasuriya - portfolio design system
   Single stylesheet. No framework. Token-driven, light + dark.
   1. Tokens          5. Header / nav
   2. Reset + base    6. Components
   3. Layout          7. Page sections
   4. Typography      8. Motion & responsive
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Light palette (default). Accent is an evolution of the original bronze,
     darkened until it clears 4.5:1 on the light surface. */
  --bg:          #f6f6f4;
  --bg-grain:    #eceae5;
  --surface:     #ffffff;
  --surface-2:   #f1f0ec;
  --border:      #e2e0da;
  --border-soft: #edebe6;
  --text:        #16181d;
  --text-dim:    #4d5159;
  --text-mute:   #686d76;
  --accent:      #9c5b1c;
  --accent-soft: rgba(156, 91, 28, 0.10);
  --accent-ink:  #ffffff;
  --ok:          #1a7a43;
  --err:         #b3271e;
  --shadow-sm:   0 1px 2px rgba(16, 18, 22, 0.05);
  --shadow-md:   0 4px 18px -6px rgba(16, 18, 22, 0.14);
  --shadow-lg:   0 24px 60px -28px rgba(16, 18, 22, 0.35);

  /* Type scale - fluid, clamped at both ends */
  --step--1: clamp(0.78rem, 0.76rem + 0.10vw, 0.84rem);
  --step-0:  clamp(0.95rem, 0.92rem + 0.14vw, 1.05rem);
  --step-1:  clamp(1.12rem, 1.05rem + 0.32vw, 1.35rem);
  --step-2:  clamp(1.38rem, 1.24rem + 0.62vw, 1.85rem);
  --step-3:  clamp(1.70rem, 1.44rem + 1.20vw, 2.60rem);
  --step-4:  clamp(2.10rem, 1.58rem + 2.40vw, 3.90rem);
  --step-5:  clamp(2.40rem, 1.70rem + 3.10vw, 4.40rem);

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 1140px;
  --gutter: clamp(1.15rem, 4vw, 2.5rem);
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --header-h: 68px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 260ms;
}

/* Dark tokens, defined once and applied from two selectors so that the
   system preference and an explicit toggle both win in either direction. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0c0e12;
    --bg-grain:    #101318;
    --surface:     #14171d;
    --surface-2:   #1a1e25;
    --border:      #262b34;
    --border-soft: #1d222a;
    --text:        #eef0f4;
    --text-dim:    #a8aeb9;
    --text-mute:   #838a96;
    --accent:      #e0a45f;
    --accent-soft: rgba(224, 164, 95, 0.12);
    --accent-ink:  #16110a;
    --ok:          #4ed88a;
    --err:         #ff8a80;
    --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md:   0 4px 20px -6px rgba(0, 0, 0, 0.55);
    --shadow-lg:   0 28px 70px -30px rgba(0, 0, 0, 0.8);
  }
}

:root[data-theme="dark"] {
  --bg:          #0c0e12;
  --bg-grain:    #101318;
  --surface:     #14171d;
  --surface-2:   #1a1e25;
  --border:      #262b34;
  --border-soft: #1d222a;
  --text:        #eef0f4;
  --text-dim:    #a8aeb9;
  --text-mute:   #838a96;
  --accent:      #e0a45f;
  --accent-soft: rgba(224, 164, 95, 0.12);
  --accent-ink:  #16110a;
  --ok:          #4ed88a;
  --err:         #ff8a80;
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:   0 4px 20px -6px rgba(0, 0, 0, 0.55);
  --shadow-lg:   0 28px 70px -30px rgba(0, 0, 0, 0.8);
}

/* 2. Reset + base ---------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

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

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

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration: none; }

button, input, textarea, select { font: inherit; color: inherit; }

ul, ol { list-style: none; padding: 0; }

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

::selection { background: var(--accent); color: var(--accent-ink); }

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  z-index: 200;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.65rem 1.25rem;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 600;
  font-size: var(--step--1);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

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

/* 3. Layout ---------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow { max-width: 880px; }

.section { padding-block: clamp(3.25rem, 7vw, 5.5rem); }
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.section + .section { padding-top: 0; }

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}
.section__head h2 { margin-top: 0.6rem; }

.rule { height: 1px; background: var(--border); border: 0; }

/* 4. Typography ------------------------------------------------------------ */

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { text-wrap: pretty; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 62ch;
}

.muted { color: var(--text-dim); }
.mono { font-family: var(--font-mono); font-size: 0.85em; }

/* 5. Header / nav ---------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--border);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand__mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  flex: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.brand:hover .brand__mark { background: var(--accent); color: var(--accent-ink); }

.nav { display: flex; align-items: center; gap: clamp(0.25rem, 1.5vw, 0.6rem); }

.nav__list { display: flex; align-items: center; gap: 0.15rem; }

.nav__link {
  position: relative;
  display: block;
  padding: 0.5rem 0.8rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav__link:hover { color: var(--text); background: var(--surface-2); }
.nav__link[aria-current="page"] { color: var(--text); font-weight: 600; }
.nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.15rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.nav__actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--text-mute); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

/* Theme toggle shows the glyph for the theme you would switch to */
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

.nav__toggle { display: none; }
.nav__toggle .icon-close { display: none; }
.nav__toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav__toggle[aria-expanded="true"] .icon-close { display: block; }

@media (min-width: 861px) {
  .nav__panel { display: contents; }
  .nav__panel .btn--drawer { display: none; }
}

@media (max-width: 860px) {
  .nav__toggle { display: grid; }
  /* Scoped to .nav__actions so this beats the later `.btn { display: inline-flex }`
     rule, which would otherwise win on equal specificity and leave the CV pill
     in the bar next to the drawer's own CV button. */
  .nav__actions .nav__cta { display: none; }

  .nav__panel {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    display: block;
    padding: 1rem var(--gutter) 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
  }
  .nav__panel.is-open { opacity: 1; visibility: visible; transform: translateY(0); }

  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__link {
    padding: 0.85rem 0.25rem;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--border-soft);
    border-radius: 0;
  }
  .nav__link[aria-current="page"]::after { left: 0.25rem; right: auto; width: 18px; bottom: 0.5rem; }
  .btn--drawer { margin-top: 1.1rem; width: 100%; justify-content: center; }
}

/* 6. Components ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), border-color var(--dur) var(--ease), filter var(--dur) var(--ease);
}
.btn svg { width: 16px; height: 16px; flex: none; }

.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.btn--primary:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn--solid { background: var(--text); color: var(--bg); }
.btn--solid:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn--ghost { border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--text-mute); background: var(--surface-2); transform: translateY(-1px); }

.btn--sm { padding: 0.5rem 0.85rem; font-size: 0.8rem; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
}
.pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
  flex: none;
}
@media (prefers-reduced-motion: no-preference) {
  .pill__dot { animation: pulse 2.6s var(--ease) infinite; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
  50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok) 4%, transparent); }
}

.tag {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.87rem;
  color: var(--accent);
}
.link-arrow svg { width: 15px; height: 15px; transition: transform var(--dur) var(--ease); }
.link-arrow:hover svg { transform: translateX(3px); }

/* 7. Page sections --------------------------------------------------------- */

/* -- Hero -- */
.hero {
  position: relative;
  padding-block: clamp(2.75rem, 8vw, 5.5rem) clamp(2.5rem, 6vw, 4rem);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -35%;
  right: -8%;
  width: min(720px, 85vw);
  aspect-ratio: 1;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 66%);
  pointer-events: none;
  z-index: -1;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}

.hero__title {
  font-size: var(--step-5);
  letter-spacing: -0.035em;
  margin-block: 1.1rem 1.1rem;
}
.hero__title em { font-style: normal; color: var(--accent); }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  margin-top: 1.6rem;
  font-size: 0.85rem;
  color: var(--text-mute);
}
.hero__meta span { display: inline-flex; align-items: center; gap: 0.4rem; }
.hero__meta svg { width: 15px; height: 15px; opacity: 0.85; }

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.9rem; }

/* Portrait */
.portrait { position: relative; justify-self: center; width: min(330px, 100%); }
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 15%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.portrait::after {
  content: "";
  position: absolute;
  inset: 16px -16px -16px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  opacity: 0.4;
  z-index: -1;
}

.portrait__social {
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  display: flex;
  gap: 0.15rem;
  padding: 0.4rem 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
}
.portrait__social a {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-dim);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.portrait__social a:hover { background: var(--accent); color: var(--accent-ink); }
.portrait__social svg { width: 17px; height: 17px; }

/* -- Stat strip -- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat { background: var(--surface); padding: 1.35rem 1.5rem; }
.stat__num {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat__num span { color: var(--accent); }
.stat__label { margin-top: 0.45rem; font-size: 0.8rem; color: var(--text-mute); line-height: 1.45; }

/* -- Work cards -- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr));
  gap: clamp(1.25rem, 3vw, 1.9rem);
}

.work-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.work-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--text-mute); }

.work-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.work-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 600ms var(--ease);
}
.work-card:hover .work-card__media img { transform: scale(1.04); }

.work-card__year {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.work-card__body {
  padding: 1.4rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.7rem;
}
.work-card__title { font-size: var(--step-1); }
.work-card__desc { font-size: 0.9rem; color: var(--text-dim); line-height: 1.6; flex: 1; }
.work-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.35rem;
}

/* -- Capability grid -- */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: clamp(1rem, 2.5vw, 1.5rem);
}
.cap {
  padding: 1.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.cap:hover { border-color: var(--accent); transform: translateY(-3px); }
.cap__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 1rem;
}
.cap__icon svg { width: 20px; height: 20px; }
.cap h3 { font-size: var(--step-1); margin-bottom: 0.5rem; }
.cap p { font-size: 0.88rem; color: var(--text-dim); line-height: 1.6; }
.cap .tag-row { margin-top: 1rem; }

/* -- Timeline -- */
.timeline { position: relative; padding-left: 1.75rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(to bottom, var(--border), var(--border) 88%, transparent);
}

.tl-item { position: relative; padding-bottom: clamp(2rem, 4vw, 2.75rem); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem + 1px);
  top: 0.5rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
}
.tl-item--current::before { border-color: var(--accent); background: var(--accent); }

.tl-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}
.tl-item__role { font-size: var(--step-1); }
.tl-item__date { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-mute); white-space: nowrap; }
.tl-item__org { display: block; margin-top: 0.2rem; font-size: 0.9rem; font-weight: 500; color: var(--accent); }
.tl-item__list { margin-top: 0.9rem; display: grid; gap: 0.5rem; }
.tl-item__list li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.tl-item__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 6px;
  height: 1px;
  background: var(--text-mute);
}
.tl-item .tag-row { margin-top: 0.9rem; }

/* -- Skill blocks -- */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(255px, 100%), 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.skill-block { background: var(--surface); padding: 1.5rem; }
.skill-block h3 {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 1rem;
}

/* -- Education / awards -- */
.edu-list {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.edu {
  background: var(--surface);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
}
.edu__title { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; letter-spacing: -0.015em; }
.edu__org { display: block; margin-top: 0.25rem; font-size: 0.87rem; color: var(--text-dim); }
.edu__note { display: block; margin-top: 0.4rem; font-size: 0.85rem; color: var(--text-mute); }
.edu__date { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-mute); white-space: nowrap; }

/* -- Contact -- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
}

.contact-methods { display: grid; gap: 0.75rem; }
.contact-method {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.05rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.contact-method:hover { border-color: var(--accent); transform: translateX(3px); }
.contact-method__icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}
.contact-method__icon svg { width: 18px; height: 18px; }
.contact-method__body { min-width: 0; }
.contact-method__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 0.15rem;
}
.contact-method__value { display: block; font-weight: 500; font-size: 0.94rem; overflow-wrap: anywhere; }

/* Form */
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.4rem; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.field input, .field textarea {
  width: 100%;
  padding: 0.8rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.94rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-mute); opacity: 0.75; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 150px; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.field__error { font-size: 0.78rem; color: var(--err); min-height: 1.1rem; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--err); }

.form__status {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.form__status[data-state="ok"] {
  border-color: color-mix(in srgb, var(--ok) 50%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}
.form__status[data-state="err"] {
  border-color: color-mix(in srgb, var(--err) 50%, transparent);
  background: color-mix(in srgb, var(--err) 10%, transparent);
}
.form__status[hidden] { display: none; }

.btn[aria-busy="true"] { opacity: 0.6; pointer-events: none; }

/* -- CTA band -- */
.cta-band {
  position: relative;
  padding: clamp(2.5rem, 6vw, 4rem);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  text-align: center;
}
.cta-band::before {
  content: "";
  position: absolute;
  inset: auto -20% -60% -20%;
  height: 260px;
  background: radial-gradient(ellipse at center, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.cta-band > * { position: relative; }
.cta-band h2 { margin-block: 0.8rem 0.9rem; }
.cta-band p { margin-inline: auto; }
.cta-band .hero__actions { justify-content: center; }

/* -- Case study -- */
.case-cover {
  margin-top: 2.25rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.case-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 1.5rem;
  padding-block: 2rem;
  border-block: 1px solid var(--border);
  margin-block: clamp(2rem, 5vw, 3rem);
}
.case-fact__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 0.4rem;
}
.case-fact__value { font-size: 0.94rem; font-weight: 500; }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.8rem; color: var(--text-mute); margin-bottom: 1.25rem; }
.breadcrumbs a { color: var(--text-dim); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs li + li::before { content: "/"; margin-right: 0.4rem; opacity: 0.6; }
.breadcrumbs li { display: flex; }

.prose { max-width: 68ch; }
.prose h2 { font-size: var(--step-2); margin-top: 2.5rem; margin-bottom: 0.9rem; }
.prose > h2:first-child { margin-top: 0; }
.prose p { color: var(--text-dim); margin-bottom: 1rem; }
.prose ul { display: grid; gap: 0.6rem; margin-bottom: 1rem; }
.prose ul li { position: relative; padding-left: 1.4rem; color: var(--text-dim); }
.prose ul li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.prose strong { color: var(--text); font-weight: 600; }

/* -- Footer -- */
.site-footer {
  margin-top: clamp(3rem, 8vw, 5.5rem);
  border-top: 1px solid var(--border);
  padding-block: clamp(2.5rem, 5vw, 3.5rem) 2rem;
  background: var(--bg-grain);
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem; }
.footer-nav a { font-size: 0.88rem; color: var(--text-dim); transition: color var(--dur) var(--ease); }
.footer-nav a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-mute);
}
.footer-social { display: flex; gap: 0.35rem; }
.footer-social a {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-dim);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.footer-social a:hover { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.footer-social svg { width: 16px; height: 16px; }

/* -- 404 -- */
.notfound { min-height: 58vh; display: grid; place-content: center; text-align: center; gap: 1.25rem; }
.notfound__code {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 16vw, 8rem);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.05em;
}

/* 8. Motion & responsive --------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 620ms var(--ease), transform 620ms var(--ease);
  }
  .reveal.is-visible { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .portrait { grid-row: 1; width: min(230px, 60%); justify-self: start; }
  .portrait::after { inset: 12px -12px -12px 12px; }
  .portrait__social { left: auto; right: -12px; bottom: -14px; transform: none; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .field--row { grid-template-columns: 1fr; }
  .hero__actions .btn { flex: 1 1 auto; justify-content: center; }
}

@media print {
  .site-header, .site-footer, .cta-band, .hero__actions, .skip-link, .portrait__social { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding-block: 1rem; }
  a { text-decoration: underline; }
}
