/* =========================================================================
   Manu Rizzo — photography portfolio
   Design system per DESIGN.md (Wired-inspired editorial), extended with a
   derived dark theme. Editorial restraint: black/white duet, serif display +
   serif body + sans labels, square geometry, hairline elevation, no shadows.
   ========================================================================= */

/* ---- Self-hosted fonts (copied into dist by the build; system fallbacks
        keep the site working even if the files are absent) ---------------- */
@font-face {
  font-family: 'Playfair Display';
  src: url('/assets/fonts/playfair-display-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/assets/fonts/source-serif-4-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/assets/fonts/source-serif-4-latin-400-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-latin-700-normal.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---- Design tokens ----------------------------------------------------- */
:root {
  /* Type families (DESIGN.md substitutes) */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  /* Spacing (4px base) */
  --sp-xxs: 2px; --sp-xs: 4px; --sp-sm: 8px; --sp-md: 12px; --sp-lg: 16px;
  --sp-xl: 20px; --sp-2xl: 24px; --sp-3xl: 32px; --sp-4xl: 48px; --sp-5xl: 72px;

  --radius-none: 0px;
  --radius-full: 9999px;
  --container: 1400px;

  /* Light theme (DESIGN.md) */
  --primary: #000000;
  --on-primary: #ffffff;
  --ink: #000000;
  --ink-soft: #1a1a1a;
  --body: #757575;
  --hairline: #e0e0e0;
  --canvas: #ffffff;
  --canvas-soft: #f5f5f5;
  --link: #057dbc;
  color-scheme: light;

  /* Elevation for the carousel photo — lifts each print off the page so mixed
     aspect ratios read as framed works and white borders separate cleanly. */
  --photo-shadow: 0 12px 34px rgba(0, 0, 0, 0.20), 0 3px 10px rgba(0, 0, 0, 0.12);
}

/* Dark theme — derived counterpart, same editorial restraint */
[data-theme='dark'] {
  --primary: #f5f5f5;     /* CTA / footer fill flips to light */
  --on-primary: #0a0a0a;
  --ink: #f5f5f5;
  --ink-soft: #e6e6e6;
  --body: #9a9a9a;
  --hairline: #2a2a2a;
  --canvas: #0a0a0a;
  --canvas-soft: #161616;
  --link: #4aa8e0;        /* lifted for contrast on dark canvas */
  color-scheme: dark;
  /* Deeper shadow so the print still lifts off the dark canvas. */
  --photo-shadow: 0 16px 46px rgba(0, 0, 0, 0.7), 0 4px 14px rgba(0, 0, 0, 0.55);
}

/* ---- Base -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: var(--container); margin: 0 auto; padding-inline: var(--sp-xl); }

.eyebrow {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute; left: var(--sp-lg); top: -60px;
  background: var(--primary); color: var(--on-primary);
  padding: var(--sp-sm) var(--sp-lg); font-family: var(--font-sans);
  font-weight: 700; font-size: 14px; z-index: 100; transition: top .15s ease;
}
.skip-link:focus { top: var(--sp-lg); }

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

/* ---- Masthead band (signature element) --------------------------------- */
.masthead {
  border-bottom: 1px solid var(--ink);
  background: var(--canvas);
  /* Sticky: stays pinned to the top of the viewport while scrolling. */
  position: sticky;
  top: 0;
  z-index: 50;
}
.masthead__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-lg); padding-block: var(--sp-md);
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 6vw, 40px);
  letter-spacing: -0.5px;
  line-height: 1;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.masthead__side { flex: 1 1 0; display: flex; align-items: center; gap: var(--sp-sm); }
.masthead__side--right { justify-content: flex-end; }

/* Nav links row */
.nav {
  display: flex; align-items: center; gap: var(--sp-lg);
}
.nav a {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .4px;
  text-decoration: none;
  color: var(--ink);
  padding-block: var(--sp-xs);
  border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current='page'] { border-bottom-color: var(--ink); }

/* Icon buttons (theme toggle, social, carousel controls) */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--canvas); color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-full);
  padding: var(--sp-sm);
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.icon-btn:hover { background: var(--ink); color: var(--on-primary); border-color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .icon-moon { display: none; }
[data-theme='dark'] .icon-btn .icon-sun { display: none; }
[data-theme='dark'] .icon-btn .icon-moon { display: inline; }

/* Mobile menu toggle — hidden on desktop */
.menu-toggle { display: none; border: 1px solid var(--hairline); background: var(--canvas);
  width: 40px; height: 40px; border-radius: var(--radius-full); align-items: center; justify-content: center; }
.menu-toggle svg { width: 20px; height: 20px; }

/* ---- Hero band --------------------------------------------------------- */
.hero {
  padding-block: var(--sp-4xl) var(--sp-2xl);
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(40px, 8vw, 64px);
  line-height: .95;
  letter-spacing: -0.5px;
  margin: 0 0 var(--sp-md);
  color: var(--ink);
}
.hero__lead {
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.47;
  color: var(--body);
  max-width: 60ch;
  margin: 0;
}

/* ---- Album selector ---------------------------------------------------- */
.albums {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding-block: var(--sp-md);
}
.albums__row {
  display: flex; gap: var(--sp-2xl); flex-wrap: wrap; align-items: baseline;
}
.album-tab {
  background: none; border: 0; padding: var(--sp-xs) 0;
  font-family: var(--font-sans); font-weight: 700; font-size: 14px;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--body);
  border-bottom: 2px solid transparent; transition: color .15s ease, border-color .15s ease;
}
.album-tab:hover { color: var(--ink); }
.album-tab[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--ink); }
.album-tab__count { color: var(--body); font-weight: 400; margin-left: var(--sp-xs); }

/* ---- Carousel ---------------------------------------------------------- */
.carousel { padding-block: var(--sp-2xl) var(--sp-4xl); }
.carousel__meta {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-lg); margin-bottom: var(--sp-md);
}
.carousel__album-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(24px, 4vw, 32px); letter-spacing: -0.3px; margin: 0; color: var(--ink);
}
.carousel__counter {
  font-family: var(--font-sans); font-weight: 700; font-size: 14px;
  letter-spacing: .4px; color: var(--body); font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* Stage: fixed max-height, image centered at its NATIVE ratio (contain, no crop) */
.carousel__viewport {
  position: relative; /* anchor for the absolutely-positioned nav on mobile */
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-md);
}
.carousel__stage {
  position: relative;
  height: min(76vh, 800px);
  min-height: 320px;
  display: flex; align-items: center; justify-content: center;
  /* No backdrop: the page shows through; the photo floats on the page.
     Padding + visible overflow keep the drop-shadow from being clipped. */
  padding: clamp(20px, 4vw, 52px);
  overflow: visible;
}
.carousel__figure { margin: 0; height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; }
.carousel__img {
  max-height: 100%; max-width: 100%; width: auto; height: auto;
  object-fit: contain;
  /* Elevation lifts the print off the page; the hairline defines the edge. */
  border: 1px solid var(--hairline);
  box-shadow: var(--photo-shadow);
}
.carousel__img.is-enter { animation: fadeIn .32s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.carousel__nav {
  /* circular icon buttons per DESIGN.md */
  width: 48px; height: 48px; flex: 0 0 auto;
}
.carousel__nav:disabled { opacity: .3; cursor: default; }
.carousel__nav:disabled:hover { background: var(--canvas); color: var(--ink); border-color: var(--hairline); }

.carousel__caption {
  font-family: var(--font-serif); font-style: italic; font-size: 14px;
  color: var(--body); margin-top: var(--sp-md); min-height: 1.2em;
  text-align: center;
}

/* Dots */
.carousel__dots { display: flex; gap: var(--sp-sm); justify-content: center; margin-top: var(--sp-lg); flex-wrap: wrap; }
.carousel__dot {
  width: 8px; height: 8px; padding: 0; border: 1px solid var(--body);
  background: transparent; border-radius: var(--radius-full);
}
.carousel__dot[aria-current='true'] { background: var(--ink); border-color: var(--ink); }

.carousel__empty {
  font-family: var(--font-serif); color: var(--body); text-align: center; padding: var(--sp-5xl) 0;
}

/* ---- About page -------------------------------------------------------- */
.about { padding-block: var(--sp-4xl); }
.about__grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-4xl); align-items: start; }
@media (min-width: 900px) { .about__grid { grid-template-columns: 5fr 7fr; } }
.about__portrait { background: var(--canvas-soft); }
.about__portrait img { width: 100%; height: auto; }
.about__portrait--empty {
  aspect-ratio: 4 / 5; display: flex; align-items: center; justify-content: center;
  color: var(--body); font-family: var(--font-sans); font-size: 14px; letter-spacing: 1px; text-transform: uppercase;
}
.about__title {
  font-family: var(--font-display); font-weight: 400; font-size: clamp(40px, 8vw, 64px);
  line-height: .95; letter-spacing: -0.5px; margin: 0 0 var(--sp-sm); color: var(--ink);
}
.about__tagline { font-family: var(--font-sans); font-weight: 700; font-size: 14px;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--body); margin: 0 0 var(--sp-2xl); }
.about__body p {
  font-family: var(--font-serif); font-size: 19px; line-height: 1.55; color: var(--ink-soft);
  margin: 0 0 var(--sp-lg); max-width: 62ch;
}
.about__contact { margin-top: var(--sp-2xl); display: flex; flex-wrap: wrap; gap: var(--sp-md); }

/* Buttons (square) */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-sm);
  font-family: var(--font-sans); font-weight: 700; font-size: 16px; letter-spacing: .3px;
  padding: var(--sp-md) var(--sp-xl); border-radius: var(--radius-none);
  text-decoration: none; border: 1px solid var(--ink);
}
.btn--primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn--outline { background: var(--canvas); color: var(--ink); }
.btn svg { width: 18px; height: 18px; }

/* ---- Footer (black band) ---------------------------------------------- */
.footer {
  background: var(--primary); color: var(--on-primary);
  padding-block: var(--sp-4xl); margin-top: var(--sp-4xl);
}
.footer__inner { display: flex; flex-wrap: wrap; gap: var(--sp-2xl); align-items: center; justify-content: space-between; }
.footer__wordmark { font-family: var(--font-display); font-size: 28px; letter-spacing: -0.5px; }
.footer__links { display: flex; gap: var(--sp-lg); align-items: center; }
.footer__links a {
  font-family: var(--font-sans); font-weight: 700; font-size: 14px; letter-spacing: .4px;
  color: var(--on-primary); text-decoration: none; opacity: .85;
}
.footer__links a:hover { opacity: 1; text-decoration: underline; }
.footer__note { font-family: var(--font-sans); font-size: 12px; opacity: .6; width: 100%; }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 767px) {
  .nav { display: none; }
  .menu-toggle { display: inline-flex; }
  .masthead__side { flex: 0 0 auto; }
  .masthead__side--left { order: 0; }
  .wordmark { order: 1; }
  .masthead__side--right { order: 2; }
  .masthead__inner { flex-wrap: wrap; }

  /* Mobile nav drawer */
  .nav.is-open {
    display: flex; flex-direction: column; align-items: flex-start;
    width: 100%; order: 3; gap: var(--sp-md); padding-top: var(--sp-md);
    border-top: 1px solid var(--hairline); margin-top: var(--sp-sm);
  }
  .carousel__viewport { grid-template-columns: 1fr; }
  .carousel__nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    background: color-mix(in srgb, var(--canvas) 82%, transparent);
  }
  .carousel__nav--prev { left: var(--sp-sm); }
  .carousel__nav--next { right: var(--sp-sm); }
  .carousel__stage { height: min(68vh, 620px); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
