/* ==========================================================
   ANDRE MCHEILEH — site styles
   Full-screen reel, logo on top, three words at the bottom.
   ========================================================== */

:root {
  --paper: #fcfcfc;              /* white with ~1% black */
  --ink: #111111;
  --mute: #8f8f8f;
  --line: rgba(17,17,17,.12);
  --edge: clamp(18px, 2.6vw, 40px);     /* distance of the UI from the screen edge */
  --top: 36px;      /* white strip behind the logo */
  --bot: 24px;        /* thinner white strip behind the menu */
  --bot-strip: var(--bot);           /* white area at the bottom (0 when hidden) */

  /* Opening curtain */
  --curtain-ease: cubic-bezier(.16, 1, .3, 1);   /* "Lift" */
  --curtain-time: 6s;
  --curtain-delay: 0s;

  /* Type */
  --logo-size: 16px;
  --logo-track: .01em;       /* letter-spacing of the name */
  --menu-size: 10px;
  --menu-track: .075em;     /* letter-spacing of Mail / About / Instagram */
  --logo-shift: 0px;       /* nudge the name up (−) or down (+) inside its strip */
  --menu-shift: 0px;       /* nudge the menu up (−) or down (+) inside its strip */
  /* how far the curtain travels: from the bottom strip up to its resting place */
  --lift: calc(100svh - var(--bot-strip) - var(--top) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  --fade: .1s;                   /* crossfade between frames */
  --hold: 2s;                   /* how long each image stays before the next fades in */
  --scrub-step: 35px;            /* drag distance per image when scrubbing (smaller = faster) */
  --font: "Futura PT", "Futura", "Jost", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .6, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { display: block; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--ink); color: var(--paper); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- The UI that floats over the work ---------- */
.ui {
  position: fixed;
  z-index: 10;
  color: var(--ink);
  transition: color .35s var(--ease), opacity .4s var(--ease);
}
.logo {
  top: calc(env(safe-area-inset-top) + var(--top) / 2);
  left: 50vw;   /* window centre, so a scrollbar never shifts the name */
  transform: translate(-50%, calc(-50% + var(--logo-shift)));
  font-weight: 700;
  font-size: var(--logo-size);
  letter-spacing: var(--logo-track);
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}
.logo img { height: 1em; width: auto; }   /* when the SVG logo replaces the text */

.bar-item {
  bottom: calc(env(safe-area-inset-bottom) + var(--bot) / 2);
  transform: translateY(calc(50% + var(--menu-shift)));
  font-size: var(--menu-size);
  font-weight: 500;
  letter-spacing: var(--menu-track);
  text-transform: uppercase;
  line-height: 1;
}
.bar-item--left   { left: var(--edge); }
.bar-item--center { left: 50vw; transform: translate(-50%, calc(50% + var(--menu-shift))); }
.bar-item--right  { right: var(--edge); }
.bar-item:hover, .logo:hover { opacity: .5; }

/* The two white strips */
body::before, body::after {
  content: "";
  position: fixed;
  left: 0; right: 0;
  z-index: 9;
  background: var(--paper);
  pointer-events: none;
}
/* The top strip is a full-height curtain, pulled up so only its bottom edge shows */
body::before {
  top: 0;
  height: calc(100svh - var(--bot-strip) - env(safe-area-inset-bottom));
  transform: translateY(calc(-1 * var(--lift)));
  will-change: transform;
}
body::after  { bottom: 0; height: calc(var(--bot) + env(safe-area-inset-bottom)); }

/* Opening: the curtain starts closed and rises; the name rides on its edge */
.intro body.home::before { animation: curtain-up var(--curtain-time) var(--curtain-ease) var(--curtain-delay) both; }
.intro body.home .logo { animation: logo-up    var(--curtain-time) var(--curtain-ease) var(--curtain-delay) both; }
@keyframes curtain-up {
  from { transform: none; }
  to   { transform: translateY(calc(-1 * var(--lift))); }
}
@keyframes logo-up {
  from { transform: translate(-50%, calc(-50% + var(--logo-shift) + var(--lift))); }
  to   { transform: translate(-50%, calc(-50% + var(--logo-shift))); }
}

/* While the WebGL curtain effect is drawing, hide the plain CSS curtain */
.fx body.home::before { visibility: hidden; }
/* Lingering-smoke ending: the smoke replaces the solid top strip on the work page */
.smoke-top body.home::before { visibility: hidden; }
.smoke-end body.home .stage { top: 0; }
body:not(.home) #curtain-fx { display: none; }

/* Text colour modes (set on <body data-text="…">) */
.ui[data-tone="light"] { color: #fff; }                  /* auto: picked per frame */
[data-text="black"] .ui { color: var(--ink) !important; }
[data-text="invert"] .ui { color: #fff !important; mix-blend-mode: difference; }

/* ---------- Home: the reel ---------- */
.home { height: 100svh; overflow: hidden; }

.stage {
  position: fixed;
  top: calc(var(--top) + env(safe-area-inset-top));
  bottom: calc(var(--bot-strip) + env(safe-area-inset-bottom));
  left: 0; right: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.is-dragging .stage { cursor: grabbing; }

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
}
.slide.is-prev   { opacity: 1; z-index: 1; }
.slide.is-active { opacity: 1; z-index: 2; transition: opacity var(--fade) var(--ease); }
.slide.is-entering { opacity: 0; }
.is-scrubbing .slide.is-active { transition: none; }

.slide img, .slide video { -webkit-user-drag: none; }

/* Three sizes — set per frame with a class */
.slide--full img, .slide--full video {          /* edge to edge */
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
}
.slide--fit img, .slide--fit video {            /* large, with air around it */
  width: auto; height: auto;
  max-width: calc(100% - 2 * var(--edge) - 8vw);
  max-height: calc(100% - 2 * (var(--edge) + 48px));
}
.slide--small img, .slide--small video {        /* small, floating in white */
  width: auto; height: auto;
  max-width: min(42vw, 560px);
  max-height: 52svh;
}

/* ---------- About ---------- */
.page { min-height: 100svh; }
.page .ui { background: transparent; }
.about {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: clamp(32px, 7vw, 140px);
  padding: calc(var(--top) + 10vh) var(--edge) calc(var(--bot) + 14vh);
  align-items: start;
}
.about__portrait { position: sticky; top: calc(var(--top) + 6vh); margin: 0; }
.about__portrait img { width: 100%; height: auto; }
.label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 2.2em;
}
.about__lead {
  font-weight: 500;
  font-size: clamp(22px, 2.3vw, 36px);
  line-height: 1.3;
  margin: 0 0 1.4em;
  max-width: 26ch;
}
.about__body { max-width: 58ch; color: #2b2b2b; }
.about__body p { margin: 0 0 1.2em; }
.about__section { margin-top: 12vh; }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list li {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.list b {
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mute);
  padding-top: .25em;
}
.list span { font-weight: 500; font-size: 17px; }

/* Preview-only switch for the text colour mode */
.dev-switch {
  position: fixed; z-index: 50; top: 50%; left: 10px; transform: translateY(-50%);
  font: 500 10px/1 var(--font); letter-spacing: .1em; text-transform: uppercase;
  background: #111; color: #fff; border: 0; padding: 8px 10px; border-radius: 2px;
  cursor: pointer; opacity: .75;
}
.dev-switch:hover { opacity: 1; }

/* ==========================================================
   Tablet
   ========================================================== */
@media (max-width: 1024px) {
  .slide--small img, .slide--small video { max-width: 52vw; }
  .about { grid-template-columns: 1fr 1fr; gap: 6vw; }
}

/* ==========================================================
   Phone
   ========================================================== */
@media (max-width: 640px) {
  :root { --edge: 18px; }   /* strips and type use the same values as desktop */

  .slide--fit img, .slide--fit video {
    max-width: calc(100% - 2 * var(--edge));
    max-height: calc(100% - 2 * (var(--edge) + 44px));
  }
  .slide--small img, .slide--small video { max-width: 64vw; max-height: 46svh; }

  .about { grid-template-columns: 1fr; padding: calc(var(--top) + 5vh) var(--edge) calc(var(--bot) + 10vh); gap: 7vh; }
  .about__portrait { position: static; }
  .about__lead { font-size: 26px; max-width: none; }
  .about__body { font-size: 16px; }
  .about__section { margin-top: 8vh; }
  .list li { grid-template-columns: 1fr; gap: 4px; padding: 16px 0; }
  .list span { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --fade: .01s; --curtain-time: .01s; --curtain-delay: .1s; }
}

/* Inner pages: words keep a paper backing so text scrolling underneath stays clear */
[data-text="invert"] .page .ui { background: transparent; }

/* Bottom strip options */
.bot-hidden { --bot-strip: 0px; }
.bot-hidden body::after { visibility: hidden; }
.menu-hidden .bar-item { visibility: hidden; }
.menu-white .bar-item { color: #fff !important; }
.logo-white .logo { color: #fff !important; }

/* ==========================================================
   About page
   ========================================================== */
body.page .bar-item, body.page .logo { color: var(--ink) !important; }   /* always readable on the white page */
.bot-hidden body.page::after { visibility: visible; }                       /* keep a white band behind the menu here */

.ab { padding: 0 var(--edge); }
.ab-hero { padding: calc(var(--top) + 16vh) 0 14vh; }
.ab-kicker, .ab-label, .ab-clients h3 {
  font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); margin: 0;
}
.ab-lead {
  margin: 2.2rem 0 0;
  font-weight: 500;
  font-size: clamp(28px, 3.5vw, 54px);
  line-height: 1.12;
  letter-spacing: -.012em;
  max-width: 23ch;
}

.ab-intro {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0 clamp(16px, 2vw, 32px);
  align-items: end;
}
.ab-portrait { grid-column: 1 / 7; margin: 0; overflow: hidden; background: #f1f0ee; }
.ab-portrait img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; }
.ab-text { grid-column: 8 / 12; font-size: 17px; line-height: 1.6; color: #2b2b2b; }
.ab-text p { margin: 0 0 1.1em; max-width: 44ch; }
.ab-text p:last-child { margin-bottom: 0; }

.ab-block {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0 clamp(16px, 2vw, 32px);
  margin-top: 20vh;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.ab-label { grid-column: 1 / 4; }
.ab-block > :not(.ab-label) { grid-column: 4 / 13; }

.ab-disc { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(16px, 2vw, 32px); }
.ab-n { display: block; font-size: 11px; font-weight: 500; letter-spacing: .12em; color: var(--mute); margin-bottom: 2.4rem; }
.ab-disc h3 { margin: 0 0 .6rem; font-size: 15px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.ab-disc p { margin: 0; font-size: 15px; line-height: 1.5; color: #555; max-width: 24ch; }

.ab-clients { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(16px, 2vw, 32px); }
.ab-clients p { margin: 1.2rem 0 0; font-size: 19px; font-weight: 500; line-height: 1.4; }

.ab-mail {
  display: inline-block;
  font-weight: 700;
  font-size: clamp(24px, 4.6vw, 84px);
  line-height: 1;
  letter-spacing: -.015em;
  white-space: nowrap;
  transition: opacity .4s var(--ease);
}
.ab-mail:hover { opacity: .45; }
.ab-links {
  display: flex; flex-wrap: wrap; gap: 12px 48px; margin-top: 2.4rem;
  font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
}
.ab-links a:hover { opacity: .45; }
.ab-links span { color: var(--mute); }

.ab-foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 20vh; padding: 18px 0 calc(var(--bot) + 40px);
  border-top: 1px solid var(--line);
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--mute);
}

/* gentle reveal as you scroll */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .ab-disc, .ab-clients { grid-template-columns: repeat(2, 1fr); row-gap: 3rem; }
  .ab-text { grid-column: 7 / 13; }
}
@media (max-width: 640px) {
  .ab-hero { padding: calc(var(--top) + 9vh) 0 9vh; }
  .ab-lead { font-size: 28px; }
  .ab-intro, .ab-block { display: block; }
  .ab-portrait { width: 86%; }
  .ab-text { margin-top: 3rem; font-size: 16px; }
  .ab-block { margin-top: 13vh; }
  .ab-label { margin-bottom: 2rem; }
  .ab-n { margin-bottom: 1.2rem; }
  .ab-clients p { font-size: 17px; }
  .ab-mail { font-size: 6.3vw; }
  .ab-links { flex-direction: column; gap: 12px; }
  .ab-foot { flex-direction: column; margin-top: 13vh; }
}
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }

/* About — text-led layout */
.ab-copy { padding: calc(var(--top) + 16vh) 0 4vh; display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 clamp(16px, 2vw, 32px); }
.ab-copy .ab-kicker { grid-column: 1 / 13; }
.ab-copy .ab-lead { grid-column: 1 / 11; max-width: 30ch; }
.ab-body { grid-column: 4 / 10; margin-top: 12vh; font-size: clamp(17px, 1.35vw, 21px); line-height: 1.55; color: #2b2b2b; }
.ab-body p { margin: 0 0 1.2em; max-width: 46ch; }
.ab-clientline { margin: 0; font-size: clamp(17px, 1.4vw, 22px); font-weight: 500; line-height: 1.6; max-width: 60ch; }
@media (max-width: 640px) {
  .ab-copy { display: block; padding-top: calc(var(--top) + 9vh); }
  .ab-body { margin-top: 7vh; font-size: 16px; }
}

/* About — services */
.ab-services { list-style: none; margin: 0; padding: 0; }
.ab-services li { display: grid; grid-template-columns: 11rem 1fr; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.ab-services li:first-child { padding-top: 0; }
.ab-services b { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding-top: .3em; }
.ab-services span { font-size: clamp(16px, 1.25vw, 19px); color: #2b2b2b; }
@media (max-width: 640px) { .ab-services li { grid-template-columns: 1fr; gap: 4px; } }

/* About — one text size for the whole statement */
.ab-copy .ab-p, .ab-rest .ab-p {
  grid-column: 1 / 10;
  margin: 0 0 1.1em;
  font-weight: 500;
  font-size: clamp(22px, 2.1vw, 34px);
  line-height: 1.28;
  letter-spacing: -.008em;
  color: var(--ink);
  max-width: 40ch;
}
.ab-copy { padding-bottom: 2vh; }
.ab-rest { grid-column: 1 / 13; }
.ab-big {
  display: block;
  width: fit-content;
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 56px);
  line-height: 1.1;
  letter-spacing: -.012em;
  white-space: nowrap;
  transition: opacity .4s var(--ease);
}
.ab-big + .ab-big { margin-top: .25em; }
.ab-big:hover { opacity: .45; }
.ab-place { margin: 2.2rem 0 0; font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
@media (max-width: 640px) {
  .ab-copy .ab-p, .ab-rest .ab-p { font-size: 21px; }
  .ab-big { font-size: 6.3vw; }
}

/* About page — editable values */
:root {
  --ab-size: clamp(22px, 2.1vw, 34px);  /* statement text size */
  --ab-lh: 1.28;                          /* line height */
  --ab-width: 40ch;                       /* column width */
  --ab-color: #111111;                    /* statement colour */
  --ab-top: 16vh;                         /* space above the text */
  --ab-left: 0px;                         /* shift the text block right */
  --ab-svc-size: clamp(16px, 1.25vw, 19px);
  --ab-contact-size: clamp(24px, 3.4vw, 56px);
}
.ab-copy { padding-top: calc(var(--top) + var(--ab-top)); }
.ab-copy .ab-p, .ab-rest .ab-p { font-size: var(--ab-size); line-height: var(--ab-lh); max-width: var(--ab-width); color: var(--ab-color); margin-left: var(--ab-left); }
.ab-services span { font-size: var(--ab-svc-size); }
.ab-big { font-size: var(--ab-contact-size); }
@media (max-width: 640px) {
  .ab-copy .ab-p, .ab-rest .ab-p { font-size: min(var(--ab-size), 21px); margin-left: 0; }
  .ab-big { font-size: min(var(--ab-contact-size), 6.3vw); }
}


/* ───────── About — portrait ─────────
   Desktop: portrait pinned in the left column, text scrolls in the right.
   iPad + phone: portrait stacked on top, vertical.                     */
:root {
  --ab-img: 42%;        /* portrait column width (desktop) */
  --ab-gap: 5vw;        /* gap between portrait and text (desktop) */
  --ab-img-w: 100%;     /* portrait width on phone / iPad */
}
.ab-fig { margin: 0; background: #efefef; overflow: hidden; }
.ab-fig img { display: block; width: 100%; height: auto; aspect-ratio: 1002 / 1337; object-fit: cover; object-position: 50% 20%; filter: grayscale(1); }

@media (min-width: 1025px) {
  .ab {
    display: grid;
    grid-template-columns: var(--ab-img) minmax(0, 1fr);
    column-gap: var(--ab-gap);
    align-items: start;
  }
  .ab > :not(.ab-fig) { grid-column: 2; }
  .ab-fig {
    grid-column: 1; grid-row: 1 / span 6;
    position: sticky;
    top: calc(var(--top) + 3vh);
    margin-top: calc(var(--top) + 3vh);
    align-self: start;
  }
  .ab-fig img { max-height: calc(100vh - var(--top) - var(--bot) - var(--bot-strip, 0px) - 6vh); }
  .ab .ab-copy { padding-top: calc(var(--top) + 3vh + var(--ab-top) - 16vh); display: block; }
  .ab .ab-block { display: block; margin-top: 14vh; }
  .ab .ab-label { margin: 0 0 1.6rem; }
  .ab .ab-copy .ab-p, .ab .ab-rest .ab-p { max-width: min(var(--ab-width), 100%); }
  .ab-big { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 1024px) {
  .ab-fig { width: var(--ab-img-w); margin-top: calc(var(--top) + 4vh); }
  .ab .ab-copy { padding-top: 8vh; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  :root { --ab-img-w: 66%; }
}
