/* ========================================
   Portfolio — Zach Kelley
   Design Tokens & Styles
   ======================================== */

/* ----------------------------------------
   Custom Properties (Design Tokens)
   ---------------------------------------- */

/* ── THEME TOGGLE ────────────────────────────────
   By default the site follows your OS appearance.
   To force a specific theme, change the value below:

     light dark  → follows system preference (default)
     dark        → force dark mode
     light       → force light mode
   ────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;

  /* Colors — light-dark(light value, dark value) */
  --color-primary:              light-dark(#0069CC, #8DC5FF);
  --color-on-primary:           light-dark(#FFFFFF, #003258);
  --color-primary-container:    light-dark(#D1E8FF, #004880);
  --color-on-primary-container: light-dark(#00294F, #D1E8FF);
  --color-secondary:            light-dark(#0A345C, #9DC3E8);
  --color-on-secondary:         light-dark(#FFFFFF, #062240);
  --color-secondary-container:  light-dark(#C8DDEF, #0D3D66);
  --color-on-secondary-container: light-dark(#021828, #D4E6F6);
  --color-accent:               light-dark(#FF6700, #FFB68A);
  --color-on-accent:            light-dark(#1A0A00, #4D1F00);
  --color-accent-container:     light-dark(#FFD9B8, #6B2D00);
  --color-on-accent-container:  light-dark(#2A1000, #FFD9B8);
  --color-background:           light-dark(#FBFBFB, #121212);
  --color-surface:              light-dark(#ECECEC, #1E1E1E);
  --color-on-surface:           light-dark(#1A1A1A, #E3E3E3);
  --color-surface-variant:      light-dark(#D4D4D4, #2C2C2C);
  --color-on-surface-variant:   light-dark(#4A4A4A, #C4C4C4);
  --color-outline:              light-dark(#737373, #8E8E8E);
  --color-outline-variant:      light-dark(#C0C0C0, #444444);

  /* Spacing — 8px base scale */
  --space-x-sm: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-x-lg: 32px;
  --space-display-sm: 40px;
  --space-display-md: 56px;
  --space-display-lg: 72px;
  --space-display-x-lg: 96px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-lg: 8px;

  /* Max Width */
  --max-width-sm: 800px;
  --max-width-lg: 1280px;

  /* Typography Families */
  --font-heading: 'Geist', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

/* ----------------------------------------
   Reset & Base
   ---------------------------------------- */

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-on-surface);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.italics {
  font-style: italic;
}

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

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

ul {
  list-style: none;
}

.bullet-list {
  list-style: disc;
  list-style-position: outside;
  line-height: 2.0;
}

li {
  margin-left: 1.5rem;
}

/* ----------------------------------------
   Typography
   ---------------------------------------- */

h1 {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 4.209rem;
  line-height: 1.2;
  color: var(--color-primary);
}

h2 {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 2.369rem;
  line-height: 1.2;
  color: var(--color-primary);
}

h3 {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--color-primary);
}

h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.333rem;
  line-height: 1.2;
  color: var(--color-primary);
}

.subheading {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.222rem;
  line-height: 1.5;
  color: var(--color-on-surface);
}

.project-card-heading {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.222rem;
  line-height: 1.5;
  color: var(--color-on-surface);
}

.caption {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.778rem;
  line-height: 1.5;
  color: var(--color-on-surface);
}

.caption--bold {
  font-weight: 700;
}

/* ----------------------------------------
   Layout
   ---------------------------------------- */

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

.section {
  padding-block: var(--space-display-lg);
}

main {
  margin: var(--space-display-lg) 0px;
}

/* ----------------------------------------
   Header & Navigation
   ---------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  /* Blur lives on a ::before pseudo so it isn't an *ancestor* filter
     of .nav__menu. Nested backdrop-filters don't render, so the mobile
     menu relies on this pseudo-element trick to keep its own blur. */
  isolation: isolate;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: light-dark(rgba(251, 251, 251, 0.88), rgba(18, 18, 18, 0.88));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width-lg);
  margin-inline: auto;
  padding-inline: var(--space-x-lg);
  height: 80px;
}

.nav__logo {
  display: block;
  line-height: 0;
}

.nav__logo img {
  height: 32px;
  width: auto;
  transition: opacity 0.2s ease;
}

.nav__logo:hover img {
  opacity: 0.7;
}

.nav__menu {
  /* On desktop the menu wrapper is transparent to layout — its children
     (the nav-item list and the LinkedIn icon) become direct flex children
     of .nav, restoring the logo | centered links | icon distribution.
     The mobile media query overrides this to become a dropdown panel. */
  display: contents;
}

.nav__center {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav__center > li {
  margin-left: 0px;
}

.nav__toggle {
  display: none;
  background: none;
  border: none;
  padding: var(--space-sm);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.nav__toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.nav__toggle-bar {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-secondary);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav__toggle-bar + .nav__toggle-bar {
  margin-top: 5px;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav__icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.nav__icon-link svg {
  width: 24px;
  height: 24px;
}

.nav__icon-link svg path {
  fill: var(--color-secondary);
  transition: fill 0.2s ease;
}

.nav__icon-link:hover svg path {
  fill: var(--color-primary);
}

.nav__icon-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Nav Item Component */

.nav-item {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  color: var(--color-on-surface);
  height: 31px;
  display: inline-flex;
  align-items: center;
  padding-inline: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background-color 0.2s ease, font-weight 0.15s ease;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--color-accent);
  background-color: var(--color-surface);
}

.nav-item.active {
  color: var(--color-primary);
  font-weight: 700;
  background-color: var(--color-surface-variant);
}

.nav-item:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ----------------------------------------
   Hero Section
   ---------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--space-display-sm);
  align-items: center;
}

.hero__content h1 {
  margin-bottom: var(--space-lg);
}

.hero__image {
  display: flex;
  justify-content: flex-end;
}

.hero__image-wrapper {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  background-color: var(--color-primary-container);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

/* ----------------------------------------
   Button Component
   ---------------------------------------- */

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-on-primary);
  background-color: var(--color-primary);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
  color: var(--color-accent);
  background-color: var(--color-surface);
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ----------------------------------------
   Project Card Component
   ---------------------------------------- */

.project-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-x-lg);
  margin-top: var(--space-display-sm);
}

.project-card {
  display: grid;
  grid-template-columns: 3fr 2fr;
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: background-color 0.2s ease;
}

.project-card:hover {
  background-color: var(--color-surface-variant);
}

.project-card__image {
  padding: var(--space-display-sm);
  padding-bottom: 0px;
}

.project-card__image-inner {
  width: 100%;
  aspect-ratio: 16 / 10;
  background-color: var(--color-primary-container);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  overflow: hidden;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.3);
}

.project-card__image-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.project-card__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-display-sm);
  padding-left: 0;
}

.project-card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.222rem;
  line-height: 1.5;
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
}

.project-card__description {
  color: var(--color-on-surface);
}

/* ----------------------------------------
   About Section
   ---------------------------------------- */

.about__top {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--space-display-sm);
  align-items: center;
  margin-bottom: var(--space-display-sm);
}

.about__content h2 {
  margin-bottom: var(--space-lg);
}

.about__image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 3 / 2;
}

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

.about__experience-heading {
  margin-bottom: var(--space-lg);
}

.experience-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-x-lg);
}

.experience-card__role {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-on-surface);
  margin-bottom: var(--space-sm);
}

.experience-card__description {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-on-surface);
}

/* ----------------------------------------
   Contact Section
   ---------------------------------------- */

.contact__text {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-lg);
}

/* ========================================
   Project Page Components
   ======================================== */

/* ----------------------------------------
   Back Link
   ---------------------------------------- */

.back-link {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  color: var(--color-on-surface);
  height: 31px;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: var(--space-sm);
  padding-inline: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.back-link:hover {
  color: var(--color-accent);
  background-color: var(--color-background);
}

.back-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ----------------------------------------
   Project Hero
   ---------------------------------------- */

.project-hero {
  background-color: var(--color-surface);
  height: calc(100vh - 80px);
  overflow: hidden;
  margin-top: calc(-1 * var(--space-display-lg));
}

.project-hero__back {
  padding: var(--space-x-lg) var(--space-display-sm) var(--space-md) var(--space-display-sm);
}

.project-hero__inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  /* padding-top: var(--space-display-sm); */
}

.project-hero__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: var(--max-width-sm);
}

.project-hero__content h4 {
  margin-bottom: var(--space-md);
}

.project-hero__heading {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 2.369rem;
  line-height: 1.2;
  color: var(--color-on-surface);
}

.project-hero__image {
  margin-top: var(--space-display-sm);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.3);
}

.project-hero__image img {
  width: 100%;
  display: block;
}

/* ----------------------------------------
   Content Grid (Building Blocks)
   ----------------------------------------
   Usage:
     <div class="content-grid content-grid--2">       = 2 equal columns
     <div class="content-grid content-grid--3">       = 3 equal columns
     <div class="content-grid content-grid--2-wide-left">  = 2fr 1fr
     <div class="content-grid content-grid--2-wide-right"> = 1fr 2fr

   Add content-grid--align-center to vertically center items.
   ---------------------------------------- */

.content-grid {
  display: grid;
  gap: var(--space-display-sm);
}

h2 + .content-grid,
h3 + .content-grid,
h4 + .content-grid {
  margin-top: var(--space-display-sm);
}

.content-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.content-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.content-grid--2-wide-left {
  grid-template-columns: 2fr 1fr;
}

.content-grid--2-wide-right {
  grid-template-columns: 1fr 2fr;
}

.content-grid--align-center {
  align-items: center;
}

/* ----------------------------------------
   Image Block
   ----------------------------------------
   A semantic <figure> component for images
   with optional captions in three layouts:

   1. No caption:
      <figure class="image-block">
        <img src="..." alt="...">
      </figure>

   2. Caption below:
      <figure class="image-block">
        <img src="..." alt="...">
        <figcaption class="image-block__caption">...</figcaption>
      </figure>

   3. Caption to the right:
      <figure class="image-block image-block--caption-right">
        <img src="..." alt="...">
        <figcaption class="image-block__caption">...</figcaption>
      </figure>

   4. Caption to the left:
      <figure class="image-block image-block--caption-left">
        <img src="..." alt="...">
        <figcaption class="image-block__caption">...</figcaption>
      </figure>

   Use .image-block--placeholder on the <figure>
   (no-caption) or a wrapper <div> inside the figure
   (with-caption) to show an empty placeholder area.
   ---------------------------------------- */

/* Base — layout wrapper only, no background */

.image-block {
  overflow: hidden;
}

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

/* Placeholder (owns its own background) */

.image-block--placeholder {
  background-color: var(--color-surface);
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
}

/* Aspect ratio modifiers */

.image-block--10x16 {
  aspect-ratio: 10 / 16;
}

/* Caption — below (default) */

.image-block__caption {
  font-family: var(--font-body);
  font-size: 0.778rem;
  line-height: 1.5;
  color: var(--color-on-surface);
  padding: var(--space-sm);
}

/* Side-caption layouts — two separate cards */

.image-block--caption-right,
.image-block--caption-left {
  display: grid;
  align-items: center;
  gap: var(--space-display-sm);
  border-radius: 0;
  overflow: visible;
}

.image-block--caption-right {
  grid-template-columns: 2fr 1fr;
}

.image-block--caption-left {
  grid-template-columns: 1fr 2fr;
}

.image-block--caption-left > .image-block__caption {
  order: -1;
}

/* In side layouts, children are independent cards */

.image-block--caption-right > .image-block--placeholder,
.image-block--caption-left > .image-block--placeholder {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.image-block--caption-right > img,
.image-block--caption-left > img {
  border-radius: var(--radius-lg);
}

.image-block--caption-right > .image-block__caption,
.image-block--caption-left > .image-block__caption {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  height: 100%;
  display: flex;
  align-items: end;
  font-family: var(--font-heading);
  font-size: 1.222rem;
  font-weight: 600;
  color: var(--color-on-surface);
  padding: var(--space-display-sm);
}

/* Legacy alias — kept for backwards compatibility */
.image-caption {
  font-family: var(--font-body);
  font-size: 1.222rem;
  line-height: 1.5;
  color: var(--color-on-surface-variant);
  padding: var(--space-display-sm);
}

/* ----------------------------------------
   Comparison Toggle (Before / After)
   ---------------------------------------- */

.comparison-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.comparison-image-wrapper {
  position: relative;
}

.comparison-image {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.comparison-image--active {
  opacity: 1;
  pointer-events: auto;
}

/* Segmented button group */

.comparison-card > .image-block--placeholder {
  background-color: transparent;
  border-radius: 0;
}

.segmented-toggle {
  display: flex;
  justify-content: center;
  padding: var(--space-sm);
  padding-bottom: var(--space-x-lg);
}

.segmented-toggle__track {
  display: flex;
  gap: var(--space-x-sm);
  background-color: var(--color-surface-variant);
  border-radius: 6px;
  padding: var(--space-x-sm);
}

.segmented-toggle__btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  color: var(--color-on-surface);
  background: transparent;
  border: none;
  height: 31px;
  display: inline-flex;
  align-items: center;
  padding-inline: var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, font-weight 0.15s ease;
}

.segmented-toggle__btn:hover {
  color: var(--color-accent);
  background-color: var(--color-surface);
}

.segmented-toggle__btn--active {
  color: var(--color-primary);
  background-color: var(--color-background);
}

.segmented-toggle__btn--active:hover {
  color: var(--color-primary);
  background-color: var(--color-surface);
}

.segmented-toggle__btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ----------------------------------------
   Showcase Card
   ---------------------------------------- */

.showcase-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.showcase-card__image {
  background-color: var(--color-surface);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  padding: var(--space-md);
}

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

.showcase-card__caption {
  padding: 0px var(--space-lg) var(--space-lg);
  font-family: var(--font-body);
  font-size: 1.222rem;
  line-height: 1.5;
  color: var(--color-on-surface);
}

/* ----------------------------------------
   Utility
   ---------------------------------------- */

.text-center {
  text-align: center;
}

.mt-display-sm {
  margin-top: var(--space-display-sm);
}

/* ----------------------------------------
   Footer
   ---------------------------------------- */

.site-footer {
  background-color: #0A345C;
  color: #FFFFFF;
  min-height: 200px;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 200px;
}

.footer__name {
  color: #FFFFFF;
}

.footer__email {
  color: #FFFFFF;
  transition: color 0.2s ease;
}

.footer__email:hover {
  color: #FF6700;
}

.footer__logo {
  display: block;
  line-height: 0;
}

.footer__logo img {
  height: 32px;
  width: auto;
  transition: opacity 0.2s ease;
}

.footer__logo:hover img {
  opacity: 0.7;
}


/* ----------------------------------------
   Responsive
   ---------------------------------------- */

@media (max-width: 960px) {
  .experience-grid {
    grid-template-columns: 1fr 1fr;
  }

  .content-grid--3 {
    grid-template-columns: 1fr 1fr;
  }

  .project-card {
    grid-template-columns: 1fr;
  }

  .project-card__image {
    order: 2;
    padding: var(--space-x-lg);
    padding-bottom: 0px;
  }

  .project-card__content {
    order: 1;
    padding: var(--space-x-lg);
    padding-bottom: 0;
  }
  .image-block--caption-right > .image-block__caption,
  .image-block--caption-left > .image-block__caption {
    padding: var(--space-lg);
  }
}

@media (max-width: 768px) {
  html {
    font-size: 16px;
    scroll-padding-top: 64px;
  }

  .container {
    padding-inline: var(--space-lg);
  }

  .nav {
    padding: var(--space-sm) var(--space-md);
  }

  .nav__logo img {
    height: 28px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: var(--space-x-lg);
  }

  .hero__image {
    order: -1;
    justify-content: center;
  }

  .hero__image-wrapper {
    max-width: 280px;
  }

  h1 {
    font-size: 2.8rem;
  }

  h2 {
    font-size: 1.8rem;
  }

  /* .project-card {
    grid-template-columns: 1fr;
  }

  .project-card__content {
    padding: 0 var(--space-lg) var(--space-lg);
  } */

  .experience-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .section {
    padding-block: var(--space-display-md);
  }

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

  .about__image {
    order: -1;
  }

  .content-grid--2,
  .content-grid--3,
  .content-grid--2-wide-left,
  .content-grid--2-wide-right {
    grid-template-columns: 1fr;
  }

  .image-block--caption-right,
  .image-block--caption-left {
    grid-template-columns: 1fr;
    gap: var(--space-lg);

  }

  .image-block--caption-left > .image-block__caption {
    order: 0;
  }

  .project-hero__heading {
    font-size: 1.8rem;
  }

  .project-hero {
    height: auto;
    overflow: visible;
  }

  .project-hero__inner {
    height: auto;
    gap: var(--space-display-md);
    overflow: hidden;
  }

  .project-hero__content {
    flex: none;
  }

  .project-hero__image {
    margin-top: 0;
  }

  .segmented-toggle {
    padding-bottom: var(--space-md);
  }
}

/* ========================================
   Image Gallery (Lightbox)
   ======================================== */

/* Clickable images */

[data-gallery] {
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}

/* [data-gallery]:hover {
  opacity: 0.85;
} */

/* Gallery overlay */

.gallery {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.gallery__backdrop {
  position: absolute;
  inset: 0;
  background-color: light-dark(rgba(251, 251, 251, 0.8), rgba(18, 18, 18, 0.8));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* Content area — image + arrows + close + counter */

.gallery__content {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  /* max-width: var(--max-width-lg); */
  height: 100%;
  padding: var(--space-display-md) var(--space-display-sm);
}

/* Close button */

.gallery__close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-lg);
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.gallery__close:hover {
  background-color: var(--color-surface-variant);
  color: var(--color-accent);
}

.gallery__close:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.gallery__close svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Arrow buttons */

.gallery__arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: var(--radius-lg);
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  z-index: 2;
}

.gallery__arrow:hover {
  background-color: var(--color-surface-variant);
  color: var(--color-accent);
}

.gallery__arrow:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.gallery__arrow svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Image wrapper — fills available space */

.gallery__image-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  z-index: 1;
}

.gallery__image {
  max-width: 100%;
  max-height: calc(100% - 48px);
  object-fit: contain;
  border-radius: var(--radius-lg);
  opacity: 1;
  transition: opacity 0.25s ease;
}

.gallery__image.gallery__image--fading {
  opacity: 0;
}

/* Caption */

.gallery__caption {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-on-surface);
  text-align: center;
  padding: var(--space-sm) var(--space-md);
  max-width: var(--max-width-sm);
  opacity: 1;
  transition: opacity 0.25s ease;
}

.gallery__caption.gallery__caption--fading {
  opacity: 0;
}

.gallery__caption:empty {
  display: none;
}

/* Counter */

.gallery__counter {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 0.778rem;
  line-height: 1;
  color: var(--color-on-surface-variant);
  z-index: 2;
}

/* Prevent body scroll when gallery is open */

body.gallery-open {
  overflow: hidden;
}

/* ── Gallery Responsive ─────────────────── */

@media (max-width: 768px) {
  .gallery__content {
    padding: var(--space-display-sm) var(--space-sm);
    gap: var(--space-sm);
  }

  .gallery__arrow {
    width: 36px;
    height: 36px;
  }

  .gallery__arrow svg {
    width: 22px;
    height: 22px;
  }

  .gallery__close {
    top: var(--space-md);
    right: var(--space-md);
    width: 36px;
    height: 36px;
  }

  .gallery__close svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 600px) {
  .site-footer .container {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: var(--space-md);
    height: auto;
    padding-block: var(--space-x-lg);
  }

  .nav {
    position: relative;
  }

  .nav__toggle {
    display: block;
    margin-left: auto;
  }

  .nav__menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-x-lg) var(--space-lg);
    background-color: light-dark(rgba(251, 251, 251, 0.88), rgba(18, 18, 18, 0.88));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--color-surface-variant);
  }

  .nav__menu.is-open {
    display: flex;
  }

  .nav__center {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-xs, 4px);
    width: 100%;
  }

  .nav-item {
    height: auto;
    padding: var(--space-sm);
    width: 100%;
  }

  .nav__icon-link {
    justify-content: flex-start;
    padding: var(--space-sm);
  }
}
