/* site.css - reset, layout, components. No :root here; tokens.css owns it. */

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

html { overflow-x: clip; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + var(--space-6)); }

body {
  margin: 0;
  /* The hero banner bleeds to 100vw, which is wider than the page when a vertical
     scrollbar exists. clip trims it without creating a scroll container, so the
     sticky header keeps working. */
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.12; margin: 0; font-weight: 650; letter-spacing: -0.025em; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); }
p  { margin: 0; }
ul, ol { margin: 0; padding: 0; }

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

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

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

kbd {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
  padding: 3px 5px;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ---------- skip link ---------- */

.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; }

.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  text-decoration: none;
}

/* ---------- background canvas and custom cursor ---------- */

/* fx.js inserts this canvas. With no JavaScript the element never exists. */
#bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(900px circle at 18% -10%, var(--fx-bloom), transparent 70%);
}

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  pointer-events: none;
  border-radius: 50%;
  margin-top: -5px;
  margin-left: -5px;
}

.cursor-dot { width: 10px; height: 10px; background: var(--accent); }

.cursor-ring {
  width: 34px;
  height: 34px;
  margin-top: -17px;
  margin-left: -17px;
  border: 1px solid var(--line-strong);
  transition: width var(--dur-2) var(--ease-out), height var(--dur-2) var(--ease-out),
    margin var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out),
    background-color var(--dur-2) var(--ease-out);
}

.cursor-ring.is-big {
  width: 52px;
  height: 52px;
  margin-top: -26px;
  margin-left: -26px;
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Only once fx.js has the replacement in the document. */
:root.has-cursor,
:root.has-cursor a,
:root.has-cursor button,
:root.has-cursor [role="button"] { cursor: none; }

/* A text field still needs its own cursor to be usable. */
:root.has-cursor input,
:root.has-cursor textarea { cursor: text; }

/* ---------- layout ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section { padding-block: var(--space-16); border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; }
.section__head { margin-bottom: var(--space-8); }
.prose { max-width: var(--measure); color: var(--text-muted); }
.prose + .prose { margin-top: var(--space-4); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  view-transition-name: site-header;
  background: var(--surface-glass);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}

html[data-scrolled] .site-header { border-bottom-color: var(--line); box-shadow: var(--shadow); }

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-h);
  transition: min-height var(--dur-2) var(--ease-out);
}

html[data-scrolled] .site-header__inner { min-height: var(--header-h-sm); }

/* scroll progress, driven by --progress on .site-header (set by main.js) */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 100%;
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  background: var(--accent);
  opacity: 0.9;
}

.brand {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-decoration: none;
  letter-spacing: 0.04em;
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius);
}

.brand:hover { background: var(--accent-soft); color: var(--accent); }

.nav { display: flex; align-items: center; gap: var(--space-2); }
.nav__links { display: flex; gap: var(--space-1); list-style: none; }

.nav__links a {
  position: relative;
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--step--1);
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out);
}

.nav__links a::after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transition: left var(--dur-2) var(--ease-out), right var(--dur-2) var(--ease-out);
}

.nav__links a:hover,
.nav__links a:focus-visible { color: var(--text); }
.nav__links a:hover::after,
.nav__links a:focus-visible::after { left: var(--space-3); right: var(--space-3); }

.nav__links a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
.nav__links a[aria-current="page"]::after { left: var(--space-3); right: var(--space-3); }

/* ---------- icon buttons in the header ---------- */

.theme-toggle,
.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  padding: 0 var(--space-3);
  font: inherit;
  font-size: var(--step--1);
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out),
    background-color var(--dur-1) var(--ease-out);
}

.theme-toggle { width: 32px; padding: 0; display: grid; place-items: center; }

.theme-toggle:hover,
.nav-trigger:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel); }

.theme-toggle > span {
  grid-area: 1 / 1;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-spring);
}

.theme-toggle__dark { opacity: 0; transform: rotate(-90deg) scale(0.6); }
:root[data-theme="dark"] .theme-toggle__light { opacity: 0; transform: rotate(90deg) scale(0.6); }
:root[data-theme="dark"] .theme-toggle__dark { opacity: 1; transform: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__light { opacity: 0; transform: rotate(90deg) scale(0.6); }
  :root:not([data-theme="light"]) .theme-toggle__dark { opacity: 1; transform: none; }
}

.nav-trigger kbd { pointer-events: none; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}

/* Magnetic hover. --tx/--ty come from fx.js; translate composes with the transform above. */
.btn { translate: var(--tx, 0) var(--ty, 0); transition: translate var(--dur-1) var(--ease-out); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn .arrow { transition: transform var(--dur-2) var(--ease-spring); }
.btn:hover .arrow { transform: translateX(3px); }

.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--text)); box-shadow: var(--shadow-lift); }

.btn--outlined { background: transparent; color: var(--text); border-color: var(--line); }
.btn--outlined:hover { border-color: var(--accent); background: var(--accent-soft); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* ---------- hero ---------- */

/* ---------- hero banner ---------- */

/* Four layers, back to front: the #bg canvas, the aurora, the grid, the text.
   Every layer here is decoration and carries aria-hidden in the markup. */
.hero { position: relative; isolation: isolate; }

.hero__bg {
  position: absolute;
  z-index: -1;
  top: calc(var(--space-16) * -1);
  bottom: 0;
  /* Bleed past the container to the full viewport width. */
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  overflow: hidden;
  pointer-events: none;
  /* Dissolve into the flat page before the metrics strip. No hard edge. */
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
}

/* Aurora. Soft colour stops, not filter: blur() - a blur on a box this size
   repaints every frame and is the one thing here that would cost real time. */
.hero__bg span {
  position: absolute;
  display: block;
  border-radius: 50%;
  will-change: transform;
  /* Hold the aurora off the text column. The grid keeps the left side; the colour
     stays on the empty right, so hero text never loses contrast to a drifting blob. */
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.22) 34%, #000 64%);
  mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.22) 34%, #000 64%);
}

.hero__bg span:nth-child(1) {
  top: -22%;
  left: 40%;
  width: 46rem;
  height: 46rem;
  background: radial-gradient(closest-side, var(--banner-a), transparent 72%);
  animation: aurora-a 28s var(--ease-out) infinite alternate;
}

.hero__bg span:nth-child(2) {
  top: -8%;
  left: 66%;
  width: 38rem;
  height: 38rem;
  background: radial-gradient(closest-side, var(--banner-b), transparent 70%);
  animation: aurora-b 36s var(--ease-out) infinite alternate;
}

.hero__bg span:nth-child(3) {
  top: 36%;
  left: 54%;
  width: 40rem;
  height: 40rem;
  background: radial-gradient(closest-side, var(--banner-c), transparent 70%);
  animation: aurora-c 44s var(--ease-out) infinite alternate;
}

@keyframes aurora-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-7%, 6%, 0) scale(1.18); }
}

@keyframes aurora-b {
  from { transform: translate3d(0, 0, 0) scale(1.1); }
  to   { transform: translate3d(9%, -8%, 0) scale(0.92); }
}

@keyframes aurora-c {
  from { transform: translate3d(0, 0, 0) scale(0.95); }
  to   { transform: translate3d(6%, 10%, 0) scale(1.14); }
}

/* Grid, densest at the top left and gone before the text runs out. */
.hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 34px);
  -webkit-mask-image: radial-gradient(120% 150% at 4% 0%, #000 0%, transparent 78%);
  mask-image: radial-gradient(120% 150% at 4% 0%, #000 0%, transparent 78%);
  opacity: 0.9;
}

.hero { padding-block: var(--space-16) var(--space-12); }
.hero h1 { margin-bottom: var(--space-4); }

.hero__role {
  font-size: var(--step-1);
  color: var(--text);
  max-width: var(--measure);
  margin-bottom: var(--space-3);
}

.hero__meta {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
  margin-bottom: var(--space-8);
}

/* One line of value, under the role line. The text comes from ROLES in main.js. */
.hero__value {
  font-size: var(--step-0);
  color: var(--text-muted);
  max-width: var(--measure);
  margin-bottom: var(--space-4);
}

/* Text column plus a photo slot. The slot is parked, not dead: the markup is
   commented out in index.html until a headshot exists. */
.hero__grid { display: grid; gap: var(--space-8); align-items: start; }

/* Placeholder box. aspect-ratio holds the square, so a real photo shifts no layout. */
.hero__photo {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  overflow: hidden;
}

.hero__photo img { width: 100%; height: 100%; object-fit: cover; }

.hero__photo span {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-3);
}

@media (min-width: 720px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-12); }
  .hero__photo { max-width: 240px; }
}

/* ---------- availability and role switcher ---------- */

.availability {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--step--1);
  color: var(--text);
  margin-bottom: var(--space-6);
}

.availability::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.role-switch { margin-top: var(--space-8); }

.role-switch ul { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; }

.role-switch a {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  line-height: 1;
  padding: var(--space-3) var(--space-4);
  color: var(--text-muted);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out);
}

.role-switch a:hover { color: var(--text); border-color: var(--line-strong); }

.role-switch a[aria-current="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- worked with ---------- */

.worked-with {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  list-style: none;
  margin-top: var(--space-4);
}

/* Monochrome badges. A mask paints the artwork in currentColor, so one rule covers
   both themes and any source file, vector or transparent bitmap. */
.logo-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 34px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}

.logo-badge:hover { color: var(--text); border-color: var(--line-strong); }

.logo-badge__mark {
  display: block;
  flex: none;
  background: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* One size per logo, from its own viewBox, so nothing is stretched. */
.logo-badge__mark--taqa {
  width: 53px; /* 117 x 29 */
  height: 13px;
  -webkit-mask-image: url("../assets/logos/taqa.svg");
  mask-image: url("../assets/logos/taqa.svg");
}

.logo-badge__mark--adnoc {
  width: 21px; /* symbol only, 76 x 64 */
  height: 18px;
  -webkit-mask-image: url("../assets/logos/adnoc.svg");
  mask-image: url("../assets/logos/adnoc.svg");
}

.logo-badge__mark--42 {
  width: 17px; /* 960 x 960 */
  height: 17px;
  -webkit-mask-image: url("../assets/logos/42.svg");
  mask-image: url("../assets/logos/42.svg");
}

/* A transparent bitmap masks exactly like a vector: the mask reads alpha, not colour. */
.logo-badge__mark--khalifa {
  width: 105px; /* latin wordmark only, 1500 x 157 */
  height: 11px;
  -webkit-mask-image: url("../assets/logos/khalifa-fund.png");
  mask-image: url("../assets/logos/khalifa-fund.png");
}

/* The name behind a logo badge, for assistive tech and for images-off reading. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- metrics ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  list-style: none;
}

.metric { background: var(--bg); padding: var(--space-5) var(--space-4); transition: background-color var(--dur-2) var(--ease-out); }
.metric:hover { background: var(--bg-soft); }

.metric__value {
  font-size: var(--step-2);
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.metric__label { font-size: var(--step--1); color: var(--text-muted); line-height: 1.35; }

.metric a { display: block; color: inherit; text-decoration: none; }
.metric:has(a:hover) { background: var(--bg-soft); }

/* ---------- cards ---------- */

.grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4); list-style: none; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
}

/* pointer-tracked glow; --mx/--my are set by main.js */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), var(--accent-glow), transparent 70%);
  transition: opacity var(--dur-2) var(--ease-out);
}

.card { scroll-margin-top: calc(var(--header-h) + var(--space-8)); }
.card:target { border-color: var(--accent); box-shadow: var(--shadow-lift); }
/* Tilt. --rx/--ry come from fx.js and stay at 0 when nothing sets them. */
.card:hover {
  transform: translateY(-2px) perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
}
.card:hover::before { opacity: 1; }
.card > * { position: relative; }

.card--link h3 a { text-decoration: none; }
.card--link h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.ext { margin-left: 0.3em; font-size: 0.8em; color: var(--text-muted); }

.card__desc { color: var(--text-muted); font-size: var(--step--1); flex: 1; }

/* case study: Context, My role, Problem, Approach, Result */
.case { display: grid; gap: var(--space-1); font-size: var(--step--1); }

.case dt {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.case dd { margin: 0; color: var(--text-muted); }
.case dd + dt { margin-top: var(--space-3); }

/* Delivered systems: the Result stays visible, the rest folds under "More info". */
/* Each card takes its own height, so opening one does not stretch its row neighbour. */
.grid:has(.case-more) { align-items: start; }
.case-more summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  list-style: none;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--accent);
}
.case-more summary::-webkit-details-marker { display: none; }
.case-more summary::before {
  content: "\25B8";
  transition: transform var(--dur-1) var(--ease-out);
}
.case-more[open] summary::before { transform: rotate(90deg); }
.case-more[open] summary { margin-bottom: var(--space-3); }
.case-more summary:hover { text-decoration: underline; }

/* Unwritten copy. It must look unfinished, so it cannot ship by accident. */
.placeholder {
  display: inline-block;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  padding: var(--space-1) var(--space-2);
  color: var(--text-muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* Media slot. aspect-ratio holds the box, so adding a file shifts no layout. */
.card__media {
  margin: 0;
  /* A full-width card would otherwise give the 16:9 box a huge height. */
  max-width: 560px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.card__media img,
.card__media video { display: block; width: 100%; height: 100%; object-fit: cover; }

.card__media--empty {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
}

.card__media--empty span {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--text-muted);
}

.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; }

.tag {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  line-height: 1;
  padding: var(--space-2) var(--space-3);
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.card__note { font-family: var(--font-mono); font-size: var(--step--2); color: var(--text-muted); }

.empty-state {
  padding: var(--space-6);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: var(--step--1);
}

/* ---------- experience ---------- */

.timeline { list-style: none; display: grid; gap: var(--space-8); }

.role {
  display: grid;
  gap: var(--space-2);
  padding-left: var(--space-6);
  border-left: 2px solid var(--line);
  transition: border-color var(--dur-3) var(--ease-out);
}

.role.is-visible,
.role:hover { border-left-color: var(--accent); }

.role__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-4); }
.role__org { color: var(--text-muted); font-size: var(--step--1); }

.role__date {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
  white-space: nowrap;
}

.role__points { list-style: none; display: grid; gap: var(--space-2); color: var(--text-muted); }
.role__points li { padding-left: var(--space-5); position: relative; }
.role__points li::before { content: "\25B8"; position: absolute; left: 0; color: var(--accent); }

.skill-group { display: grid; gap: var(--space-2); padding-block: var(--space-4); border-top: 1px solid var(--line); }
.skill-group dt { font-size: var(--step--1); font-weight: 650; }
.skill-group dd { margin: 0; color: var(--text-muted); font-size: var(--step--1); }

/* ---------- contact ---------- */

.contact-list { list-style: none; display: grid; gap: var(--space-4); }
.contact-list a { font-family: var(--font-mono); font-size: var(--step--1); }

/* Shown by scripts/contact.js only when the backend is configured. */
.contact-form {
  display: grid;
  gap: var(--space-4);
  max-width: var(--measure);
  margin-bottom: var(--space-8);
}
@media (min-width: 720px) {
  .contact-form { grid-template-columns: 1fr 1fr; }
  .field--wide { grid-column: 1 / -1; }
}
.contact-form[hidden] { display: none; }
.field { display: grid; gap: var(--space-1); }
.field label { font-size: var(--step--1); font-weight: 600; }
.field input,
.field textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  width: 100%;
}
.field textarea { resize: vertical; min-height: 8rem; }
.field input:focus-visible,
.field textarea:focus-visible { border-color: var(--accent); }
/* Honeypot: off-screen for people, still in the form for bots. */
.field--trap { position: absolute; left: -100vw; width: 1px; height: 1px; overflow: hidden; }
.contact-form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.contact-form__status { color: var(--text-muted); font-size: var(--step--1); }
.contact-form__note { color: var(--text-muted); font-size: var(--step--1); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--space-8);
  font-size: var(--step--1);
  color: var(--text-muted);
}

.site-footer__inner { display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: space-between; }

/* ---------- sidebar, built by scripts/sidebar.js ---------- */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--scrim);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-2) var(--ease-out), visibility var(--dur-2);
}

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  width: min(360px, 100vw);
  height: 100dvh;
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-panel);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--dur-3) var(--ease-out), visibility var(--dur-3);
}

body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
body.sidebar-open .sidebar { transform: none; visibility: visible; }
body.sidebar-open { overflow: hidden; }

.sidebar__head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--line); }

.sidebar__search {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: var(--step--1);
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sidebar__search::placeholder { color: var(--text-muted); }
.sidebar__search:focus { border-color: var(--accent); outline: none; }

.sidebar__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  font: inherit;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.sidebar__close:hover { color: var(--text); border-color: var(--line-strong); }

.sidebar__body { flex: 1; overflow-y: auto; padding: var(--space-4); }
.sidebar__group { margin-bottom: var(--space-6); }
.sidebar__group[hidden] { display: none; }
.sidebar__group h2 { font-size: var(--step--2); font-family: var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: var(--space-2); font-weight: 500; }
.sidebar__list { list-style: none; display: grid; gap: 2px; }

.sidebar__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: var(--step--1);
  padding: var(--space-3) var(--space-3);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out);
}

.sidebar__row:hover,
.sidebar__row.is-active { color: var(--text); background: var(--panel); }
.sidebar__row[aria-current] { color: var(--accent); background: var(--accent-soft); }
.sidebar__row.is-current-section { color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.sidebar__row [hidden] { display: none; }
.sidebar__icon { flex: none; width: 1.1em; text-align: center; opacity: 0.75; }
.sidebar__row kbd { margin-left: auto; }

.sidebar__empty { font-size: var(--step--1); color: var(--text-muted); padding: var(--space-3); }

.sidebar__foot { border-top: 1px solid var(--line); padding: var(--space-4); display: grid; gap: var(--space-2); }
.sidebar__shortcut { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--step--2); color: var(--text-muted); }
.sidebar__shortcut span:last-child { display: flex; gap: 3px; flex: none; }

/* groups stagger in with the panel */
body.sidebar-open .sidebar__group { animation: sidebar-in var(--dur-3) var(--ease-out) backwards; }
body.sidebar-open .sidebar__group:nth-child(2) { animation-delay: var(--stagger); }
body.sidebar-open .sidebar__group:nth-child(3) { animation-delay: calc(var(--stagger) * 2); }

@keyframes sidebar-in {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- reveal (opt-in, only when JS runs) ---------- */

.js .reveal { opacity: 0; transform: translateY(10px); }

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
  transition-delay: calc(var(--i, 0) * var(--stagger));
}

/* ---------- breakpoints ---------- */

@media (max-width: 559px) {
  .nav__links { display: none; }
  .nav-trigger kbd { display: none; }
  .sidebar { width: 100vw; border-left: 0; }
}

@media (min-width: 720px) {
  .metrics { grid-template-columns: repeat(4, 1fr); }
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .skill-group { grid-template-columns: 200px 1fr; gap: var(--space-6); }
}

@media (min-width: 960px) {
  .container { padding-inline: var(--space-8); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .hero { padding-block: var(--space-24) var(--space-16); }
}

/* ---------- cross-document view transitions ---------- */
/* Chrome and Edge 126+, Safari 18.2+. A no-op in Firefox, which navigates as before. */

@view-transition { navigation: auto; }

main { view-transition-name: page-content; }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .btn:hover, .card:hover { transform: none; }
  .btn { translate: none; }
  .cursor-dot, .cursor-ring { display: none; }
  /* Settle the aurora at its keyframe start, not at a near-zero-duration end. */
  .hero__bg span { animation: none !important; }
  @view-transition { navigation: none; }
}
