/* =========================
   page_wrap.css (clean) — CORRECTED
   ========================= */

/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }
img { max-width: 100%; display: block; }

/* =========================
   Tokens
   ========================= */
:root{
  /* Layout */
  --header-h: 64px;
  --submenu-h: 44px;
  --section-gap: 32px;
  --top-gap: 32px;

  /* Type (single source of truth) */
  --font-sans: "Lexend", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --text-base: 16px;        /* change this to scale everything */
  --lh-body: 1.6;
  --lh-tight: 1.15;

  --text-sm: 0.92rem;
  --text-md: 1rem;

  --h1: clamp(1.7rem, 3.2vw, 2.35rem);
  --h2: clamp(1.25rem, 2.2vw, 1.6rem);
  --h3: 1.15rem;

  --space-1: 0.4em;
  --space-2: 0.75em;
  --space-3: 1.1em;

  --text-muted: rgba(255,255,255,0.75);

  --hero-h: 160px;         /* cinematic banner */
  --hero-nudge: -0.05em;   /* optical correction */
  --footer-h: 42px;        /* fixed footer height */
}

/* Desktop */
@media (min-width: 1024px){
  :root{
    --section-gap: 36px;
    --top-gap: 56px;
  }
}

/* Mobile portrait */
@media (max-width: 768px) and (orientation: portrait){
  :root{
    --header-h: 56px;
    --section-gap: 24px;
    --top-gap: 36px;
  }
}

/* Mobile landscape */
@media (max-width: 768px) and (orientation: landscape){
  :root{
    --header-h: 56px;
    --section-gap: 28px;
    --top-gap: 40px;
  }
}

/* =========================
   Base
   ========================= */
html, body { height: 100%; }
html { font-size: var(--text-base); }

body{
  background: #000;
  color: #fff;
  font-family: var(--font-sans);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Background */
body::before{
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
  z-index: -2;
}

body::after{
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: -1;
}

/* =========================
   Header
   ========================= */
.site-header{
  position: fixed;
  top: 0;
  width: 100%;
  height: var(--header-h, 64px);
  background: #000;
  z-index: 1000;
  pointer-events: none;
}
.site-header *{ pointer-events: auto; }

.header-inner{
  height: 100%;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo img{ height: 28px; }

.header-actions{
  display: flex;
  gap: 16px;
}

.header-actions a{
  width: 28px;
  height: 28px;
  opacity: 0.85;
}
.header-actions img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 768px){
  .logo img{ height: 24px; }
  .header-actions a{ width: 24px; height: 24px; }
}

/* =========================
   Header top-right buttons
   ========================= */
.header-actions a{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, opacity 0.25s ease;
  position: relative;
  overflow: hidden; /* glimmer */
}

.header-actions a img{
  display: block;
  height: 28px;
  width: auto;
  transition: transform 0.25s ease;
}

.header-actions a:hover{ transform: scale(1.1); }
.header-actions a:active{ transform: scale(0.96); }

/* Glimmer overlay */
.header-actions a::after{
  content: "";
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.7) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(25deg);
  opacity: 0;
}

@keyframes glimmer{
  0% { left: -75%; opacity: 0; }
  10% { opacity: 1; }
  40% { left: 125%; opacity: 0; }
  100% { left: 125%; opacity: 0; }
}

/* Apply only to email icon (second link) */
.header-actions a:last-child::after{
  animation: glimmer 6s infinite;
}

/* =========================
   Submenu
   ========================= */
.submenu{
  position: fixed;
  top: var(--header-h, 64px);
  width: 100%;
  background: rgba(0,0,0,0.75);
  transform: translateY(-12px);
  opacity: 0;
  z-index: 999;

  /* lock submenu to token height so .main padding-top matches reality */
  height: var(--submenu-h, 44px);
  display: flex;
  align-items: center;
}

body.submenu-ready .submenu{ animation: submenuIn .5s forwards; }

@keyframes submenuIn{
  to{ transform: translateY(0); opacity: 1; }
}

.submenu-inner{
  padding: 0 20px;
  width: 100%;

  display: flex;
  gap: 14px;

  /* ✅ IMPORTANT: do NOT wrap by default (prevents desktop stacking) */
  flex-wrap: nowrap;
  justify-content: center;

  /* if it gets super tight, allow horizontal scroll instead of wrapping */
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.submenu-inner::-webkit-scrollbar{ display: none; } /* Safari/Chrome */

.submenu a{
  position: relative;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 999px;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.submenu a:hover{ color: #fff; }

.submenu a::after{
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.9);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.submenu a:hover::after,
.submenu a[aria-current="page"]::after{
  transform: scaleX(1);
}

/* =========================
   Layout
   ========================= */
.main{
  padding-top: calc(
    var(--header-h, 64px) +
    var(--submenu-h, 44px) +
    var(--top-gap, 56px)
  );
  padding-bottom: calc(60px + var(--footer-h));
}

.wrap{
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =========================
   Content blocks
   ========================= */
.content-block{
  background: rgba(0,0,0,0.55);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: var(--section-gap);
  overflow: hidden;
}

/* =========================
   Cinematic Banner (Hero)
   ========================= */
.page-hero{
  max-width: 820px;
  margin: 0 auto;

  height: var(--hero-h);
  padding: 0 28px;

  display: grid;
  place-items: center;

  background: rgba(0,0,0,0.7);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
}

.page-hero-inner{ text-align: center; }

.page-hero-title{
  margin: 0;
  line-height: 1;
  font-weight: 650;
  transform: translateY(var(--hero-nudge));
}

/* Titles use DM Serif Display */
.page-hero-title,
.project-title,
.thumbs-block h2{
  font-family: 'DM Serif Display', serif;
  letter-spacing: 0.01em;
}

.page-hero-title{
  font-size: clamp(2.8rem, 5vw, 4rem);
  line-height: 1.05;
}

.page-hero-subtitle{
  margin-top: 14px;
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Reduce space under banner */
.section-gap{
  height: calc(var(--section-gap) * 0.6);
}

/* Project header spacing */
.project-header{ margin-bottom: 14px; }
.project-header .project-title{ margin: 0; }
.project-header .project-credit{ margin: 0; }

@media (max-width: 768px){
  .project-header{ margin-bottom: 12px; }
}

/* =========================
   Typography: Prose wrapper
   ========================= */
.prose{ font-size: var(--text-md); }

.prose :where(h1,h2,h3){
  line-height: var(--lh-tight);
  letter-spacing: 0.01em;
  margin: 0 0 var(--space-2) 0;
}

.prose :where(h1){ font-size: var(--h1); font-weight: 650; }
.prose :where(h2){ font-size: var(--h2); font-weight: 600; }
.prose :where(h3){ font-size: var(--h3); font-weight: 600; }

.prose :where(p, ul, ol, blockquote){ margin: 0 0 var(--space-2) 0; }
.prose :where(p){ color: rgba(255,255,255,0.92); }

.prose :where(a){
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  opacity: 0.95;
}

.prose :where(.muted){ color: var(--text-muted); }

.prose :where(hr){
  border: 0;
  height: 1px;
  background: rgba(255,255,255,0.14);
  margin: var(--space-3) 0;
}

/* =========================
   Dividers (single source of truth)
   ========================= */
.project-divider,
.project-title-divider{
  display: block;
  width: 100%;
  height: 0 !important;
  border: 0 !important;
  border-top: 1px solid rgba(255,255,255,0.28) !important;
  background: none !important;
  opacity: 1 !important;

  transform: scaleX(0);
  transform-origin: left;
}

.project-divider{
  transition: transform 650ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.project-title-divider{
  margin: 0.5rem 0 0.3rem;
  transition: transform 700ms ease;
}

.project-divider.is-visible,
.project-title-divider.is-visible{
  transform: scaleX(1);
  opacity: 1 !important;
}

@media (prefers-reduced-motion: reduce){
  .project-divider,
  .project-title-divider{
    transition: none;
    transform: scaleX(1);
  }
}

/* Optional spacing helper */
.page-title{ margin-bottom: 20px; }

/* =========================
   Thumbnail grid
   ========================= */
.thumbs-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.thumb{
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
}

.thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (hover: hover) and (pointer: fine){
  .thumb:hover img{ transform: scale(1.08); }
}
.thumb:active img{ transform: scale(1.04); }

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

.thumb.media-16x9{
  aspect-ratio: auto;
  width: 100%;
}

/* A4 portrait thumbnails */
.thumbs-grid-a4 .thumb-a4{ aspect-ratio: 210 / 297; }
.thumbs-grid-a4 .thumb-img-a4{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* =========================
   16:9 media frame (Design/About)
   ========================= */
.media-16x9{
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  aspect-ratio: 16 / 9;
}

.media-16x9 img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fallback for older Safari */
@supports not (aspect-ratio: 16 / 9){
  .media-16x9{ height: 0; padding-bottom: 56.25%; }
  .media-16x9 img{ position: absolute; inset: 0; }
}

/* Wrap-left / wrap-right layout */
.wrap-left .media-16x9,
.wrap-right .media-16x9{
  max-width: 420px;
  margin-bottom: 12px;
}

@media (min-width: 769px){
  .wrap-right .media-16x9{ float: right; margin-left: 18px; }
  .wrap-left  .media-16x9{ float: left;  margin-right: 18px; }

  .wrap-left::after,
  .wrap-right::after{
    content: "";
    display: block;
    clear: both;
  }
}

@media (max-width: 768px){
  .wrap-left .media-16x9,
  .wrap-right .media-16x9{
    float: none;
    max-width: 100%;
    margin: 0 0 14px 0;
  }
}

/* =========================
   Directing layout
   ========================= */
.video-embed{
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  margin-bottom: 18px;
}

.video-embed iframe{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Copy + thumbs columns */
.info-row{
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.copy-wide,
.thumbs-side{ min-width: 0; }

.thumbs-grid.thumbs-grid-6{
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 768px){
  .info-row{ grid-template-columns: 1fr; }
  .thumbs-grid.thumbs-grid-6{ grid-template-columns: repeat(3, 1fr); }
}

/* =========================
   Lightbox
   ========================= */
.lightbox{
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: pan-y;
}

.lightbox.open{
  opacity: 1;
  pointer-events: auto;
}

.lightbox-figure{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-img{
  width: min(92vw, 1200px);
  max-height: 84vh;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  transform: scale(0.98);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox.open .lightbox-img{ transform: scale(1); }

.lightbox-caption{
  max-width: min(92vw, 900px);
  text-align: center;
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.85);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.lightbox.open .lightbox-caption{
  opacity: 1;
  transform: translateY(0);
}

.lightbox-close{
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2001;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* =========================
   Lightbox Nav + Slide/Fade Animation
   ========================= */
.lightbox-nav{
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2002;

  width: 46px;
  height: 46px;
  border-radius: 999px;

  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.45);
  color: #fff;

  font-size: 34px;
  line-height: 1;

  display: grid;
  place-items: center;
  cursor: pointer;

  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.lightbox.open .lightbox-nav{
  opacity: 1;
  pointer-events: auto;
}

.lightbox-prev{ left: 18px; }
.lightbox-next{ right: 18px; }

@media (max-width: 768px){
  .lightbox-prev{ left: 10px; }
  .lightbox-next{ right: 10px; }
}

.lightbox-img,
.lightbox-caption{
  will-change: transform, opacity;
}

.lightbox.is-animating.dir-next .lightbox-img,
.lightbox.is-animating.dir-next .lightbox-caption{
  animation: lbOutNext 180ms ease forwards;
}
.lightbox.is-animating.dir-prev .lightbox-img,
.lightbox.is-animating.dir-prev .lightbox-caption{
  animation: lbOutPrev 180ms ease forwards;
}

.lightbox.is-entering.dir-next .lightbox-img,
.lightbox.is-entering.dir-next .lightbox-caption{
  animation: lbInNext 220ms ease forwards;
}
.lightbox.is-entering.dir-prev .lightbox-img,
.lightbox.is-entering.dir-prev .lightbox-caption{
  animation: lbInPrev 220ms ease forwards;
}

@keyframes lbOutNext{ to{ opacity: 0; transform: translateX(-14px) scale(0.995); } }
@keyframes lbOutPrev{ to{ opacity: 0; transform: translateX(14px) scale(0.995); } }
@keyframes lbInNext { from{ opacity: 0; transform: translateX(14px) scale(0.995); } to{ opacity: 1; transform: translateX(0) scale(1); } }
@keyframes lbInPrev { from{ opacity: 0; transform: translateX(-14px) scale(0.995); } to{ opacity: 1; transform: translateX(0) scale(1); } }

@media (prefers-reduced-motion: reduce){
  .lightbox.is-animating .lightbox-img,
  .lightbox.is-animating .lightbox-caption,
  .lightbox.is-entering .lightbox-img,
  .lightbox.is-entering .lightbox-caption{
    animation: none !important;
  }
}

/* =========================
   Minimal Fixed Footer
   ========================= */
.site-footer{
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-h);

  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  border-top: 1px solid rgba(255,255,255,0.08);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 1500;

  transition: transform 420ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.footer-inner{
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.12em;
}

.site-footer.is-hidden{ transform: translateY(100%); }

/* =========================
   Editing page layout
   ========================= */
.content-with-aside{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.clients-aside{
  position: sticky;
  top: calc(var(--header-h) + var(--submenu-h) + 18px);
}

.clients-title{
  margin: 0 0 10px 0;
  font-size: var(--h3);
  font-weight: 600;
  line-height: var(--lh-tight);
}

.clients-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

body.page-editing .info-row{ grid-template-columns: 1fr; }
body.page-editing .thumbs-side{ display: none; }

@media (max-width: 900px), (orientation: portrait){
  .content-with-aside{ grid-template-columns: 1fr; }
  .clients-aside{ position: static; top: auto; }
}

/* =========================
   About page: 65/35 columns
   ========================= */
.about-grid{
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); /* ~65/35 */
  gap: 18px;
  align-items: start;
}

.about-copy{ min-width: 0; }
.about-side{ min-width: 0; }

.about-portrait{
  width: min(220px, 70%);
  margin: 0 auto 14px auto;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  overflow: hidden;

  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
}

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

.about-links{
  background: rgba(0,0,0,0.40);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
}

.about-links-title{
  margin: 0 0 10px 0;
  font-size: var(--h3);
  font-weight: 600;
  line-height: var(--lh-tight);
}

.about-links-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.about-links-list a{
  display: block;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;

  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.90);

  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

@media (hover: hover) and (pointer: fine){
  .about-links-list a:hover{
    transform: translateY(-1px);
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.16);
    color: #fff;
  }
}

.about-links-list a:active{ transform: translateY(0); }

@media (max-width: 768px){
  .about-grid{ grid-template-columns: 1fr; }
  .about-portrait{ width: min(240px, 65%); }
}

/* =========================
   iPhone rules
   ========================= */

/* iPhone-tight: submenu wraps into 2 rows + black background + pushes content down */
@media (max-width: 430px){
  :root{ --submenu-h: 88px; }

  .submenu{
    background: #000;
    height: var(--submenu-h);
  }

  .submenu-inner{
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: center;
    align-content: center;
    gap: 10px 12px;
  }

  .submenu-inner a{
    flex: 0 0 calc(33.333% - 12px);
    text-align: center;
    padding: 6px 8px;
  }
}

/* Hide page hero on iPhone portrait */
@media (max-width: 430px){
  .content-block.page-hero{ display: none !important; }

  .main{
    padding-top: calc(var(--header-h) + var(--submenu-h) + 20px) !important;
  }
}

/* Hide page hero on iPhone landscape (horizontal) */
@media (max-height: 430px) and (orientation: landscape){
  .content-block.page-hero{ display: none !important; }

  .main{
    padding-top: calc(var(--header-h) + var(--submenu-h) + 20px) !important;
  }
}

/* Copy-based links hover colour */
.prose :where(a:hover){
  color: #45a0e7;
  opacity: 1;
}