/* ==========================================================================
   Yasmine Moufti — site theme
   Cream paper, ink line, tile teal. Type: Fraunces (display) + DM Sans (UI).
   ========================================================================== */

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

:root {
  --cream: #F4E8D9;
  --cream-deep: #EDE0CE;
  --ink: #141210;
  --ink-soft: #4A433C;
  --muted: #8A7E72;
  --rule: #D9C8B2;
  --teal: #88A8A6;
  --teal-deep: #5E8481;
  --wine: #906038;

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --gutter: clamp(20px, 4vw, 56px);
  --measure: 64ch;
  --nav-h: 64px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t: 0.3s var(--ease);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-weight: 300;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: none; }
::selection { background: var(--teal); color: var(--ink); }
:focus-visible { outline: 2px solid var(--teal-deep); outline-offset: 3px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 500;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  min-height: var(--nav-h);
  padding: 14px var(--gutter);
  background: rgba(244, 232, 217, 0.92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t);
}
.nav.scrolled { border-color: var(--rule); }
.nav-logo { display: block; flex-shrink: 0; }
.nav-logo img {
  height: clamp(17px, 2.1vw, 23px); width: auto;
  transition: opacity var(--t);
}
.nav-logo:hover img { opacity: 0.6; }
.nav-links { display: flex; gap: clamp(16px, 3vw, 36px); list-style: none; }
.nav-links a {
  font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none; color: var(--ink);
  padding-bottom: 3px;
  background: linear-gradient(var(--teal), var(--teal)) no-repeat 0 100% / 0 1.5px;
  transition: background-size var(--t);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { background-size: 100% 1.5px; }

/* ==========================================================================
   HOME — one screen, no scrolling
   ========================================================================== */
body.home { height: 100dvh; overflow: hidden; }
.home-wrap { height: 100dvh; display: flex; flex-direction: column; }
.home-stage {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(14px, 2.4vh, 30px);
  padding: clamp(8px, 1.5vh, 20px) var(--gutter) clamp(20px, 4vh, 48px);
}
/* The drawing sits in the middle third of a 1920x600 canvas, so the banner is
   sized by HEIGHT and allowed to bleed sideways: the table then fills the screen.
   The height is capped so the table never grows wider than the viewport. */
.home-banner {
  flex: 1; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.home-banner > div {
  width: auto !important;
  height: min(100%, calc((100vw - 2 * var(--gutter)) / 1.12));
  margin: 0 !important;
}
.home-lines {
  text-align: center;
  font-size: clamp(15px, 1.5vw, 20px);
  line-height: 1.5; color: var(--ink-soft);
  text-wrap: balance;
}
.home-lines .lead {
  display: block;
  font-family: var(--display); font-weight: 400;
  font-variation-settings: 'SOFT' 60, 'opsz' 40;
  font-size: clamp(21px, 2.4vw, 34px);
  line-height: 1.25; letter-spacing: -0.01em;
  color: var(--ink); margin-bottom: 8px;
}

/* ==========================================================================
   SHARED
   ========================================================================== */
main.page { padding: clamp(32px, 5vw, 64px) var(--gutter) clamp(56px, 7vw, 96px); }

.back-btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 500;
  text-decoration: none; color: var(--muted);
  margin-bottom: 22px;
  transition: color var(--t), gap var(--t);
}
.back-btn:hover { color: var(--ink); gap: 16px; }
.back-btn .arrow { display: inline-block; transition: transform var(--t); }
.back-btn:hover .arrow { transform: translateX(-4px); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--ink); margin-top: clamp(48px, 7vw, 96px); }
.footer-cta {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 28px 40px;
  padding: clamp(44px, 6vw, 76px) var(--gutter) clamp(32px, 4vw, 48px);
}
.footer-cta h2 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(28px, 3.4vw, 50px);
  font-variation-settings: 'SOFT' 80, 'opsz' 96;
  line-height: 1.08; letter-spacing: -0.02em;
  max-width: 17ch; text-wrap: balance;
}
.footer-cta h2 em { font-style: italic; font-weight: 300; color: var(--wine); }
.footer-right { display: flex; align-items: flex-end; gap: clamp(18px, 3vw, 34px); }
.footer-table { width: clamp(96px, 12vw, 168px); height: auto; opacity: 0.9; }
.footer-mail {
  font-family: var(--display); font-weight: 400;
  font-variation-settings: 'opsz' 40;
  font-size: clamp(17px, 1.7vw, 24px);
  text-decoration: none; color: var(--ink);
  border-bottom: 1.5px solid var(--rule); padding-bottom: 3px;
  transition: border-color var(--t); white-space: nowrap;
}
.footer-mail:hover { border-color: var(--ink); }
.footer-contact { display: flex; flex-direction: column; align-items: flex-start; gap: 11px; }
.footer-ig {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; letter-spacing: 0.02em;
  text-decoration: none; color: var(--muted);
  transition: color var(--t);
}
.footer-ig svg { flex: 0 0 auto; }
.footer-ig:hover { color: var(--ink); }
.footer-base {
  border-top: 1px solid var(--rule);
  padding: 18px var(--gutter) 26px;
  font-size: 12px; letter-spacing: 0.06em; color: var(--muted);
}

/* ==========================================================================
   PROJECTS INDEX — natural ratios, never cropped, never rotated
   ========================================================================== */
.pgrid { columns: 3; column-gap: clamp(20px, 2.6vw, 40px); }
.pgrid.is-flex { columns: auto; display: flex; align-items: flex-start; gap: clamp(20px, 2.6vw, 40px); }
.pgrid.is-flex > .mcol { flex: 1 1 0; min-width: 0; }
.pcard {
  display: block; break-inside: avoid;
  margin: 0 0 clamp(30px, 3.4vw, 52px);
  text-decoration: none; color: inherit;
}
.pcard-img {
  width: 100%; height: auto;
  border: 1px solid var(--ink);
  background: var(--cream-deep);
  transition: transform var(--t), box-shadow var(--t);
}
.pcard:hover .pcard-img { transform: translateY(-4px); box-shadow: 0 10px 0 -6px var(--teal); }
.pcard-title {
  font-family: var(--display); font-weight: 400;
  font-variation-settings: 'SOFT' 40, 'opsz' 36;
  font-size: clamp(16px, 1.4vw, 21px);
  line-height: 1.25; letter-spacing: -0.01em;
  margin-top: 14px; text-wrap: balance;
}
.pcard:hover .pcard-title { color: var(--wine); }

/* ==========================================================================
   PROJECT PAGE — title, then a slowly drifting carousel, then the text
   ========================================================================== */
main.project { padding-top: clamp(28px, 4vw, 52px); }
.proj-head { padding: 0 var(--gutter); margin-bottom: clamp(24px, 3.4vw, 42px); }
.proj-title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(32px, 4.4vw, 66px);
  font-variation-settings: 'SOFT' 80, 'opsz' 144;
  line-height: 1.03; letter-spacing: -0.02em;
  text-wrap: balance; max-width: 20ch; margin-bottom: 12px;
}
.proj-meta { font-size: 13.5px; color: var(--muted); letter-spacing: 0.01em; }

.carousel { position: relative; }
.carousel-track {
  display: flex; align-items: center;
  gap: clamp(12px, 1.4vw, 22px);
  height: clamp(280px, 56vh, 620px);
  overflow-x: auto; overflow-y: hidden;
  padding: 0 var(--gutter);
  scrollbar-width: none; -ms-overflow-style: none;
  overscroll-behavior-x: contain;
  cursor: grab;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track.dragging { cursor: grabbing; }
/* Dragging a tile should scrub the strip, never start a native image drag,
   and never leave a blue text selection trailing behind the cursor. */
.carousel-track { user-select: none; -webkit-user-select: none; }
.slide img { -webkit-user-drag: none; user-drag: none; }
/* The drift advances by fractions of a pixel. scrollLeft only takes whole
   pixels, so site.js carries the remainder here — without it the strip
   twitches a pixel at a time instead of gliding. */
.carousel-track { --sub: 0px; }
.slide { transform: translate3d(var(--sub), 0, 0); }
/* Uniform square tiles: every slide is the same size. Images fill the tile with
   object-fit:cover — they are cropped to fit, never stretched or squashed. */
.slide {
  flex: 0 0 auto; height: 100%; aspect-ratio: 1 / 1; padding: 0;
  position: relative; cursor: zoom-in;
  border: 1px solid var(--ink); background: var(--cream-deep);
  overflow: hidden;
}
.slide img { width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center; }
.slide.is-video { cursor: pointer; }
.slide .play {
  position: absolute; inset: 0; margin: auto;
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(20,18,16,0.55); backdrop-filter: blur(2px);
  transition: background var(--t), transform var(--t);
}
.slide .play::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 0; height: 0;
  border-left: 15px solid var(--cream);
  border-top: 9px solid transparent; border-bottom: 9px solid transparent;
  transform: translateX(2px);
}
.slide.is-video:hover .play { background: rgba(20,18,16,0.8); transform: scale(1.06); }

.car-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(244,232,217,0.92); border: 1px solid var(--ink);
  font-size: 22px; line-height: 1; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity var(--t), background var(--t);
}
.carousel:hover .car-nav, .car-nav:focus-visible { opacity: 1; }
.car-nav:hover { background: var(--cream); }
.car-nav.prev { left: calc(var(--gutter) / 2); }
.car-nav.next { right: calc(var(--gutter) / 2); }
@media (hover: none) { .car-nav { display: none; } }

.proj-desc {
  padding: clamp(34px, 4.5vw, 60px) var(--gutter) 0;
  max-width: calc(var(--measure) + 2 * var(--gutter));
}
.proj-desc p { font-size: clamp(15.5px, 1.15vw, 17.5px); line-height: 1.75; color: var(--ink-soft); margin-bottom: 20px; }
.proj-desc p em { font-style: italic; color: var(--ink); }
.proj-desc p:first-child {
  font-family: var(--display); font-weight: 400;
  font-variation-settings: 'SOFT' 60, 'opsz' 40;
  font-size: clamp(19px, 1.6vw, 24px); line-height: 1.45; color: var(--ink);
}
.proj-desc p:last-child { margin-bottom: 0; }

/* ---------- lightbox ---------- */
#lightbox {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(20, 18, 16, 0.97);
  align-items: center; justify-content: center;
}
#lightbox.open { display: flex; }
#lb-stage { display: flex; align-items: center; justify-content: center; max-width: 92vw; max-height: 88vh; }
#lb-stage img, #lb-stage video { max-width: 92vw; max-height: 88vh; width: auto; height: auto; }
.lb-btn {
  position: absolute; color: rgba(244,232,217,0.75);
  font-size: 30px; padding: 14px 22px; line-height: 1;
  transition: color 0.2s, transform 0.2s; cursor: pointer;
}
.lb-btn:hover { color: var(--cream); }
#lb-close { top: 12px; right: 16px; font-size: 22px; }
#lb-prev  { left: 4px;  top: 50%; transform: translateY(-50%); }
#lb-next  { right: 4px; top: 50%; transform: translateY(-50%); }
#lb-prev:hover { transform: translateY(-50%) translateX(-4px); }
#lb-next:hover { transform: translateY(-50%) translateX(4px); }
.lb-counter {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: rgba(244,232,217,0.55); font-size: 12px; letter-spacing: 0.12em;
}

/* ==========================================================================
   ABOUT
   ========================================================================== */
.about-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 90px); align-items: start;
}
.about-text p {
  font-size: clamp(15.5px, 1.2vw, 18px); line-height: 1.75;
  color: var(--ink-soft); max-width: var(--measure); margin-bottom: 20px;
}
.about-text p:first-child {
  font-family: var(--display); font-weight: 400;
  font-variation-settings: 'SOFT' 60, 'opsz' 48;
  font-size: clamp(21px, 2vw, 30px); line-height: 1.35; color: var(--ink);
  margin-bottom: 26px;
}
.about-text p:last-child { margin-bottom: 0; }
.about-illus { position: sticky; top: calc(var(--nav-h) + 36px); display: flex; justify-content: center; }
.about-illus img { width: auto; max-height: clamp(280px, 42vh, 460px); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1050px) {
  .pgrid { columns: 2; }
  .about-grid { grid-template-columns: 1fr; }
  .about-illus { position: static; justify-content: flex-start; margin-top: 4px; }
  .about-illus img { max-height: 240px; }
}

@media (max-width: 860px) {
  .footer-cta { flex-direction: column; align-items: flex-start; }
  .footer-right { width: 100%; justify-content: space-between; align-items: center; }
  .footer-contact { align-items: flex-end; }
}

@media (max-width: 620px) {
  .pgrid { columns: 1; }
  .nav-links { gap: 15px; }
  .nav-links a { font-size: 11px; letter-spacing: 0.09em; }
  .carousel-track { height: clamp(240px, 42vh, 380px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
