/* =========================================================================
   rgrande.it — Technical Dossier
   Hand-built design system. See DESIGN.md for the rationale behind tokens.
   ========================================================================= */

/* ---------------------------------------------------------------- Tokens */
:root {
  /* Color — OKLCH. Cool technical paper, deep petrol ink, one petrol accent. */
  --bg:            oklch(0.992 0.003 220);
  --surface:       oklch(0.967 0.005 220);
  --surface-2:     oklch(0.945 0.006 220);
  --line:          oklch(0.886 0.006 220);
  --line-strong:   oklch(0.820 0.008 220);
  --ink:           oklch(0.235 0.018 235);
  --ink-2:         oklch(0.380 0.016 232);
  --muted:         oklch(0.505 0.014 230);
  --accent:        oklch(0.520 0.088 207);
  --accent-deep:   oklch(0.420 0.080 210);
  --accent-wash:   oklch(0.950 0.020 207);
  --ember:         oklch(0.620 0.130 50);

  /* Typography */
  --font-display: "Schibsted Grotesk", system-ui, sans-serif;
  --font-body:    "Hanken Grotesk", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Fluid type scale (ratio ~1.27) */
  --step--1: clamp(0.80rem, 0.78rem + 0.10vw, 0.86rem);
  --step-0:  clamp(1.00rem, 0.97rem + 0.14vw, 1.08rem);
  --step-1:  clamp(1.20rem, 1.13rem + 0.34vw, 1.40rem);
  --step-2:  clamp(1.45rem, 1.31rem + 0.66vw, 1.85rem);
  --step-3:  clamp(1.80rem, 1.55rem + 1.20vw, 2.55rem);
  --step-4:  clamp(2.25rem, 1.80rem + 2.15vw, 3.40rem);
  --display: clamp(2.55rem, 1.85rem + 3.45vw, 4.20rem);

  /* Spacing scale (4px base) */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;  --sp-4: 1rem;
  --sp-6: 1.5rem;   --sp-8: 2rem;     --sp-12: 3rem;    --sp-16: 4rem;
  --sp-24: 6rem;    --sp-32: 8rem;

  /* Layout */
  --shell-max: 75rem;        /* 1200px */
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --section-y: clamp(5rem, 12vh, 9rem);
  --measure: 66ch;
  --radius: 4px;
  --radius-lg: 8px;

  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --dur: 0.5s;

  /* Z-scale (semantic) */
  --z-header: 100;
  --z-overlay: 200;

  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

/* ---------------------------------------------------------------- Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.04; font-weight: 600; text-wrap: balance; }
p { text-wrap: pretty; }

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

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

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

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

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

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 2px;
}

/* ------------------------------------------------------- Skip link */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -4rem;
  z-index: var(--z-overlay);
  background: var(--ink);
  color: var(--bg);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius);
  font-size: var(--step--1);
  transition: top 0.2s var(--ease-out-quart);
}
.skip-link:focus { top: var(--sp-4); }

/* ------------------------------------------------------- Layout shell */
.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }

/* Hairline divider between major sections, with datum ticks at the ends. */
.section:not(.section--contact) { position: relative; }
.section + .section::before {
  content: "";
  position: absolute;
  inset-inline: var(--gutter);
  top: 0;
  height: 1px;
  background: var(--line);
}

/* =========================================================================
   HEADER / NAV
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: color-mix(in oklch, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease-out-quart),
              background 0.3s var(--ease-out-quart);
}
.site-header[data-scrolled] {
  border-bottom-color: var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.wordmark__mark {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--ink);
  padding: 0.32em 0.5em;
  border-radius: var(--radius);
  line-height: 1;
  transition: background 0.3s var(--ease-out-quart);
}
.wordmark:hover .wordmark__mark { background: var(--accent); }
.wordmark__name { font-size: var(--step-0); }

.nav__list { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.25rem); }
.nav__list a {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  position: relative;
  padding-block: 0.25rem;
  transition: color 0.2s var(--ease-out-quart);
}
.nav__list a:not(.nav__cta)::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out-expo);
}
.nav__list a:hover { color: var(--ink); }
.nav__list a:not(.nav__cta):hover::after { transform: scaleX(1); }

.nav__cta {
  color: var(--ink) !important;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.4rem 0.95rem !important;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.nav__cta:hover { background: var(--ink); color: var(--bg) !important; border-color: var(--ink); }

/* The name in the wordmark collapses to the monogram on small screens. */
@media (max-width: 30rem) {
  .wordmark__name { display: none; }
}

/* =========================================================================
   HERO
   ========================================================================= */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: end;
  padding-top: clamp(3.5rem, 9vh, 7rem);
  padding-bottom: var(--section-y);
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin-bottom: var(--sp-6);
}
.hero__eyebrow .dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex: none;
}

.hero__title {
  font-size: var(--display);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.98;
  max-width: 18ch;
}
.hero__title-accent { color: var(--accent); display: block; }

.hero__sub {
  margin-top: var(--sp-6);
  max-width: 46ch;
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-2);
}

.hero__actions {
  margin-top: var(--sp-8);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

/* --- Title-block (signature detail) --- */
.title-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(var(--surface), var(--surface));
  padding: var(--sp-6);
  position: relative;
}
.title-block::before {
  /* corner datum mark, like a drawing sheet */
  content: "";
  position: absolute;
  top: 10px; left: 10px;
  width: 10px; height: 10px;
  border-top: 1.5px solid var(--accent);
  border-left: 1.5px solid var(--accent);
}
.title-block__caption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
  margin-bottom: var(--sp-4);
}
.title-block__grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem 1.1rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
}
.title-block__grid dt {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.04em;
}
.title-block__grid dd { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.tb-coord { color: var(--muted); font-weight: 400; white-space: nowrap; }

.title-block__status { display: flex; align-items: center; gap: 0.5rem; }
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ember);
  flex: none;
  box-shadow: 0 0 0 0 color-mix(in oklch, var(--ember) 60%, transparent);
  animation: pulse 2.6s var(--ease-out-quart) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklch, var(--ember) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px color-mix(in oklch, var(--ember) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--ember) 0%, transparent); }
}

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
  --_pad-y: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: var(--_pad-y) 1.25rem;
  border-radius: 999px;
  font-size: var(--step-0);
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.25s var(--ease-out-quart),
              color 0.25s var(--ease-out-quart),
              border-color 0.25s var(--ease-out-quart),
              transform 0.25s var(--ease-out-expo);
}
.btn__arrow { transition: transform 0.3s var(--ease-out-expo); }

.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--accent-deep); }
.btn--primary:hover .btn__arrow { transform: translateX(4px); }
.btn--primary:active { transform: translateY(1px); }

.btn--ghost { color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); background: var(--surface); }

.btn--block { width: 100%; justify-content: center; }

/* =========================================================================
   SECTION HEADERS  (the dossier "folio rail")
   ========================================================================= */
.section__head { margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.folio {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-3);
}
.section__title {
  font-size: var(--step-4);
  font-weight: 600;
  letter-spacing: -0.025em;
}
.section__note {
  margin-top: var(--sp-4);
  max-width: 52ch;
  color: var(--muted);
  font-size: var(--step-1);
}

/* =========================================================================
   SELECTED WORK
   ========================================================================= */
.projects { border-top: 1px solid var(--line); }

.project {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1.7fr) minmax(0, 1fr);
  gap: clamp(1rem, 4vw, 3rem);
  padding: clamp(1.75rem, 3.5vw, 2.75rem) 0;
  border-bottom: 1px solid var(--line);
  position: relative;
  isolation: isolate;
  transition: background 0.35s var(--ease-out-quart);
}
/* full-bleed hover wash that respects the gutter visually */
.project::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--gutter) * -0.5);
  background: color-mix(in oklch, var(--accent-wash) 55%, var(--surface));
  opacity: 0;
  z-index: -1;
  border-radius: var(--radius-lg);
  transition: opacity 0.35s var(--ease-out-quart);
}
/* Hover/focus affordances belong to linked entries only. Entries without a
   public URL are plain <article class="project"> and stay static. */
a.project:hover::before,
a.project:focus-visible::before { opacity: 1; }

.project__index {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
  padding-top: 0.55rem;
  transition: color 0.3s var(--ease-out-quart);
}
a.project:hover .project__index { color: var(--accent); }

.project__title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: var(--step-3);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  transition: transform 0.35s var(--ease-out-expo), color 0.3s var(--ease-out-quart);
}
a.project:hover .project__title,
a.project:focus-visible .project__title { transform: translateX(6px); color: var(--accent-deep); }
.project__arrow {
  font-size: 0.7em;
  color: var(--muted);
  transform: translate(-4px, 0);
  opacity: 0;
  transition: transform 0.35s var(--ease-out-expo), opacity 0.35s, color 0.35s;
}
a.project:hover .project__arrow { transform: translate(0, 0); opacity: 1; color: var(--accent); }

.project__desc {
  margin-top: var(--sp-3);
  max-width: 48ch;
  color: var(--ink-2);
  font-size: var(--step-0);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin-top: var(--sp-4);
}
.tags li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.22rem 0.5rem;
  border-radius: var(--radius);
}
a.project:hover .tags li { border-color: var(--line-strong); }

.project__meta {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-top: 0.5rem;
}
.project__meta div {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.5rem;
  align-items: baseline;
}
.project__meta dt {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.project__meta dd { font-size: var(--step--1); color: var(--ink-2); }

/* =========================================================================
   ABOUT
   ========================================================================= */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.about__prose { display: flex; flex-direction: column; gap: var(--sp-6); max-width: var(--measure); }
.about__lead {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}
.about__prose p:not(.about__lead) { color: var(--ink-2); font-size: var(--step-1); line-height: 1.62; }

.about__aside {
  border-top: 2px solid var(--ink);
  padding-top: var(--sp-4);
}
.keyvals, .contact__meta { display: flex; flex-direction: column; }
.keyvals div, .contact__meta div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line);
}
.keyvals dt, .contact__meta dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-top: 0.15rem;
}
.keyvals dd, .contact__meta dd { font-size: var(--step-0); color: var(--ink); font-weight: 500; }

/* =========================================================================
   FOCUS
   ========================================================================= */
.focus__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 4vw, 3.5rem) clamp(2rem, 5vw, 4rem);
}
@media (min-width: 64rem) {
  .focus__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 30rem) {
  .focus__grid { grid-template-columns: minmax(0, 1fr); }
}
.focus__group { border-top: 2px solid var(--ink); padding-top: var(--sp-4); }
.focus__heading {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-4);
}
.focus__list { display: flex; flex-direction: column; }
.focus__list li {
  font-size: var(--step-0);
  color: var(--ink-2);
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: color 0.2s, padding-left 0.25s var(--ease-out-expo);
}
.focus__list li::before {
  content: "";
  width: 5px; height: 5px;
  background: var(--line-strong);
  flex: none;
  transition: background 0.25s var(--ease-out-quart), transform 0.25s;
}
.focus__list li:hover { color: var(--ink); padding-left: 0.35rem; }
.focus__list li:hover::before { background: var(--accent); }

/* Prose variant of a focus group — used by the Lab section, which describes
   things rather than listing them. Same rule, same rhythm, no list marks. */
.focus__text {
  font-size: var(--step-0);
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 42ch;
}

/* =========================================================================
   CONTACT
   ========================================================================= */
.section--contact { background: var(--surface); }
.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}
.contact__note {
  margin-top: var(--sp-4);
  max-width: 42ch;
  color: var(--muted);
  font-size: var(--step-1);
}
.contact__email {
  display: inline-block;
  margin-top: var(--sp-8);
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  position: relative;
  width: fit-content;
}
.contact__email::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0.05em;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out-expo);
}
.contact__email:hover { color: var(--accent-deep); }
.contact__email:hover::after { transform: scaleX(1); }

.contact__meta { margin-top: var(--sp-8); }
.contact__meta a { color: var(--accent); transition: color 0.2s; }
.contact__meta a:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }

/* --- Form --- */
.contact__form { display: flex; flex-direction: column; gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: 0.45rem; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.field input, .field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  font-size: var(--step-0);
  color: var(--ink);
  transition: border-color 0.2s var(--ease-out-quart), box-shadow 0.2s;
}
.field textarea { resize: vertical; min-height: 7rem; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:hover, .field textarea:hover { border-color: var(--muted); }
.field input:focus-visible, .field textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] {
  border-color: oklch(0.55 0.16 25);
}

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.contact__form .btn { margin-top: var(--sp-2); }

.form-status {
  font-size: var(--step--1);
  min-height: 1.4em;
  color: var(--muted);
}
.form-status[data-state="success"] { color: var(--accent-deep); font-weight: 500; }
.form-status[data-state="error"]   { color: oklch(0.52 0.17 25); font-weight: 500; }

/* =========================================================================
   FOOTER
   ========================================================================= */
.site-footer { border-top: 1px solid var(--line); padding-block: var(--sp-12); }
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4) var(--sp-8);
}
.site-footer__sig { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.site-footer__colophon {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
}
.site-footer__year { margin-left: 0.5rem; }
.site-footer__top {
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--muted);
  display: inline-flex;
  gap: 0.4rem;
  transition: color 0.2s, gap 0.25s var(--ease-out-expo);
}
.site-footer__top:hover { color: var(--ink); gap: 0.65rem; }

/* =========================================================================
   REVEAL — progressive enhancement only (.js + motion allowed)
   Content is fully visible by default; this just adds entrance polish.
   ========================================================================= */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
  will-change: opacity, transform;
}
.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: clamp(2rem, 6vw, 3rem);
  }
  .title-block { max-width: 30rem; }

  .about__grid { grid-template-columns: minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 3.5rem); }
  .contact__grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 48rem) {
  .project {
    grid-template-columns: 2rem 1fr;
    gap: var(--sp-3) var(--sp-4);
  }
  .project__meta {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--sp-3) var(--sp-6);
    margin-top: var(--sp-2);
  }
  .project__meta div { grid-template-columns: auto auto; gap: 0.4rem; }
}

@media (max-width: 34rem) {
  .nav__list { gap: 1rem; }
  .nav__list li:has(a:not(.nav__cta)) { display: none; }  /* keep only Contact on phones */
  .project__meta div { grid-template-columns: 1fr; gap: 0.1rem; }
  .site-footer__inner { flex-direction: column; gap: var(--sp-3); }
}

/* =========================================================================
   ICONS  (inline Lucide sprite — functional, never decorative)
   ========================================================================= */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.btn__arrow { width: 1.05em; height: 1.05em; }
.project__title .icon { align-self: center; }

/* =========================================================================
   HEADER CONTROLS  (language + theme)
   ========================================================================= */
.site-header__right { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.25rem); }
.controls { display: flex; align-items: center; gap: clamp(0.6rem, 1.6vw, 1rem); }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
}
.lang-switch__btn {
  background: none;
  border: none;
  padding: 0.2rem 0.15rem;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.03em;
  border-radius: 3px;
  transition: color 0.2s var(--ease-out-quart);
}
.lang-switch__btn:hover { color: var(--ink-2); }
.lang-switch__btn[aria-pressed="true"] { color: var(--ink); }
.lang-switch__sep { color: var(--line-strong); }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.2s var(--ease-out-quart),
              border-color 0.2s var(--ease-out-quart),
              background 0.2s var(--ease-out-quart);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); background: var(--surface); }
.theme-toggle .icon { width: 1.05rem; height: 1.05rem; stroke-width: 1.85; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Contact email gains a quiet leading mail glyph. */
.contact__email { display: inline-flex; align-items: center; gap: 0.6rem; }
.contact__email-icon { width: 0.62em; height: 0.62em; color: var(--accent); stroke-width: 2.1; }
.contact__email:hover .contact__email-icon { color: var(--accent-deep); }
.site-footer__top .icon { width: 0.9em; height: 0.9em; }

/* =========================================================================
   DARK THEME
   The mood at night: a precision instrument lit from within. Deep petrol
   charcoal (carries the brand hue), the same single teal accent, brightened
   so it reads as a glow rather than a smudge.
   ========================================================================= */
:root[data-theme="dark"] {
  --bg:            oklch(0.178 0.014 245);
  --surface:       oklch(0.216 0.015 244);
  --surface-2:     oklch(0.255 0.016 244);
  --line:          oklch(0.320 0.014 242);
  --line-strong:   oklch(0.420 0.016 240);
  --ink:           oklch(0.945 0.006 230);
  --ink-2:         oklch(0.830 0.010 232);
  --muted:         oklch(0.675 0.014 234);
  --accent:        oklch(0.760 0.105 198);
  --accent-deep:   oklch(0.835 0.090 196);
  --accent-wash:   oklch(0.300 0.050 212);
  --ember:         oklch(0.720 0.130 52);
}

:root[data-theme="dark"] body {
  /* Light type on a dark field reads lighter; give it a touch more air. */
  line-height: 1.64;
}
/* Slightly stronger header separation on dark so it doesn't float. */
:root[data-theme="dark"] .site-header[data-scrolled] { border-bottom-color: var(--line-strong); }
/* Tags need a hair more presence on dark. */
:root[data-theme="dark"] .tags li { background: var(--surface); }

/* Smooth, brief crossfade only while toggling (never on load or hover). */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color 0.4s var(--ease-out-quart),
              border-color 0.4s var(--ease-out-quart),
              color 0.4s var(--ease-out-quart),
              fill 0.4s var(--ease-out-quart),
              stroke 0.4s var(--ease-out-quart) !important;
}

/* =========================================================================
   RESPONSIVE — controls
   ========================================================================= */
@media (max-width: 44rem) {
  /* On phones the section links collapse; language + theme + Contact stay. */
  .nav { display: none; }
}
@media (max-width: 22rem) {
  .lang-switch { display: none; }
}

/* =========================================================================
   REDUCED MOTION
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
  .status-dot { animation: none; }
  html.theme-anim, html.theme-anim * { transition-duration: 0.001ms !important; }
}
