/* ─── RESET ────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── TOKENS ───────────────────────────────────────────────────────────────── */
:root {
  --bg:           #F4F4F2;
  --ink:          #FFFFFF;
  --ink-faint:    rgba(255, 255, 255, 0.5);
  --spine-top:    46vh;   /* how far down the spine sits */
  --ease:         cubic-bezier(0.16, 1, 0.3, 1);
  --dur:          0.55s;
}

/* ─── BASE ─────────────────────────────────────────────────────────────────── */
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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


/* ─── SPINE ─────────────────────────────────────────────────────────────────  */
/*  Mirrors the panel flex structure so each label left-aligns with its column */
.spine {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--spine-top);
  z-index: 200;
  display: flex;
  align-items: center;
  height: 28px;
  pointer-events: none;
  user-select: none;
  transition: opacity var(--dur) var(--ease);
}

.spine.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Mirrors .panel-left */
.spine-left {
  width: 25%;
  flex-shrink: 0;
  padding-left: 44px;
}

/* Mirrors .panel-right (same padding + gap) */
.spine-right {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 44px 0 44px;
  gap: 44px;
}

/* Mirrors .panel-mid (flex: 1, flex-shrink: 0) */
.spine-right span:first-child {
  flex: 1;
  flex-shrink: 0;
}

/* Mirrors .projects-list (flex: 1) */
.spine-right span:nth-child(2) {
  flex: 1;
}

/* Mirrors .about-section (20vw) */
.spine-right span:last-child {
  flex: 0 0 20vw;
}

.spine-seg {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
}

/* ABOUT spine label replaced by about-col-header — keep flex slot but hide */
.spine-about {
  opacity: 0;
  pointer-events: none;
}


/* ─── PANELS ───────────────────────────────────────────────────────────────── */
/*  Fills the space above the spine (0 → --spine-top).                         */
.panels {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--spine-top);
  z-index: 5;
  display: flex;
  transition: opacity var(--dur) var(--ease);
}

/* Left panel: blank — shows project image on hover */
.panel-left {
  width: 25%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.panel-preview {
  position: fixed;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  padding: 0;
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}

.panel-preview.is-visible {
  opacity: 1;
}

.panel-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

/* Right panel: blank mid + project list + about portrait, three columns */
.panel-right {
  flex: 1;
  display: flex;
  align-items: stretch;
  padding: 40px 44px 32px 44px;
  gap: 44px;
  overflow: hidden;
}

/* Blank column 2 — mirrors "2026 — IDP" spine segment */
.panel-mid {
  flex: 1;
  flex-shrink: 0;
}

/* ─── PROJECT LIST ──────────────────────────────────────────────────────────  */
.projects-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.project-item {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid transparent;
  text-align: left;
  transition: border-color 0.18s, gap 0.25s var(--ease);
}

.project-item:hover {
  border-bottom-color: var(--ink);
  gap: 26px;
}

.project-item-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex: 1;
}

/* Number + tag merged into a single right-aligned meta element */
.project-item-meta {
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  text-transform: uppercase;
  flex-shrink: 0;
}


/* ─── ABOUT ────────────────────────────────────────────────────────────────── */
/* Invisible but keeps its 200 px flex slot so projects-list stays aligned     */
/* with the "PROJECTS" spine label. Accessible only via the spine ABOUT text.  */
.about-section {
  flex: 0 0 20vw;
  visibility: hidden;
  pointer-events: none;
}

.portrait-wrap {
  width: 100%;
  flex: 1;
  overflow: hidden;
  max-height: 240px;
}

.portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(20%);
}

.portrait-placeholder {
  width: 100%;
  height: 100%;
  min-height: 160px;
  background: #DEDAD4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}


/* Projects column sits on the light background — use dark ink */
#spine-projects { color: #1C1C1C; }

.project-item { color: #1C1C1C; }
.project-item:hover { border-bottom-color: #1C1C1C; }
.project-item-meta { color: rgba(28, 28, 28, 0.45); }

.contact-me {
  position: fixed;
  top: var(--spine-top);
  left: calc(100% - 44px - 20vw);
  height: 28px;
  display: flex;
  align-items: center;
  z-index: 200;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1C1C1C;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.25s var(--ease), opacity var(--dur) var(--ease);
}

.contact-me:hover { color: rgba(28, 28, 28, 0.45); }

.contact-me.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.about-label {
  font-size: 8.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  line-height: 2;
  color: var(--ink-faint);
}



/* ─── PANELS HIDDEN (while detail is open) ─────────────────────────────────  */
.panels.is-hidden {
  opacity: 0;
  pointer-events: none;
}


/* ─── PROJECT DETAIL OVERLAY ───────────────────────────────────────────────  */
.project-detail {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: block;         /* block so sticky hero works */
  overflow-y: auto;
  overflow-x: hidden;

  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}

.project-detail.is-open {
  opacity: 1;
  pointer-events: all;
}

.project-detail,
#about-detail {
  --ink:       #1C1C1C;
  --ink-faint: rgba(28, 28, 28, 0.35);
}



/* ─── HERO (video + title) ─────────────────────────────────────────────────  */
.project-hero {
  position: relative;
  width: 100%;
  height: 100%;           /* of the fixed overlay — 100vh is too tall on phones */
  background: var(--project-color, #111);
}

#project-video,
#project-hero-img,
#about-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
}

/* Match the homepage background video: black & white, darkened */
#project-video {
  filter: grayscale(100%) brightness(0.7) contrast(1.3);
}

/* Title pinned to the bottom of the hero, scaled to fill full width by JS */
.project-title-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: hidden;
  line-height: 1;
}

.project-title-display {
  /*
    "Fit" variable font by DJR — ultra-extended weight fills the screen.
    If Fit is not loading, the title still renders large in Helvetica.
    Replace the Google Fonts link in index.html with a local @font-face
    if needed: @font-face { font-family: 'Fit'; src: url('Fit-Variable.woff2'); }
  */
  font-family: 'Fit', 'Arial Black', 'Helvetica Neue', Helvetica, sans-serif;
  font-variation-settings: 'wdth' 200;
  font-stretch: ultra-expanded;
  font-weight: 900;

  display: block;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--bg);
  line-height: 0.86;

  /* JS overrides this with the exact fit value */
  font-size: 10vw;
  padding: 0 0 6px 0;
}

/* Close button — fixed to viewport corner, fades with its overlay parent */
.close-btn {
  position: fixed;
  top: 28px;
  right: 36px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
  color: var(--bg);
  background: transparent;
  border: none;
  padding: 4px 8px;
  transition: color 0.18s, opacity 0.18s;
  z-index: 20;
}

.close-btn:hover { opacity: 0.55; }

.close-btn.is-dark { color: #1C1C1C; }

.close-btn.is-dark:hover { opacity: 0.55; background: transparent; }

.close-label { display: none; }


/* ─── PROJECT BODY ─────────────────────────────────────────────────────────  */
/* Column layout: info row (text) above, gallery strip below.                  */
/* Height set by JS to crushEnd so scrolling stops when title locks as banner. */
.project-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
}

/* Flex row inside body: holds project text (and any future columns) */
.project-info {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

/* Left column: meta + description.
   Clipped, not scrollable by the browser: main.js scrolls it once the page
   itself has reached the end, so the gallery and focus image stay put. */
.project-text {
  width: 26%;
  flex-shrink: 0;
  min-height: 0;
  overflow-y: hidden;
  padding: 52px 44px 44px 44px;
}

/* Fades the bottom edge while more text is hidden below */
.project-text.has-more {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent);
}

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 48px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.project-meta-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.project-meta-item:last-child {
  border-bottom: none;
}

.meta-label {
  font-size: 7.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.5;
}

.meta-value {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.project-description {
  font-size: 13px;
  line-height: 1.75;
  letter-spacing: 0.02em;
  text-transform: none;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  white-space: pre-line;   /* keep the paragraph breaks from projects.js */
}

/* ─── PROJECT GALLERY ──────────────────────────────────────────────────────  */
.project-gallery {
  flex-shrink: 0;
  padding: 10px 0;
  display: flex;
  justify-content: center;
}

.gallery-strip {
  display: flex;
  align-items: flex-end;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  max-width: 100%;
}

.gallery-strip::-webkit-scrollbar { display: none; }

.gallery-thumb {
  height: 90px;
  flex-shrink: 0;
  cursor: pointer;
  overflow: hidden;
}

.gallery-thumb img {
  height: 100%;
  width: auto;
  display: block;
  object-fit: cover;
  object-position: center center;
  transition: opacity 0.18s ease;
}

.gallery-thumb:hover img { opacity: 0.55; }

/* ─── FOCUS IMAGE (inline, right of project text) ──────────────────────────  */
.project-focus {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 44px 44px 12px 28px;
  overflow: hidden;
}

.focus-img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  display: block;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.focus-img.is-visible { opacity: 1; }

.focus-caption {
  margin-top: 14px;
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.45;
  text-align: center;
}


/* ─── LOWER SECTION ────────────────────────────────────────────────────────── */
/*  Sits below the spine. Shows ambient video by default,                      */
/*  swapped for project info on hover.                                         */
/* Video covers the full viewport, behind all content */
.video-wrap {
  position: fixed;
  top: 0;
  left: 0;
  width: 50vw;
  bottom: 0;
  z-index: 0;
  overflow: hidden;
}

.lower-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) brightness(0.55) contrast(1.3);
  transition: opacity 0.45s var(--ease);
}

.lower-video.is-faded {
  opacity: 0;
}

/* Semi-transparent veil between video and content for text readability */
.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: transparent;
  pointer-events: none;
}

.lower-section {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--spine-top) + 28px);
  bottom: 0;
  z-index: 10;
}

/* ─── HOVER INFO ────────────────────────────────────────────────────────────  */
.lower-info {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
  display: flex;
}

body.has-preview {
  --ink:       #1C1C1C;
  --ink-faint: rgba(28, 28, 28, 0.35);
}

.lower-info.is-visible {
  opacity: 1;
}

/* Mirrors panel-left (blank col 1) */
.lower-info-left {
  width: 25%;
  flex-shrink: 0;
}

/* Mirrors panel-right: same padding + gap so columns align */
.lower-info-inner {
  flex: 1;
  display: flex;
  align-items: stretch;
  padding: 0 44px;
  gap: 44px;
}

/* Col 2 — text, constrained to "2026 — IDP" column */
.lower-info-mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0;
}

/* Col 3 — hover text, under "PROJECTS" column */
.lower-info-projects {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: safe center;   /* never pushes text above the top edge */
  padding: 40px 0;
  overflow: hidden;
}

/* Mirrors about-section (20vw) */
.lower-info-about {
  flex: 0 0 20vw;
}

.hover-number {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 18px;
}

.hover-title {
  font-size: clamp(22px, 2.8vw, 42px);
  font-weight: 400;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.1;
  margin-bottom: 22px;
}

.hover-desc {
  font-size: 12.5px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  text-transform: none;
  max-width: 520px;
  color: var(--ink);
  margin-bottom: 28px;
  white-space: pre-line;   /* keep the paragraph breaks from projects.js */
  /* main.js sets -webkit-line-clamp when the text is taller than the space */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-shrink: 0;   /* clamp by whole lines instead of being squeezed mid-line */
}

.hover-tags {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}


/* ─── ABOUT OVERLAY ─────────────────────────────────────────────────────────  */
/*  Reuses .project-detail, .project-hero, .project-title-display, .close-btn  */

/* Portrait fills the hero as a background image */
.about-portrait-bg { display: none; }

.about-portrait {
  flex: none;
  align-self: flex-start;
  margin-left: 28px;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: grayscale(100%) contrast(1.1);
}

/* ─── ABOUT BODY ─────────────────────────────────────────────────────────────  */
.about-body {
  padding: 52px 0 40px 44px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

.about-left {
  flex: none;
  width: 26%;
  display: flex;
  flex-direction: column;
  gap: 44px;
}

.about-bio {
  flex: 1;
  max-width: 560px;
}

.about-bio p {
  font-size: 14px;
  line-height: 1.75;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink);
  margin-bottom: 28px;
}

.about-bio p:last-child { margin-bottom: 0; }

/* Details below bio in the narrow text column */
.about-details {
  width: 100%;
}

.about-detail-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid var(--ink);
}

.about-detail-row:first-child {
  border-top: 1px solid var(--ink);
}

.about-detail-label {
  font-size: 7.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.5;
}

.about-detail-value {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}


/* ─── MOBILE CORNER LABELS (hidden on desktop) ─────────────────────────────── */
.mobile-name,
.mobile-tagline,
.mobile-projects-head { display: none; }

.mobile-name {
  position: fixed;
  top: 12px;
  left: 12px;
  color: var(--bg);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  z-index: 6;
  pointer-events: none;
}

.mobile-tagline {
  position: fixed;
  bottom: 12px;
  left: 12px;
  color: var(--bg);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  z-index: 6;
  pointer-events: none;
  max-width: 44vw;
  line-height: 1.5;
}

.mobile-projects-head {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #1C1C1C;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: right;
  width: 100%;
}

/* ─── MOBILE ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Enable vertical scrolling */
  html, body {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100%;
  }

  /* Lock scroll when an overlay is open */
  body.overlay-open { overflow: hidden; }

  /* ── No top bar on mobile ────────────────────────────────────────────────── */
  .spine { display: none; }

  /* ── Mobile corner labels shown ──────────────────────────────────────────── */
  .mobile-name, .mobile-tagline, .mobile-projects-head { display: block; }

  /* ── Panels: collapsed — panel-right is positioned independently ─────────── */
  .panels { position: static; height: 0; overflow: visible; }
  .panel-left, .panel-mid { display: none; }

  /* ── Right panel: fixed, right half, always visible ─────────────────────── */
  .panel-right {
    position: fixed;
    top: 0;
    right: 0;
    width: 50vw;
    bottom: 0;
    z-index: 5;
    background: var(--bg);
    overflow-y: auto;
    flex-direction: column;
    justify-content: flex-start;
    padding: 12px 12px 60px 12px;
    gap: 0;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    transition: none;
  }

  /* No drawer animation on mobile */
  .panel-right.projects-open { opacity: 1; pointer-events: auto; transform: none; }

  /* Projects list hidden until PROJECTS is clicked */
  .projects-list {
    display: none;
    flex: none;
    justify-content: flex-start;
    border-top: none;
    margin-top: 4px;
  }

  .panel-right.projects-open .projects-list { display: flex; }

  .project-item { padding: 12px 0; }

  /* Hide about section — CONTACT ME handles navigation */
  .about-section { display: none; }

  /* CONTACT ME: bottom-right corner, same type style */
  .contact-me {
    top: auto;
    bottom: 12px;
    left: auto;
    right: 12px;
    font-size: 8.5px;
    letter-spacing: 0.16em;
    color: #1C1C1C;
  }

  /* Lower section not needed on mobile */
  .lower-section { display: none; }

  /* ── Project / About overlays sit above everything, including spine ─────── */
  .project-detail {
    z-index: 500;
  }

  /* ── Project detail layout ───────────────────────────────────────────────── */
  .project-body {
    height: auto !important;
    overflow: visible;
  }

  .project-info { flex-direction: column; }

  .project-text {
    width: 100%;
    padding: 28px 20px 24px;
    overflow: visible;
  }

  .project-text.has-more { -webkit-mask-image: none; mask-image: none; }

  .project-gallery { padding: 16px 20px; }
  .gallery-thumb { height: 90px; }

  /* ── About overlay ────────────────────────────────────────────────────────── */
  .about-body {
    flex-direction: column;
    padding: 28px 20px 60px;
  }

  .about-left {
    width: 100%;
    gap: 36px;
  }

  .about-portrait {
    margin-left: 0;
    width: 100% !important;
    height: auto !important;
  }

  /* Close button */
  .close-btn {
    top: 20px;
    right: 20px;
  }
}
