/* ============================================================
   MANUEL BERBERAN — PHOTOGRAPHY
   Design tokens
   ============================================================ */
:root{
  --bg: #f4f3ef;
  --bg-raised: #ece9e2;
  --fg: #15140f;
  --muted: #6b665e;
  --muted-dim: #a49f95;
  --hairline: rgba(21,20,15,0.14);
  --hairline-strong: rgba(21,20,15,0.32);
  --accent: #a8362d;
  --nav-bg: rgba(244,243,239,0.86);

  --serif: 'Times New Roman', Times, 'Noto Serif', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;

  --nav-h: 76px;
  --edge: clamp(20px, 4vw, 56px);
}

*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

html{ color-scheme: light; }
body{
  margin:0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  color-scheme: light;
}

a{ color: inherit; text-decoration: none; }
img{ max-width: 100%; display:block; }

::selection{ background: var(--fg); color: var(--bg); }

:focus-visible{
  outline: 1px solid var(--fg);
  outline-offset: 4px;
}

.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;
}

/* ---------------- Nav ---------------- */
.site-nav{
  position: fixed;
  top:0; left:0; right:0;
  z-index: 50;
  height: var(--nav-h);
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 22px var(--edge) 0;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.site-nav .logo{
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 18px;
  letter-spacing: 0.01em;
}
.site-nav .links{
  display:flex;
  gap: clamp(18px, 3vw, 36px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.site-nav .links a{
  position: relative;
  padding-bottom: 4px;
}
.site-nav .links a::after{
  content:"";
  position:absolute; left:0; right:100%; bottom:0;
  height:1px; background: var(--fg);
  transition: right 0.35s cubic-bezier(.2,.7,.3,1);
}
.site-nav .links a:hover::after,
.site-nav .links a.active::after{
  right:0;
}

/* ---------------- Footer (generic, currently unused but kept for reuse) ---------------- */
.site-footer{
  border-top: 1px solid var(--hairline);
  padding: 28px var(--edge) 40px;
  display:flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.site-footer a:hover{ color: var(--fg); }

/* ---------------- Landing / splash ---------------- */
.splash{
  min-height: 100svh;
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  text-align:center;
  position: relative;
  overflow:hidden;
  padding: var(--edge);
}
.splash-bg{
  position:absolute; inset:0;
  z-index:0;
  opacity: 0.5;
}
.splash-bg .frame-placeholder,
.splash-bg .frame-filled{
  position:absolute;
  inset:0;
  width:100%; height:100%;
  border:0;
  animation: splash-fade 12s ease-in-out infinite;
  opacity:0;
}
.splash-bg > *:nth-child(1){ animation-delay: 0s; }
.splash-bg > *:nth-child(2){ animation-delay: 4s; }
.splash-bg > *:nth-child(3){ animation-delay: 8s; }
@keyframes splash-fade{
  0%{ opacity:0; }
  8%{ opacity:0.55; }
  30%{ opacity:0.55; }
  38%{ opacity:0; }
  100%{ opacity:0; }
}

/* Single static hero image (real photo) instead of the placeholder cycle */
.splash-bg.splash-bg-single{ opacity: 1; }
.splash-bg-single .frame-placeholder,
.splash-bg-single .frame-filled{
  animation: none;
  opacity: 1;
}
.splash-bg-single::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(180deg, rgba(10,10,10,0.35) 0%, rgba(10,10,10,0.15) 45%, rgba(10,10,10,0.5) 100%);
}

body.theme-hero{
  --fg: #f5efe6;
  --muted: #d9d2c6;
  --muted-dim: #b8b0a2;
  --hairline: rgba(245,239,230,0.28);
  --hairline-strong: rgba(245,239,230,0.5);
}

.splash-content{
  position:relative; z-index:2;
  animation: splash-in 1.1s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes splash-in{
  from{ opacity:0; transform: translateY(10px) scale(0.99); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}
.splash-name{
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(40px, 8vw, 96px);
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0;
}
.splash-role{
  margin: 18px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.enter-link{
  margin-top: 48px;
  display:inline-flex;
  align-items:center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 14px 0;
  border-top: 1px solid var(--hairline-strong);
  border-bottom: 1px solid var(--hairline-strong);
  transition: gap 0.3s cubic-bezier(.2,.7,.3,1), color 0.3s;
}
.enter-link:hover{ gap: 16px; color: var(--fg); }
.enter-link svg{ width:14px; height:14px; }

/* ---------------- Placeholder / filled frame ---------------- */
.frame-placeholder{
  position:relative;
  width:100%;
  background:
    repeating-linear-gradient(135deg, rgba(21,20,15,0.05) 0 2px, transparent 2px 26px),
    linear-gradient(180deg, #eae7e0, #f0eee8);
  border: 1px solid var(--hairline);
  display:flex;
  align-items:flex-end;
  justify-content:flex-start;
  overflow:hidden;
}
.frame-placeholder.portrait, .frame-filled.portrait{ aspect-ratio: 4 / 5; }
.frame-placeholder.landscape, .frame-filled.landscape{ aspect-ratio: 3 / 2; }
.frame-placeholder .frame-tag{
  margin: 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.frame-placeholder img{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit: cover;
}
.dash{
  display: inline-block;
  font-size: 0.6em;
  vertical-align: 0.14em;
  margin: 0 0.05em;
}
.frame-filled{
  position:relative;
  width:100%;
  overflow:hidden;
  border: 1px solid var(--hairline);
}
.frame-filled img{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit: cover;
}

/* ---------------- Work feed: fullscreen click-through viewer ---------------- */
.work-viewer{
  min-height: 100svh;
  padding-top: var(--nav-h);
  display:flex;
  flex-direction: column;
  background: var(--bg);
}
.work-stage{
  position: relative;
  flex: 1;
  min-height: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 32px var(--edge);
  user-select: none;
}
.work-image{
  position: relative;
  width: 100%;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: justify-content 0.35s ease;
}
/* Positional cycle: middle → right → middle → left → repeat.
   Each state shifts where the image sits horizontally; the image itself
   handles portrait/landscape sizing via .frame-filled max-height/width. */
.work-image.pos-middle{ justify-content: center;     padding: 0 var(--edge); }
.work-image.pos-right { justify-content: flex-end;   padding: 0 6vw 0 var(--edge); }
.work-image.pos-left  { justify-content: flex-start; padding: 0 var(--edge) 0 6vw; }
.work-image .frame-filled{
  max-height: 56svh;
  max-width: min(720px, 50vw);
  width:auto;
  height:auto;
  aspect-ratio: auto;
  border: 0;
}
.work-image .frame-placeholder{
  width: min(340px, 40vw);
  max-height: 56svh;
  border: 0;
}
.work-image img{
  position:static;
  max-height: 56svh;
  width:auto;
  max-width: 100%;
  object-fit: contain;
  filter: contrast(1.02);
  animation: work-fade 0.45s ease both;
}
@media (max-width: 860px){
  .work-image .frame-filled{
    max-width: min(720px, 88vw);
  }
  .work-image .frame-placeholder{
    width: min(340px, 78vw);
  }
  /* Not enough horizontal room on phones to slide the image sideways —
     keep it centered so it stays large and readable. */
  .work-image.pos-right,
  .work-image.pos-left,
  .work-image.pos-middle{
    justify-content: center;
    padding: 0 var(--edge);
  }
}
@keyframes work-fade{
  from{ opacity: 0; }
  to{ opacity: 1; }
}
/* Left/right click zones, split at the stage midpoint */
.work-stage::before, .work-stage::after{
  content: "";
  position:absolute;
  top:0; bottom:0;
  width: 50%;
  z-index: 2;
}
.work-stage::before{ left:0; }
.work-stage::after{ right:0; }

/* Same click-halves pattern for the project viewer */
.viewer-stage{ position: relative; }
.viewer-stage::before, .viewer-stage::after{
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  z-index: 2;
}
.viewer-stage::before{ left: 0; }
.viewer-stage::after{ right: 0; }

/* ---------------- Projects index (title list + hover preview) ---------------- */
.index-page{
  padding-top: var(--nav-h);
  min-height: 100svh;
  display:grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 860px){
  .index-page{ grid-template-columns: 1fr; }
}
.index-list{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 6px;
  padding: 56px var(--edge);
}
.index-row{
  display:flex;
  align-items:baseline;
  gap: 12px;
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 22px);
  padding: 3px 0;
  color: var(--fg);
  transition: color 0.25s;
}
.index-row:hover, .index-row:focus-visible{
  color: var(--accent);
}
.index-title{ white-space: nowrap; }
.index-client{
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.index-row:hover .index-client,
.index-row:focus-visible .index-client{
  color: var(--accent);
}
.index-preview{
  position: sticky;
  top: var(--nav-h);
  height: calc(100svh - var(--nav-h));
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding: 40px var(--edge);
}
.index-thumb,
.index-thumb-fade,
.index-meta{ display: none; }

@media (max-width: 860px){
  .index-preview{ display:none; }
  .index-page{ padding: 0; }
  .index-list{
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: var(--nav-h) 0 40px;
    align-items: stretch;
  }
  .index-row{
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    padding: 0;
    color: #fff;
  }
  .index-thumb{
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #0f0f0f;
  }
  .index-thumb-empty{
    background:
      repeating-linear-gradient(135deg, rgba(21,20,15,0.06) 0 2px, transparent 2px 26px),
      #2c2c2c;
  }
  .index-thumb-fade{
    display: block;
    position: absolute;
    inset: auto 0 0 0;
    height: 55%;
    background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
    pointer-events: none;
  }
  .index-meta{
    display: block;
    position: absolute;
    left: 20px;
    bottom: 62px;
    color: rgba(255,255,255,0.75);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .index-title{
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 22px;
    color: #fff;
    white-space: normal;
    font-family: var(--serif);
    font-size: 26px;
    line-height: 1.1;
  }
  .index-client{ display: none; }
}
/* Preview thumbnail on the right of the projects list.
   Show the WHOLE image regardless of orientation — portrait shots were
   being cropped to fit a forced 4:5 frame with object-fit: cover.
   Now: no forced aspect, and object-fit: contain so nothing is cut. */
.index-preview .frame-placeholder,
.index-preview .frame-filled{
  width: auto;
  max-width: 100%;
  max-height: 72svh;
  aspect-ratio: auto;
}
.index-preview .frame-placeholder{
  width: 100%;
  aspect-ratio: 4 / 5;
}
.index-preview img{
  position: static;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 72svh;
  object-fit: contain;
  filter: contrast(1.02);
}
.index-preview-caption{
  margin-top: 16px;
  display:flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------- Project viewer / lightbox ---------------- */
.viewer{
  min-height: 100svh;
  display:flex;
  flex-direction:column;
}
.viewer-top{
  display:flex;
  justify-content: space-between;
  align-items:flex-start;
  padding: 28px var(--edge) 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.viewer-top-left{
  display:flex;
  flex-direction: column;
  gap: 6px;
}
.viewer-meta{
  color: var(--muted-dim);
  font-size: 10px;
}
.viewer-top a:hover{ color: var(--fg); }
.viewer-stage{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 28px;
  padding: 24px var(--edge);
  min-height: 0;
}
.viewer-image-wrap{
  max-width: min(1100px, 78vw);
  max-height: 76svh;
}
.viewer-image-wrap .frame-placeholder,
.viewer-image-wrap .frame-filled{
  max-height: 76svh;
  width:auto;
  aspect-ratio: auto;
  display:inline-block;
  border: 0;
}
.viewer-image-wrap img{
  position:static;
  max-height: 76svh;
  width:auto;
  object-fit:contain;
  filter: contrast(1.02);
}
/* Video slides in the project viewer — size the frame directly so it works
   without relying on :has() or on the wrap having a size. z-index puts the
   video and its controls above the click-halves navigation zones. */
.viewer-image-wrap .video-frame{
  display: block;
  position: relative;
  z-index: 5;
  max-width: min(1100px, 78vw);
  max-height: 76svh;
  background: #000;
  border: 0;
  margin: 0 auto;
}
.viewer-image-wrap .video-frame.landscape{
  width: min(1100px, 78vw);
  aspect-ratio: 16/9;
}
.viewer-image-wrap .video-frame.portrait{
  height: 76svh;
  aspect-ratio: 9/16;
}
.viewer-image-wrap .video-frame video{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.viewer-arrow{
  background:none;
  border:0;
  color: var(--accent);
  width:28px; height:28px;
  flex: 0 0 auto;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  transition: transform 0.25s;
}
.viewer-arrow svg{ width:22px; height:22px; }
.viewer-arrow:hover{ transform: translateX(2px); }
.viewer-arrow.left:hover{ transform: translateX(-2px); }
.viewer-arrow:disabled{ opacity:0.25; cursor:default; }
.viewer-count{
  text-align:center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted-dim);
  padding-bottom: 8px;
}
.viewer-logo{
  text-align:center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  padding: 4px 0 32px;
}
.viewer-video-frame{ width: min(1100px, 78vw); aspect-ratio: 16/9; }

/* Work page counter — matches the project-page viewer counter. */
.work-count{
  text-align: center;
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #2a2a2a;
  padding: 24px 0 40px;
  width: 100%;
  display: block;
}
.work-arrow{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(20,20,20,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.25s, transform 0.25s;
}
.work-arrow svg{ width: 22px; height: 22px; }
.work-arrow.left{ left: 12px; }
.work-arrow.right{ right: 12px; }
.work-stage:hover .work-arrow.left{ transform: translate(-3px, -50%); color: rgba(20,20,20,0.85); }
.work-stage:hover .work-arrow.right{ transform: translate(3px, -50%); color: rgba(20,20,20,0.85); }
@media (max-width: 860px){
  .work-count{ font-size: 10px; padding: 18px 0 30px; }
}

/* Video block (reused inside the viewer for motion slides) */
.video-frame{
  position:relative;
  width:100%;
  aspect-ratio: 16/9;
  background:
    repeating-linear-gradient(135deg, rgba(21,20,15,0.05) 0 2px, transparent 2px 26px),
    #eae7e0;
  border: 1px solid var(--hairline);
  display:flex;
  align-items:center;
  justify-content:center;
}
.video-frame video, .video-frame iframe{
  position:absolute; inset:0; width:100%; height:100%; border:0;
}
.play-btn{
  width:64px; height:64px;
  border-radius:50%;
  border:1px solid var(--hairline-strong);
  display:flex; align-items:center; justify-content:center;
  transition: transform 0.3s, border-color 0.3s;
}
.play-btn svg{ width:18px; height:18px; margin-left:3px; }
.video-frame:hover .play-btn{ transform: scale(1.08); border-color: var(--fg); }

/* ---------------- Info page ("card" theme) ---------------- */
body.theme-maroon{
  --bg: #eae7e0;
  --fg: #22201b;
  --muted: #5a544a;
  --muted-dim: #7c7669;
  --hairline: rgba(34,32,27,0.14);
  --hairline-strong: rgba(34,32,27,0.3);
  --accent: #22201b;
  --nav-bg: #eae7e0;
}
body.theme-maroon .site-nav{
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Body-level flex so nav / card / footer distribute across the viewport
   without the copyright falling below the fold. */
body.theme-maroon{
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.info-card{
  flex: 1;
  min-height: 0;
  padding: calc(var(--nav-h) + 40px) var(--edge) 30px;
  max-width: 960px;
}
@media (max-width: 860px){
  .info-card{ padding: calc(var(--nav-h) + 24px) var(--edge) 20px; }
  .info-heading{ font-size: 22px; margin-bottom: 14px; }
  .info-location{ font-size: 15px; margin-bottom: 22px; }
  .info-bio p{ font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
  .info-note{ font-size: 14px; margin-bottom: 20px; }
  .info-links{ font-size: 14px; }
  .info-footer{ padding: 14px var(--edge) 20px; font-size: 11px; }
}
.info-heading{
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 34px);
  margin: 0 0 18px;
  line-height: 1.25;
}
.info-location{
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  margin: 0 0 34px;
  color: var(--fg);
}
.info-bio{
  max-width: 900px;
  margin-bottom: 30px;
}
.info-bio p{
  font-size: 17px;
  line-height: 1.7;
  margin: 0 0 18px;
  color: var(--fg);
  text-wrap: pretty;
}
.info-note{
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  margin: 0 0 34px;
}
.info-links{
  display:flex;
  flex-direction: column;
  gap: 6px;
  font-size: 16px;
}
.info-links a{ text-decoration: underline; text-underline-offset: 3px; }
.info-links a:hover{ opacity: 0.75; }
.info-email-line{ margin: 0; }
.info-email-line span{ margin-right: 4px; }

.info-footer{
  display:flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px var(--edge) 40px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}
.info-footer-logo{
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  color: var(--fg);
}
