:root {
  color-scheme: dark;
  --paper: #0f1412;
  --wash: #090c0b;
  --surface: #151c19;
  --surface-strong: #1b2420;
  --surface-soft: rgba(255, 255, 255, 0.045);
  --ink: #f3f7f4;
  --ink-strong: #ffffff;
  --muted: #a5b3ad;
  --muted-strong: #c8d2cd;
  --line: rgba(212, 226, 220, 0.14);
  --line-strong: rgba(212, 226, 220, 0.28);
  --accent: #23b8a6;
  --accent-strong: #6ee1d3;
  --accent-soft: rgba(35, 184, 166, 0.14);
  --signal: #df5264;
  --signal-soft: rgba(223, 82, 100, 0.13);
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.42);
  --glow: 0 0 0 1px rgba(35, 184, 166, 0.18), 0 22px 80px rgba(35, 184, 166, 0.08);
  --radius: 8px;
  --shell: 1120px;
  --header-height: 76px;
}

[data-theme="light"] {
  color-scheme: light;
  --paper: #fbfdfb;
  --wash: #eef3f1;
  --surface: #ffffff;
  --surface-strong: #f5f9f7;
  --surface-soft: rgba(8, 20, 18, 0.045);
  --ink: #101513;
  --ink-strong: #050807;
  --muted: #52615b;
  --muted-strong: #2d3935;
  --line: rgba(20, 42, 36, 0.14);
  --line-strong: rgba(20, 42, 36, 0.26);
  --accent: #087d73;
  --accent-strong: #075f58;
  --accent-soft: rgba(8, 125, 115, 0.12);
  --signal: #b3263a;
  --signal-soft: rgba(179, 38, 58, 0.1);
  --shadow: 0 22px 60px rgba(20, 42, 36, 0.11);
  --glow: 0 0 0 1px rgba(8, 125, 115, 0.14), 0 18px 60px rgba(8, 125, 115, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--wash);
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(35, 184, 166, 0.055), transparent 420px),
    var(--wash);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
  text-decoration-color: rgba(35, 184, 166, 0.5);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

a:hover {
  color: var(--accent-strong);
}

button {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink-strong);
  line-height: 1.05;
  letter-spacing: 0;
}

h1 {
  max-width: 790px;
  margin-bottom: 1.45rem;
  font-size: 4rem;
}

h2 {
  margin-bottom: 1rem;
  font-size: 2.35rem;
}

h3 {
  font-size: 1.25rem;
}

p {
  color: var(--muted);
}

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

.site-shell {
  width: min(100% - 2rem, var(--shell));
  margin: 0 auto;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 30;
  padding: 0.65rem 0.9rem;
  background: var(--ink);
  color: var(--wash);
  border-radius: var(--radius);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--wash) 78%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.header-inner {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 0.8rem;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 28%, transparent), transparent 58%),
    var(--surface-strong);
  color: var(--ink-strong);
  font-weight: 850;
  box-shadow: var(--glow);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--ink-strong);
}

.brand small {
  color: var(--muted);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.85rem;
  font-size: 0.95rem;
}

.site-nav a {
  padding: 0.45rem 0;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink-strong);
}

.language-switch,
.theme-toggle {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink) !important;
}

.language-switch {
  min-width: 42px;
  padding: 0.38rem 0.65rem !important;
  text-align: center;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.72rem;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-strong) !important;
  transform: translateY(-1px);
}

.theme-toggle-icon {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.section-band {
  position: relative;
  padding: 6rem 0;
  background: var(--paper);
  overflow: clip;
}

.section-band + .section-band {
  border-top: 1px solid var(--line);
}

.section-band.muted,
.hero {
  background: var(--wash);
}

.hero {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  isolation: isolate;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.hero::before {
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.68), transparent 82%);
  opacity: 0.42;
  animation: grid-drift 18s linear infinite;
}

.hero::after {
  background:
    radial-gradient(circle at 18% 28%, rgba(35, 184, 166, 0.18), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(223, 82, 100, 0.11), transparent 24%);
  filter: blur(8px);
  opacity: 0.9;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.62fr);
  align-items: center;
  gap: 4.2rem;
}

.hero-copy {
  padding: 2rem 0;
}

.eyebrow {
  margin-bottom: 0.9rem;
  color: var(--signal);
  font-size: 0.86rem;
  font-weight: 850;
  text-transform: uppercase;
}

.lead,
.large-copy {
  max-width: 720px;
  color: var(--muted-strong);
  font-size: 1.2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  color: var(--ink);
  font-weight: 760;
  text-decoration: none;
  background: var(--surface-soft);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.button:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.button.primary {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 52%, var(--ink)));
  color: #07110f;
}

.button.secondary {
  background: var(--surface);
}

.button.text-button {
  border-color: transparent;
  background: transparent;
}

.button.disabled {
  color: var(--muted);
  background: var(--surface-soft);
}

.compact-button {
  min-height: 40px;
  padding: 0.52rem 0.78rem;
}

.hero-visual {
  position: relative;
  min-height: 580px;
  display: grid;
  align-items: center;
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: 6% -4% 7% 8%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, transparent 49%, color-mix(in srgb, var(--accent) 38%, transparent) 50%, transparent 51%),
    linear-gradient(180deg, transparent 49%, color-mix(in srgb, var(--accent) 20%, transparent) 50%, transparent 51%);
  background-size: 34px 34px;
  opacity: 0.34;
  transform: rotate(-2deg);
}

.hero-visual::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 4%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-strong), transparent);
  box-shadow: 0 0 26px var(--accent);
  animation: scan-line 4.8s ease-in-out infinite;
}

.portrait {
  position: relative;
  z-index: 1;
  margin: 0;
  min-height: 540px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 13%, transparent), transparent 46%),
    var(--surface);
  box-shadow: var(--shadow);
  transform: rotate(1.5deg);
  transition: transform 320ms ease, box-shadow 320ms ease, border-color 320ms ease;
}

.hero-visual:hover .portrait {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  box-shadow: var(--shadow), var(--glow);
  transform: rotate(0deg) translateY(-4px);
}

.portrait::before {
  content: "FA";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--ink) 12%, transparent);
  font-size: 7rem;
  font-weight: 900;
}

.portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, transparent 58%, rgba(0, 0, 0, 0.54)),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent 38%);
  pointer-events: none;
}

.portrait img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 540px;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.04);
}

.portrait figcaption {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 3;
  padding: 1rem;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
}

.portrait figcaption strong,
.portrait figcaption span {
  display: block;
}

.portrait figcaption span {
  color: var(--muted);
}

.system-panel {
  position: absolute;
  z-index: 4;
  min-width: 132px;
  padding: 0.82rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.system-panel span,
.system-panel strong {
  display: block;
}

.system-panel span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.system-panel strong {
  color: var(--accent-strong);
  font-size: 1.1rem;
}

.panel-top {
  top: 8%;
  right: -5%;
}

.panel-bottom {
  left: -6%;
  bottom: 10%;
}

.section-heading {
  max-width: 640px;
  margin-bottom: 2rem;
}

.section-heading .eyebrow {
  margin-bottom: 0.5rem;
}

.project-list {
  display: grid;
  gap: 1rem;
}

.project-card,
.skill-card,
.post-row,
.timeline article,
.cv-aside {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 6%, transparent), transparent 44%),
    var(--surface);
}

.project-card {
  position: relative;
  padding: 2rem;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 1px solid color-mix(in srgb, var(--accent) 48%, transparent);
  opacity: 0.75;
  pointer-events: none;
}

.project-card:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  box-shadow: var(--shadow), var(--glow);
  transform: translateY(-3px);
}

.project-card h3 {
  margin-bottom: 0.75rem;
  font-size: 1.8rem;
}

.project-topline,
.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.project-topline {
  margin-bottom: 1rem;
  color: var(--signal);
  font-weight: 850;
}

.project-summary {
  max-width: 780px;
  color: var(--muted-strong);
  font-size: 1.08rem;
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.case-grid div,
.decision-block {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.case-grid span,
.decision-block span,
.timeline span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 850;
  text-transform: uppercase;
}

.case-grid p,
.decision-block p {
  margin-bottom: 0;
}

.decision-block ul,
.highlight-list,
.skill-card ul {
  padding-left: 1.1rem;
  margin: 0;
  color: var(--muted);
}

.decision-block li + li,
.highlight-list li + li,
.skill-card li + li {
  margin-top: 0.45rem;
}

.project-footer {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.tech-list li {
  padding: 0.25rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 760;
}

.tech-list.compact {
  justify-content: flex-end;
}

.project-links {
  display: flex;
  gap: 1rem;
  font-weight: 760;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(220px, 0.38fr) minmax(0, 1fr);
  gap: 4rem;
}

.profile-copy,
.timeline,
.post-list {
  min-width: 0;
}

.highlight-list {
  margin-top: 1.5rem;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.skill-grid.condensed {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.skill-card {
  position: relative;
  min-height: 100%;
  padding: 1.25rem;
  transition: transform 200ms ease, border-color 200ms ease, background-color 200ms ease;
}

.skill-card::before {
  content: "";
  display: block;
  width: 38px;
  height: 2px;
  margin-bottom: 1rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 54%, transparent);
}

.skill-card:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  transform: translateY(-2px);
}

.skill-card h3 {
  margin-bottom: 0.9rem;
}

.timeline {
  display: grid;
  gap: 1rem;
}

.timeline article,
.post-row {
  padding: 1.4rem;
  transition: transform 200ms ease, border-color 200ms ease;
}

.timeline article:hover,
.post-row:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  transform: translateY(-2px);
}

.timeline h3,
.post-row h3,
.post-row h2 {
  margin-bottom: 0.45rem;
}

.post-row time {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--signal);
  font-weight: 850;
}

.empty-note {
  padding: 1.25rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.contact-band {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent 48%),
    var(--ink-strong);
  color: var(--wash);
}

[data-theme="dark"] .contact-band {
  background:
    linear-gradient(135deg, rgba(35, 184, 166, 0.16), transparent 48%),
    #050807;
  color: var(--ink);
}

.contact-band h2 {
  color: inherit;
}

.contact-band p,
.contact-band .eyebrow {
  color: color-mix(in srgb, currentColor 72%, transparent);
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.42fr);
  gap: 2rem;
  align-items: center;
}

.contact-list {
  display: grid;
  gap: 0.75rem;
}

.contact-list a {
  padding: 1rem;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.045);
}

.contact-list a:hover {
  border-color: var(--accent-strong);
  transform: translateY(-2px);
}

.page-hero {
  padding-top: 7rem;
  padding-bottom: 5rem;
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 72%);
  opacity: 0.28;
  pointer-events: none;
}

.cv-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.cv-aside {
  position: sticky;
  top: calc(var(--header-height) + 22px);
  padding: 1.25rem;
}

.cv-aside dl,
.cv-aside dd {
  margin: 0;
}

.cv-aside div + div {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.cv-aside dt {
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 850;
  text-transform: uppercase;
}

.cv-main {
  display: grid;
  gap: 3rem;
}

.post-index {
  display: grid;
  gap: 1rem;
  max-width: 780px;
}

.rich-text {
  max-width: 780px;
}

.rich-text p,
.rich-text li {
  color: var(--muted);
}

.rich-text h2,
.rich-text h3 {
  margin-top: 2.4rem;
}

.rich-text h2:first-child,
.rich-text h3:first-child {
  margin-top: 0;
}

.rich-text ul,
.rich-text ol {
  padding-left: 1.25rem;
}

.rich-text li + li {
  margin-top: 0.45rem;
}

.rich-text code {
  padding: 0.15rem 0.38rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink-strong);
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 0.92em;
}

.rich-text pre {
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b100f;
  box-shadow: var(--shadow);
}

[data-theme="light"] .rich-text pre {
  background: #f3f7f5;
}

.rich-text pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

.rich-text blockquote {
  margin: 1.5rem 0;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  color: var(--muted-strong);
}

.post-shell {
  width: min(100%, 820px);
}

.post-hero h1 {
  max-width: 100%;
}

.post-backlink {
  display: inline-flex;
  margin-bottom: 1rem;
  color: var(--muted-strong);
  font-weight: 760;
  text-decoration: none;
}

.post-backlink:hover {
  color: var(--accent-strong);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.6rem;
  margin-top: 1.5rem;
  color: var(--muted-strong);
}

.post-meta strong,
.post-keywords strong {
  color: var(--ink-strong);
}

.post-keywords {
  margin-top: 1.25rem;
}

.post-keywords .tech-list {
  margin-top: 0.7rem;
}

.post-source {
  margin-top: 1rem;
}

.post-source a {
  font-weight: 760;
}

.post-content {
  display: grid;
  gap: 0;
}

.project-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.34fr);
  gap: 2rem;
  align-items: start;
}

.project-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.project-detail-grid,
.project-main-flow {
  display: grid;
  gap: 3rem;
}

.project-section {
  min-width: 0;
}

.project-section-heading {
  max-width: 680px;
  margin-bottom: 1.35rem;
}

.project-case-grid {
  margin-bottom: 0;
}

.project-list-block {
  max-width: 820px;
}

.project-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.project-two-column > div,
.project-legal-card,
.project-action-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 6%, transparent), transparent 44%),
    var(--surface);
}

.project-two-column > div,
.project-legal-card {
  padding: 1.4rem;
}

.project-action-panel {
  position: sticky;
  top: calc(var(--header-height) + 22px);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.project-action-panel h2 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.project-action-panel dl,
.project-action-panel dd {
  margin: 0;
}

.project-action-panel div + div {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.project-action-panel dt {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.project-action-panel dd {
  color: var(--muted-strong);
}

.project-action-panel .project-cta-row {
  display: grid;
}

.project-tech-list {
  max-width: 820px;
}

.project-gallery {
  position: relative;
}

.gallery-track {
  display: grid;
  grid-auto-columns: calc((100% - 2rem) / 3);
  grid-auto-flow: column;
  gap: 1rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-behavior: smooth;
  scroll-snap-type: inline mandatory;
  padding-bottom: 0.4rem;
}

.gallery-track:focus {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.gallery-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  scroll-snap-align: start;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.gallery-media {
  width: 100%;
  height: clamp(470px, 54vw, 620px);
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--surface-strong);
  cursor: zoom-in;
}

.gallery-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 220ms ease;
}

.gallery-media:hover img,
.gallery-media:focus-visible img {
  transform: scale(1.018);
}

.gallery-media:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.gallery-item figcaption {
  flex: 1;
  padding: 0.85rem 1rem;
  color: var(--muted);
}

.gallery-controls {
  position: absolute;
  top: -3.4rem;
  right: 0;
  display: flex;
  gap: 0.5rem;
}

.gallery-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-strong);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  transition: border-color 180ms ease, transform 180ms ease, color 180ms ease;
}

.gallery-button:hover,
.gallery-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

body.gallery-lightbox-open {
  overflow: hidden;
}

.gallery-lightbox {
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  overflow: hidden;
  border: 0;
  background: rgba(4, 7, 6, 0.88);
  color: var(--ink);
  opacity: 0;
  transition: opacity 180ms ease;
}

.gallery-lightbox::backdrop {
  background: rgba(4, 7, 6, 0.76);
  backdrop-filter: blur(12px);
}

.gallery-lightbox.is-open {
  opacity: 1;
}

.gallery-lightbox-panel {
  width: min(100%, 1120px);
  height: 100%;
  min-height: 0;
  max-height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  overflow: hidden;
  transform: scale(0.965) translateY(12px);
  transition: transform 180ms ease;
}

.gallery-lightbox.is-open .gallery-lightbox-panel {
  transform: scale(1) translateY(0);
}

.gallery-lightbox-toolbar {
  display: flex;
  min-height: 0;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gallery-lightbox-counter {
  color: #d7e2dd;
  font-weight: 760;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(15, 20, 18, 0.82);
  color: #ffffff;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.gallery-lightbox-close {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 1.8rem;
  line-height: 1;
}

.gallery-lightbox-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding-inline: 4rem;
  overflow: hidden;
}

.gallery-lightbox-stage img {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.gallery-lightbox-nav {
  position: absolute;
  z-index: 1;
  top: 50%;
  width: 48px;
  height: 64px;
  border-radius: var(--radius);
  font-size: 2rem;
  transform: translateY(-50%);
}

.gallery-lightbox-previous {
  left: 0.5rem;
}

.gallery-lightbox-next {
  right: 0.5rem;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-close:focus-visible,
.gallery-lightbox-nav:hover,
.gallery-lightbox-nav:focus-visible {
  border-color: var(--accent-strong);
  background: rgba(15, 20, 18, 0.96);
}

.gallery-lightbox-caption {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: 0.25rem;
  color: #d7e2dd;
  line-height: 1.4;
  text-align: center;
}

.project-legal-shell {
  display: grid;
  gap: 3rem;
}

.site-footer {
  padding: 2rem 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.footer-grid p {
  margin-bottom: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.9rem;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes grid-drift {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 54px 54px, 54px 54px;
  }
}

@keyframes scan-line {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.18;
  }
  45% {
    transform: translateY(520px);
    opacity: 0.58;
  }
}

@media (max-width: 980px) {
  h1 {
    font-size: 3rem;
  }

  .hero {
    min-height: auto;
  }

  .hero-grid,
  .split-section,
  .contact-grid,
  .cv-grid,
  .project-hero-grid,
  .project-two-column {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 500px;
  }

  .skill-grid,
  .skill-grid.condensed {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-grid {
    grid-template-columns: 1fr;
  }

  .portrait,
  .portrait img {
    min-height: 460px;
  }

  .cv-aside {
    position: static;
  }

  .project-action-panel {
    position: static;
  }

  .gallery-track {
    grid-auto-columns: calc((100% - 1rem) / 2);
  }

  .gallery-media {
    height: clamp(560px, 75vw, 680px);
  }
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }

  h1 {
    font-size: 2.35rem;
  }

  h2 {
    font-size: 1.9rem;
  }

  .section-band {
    padding: 4rem 0;
  }

  .header-inner {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 0.9rem 0;
  }

  .brand {
    width: 100%;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .hero-grid {
    gap: 2.5rem;
  }

  .hero-copy {
    padding-bottom: 0;
  }

  .hero-visual {
    min-height: 410px;
  }

  .portrait {
    transform: none;
  }

  .portrait,
  .portrait img {
    min-height: 380px;
  }

  .system-panel {
    min-width: 112px;
    padding: 0.7rem 0.78rem;
  }

  .panel-top {
    right: 0;
  }

  .panel-bottom {
    left: 0;
  }

  .project-card {
    padding: 1.2rem;
  }

  .project-topline,
  .project-footer,
  .footer-grid {
    align-items: flex-start;
    flex-direction: column;
  }

  .project-cta-row {
    align-items: stretch;
    flex-direction: column;
  }

  .project-cta-row .button {
    width: 100%;
  }

  .gallery-controls {
    position: static;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
  }

  .gallery-track {
    grid-auto-columns: minmax(260px, 92%);
  }

  .gallery-media {
    height: clamp(520px, 76vh, 680px);
  }

  .gallery-lightbox-stage {
    padding-inline: 0;
    padding-bottom: 4.25rem;
  }

  .gallery-lightbox-nav {
    top: auto;
    bottom: 0;
    width: 56px;
    height: 48px;
    transform: none;
  }

  .gallery-lightbox-previous {
    left: calc(50% - 64px);
  }

  .gallery-lightbox-next {
    right: calc(50% - 64px);
  }

  .tech-list.compact {
    justify-content: flex-start;
  }

  .skill-grid,
  .skill-grid.condensed {
    grid-template-columns: 1fr;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

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

  .reveal {
    opacity: 1;
    transform: none;
  }
}

