/* ── Theme tokens ── */
:root {
  color-scheme: light;
  --color-page: 255 255 255;
  --color-surface: 255 255 255;
  --color-soft: 248 250 252;
  --color-primary: 30 41 59;
  --color-secondary: 71 85 105;
  --color-tertiary: 100 116 139;
  --color-accent: 121 85 72;
  --color-accent-strong: 93 64 55;
  --color-on-accent: 248 250 252;
  --color-line: 226 232 240;
  --color-line-strong: 148 163 184;
  --color-ink: 15 23 42;
  --color-focusring: 63 114 171;
}

[data-theme="dark"] {
  color-scheme: dark;
  --color-page: 23 18 16;
  --color-surface: 35 29 26;
  --color-soft: 49 40 36;
  --color-primary: 241 232 223;
  --color-secondary: 198 183 170;
  --color-tertiary: 154 139 125;
  --color-accent: 218 169 125;
  --color-accent-strong: 190 142 104;
  --color-on-accent: 25 20 17;
  --color-line: 82 67 59;
  --color-line-strong: 112 92 81;
  --color-ink: 11 10 9;
  --color-focusring: 120 172 228;
}

/* ── Skip link ── */
.skip-link {
  position: absolute; top: -999px; left: 1rem; z-index: 9999;
  padding: .65rem 1.25rem;
  background: rgb(var(--color-accent));
  color: rgb(var(--color-on-accent));
  border-radius: 4px; font-weight: 600; font-size: .875rem;
  text-decoration: none; font-family: Inter, system-ui, sans-serif;
}
.skip-link:focus { top: 1rem; }

/* ── Focus ring ── */
:focus-visible { outline: 3px solid rgb(var(--color-focusring)); outline-offset: 3px; border-radius: 2px; }
:focus:not(:focus-visible) { outline: none; }

html {
  scroll-behavior: smooth;
  background: rgb(var(--color-page));
}

body {
  background: rgb(var(--color-page));
  color: rgb(var(--color-primary));
  transition: background-color .3s ease, color .3s ease;
}

/* ── Screen-reader only ── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ── Accordion panel ── */
.acc-panel { overflow: hidden; transition: max-height .3s ease, opacity .3s ease; }
.acc-panel.closed { max-height: 0; opacity: 0; pointer-events: none; }
.acc-panel.open   { max-height: 3000px; opacity: 1; }

/* ── Portfolio imagery ── */
.portfolio-media-frame {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  background: rgb(var(--color-soft));
  border: 1px solid rgb(var(--color-line) / .65);
  box-shadow: 0 18px 50px rgba(61, 46, 38, 0.12);
}

.portfolio-media-frame img {
  width: 100%;
  height: 100%;
  display: block;
}

.portfolio-caption {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  margin: 0;
  padding: .75rem .9rem;
  border-radius: 999px;
  background: rgba(35, 35, 35, 0.72);
  color: rgb(var(--color-on-accent));
  font-size: .78rem;
  line-height: 1.3;
  backdrop-filter: blur(10px);
}

/* ── Dark theme imagery refinement ── */
[data-theme="dark"] .portfolio-media-frame {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}
[data-theme="dark"] .portfolio-caption {
  background: rgba(11, 10, 9, 0.82);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .acc-panel { transition: none !important; }
}
