/* ============================================
   KARLIE KING STUDIO
   Modern Fullscreen Hero / Editorial-Cinematic
   ============================================ */

:root {
  --color-bg: #ffffff;
  --color-text: #0a0a0a;
  --color-muted: #6b6b6b;
  --color-line: #e6e6e6;
  --color-accent: #0a0a0a;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-w: 1440px;
  --pad: clamp(1.25rem, 4vw, 3rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  font-size: 16px;
  letter-spacing: 0.01em;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.3s ease; }
a:hover { opacity: 0.65; }

/* ===== Typography ===== */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; line-height: 1.1; }
h1 { font-size: clamp(2.5rem, 7vw, 5.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 3rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.1rem; letter-spacing: 0.05em; text-transform: uppercase; font-family: var(--font-body); font-weight: 500; }
p { font-size: 1rem; color: var(--color-muted); }
.lead { font-size: clamp(1.05rem, 1.4vw, 1.25rem); color: var(--color-text); max-width: 65ch; }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--color-muted); font-weight: 500; }

/* ===== Header / Navigation ===== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem var(--pad);
  transition: background 0.4s ease, color 0.4s ease, border 0.4s ease;
  border-bottom: 1px solid transparent;
}
.site-header.is-overlay { background: transparent; color: #fff; }
.site-header.is-solid {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--color-text);
  border-bottom-color: var(--color-line);
}
.site-header .logo a { display: block; line-height: 0; }
.site-header .logo img { height: 38px; width: auto; transition: opacity 0.3s ease; }
.site-header .logo .logo-light { display: none; }
.site-header.is-overlay .logo .logo-light { display: block; }
.site-header.is-overlay .logo .logo-dark { display: none; }

.nav { display: flex; align-items: center; gap: 2.25rem; }
.nav > ul { display: flex; list-style: none; gap: 2rem; margin: 0; padding: 0; }
.nav a {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  padding: 0.25rem 0;
}
.nav a::after {
  content: ''; position: absolute; left: 0; bottom: -2px;
  width: 0; height: 1px; background: currentColor;
  transition: width 0.3s ease;
}
.nav a:hover::after, .nav .has-dropdown:hover > a::after { width: 100%; }

.has-dropdown { position: relative; }
.has-dropdown > a::after { display: none; }
.has-dropdown .caret {
  display: inline-block;
  width: 0.45em; height: 0.45em;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  margin-left: 0.4em;
  transition: transform 0.3s ease;
}
.dropdown {
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%) translateY(8px);
  min-width: 220px;
  background: #fff;
  color: var(--color-text);
  border: 1px solid var(--color-line);
  padding: 0.75rem 0;
  list-style: none;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  box-shadow: 0 12px 40px rgba(0,0,0,0.08);
}
.has-dropdown:hover > .dropdown,
.has-dropdown:focus-within > .dropdown {
  opacity: 1; visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.has-dropdown:hover .caret { transform: rotate(225deg) translateY(2px); }
.dropdown li { display: block; }
.dropdown a {
  display: block;
  padding: 0.6rem 1.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.dropdown a::after { display: none; }
.dropdown a:hover { background: #f6f6f6; opacity: 1; }

.hamburger {
  display: none;
  width: 32px; height: 32px;
  position: relative;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  /* iOS Safari forces a system-blue on bare <button>s — explicitly inherit
     so the spans (background: currentColor) follow the header's color
     (black on is-solid, white on is-overlay). */
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.hamburger span {
  position: absolute;
  left: 4px; right: 4px;
  height: 1.5px;
  background: currentColor;
  transition: all 0.3s ease;
}
.hamburger span:nth-child(1) { top: 11px; }
.hamburger span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.hamburger span:nth-child(3) { bottom: 11px; }
.hamburger.is-active span:nth-child(1) { top: 50%; transform: rotate(45deg); }
.hamburger.is-active span:nth-child(2) { opacity: 0; }
.hamburger.is-active span:nth-child(3) { bottom: 50%; transform: translateY(50%) rotate(-45deg); }

/* Mobile drawer close button — JS injects it onto <body>. Hidden on desktop;
   the @media (max-width: 768px) block below switches it on when the menu opens. */
.nav-close { display: none; }

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  overflow: hidden;
  background: #111;
}
.hero-media { position: absolute; inset: 0; z-index: 0; }
.hero-media img, .hero-media video { width: 100%; height: 100%; object-fit: cover; }
.hero-media::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.55) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 var(--pad);
  max-width: 900px;
  animation: fadeUp 1.2s ease forwards;
}
.hero-content h1 { color: #fff; margin-bottom: 1.25rem; font-weight: 400; letter-spacing: -0.015em; }
.hero-content .eyebrow { color: #fff; margin-bottom: 1.5rem; opacity: 0.85; }
.hero-content p { color: rgba(255,255,255,0.85); font-size: clamp(1rem, 1.5vw, 1.2rem); max-width: 600px; margin: 0 auto 2rem; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.scroll-indicator {
  position: absolute;
  bottom: 2.5rem; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: #fff;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  animation: pulse 2.5s ease-in-out infinite;
}
.scroll-indicator::after {
  content: '';
  width: 1px; height: 40px;
  background: linear-gradient(180deg, #fff, transparent);
}
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.95rem 2.4rem;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
  border: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}
.btn:hover { background: #fff; color: #0a0a0a; opacity: 1; }
.btn-dark { background: #0a0a0a; color: #fff; border-color: #0a0a0a; }
.btn-dark:hover { background: transparent; color: #0a0a0a; }

/* ===== Sections / layout ===== */
section { padding: clamp(4rem, 10vh, 8rem) var(--pad); }
.container { max-width: var(--max-w); margin: 0 auto; }
.section-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 3rem;
  max-width: 720px;
}
.section-head.center { align-items: center; text-align: center; margin-left: auto; margin-right: auto; }

/* ===== Highlights gallery (home) ===== */
.highlights {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(0.5rem, 1.2vw, 1rem);
  grid-auto-rows: minmax(180px, auto);
}
.highlight-tile {
  position: relative;
  overflow: hidden;
  background: #f0f0f0;
  aspect-ratio: 4 / 5;
}
.highlight-tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.highlight-tile:hover img { transform: scale(1.04); }
.highlight-tile .meta {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.25rem;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.6));
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.highlight-tile:hover .meta { opacity: 1; transform: translateY(0); }
.highlight-tile .meta .eyebrow { color: rgba(255,255,255,0.7); }
.highlight-tile .meta .title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 400; margin-top: 0.25rem; }

/* Tile shape follows the project's cover_format (portrait | landscape | square).
   The aspect-ratios here are tuned so a portrait (span 4, 4:5) and a landscape
   (span 8, 8:5) end up with identical heights — keeping each row visually calm. */
.highlight-tile.format-portrait  { grid-column: span 4; aspect-ratio: 4 / 5; }
.highlight-tile.format-landscape { grid-column: span 8; aspect-ratio: 8 / 5; }
.highlight-tile.format-square    { grid-column: span 4; aspect-ratio: 1 / 1; }
/* Fallback for tiles without an explicit format = portrait */
.highlight-tile:not(.format-portrait):not(.format-landscape):not(.format-square) {
  grid-column: span 4; aspect-ratio: 4 / 5;
}

/* ===== Service cards (home) ===== */
.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}
.service-card { border-top: 1px solid var(--color-line); padding-top: 2rem; }
.service-card .num {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--color-muted);
  margin-bottom: 1rem;
  display: block;
}
.service-card h3 { margin-bottom: 0.75rem; }
.service-card p { margin-bottom: 1.5rem; }
.service-card .arrow-link {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.service-card .arrow-link::after { content: '→'; transition: transform 0.3s ease; }
.service-card .arrow-link:hover::after { transform: translateX(4px); }

/* ===== Portfolio Grid (category pages) ===== */
.portfolio-hero { padding: clamp(7rem, 14vh, 10rem) var(--pad) clamp(2rem, 6vh, 4rem); text-align: center; }
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: clamp(0.5rem, 1.5vw, 1.5rem);
  padding: 0 var(--pad) clamp(4rem, 8vh, 6rem);
}
.portfolio-item {
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
  aspect-ratio: 4 / 5;
}
.portfolio-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1s ease;
}
.portfolio-item:hover img { transform: scale(1.05); }
.portfolio-item .overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.55));
  display: flex;
  align-items: flex-end;
  padding: 1.5rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.portfolio-item:hover .overlay { opacity: 1; }
.portfolio-item .title { font-family: var(--font-display); font-size: 1.25rem; }

/* Optional cover_format overrides for portfolio tiles (e.g. Book project with one entry).
   The grid still controls the column width, only the aspect ratio of the tile changes. */
.portfolio-item.format-portrait  { aspect-ratio: 4 / 5; }
.portfolio-item.format-landscape { aspect-ratio: 16 / 9; }
.portfolio-item.format-square    { aspect-ratio: 1 / 1; }

/* Mobile gallery density: 2 tiles per row on phones — magazine-style spread.
   Below 640px the auto-fit rule above would otherwise collapse to 1 column. */
@media (max-width: 640px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  /* Landscape covers (e.g. Book) take the full row on phones — half-width
     would crush them. 16:10 keeps a balanced height. */
  .portfolio-item.format-landscape {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 10;
  }
  /* Count badge proportional to the tile. */
  .portfolio-item .count-badge {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
  }
}

/* Multi-gallery sub-navigation (Product Photography) */
.sub-nav {
  position: sticky;
  top: 78px;
  z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-line);
}
.sub-nav .container {
  display: flex;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: 1rem var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
}
.sub-nav .container::-webkit-scrollbar { display: none; }
.sub-nav a {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.4rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, color 0.3s ease;
}
.sub-nav a:hover { border-bottom-color: var(--color-text); opacity: 1; }

.gallery-section { padding: clamp(3rem, 7vh, 5rem) 0 clamp(3rem, 7vh, 5rem); }
.gallery-section .section-head { padding: 0 var(--pad); margin-bottom: 2.5rem; }

/* Clippings: contained, on white, no zoom-on-hover */
.clippings-grid { background: #fff; }
.portfolio-item.clipping {
  background: #ffffff;
  border: 1px solid var(--color-line);
  aspect-ratio: 1 / 1;
}
.portfolio-item.clipping img {
  object-fit: contain;
  padding: 12%;
  transition: transform 0.6s ease;
}
.portfolio-item.clipping:hover img { transform: scale(1.04); }
.portfolio-item.clipping .overlay { background: linear-gradient(180deg, transparent 70%, rgba(0,0,0,0.45)); }

/* Print pages have similar grid */
.print-grid { display: grid; gap: clamp(1rem, 2vw, 2rem); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); padding: 0 var(--pad) 6rem; }
.print-card { background: #fafafa; padding: 2rem; border: 1px solid var(--color-line); }
.print-card img { margin-bottom: 1rem; aspect-ratio: 3/4; object-fit: cover; }
.print-card h3 { margin-bottom: 0.5rem; font-size: 1.4rem; }
.print-card .meta { font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 1rem; }

/* ===== About page ===== */
.about-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding: clamp(7rem, 14vh, 10rem) var(--pad) 5rem;
}
.about-split .image img { aspect-ratio: 4/5; object-fit: cover; width: 100%; }
.about-split .text h1 { margin-bottom: 1.5rem; }
.about-split .text p { font-size: 1.05rem; color: var(--color-text); margin-bottom: 1.25rem; line-height: 1.7; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  padding: 4rem var(--pad);
  background: #fafafa;
}
.fact-item .num { font-family: var(--font-display); font-size: 2.5rem; line-height: 1; }
.fact-item .label { font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--color-muted); margin-top: 0.5rem; }

/* ===== Contact page ===== */
.contact-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(7rem, 14vh, 10rem) var(--pad) 5rem;
}

.contact-intro {
  max-width: 720px;
  margin: 0 auto clamp(3rem, 6vw, 5rem);
  text-align: center;
}
.contact-intro .eyebrow { display: block; margin-bottom: 1.25rem; }
.contact-intro h1 { margin-bottom: 1.25rem; }
.contact-intro .lead { margin: 0 auto; }

.contact-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 1.8fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
  max-width: 1100px;
  margin: 0 auto;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  padding-top: 0.5rem;
}
.contact-info-block { display: flex; flex-direction: column; gap: 0.6rem; }
.contact-info-block .eyebrow { display: block; }
.contact-info-block p { margin: 0; color: var(--color-text); line-height: 1.6; }
.contact-link {
  color: var(--color-text);
  align-self: flex-start;
  border-bottom: 1px solid var(--color-line);
  padding-bottom: 2px;
  transition: border-color 0.3s ease, opacity 0.3s ease;
}
.contact-link:hover { border-bottom-color: var(--color-text); opacity: 1; }

.contact-form {
  background: #fafafa;
  border: 1px solid var(--color-line);
  padding: clamp(1.75rem, 3vw, 2.75rem);
}
.contact-form .form-eyebrow {
  display: block;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-line);
}

form .row { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
form .row.two { grid-template-columns: 1fr 1fr; }
form label { display: block; font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 0.5rem; font-weight: 500; }
form input, form textarea, form select {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--color-line);
  padding: 0.7rem 0;
  font-family: inherit;
  font-size: 1rem;
  background: transparent;
  color: var(--color-text);
  transition: border-color 0.3s ease;
}
form input::placeholder, form textarea::placeholder { color: #b5b5b5; font-weight: 300; }
form input:focus, form textarea:focus, form select:focus { outline: none; border-bottom-color: var(--color-text); }
form textarea { resize: vertical; min-height: 120px; }
.form-submit { margin-top: 1.5rem; width: 100%; }

/* ===== Legal pages ===== */
.legal { max-width: 760px; margin: 0 auto; padding: clamp(7rem, 14vh, 10rem) var(--pad) 5rem; }
.legal h1 { margin-bottom: 1.5rem; }
.legal h2 { margin-top: 2.5rem; margin-bottom: 1rem; font-size: 1.4rem; }
.legal p, .legal li { color: var(--color-text); margin-bottom: 1rem; line-height: 1.75; }
.legal ul { padding-left: 1.5rem; margin-bottom: 1rem; }

/* ===== Footer ===== */
.site-footer { background: #0a0a0a; color: #ccc; padding: 4rem var(--pad) 2rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 3rem;
  max-width: var(--max-w);
  margin: 0 auto;
}
.site-footer h4 { color: #fff; margin-bottom: 1.25rem; }
.site-footer .logo img { height: 32px; }
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 0.5rem; font-size: 0.9rem; }
.site-footer a { color: #ccc; }
.site-footer a:hover { color: #fff; opacity: 1; }
.footer-bottom {
  max-width: var(--max-w);
  margin: 3rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid #222;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: #888;
}
.footer-bottom .legal-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }

/* ===== Lightbox / Carousel ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(10,10,10,0.96);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lightbox.is-open { display: flex; opacity: 1; }
.lightbox-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(3rem, 8vh, 5rem) clamp(3rem, 8vw, 6rem);
  user-select: none;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.35s ease;
  cursor: zoom-out;
}
.lightbox-img.is-loaded { opacity: 1; }
.lightbox-caption {
  position: absolute;
  top: 1.5rem; left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.85);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  pointer-events: none;
  width: max-content;
  max-width: 80vw;
}
.lightbox-counter {
  position: absolute;
  bottom: 1.5rem; left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  font-variant-numeric: tabular-nums;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  z-index: 10; /* keep controls above the image so they stay clickable */
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.7);
}
.lightbox-close { top: 1.25rem; right: 1.25rem; font-size: 1.4rem; line-height: 1; }
.lightbox-prev  { left: 1.25rem;  top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 1.25rem; top: 50%; transform: translateY(-50%); }
.lightbox-prev::before, .lightbox-next::before {
  content: '';
  width: 12px; height: 12px;
  border-top: 1px solid currentColor;
  border-left: 1px solid currentColor;
}
.lightbox-prev::before  { transform: rotate(-45deg) translate(2px,2px); }
.lightbox-next::before  { transform: rotate(135deg) translate(2px,2px); }
.lightbox-prev[disabled], .lightbox-next[disabled] { opacity: 0.25; cursor: default; }
@media (max-width: 600px) {
  .lightbox-prev, .lightbox-next { width: 42px; height: 42px; }
  .lightbox-prev { left: 0.75rem; } .lightbox-next { right: 0.75rem; }
  .lightbox-stage { padding: 4rem 0.75rem 3.5rem; }
}

/* Project tile count badge */
.portfolio-item .count-badge {
  position: absolute;
  top: 0.75rem; right: 0.75rem;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-weight: 500;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.portfolio-item.clipping .count-badge { background: rgba(0,0,0,0.7); }

/* ===== Cookie banner ===== */
.cookie-banner {
  position: fixed;
  bottom: 1rem; left: 1rem; right: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--color-line);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  z-index: 200;
  font-size: 0.85rem;
  visibility: hidden;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0s linear 0.4s;
}
.cookie-banner.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.cookie-banner-inner {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.cookie-banner-text { flex: 1 1 320px; min-width: 0; }
.cookie-banner-text p { font-size: 0.85rem; margin: 0; line-height: 1.55; }
.cookie-banner-text a { text-decoration: underline; }
.cookie-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.cookie-banner .btn { padding: 0.6rem 1.2rem; font-size: 0.7rem; }

@media (max-width: 640px) {
  .cookie-banner { padding: 1rem 1.1rem; }
  .cookie-banner-inner { gap: 0.9rem; }
  .cookie-actions { width: 100%; }
  .cookie-actions .btn { flex: 1 1 auto; }
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .about-split { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; max-width: 640px; }
  .contact-info { gap: 1.75rem; }
}
@media (max-width: 768px) {
  .hamburger { display: block; }
  /* Full-screen mobile drawer.
     z-index 200 puts it ABOVE the header (z-index 100), so the header logo
     and hamburger never bleed through and the page content is fully hidden.
     Items align to the top with overflow scroll → Home and Portfolio are
     always reachable, even on short viewports. */
  .nav {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    /* Belt-and-braces height: 100vh works everywhere, 100dvh tracks the
       dynamic viewport on iOS Safari so the drawer never gets clipped by
       the URL bar appearing or disappearing. */
    height: 100vh;
    height: 100dvh;
    width: 100%;
    background-color: #ffffff;
    color: var(--color-text);
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.7, 0, 0.3, 1);
    z-index: 200;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 5.5rem 1.5rem 3rem;
    gap: 0;
  }
  .nav.is-open { transform: translateX(0); }
  .nav > ul {
    flex-direction: column;
    gap: 1.4rem;
    align-items: center;
    text-align: center;
    width: 100%;
    margin: 0 auto;
  }
  .nav a { font-size: 1.1rem; }
  /* Visible close button (X). It lives on <body> (not in .nav) so the
     drawer's transform doesn't re-anchor it and it stays pinned to the
     viewport even while the menu content scrolls. */
  .nav-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid var(--color-line);
    border-radius: 50%;
    color: var(--color-text);
    cursor: pointer;
    padding: 0;
    line-height: 0;
    /* Above the drawer (z-index 200) so it's never covered. */
    z-index: 210;
    -webkit-appearance: none;
    appearance: none;
  }
  body.nav-open .nav-close { display: flex; }
  .nav-close::before,
  .nav-close::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 1.5px;
    background: currentColor;
  }
  .nav-close::before { transform: rotate(45deg); }
  .nav-close::after  { transform: rotate(-45deg); }
  .nav-close:hover { opacity: 0.7; }
  /* Mobile: the parent now navigates to the overview page, so we always
     show the sub-items underneath as quick links — no toggle needed. */
  .dropdown {
    position: static;
    transform: none;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.5rem 0 0;
    opacity: 1;
    visibility: visible;
    min-width: 0;
    text-align: center;
    display: block;
  }
  .has-dropdown .caret { display: none; } /* no caret needed on mobile */
  .dropdown a { padding: 0.4rem 0; font-size: 0.85rem; color: var(--color-muted); }
  .dropdown a:hover { background: transparent; }
  /* While the drawer is open, freeze body scroll under it
     (JS also sets overflow:hidden, this is a CSS belt-and-braces). */
  body.nav-open { overflow: hidden; }
  /* Sub-nav (sticky chip nav on category pages) must NOT show through
     the drawer, even on rare repaint glitches. */
  body.nav-open .sub-nav { z-index: 1; }
  /* Tablet: 12-col grid, simpler spans */
  .highlights { gap: 0.5rem; }
  .highlight-tile.format-portrait,
  .highlight-tile.format-square,
  .highlight-tile:not(.format-landscape) { grid-column: span 6; }
  /* Tablet: portrait/square at span 6 (aspect 4:5 ≈ height 1.25 col-units),
     landscape at span 12 (aspect 12:5 ≈ height 1.25 col-units) — equal heights. */
  .highlight-tile.format-landscape { grid-column: span 12; aspect-ratio: 12 / 5; }
  form .row.two { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  /* Phone: keep portrait & square at 2 per row (span 6 of the 12-col grid).
     Landscape covers stay full-width but eased to 16:10 so they don't
     get too thin on narrow viewports. */
  .highlight-tile.format-landscape { aspect-ratio: 16 / 10; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
