/* ==========================================================================
   Tristan Gage — Portfolio
   ========================================================================== */

:root {
  --bg: #0b0b0d;
  --bg-alt: #131316;
  --bg-raised: #1a1a1e;
  --fg: #f3f1ea;
  --fg-dim: #a9a7a1;
  --fg-faint: #6f6d68;
  --accent: #4fb8a9;
  --accent-dim: #3e9084;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);

  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --container: 1180px;
  --gap: 24px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0; }

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

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

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

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px;
}

.eyebrow {
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 14px;
}

/* Film grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Buttons / Tags
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease), opacity .35s var(--ease);
}
.btn:hover { transform: translateY(-2px); }

.btn--light {
  background: var(--fg);
  color: var(--bg);
}
.btn--light:hover { background: var(--accent); }

.btn--ghost {
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--fg);
}
.btn--ghost:hover { border-color: var(--fg); background: rgba(255,255,255,0.06); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  color: var(--fg-dim);
  white-space: nowrap;
}
.tag--accent {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   Nav
   ========================================================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: linear-gradient(to bottom, rgba(11,11,13,0.85), rgba(11,11,13,0));
  backdrop-filter: blur(6px);
}

.nav__mark {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.nav__mark:hover { opacity: 0.75; transform: scale(1.04); }

.nav__mark-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav__links {
  position: relative;
  display: flex;
  gap: 36px;
  font-size: 14px;
  font-weight: 500;
}
.nav__links a {
  color: var(--fg-dim);
  position: relative;
  z-index: 1;
  transition: color 0.3s var(--ease);
}
.nav__links a:hover { color: var(--fg); }
.nav__links a[aria-current="page"],
.nav__links a.is-active { color: var(--accent); }

.nav__indicator {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 0;
  height: 30px;
  width: 0;
  border-radius: var(--radius-pill);
  background: rgba(79, 184, 169, 0.12);
  border: 1px solid rgba(79, 184, 169, 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(0);
  transition: transform 0.5s var(--ease-bounce), width 0.5s var(--ease-bounce), opacity 0.3s var(--ease);
}

.nav__cta {
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.nav__cta:hover { border-color: var(--accent); background: rgba(79,184,169,0.1); }

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
}
.nav__toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--fg);
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.nav-mobile {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  font-family: var(--serif);
  font-size: 30px;
  transform: translateY(-100%);
  transition: transform 0.4s var(--ease);
}
.nav-mobile.is-open {
  display: flex;
  transform: translateY(0);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  height: 100svh;
  min-height: 560px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: radial-gradient(120% 100% at 50% 0%, #2b3038 0%, #14161a 55%, #0b0b0d 100%);
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

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

.hero__placeholder-label {
  position: absolute;
  bottom: 28px;
  left: 32px;
  font-family: "SF Mono", "Roboto Mono", monospace;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: rgba(243,241,234,0.55);
  border: 1px dashed rgba(243,241,234,0.3);
  padding: 6px 10px;
  border-radius: 6px;
  z-index: 2;
  pointer-events: none;
}

.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(11,11,13,0.92) 0%, rgba(11,11,13,0.35) 45%, rgba(11,11,13,0.15) 100%);
}

.hero__content {
  position: relative;
  z-index: 2;
  padding: 0 32px 100px;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
}

.hero__eyebrow {
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 20px;
}

.hero__name {
  font-size: clamp(48px, 9vw, 108px);
  line-height: 0.98;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}

.hero__role {
  font-size: clamp(17px, 2.2vw, 22px);
  color: var(--fg);
  font-weight: 500;
  margin: 0 0 10px;
  max-width: 640px;
}

.hero__sub {
  font-size: 15px;
  color: var(--fg-dim);
  max-width: 520px;
  margin: 0 0 36px;
}

.hero__actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.hero__scroll {
  position: absolute;
  z-index: 2;
  right: 32px;
  bottom: 40px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(243,241,234,0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero__scroll span {
  display: block;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--fg);
  border-bottom: 1.5px solid var(--fg);
  transform: rotate(45deg) translateY(-2px);
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: rotate(45deg) translateY(-2px); }
  50% { transform: rotate(45deg) translateY(3px); }
}

/* ==========================================================================
   Sections general
   ========================================================================== */

section:not(.hero) {
  padding: 110px 0;
  border-top: 1px solid var(--border);
}

.about { background: var(--bg); }
.work { background: var(--bg-alt); }
.photography { background: var(--bg); }
.side { background: var(--bg-alt); }
.contact { background: var(--bg); }

.section-head {
  max-width: 640px;
  margin: 0 0 56px;
}
.section-head--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  max-width: none;
}
.section-head h2 {
  font-size: clamp(28px, 4vw, 40px);
  margin-bottom: 16px;
}
.section-head__sub {
  color: var(--fg-dim);
  font-size: 15.5px;
  max-width: 560px;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   About
   ========================================================================== */

.about__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 64px;
  align-items: start;
}

.about__copy h2 {
  font-size: clamp(28px, 4vw, 42px);
  margin-bottom: 26px;
}

.about__copy p {
  color: var(--fg-dim);
  font-size: 16px;
  margin-bottom: 18px;
  max-width: 560px;
}

.about__cta-line {
  color: var(--fg) !important;
  font-weight: 500;
  margin-top: 26px !important;
}
.about__cta-line a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
}

.about__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: flex-start;
  padding-top: 8px;
}

/* ==========================================================================
   Media placeholders
   ========================================================================== */

.media-placeholder {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255,255,255,0.045),
      rgba(255,255,255,0.045) 1px,
      transparent 1px,
      transparent 14px
    ),
    linear-gradient(155deg, #22222a 0%, #17171c 100%);
}
.media-placeholder::before {
  content: "";
  display: block;
  padding-top: 62.5%; /* default 16:10-ish */
}
.media-placeholder.ratio-16-9::before { padding-top: 56.25%; }
.media-placeholder.ratio-4-3::before { padding-top: 75%; }
.media-placeholder.ratio-square::before { padding-top: 100%; }
.media-placeholder.ratio-wide::before { padding-top: 46%; }
.media-placeholder.ratio-tall::before { padding-top: 128%; }

.media-placeholder__label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  right: 10px;
  font-family: "SF Mono", "Roboto Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--fg-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-placeholder__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-placeholder__img--top {
  object-position: center 20%;
}

/* Real photos: sized to their own true aspect ratio (via width/height attrs)
   instead of a preset ratio box, so nothing is ever cropped or letterboxed.
   Reserved now for "hero" full-width images, where a forced crop would
   look heavy-handed. Everything else uses the landscape/portrait classes
   below for a consistent, cover-cropped preview. */
.media-placeholder--natural {
  border: none;
  background: none;
}
.media-placeholder--natural::before { content: none; }
.media-placeholder--natural .media-placeholder__img {
  position: static;
  display: block;
  width: 100%;
  height: auto;
  object-fit: unset;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
}

/* Real photos, everywhere else: a consistent preview shape per orientation,
   cropped with object-fit: cover (inherited from the base .media-placeholder
   / .media-placeholder__img rules above). The lightbox always shows the
   full, uncropped original regardless of this preview crop. */
.media-placeholder--landscape {
  aspect-ratio: 16 / 9;
}
.media-placeholder--landscape::before { content: none; }
.media-placeholder--portrait {
  aspect-ratio: 3 / 4;
}
.media-placeholder--portrait::before { content: none; }

/* Photography page index cards only: crop every project thumbnail to a
   square, regardless of its own orientation. */
.work-grid--square .media-placeholder--landscape,
.work-grid--square .media-placeholder--portrait {
  aspect-ratio: 1 / 1;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

/* ==========================================================================
   Gallery — CSS Grid, so tiles always read left-to-right then top-to-bottom
   (source order), and never suffer the Safari bug where CSS multi-column
   content randomly collapses to a single column once images finish
   loading. Each row's height is set by its tallest tile; shorter tiles
   align to the top rather than stretching. Click any image to open it in
   the lightbox.
   ========================================================================== */

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  gap: 14px;
}
.gallery .media-placeholder {
  cursor: zoom-in;
}
.gallery .media-placeholder__img {
  transition: opacity 0.3s var(--ease);
}
.gallery .media-placeholder:hover .media-placeholder__img {
  opacity: 0.85;
}
.gallery .media-placeholder--hero {
  grid-column: 1 / -1;
}

/* Sunrise Brewery only: every thumbnail cropped to a square, regardless of
   its own orientation. The lightbox is untouched and still opens each
   image at its true aspect ratio. */
.gallery--square .media-placeholder--landscape,
.gallery--square .media-placeholder--portrait {
  aspect-ratio: 1 / 1;
}

@media (max-width: 900px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .gallery { grid-template-columns: 1fr; }
}

/* On mobile, every image (work/photo cards and gallery tiles) is already
   shown full width in a single column, so there's no "uniform grid" for
   the landscape/portrait/square crops to protect — just show each photo
   at its own true aspect ratio, uncropped. */
@media (max-width: 640px) {
  .media-placeholder--landscape,
  .media-placeholder--portrait,
  .gallery--square .media-placeholder--landscape,
  .gallery--square .media-placeholder--portrait,
  .work-grid--square .media-placeholder--landscape,
  .work-grid--square .media-placeholder--portrait {
    aspect-ratio: auto;
    border: none;
    background: none;
  }
  .media-placeholder--landscape .media-placeholder__img,
  .media-placeholder--portrait .media-placeholder__img {
    position: static;
    display: block;
    width: 100%;
    height: auto;
    object-fit: unset;
    object-position: unset;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
  }
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  border: none;
  padding: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  background: transparent;
  overflow: visible;
}
.lightbox::backdrop {
  background: rgba(6, 6, 7, 0.92);
  backdrop-filter: blur(4px);
}
.lightbox__stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px;
}
.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.lightbox__close,
.lightbox__nav {
  position: fixed;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--fg-dim);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.lightbox__close:hover,
.lightbox__nav:hover { color: var(--fg); border-color: var(--accent); }

.lightbox__close {
  top: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  font-size: 22px;
  line-height: 1;
}
.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 22px;
}
.lightbox__nav--prev { left: 24px; }
.lightbox__nav--next { right: 24px; }
.lightbox__nav[hidden] { display: none; }

.lightbox__counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "SF Mono", "Roboto Mono", monospace;
  font-size: 12.5px;
  color: var(--fg-dim);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
}

@media (max-width: 640px) {
  .lightbox__stage { padding: 24px 24px 72px; }
  .lightbox__nav { width: 40px; height: 40px; }
  .lightbox__nav--prev { left: 10px; }
  .lightbox__nav--next { right: 10px; }
  .lightbox__close { top: 14px; right: 14px; }
}

/* ==========================================================================
   Work grid
   ========================================================================== */

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  gap: 28px;
}

.work-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.4s var(--ease);
}
.work-card:hover { transform: translateY(-6px); }
.work-card:hover .media-placeholder { border-color: var(--accent-dim); }
.work-card:hover .media-placeholder--natural .media-placeholder__img { border-color: var(--accent-dim); }

.work-card__body {
  padding: 20px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.work-card__tag {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.work-card__tag--win { color: #7fd18a; }

.work-card__title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--fg);
}

.work-card__desc {
  font-size: 14px;
  color: var(--fg-dim);
  line-height: 1.55;
}

/* ==========================================================================
   Photography grid
   ========================================================================== */

.photo-grid {
  columns: 4 220px;
  column-gap: 20px;
}
.photo-grid .media-placeholder {
  margin-bottom: 20px;
  break-inside: avoid;
}

/* ==========================================================================
   Side grid
   ========================================================================== */

.side-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin-top: 40px;
}

/* ==========================================================================
   Contact
   ========================================================================== */

.contact__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
}

.contact__intro h2 {
  font-size: clamp(28px, 4vw, 42px);
  margin-bottom: 18px;
}
.contact__intro p {
  color: var(--fg-dim);
  max-width: 440px;
  margin-bottom: 30px;
}

.contact__links {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.contact__links > a {
  font-family: var(--serif);
  font-size: 20px;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 4px;
  width: fit-content;
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
.contact__links > a:hover { border-color: var(--accent); color: var(--accent); }

.contact__social {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--fg-dim);
}
.contact__social a:hover { color: var(--fg); }

.contact__form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.contact__form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 600;
}
.contact__form input,
.contact__form textarea {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--fg);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  resize: vertical;
  transition: border-color 0.3s var(--ease);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.contact__form input:focus,
.contact__form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.contact__form .btn { align-self: flex-start; margin-top: 4px; }

.contact__note {
  font-size: 12.5px;
  color: var(--fg-faint);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  margin-top: -6px;
}

/* ==========================================================================
   Page intro (secondary pages, e.g. Photography)
   ========================================================================== */

section.page-intro {
  position: relative;
  padding: 180px 0 64px;
  border-top: none;
  overflow: hidden;
  background: var(--bg);
}
.page-intro__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: image-set(
    url("../assets/img/photography-header.avif") type("image/avif"),
    url("../assets/img/photography-header.jpg") type("image/jpeg")
  );
  background-size: cover;
  background-position: center;
}
.page-intro__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(11,11,13,0.55) 0%, rgba(11,11,13,0.82) 65%, rgba(11,11,13,0.94) 100%);
}
section.page-intro .container {
  position: relative;
  z-index: 2;
}
.page-intro h1 {
  font-size: clamp(32px, 5vw, 52px);
  max-width: 720px;
  margin-bottom: 20px;
}
.page-intro__sub {
  color: var(--fg-dim);
  font-size: 16px;
  max-width: 620px;
}

@media (max-width: 640px) {
  section.page-intro { padding: 140px 0 48px; }
}

section.work--gallery {
  border-top: none;
  padding-top: 56px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  padding: 50px 32px 60px;
  text-align: center;
  color: var(--fg-faint);
  font-size: 13px;
  border-top: 1px solid var(--border);
}
.footer p { margin-bottom: 6px; }
.footer__meta { font-size: 12px; }

.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), border-color .3s var(--ease);
  z-index: 60;
}
.to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { border-color: var(--accent); color: var(--accent); }

/* ==========================================================================
   Case study modal (native <dialog>)
   ========================================================================== */

.case-modal {
  border: none;
  padding: 0;
  width: min(880px, 92vw);
  max-height: 86vh;
  background: var(--bg-alt);
  color: var(--fg);
  border-radius: 18px;
  overflow: hidden;
}
.case-modal::backdrop {
  background: rgba(6,6,7,0.75);
  backdrop-filter: blur(3px);
}

.case-modal__inner {
  padding: 48px 48px 56px;
  overflow-y: auto;
  max-height: 86vh;
}

.case-modal__close {
  position: sticky;
  float: right;
  top: 0;
  right: 0;
  z-index: 20;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-dim);
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.case-modal__close:hover { color: var(--fg); border-color: var(--accent); }

.case-modal__tag {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
  clear: both;
}

.case-modal h3 {
  font-size: clamp(24px, 4vw, 34px);
  margin-bottom: 10px;
  padding-right: 40px;
}

.case-modal__sub {
  color: var(--fg-dim);
  font-size: 15px;
  margin-bottom: 36px;
  max-width: 560px;
}

.case-modal__facts {
  display: grid;
  gap: 22px;
  margin: 0 0 36px;
}
.case-modal__facts > div {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
}
.case-modal__facts dt {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 600;
}
.case-modal__facts dd {
  margin: 0;
  font-size: 14.5px;
  color: var(--fg-dim);
  line-height: 1.6;
}

.case-modal__prose {
  margin-bottom: 36px;
}
.case-modal__prose h4 {
  font-size: 15px;
  color: var(--fg);
  margin: 28px 0 10px;
}
.case-modal__prose h4:first-child { margin-top: 0; }
.case-modal__prose p {
  font-size: 14.5px;
  color: var(--fg-dim);
  line-height: 1.7;
  margin-bottom: 12px;
}
.case-modal__prose a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.case-modal__prose a:hover { color: var(--fg); border-color: var(--fg); }
.case-modal__prose-media {
  display: block;
  margin: 8px 0 28px;
}

.case-modal__media {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  gap: 14px;
}
.case-modal__media--2col { grid-template-columns: repeat(2, 1fr); }
.case-modal__media--videos { grid-template-columns: 1fr; gap: 24px; }

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-embed__caption {
  grid-column: 1 / -1;
  margin-top: -6px;
  font-size: 12.5px;
  color: var(--fg-faint);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .nav__links, .nav__cta { display: none; }
  .nav__toggle { display: flex; }

  .about__grid { grid-template-columns: 1fr; gap: 40px; }
  .contact__grid { grid-template-columns: 1fr; gap: 48px; }

  .work-grid { grid-template-columns: repeat(2, 1fr); }
  .case-modal__media { grid-template-columns: repeat(2, 1fr); }
  .span-3 { grid-column: span 2; }
}

@media (max-width: 640px) {
  .container { padding: 0 22px; }
  section:not(.hero) { padding: 80px 0; }

  .work-grid { grid-template-columns: 1fr; }
  .side-grid { grid-template-columns: 1fr; }
  .case-modal__media { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .photo-grid { columns: 2 160px; }

  .case-modal__facts > div { grid-template-columns: 1fr; gap: 6px; }
  .case-modal__inner { padding: 36px 22px 44px; }

  .hero__content { padding-bottom: 70px; }
  .hero__scroll { display: none; }

  .section-head--row { flex-direction: column; align-items: flex-start; gap: 20px; }
}
