/* ==========================================================================
   Studiomaleya — "The Archive" · components (v2)
   Base + components. In the Astro build each block becomes the scoped style
   of its component (names kept identical).
   v2: no decorative patterns · handmade paper notes · slanted folder tabs ·
       thumb-friendly mobile bar · touch-first interactions.
   ========================================================================== */

/* ---------- Base ---------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Paper grain: one fixed layer over everything, never intercepts clicks */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background-image: var(--grain);
  opacity: 0.16;
  mix-blend-mode: multiply;
}

main { overflow-x: clip; } /* tilted paper may never widen the page */
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--burgundy); color: var(--cream); }

:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 4px; border-radius: 2px; }
.on-dark :focus-visible { outline-color: var(--cream); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: fixed; left: var(--gutter); top: -4rem; z-index: 200; padding: var(--s-2) var(--s-4);
  background: var(--brown); color: var(--cream);
  font: 500 var(--fs-micro) / 1 var(--font-sans); letter-spacing: var(--track-caps); text-transform: uppercase;
}
.skip-link:focus { top: var(--s-3); }

/* ---------- Type helpers --------------------------------------------------- */
.caps {
  font-family: var(--font-sans); font-size: var(--fs-micro); font-weight: 500;
  letter-spacing: var(--track-caps); text-transform: uppercase; line-height: 1.4;
}
.mono { font-family: var(--font-mono); font-size: var(--fs-mono); line-height: var(--lh-mono); }
.script { font-family: var(--font-script); font-weight: 400; font-style: normal; letter-spacing: 0; text-transform: none; line-height: 0.8; }
.hand { font-family: var(--font-hand); font-weight: 400; color: var(--pencil); letter-spacing: 0; line-height: 1.5; }
.ar { font-family: var(--font-arabic); direction: rtl; unicode-bidi: isolate; }
.eyebrow { display: flex; align-items: center; gap: var(--s-3); color: var(--ink-muted); }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.on-dark .eyebrow { color: var(--on-dark-muted); }

.section-title { font-size: var(--fs-h1); font-weight: 300; line-height: 0.95; letter-spacing: var(--track-tight); }
.section-title .script { color: var(--burgundy); font-size: 1.12em; margin-left: -0.04em; }
.on-dark .section-title .script { color: var(--kraft); }

/* Exploded justification: every word of a line pushed to the full width */
.exploded { display: grid; gap: 0.04em; }
.exploded > span { display: flex; justify-content: space-between; gap: 0.3em; }

/* ---------- Layout --------------------------------------------------------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
.section { padding-block: var(--section); position: relative; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: var(--s-5); flex-wrap: wrap; margin-bottom: var(--s-6); }
.on-dark { color: var(--on-dark); }
.bg-brown { background: var(--brown); }
.bg-oxblood { background: var(--oxblood); }
.bg-burgundy { background: var(--burgundy); }
.bg-cream { background: var(--cream); }

/* ---------- Buttons / calls to action ------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.7rem; min-height: 48px;
  padding: 0 1.5rem; border-radius: var(--r-pill); text-decoration: none;
  font-family: var(--font-sans); font-size: var(--fs-micro); font-weight: 500; letter-spacing: var(--track-caps); text-transform: uppercase;
  transition: background var(--dur-1), color var(--dur-1), transform var(--dur-2) var(--ease-paper);
}
.btn--solid { background: var(--burgundy); color: var(--cream); }
.btn--solid:hover { background: var(--oxblood); }
.btn--line { border: 1px solid currentColor; }
.btn--line:hover { background: var(--brown); color: var(--cream); border-color: var(--brown); }
.btn span[aria-hidden] { transition: transform var(--dur-2) var(--ease-paper); }
.btn:hover span[aria-hidden] { transform: translateX(4px); }

/* ---------- Navigation ------------------------------------------------------
   Laptop: top bar (About · Projects · Contact, Contact as the call to action).
   Mobile: a small top bar with the logo + a bottom bar in the thumb zone.     */
.nav { position: fixed; inset: 0 0 auto; z-index: var(--z-nav); transition: background var(--dur-2) var(--ease-paper), color var(--dur-2); }
.nav__inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 64px; border-bottom: 1px solid var(--line); }
.nav__link { text-decoration: none; padding: var(--s-3) 0; position: relative; }
.nav__link { justify-self: start; }
.nav__link + .nav__link { justify-self: center; }
.nav__link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform var(--dur-2) var(--ease-drawer);
}
.nav__link:hover::after, .nav__link[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }
.nav__cta { justify-self: end; min-height: 40px; padding: 0 1.15rem; }
.nav.is-scrolled { background: rgb(248 247 242 / 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.nav.is-dark { color: var(--cream); }
.nav.is-dark .nav__inner { border-color: var(--line-dark); }
.nav.is-dark.is-scrolled { background: rgb(42 18 15 / 0.85); }
.nav__home { display: none; }
.page-home .nav:not(.is-past) .nav__home { opacity: 0; pointer-events: none; } /* the hero already shows the logo */
.nav__home { transition: opacity var(--dur-2) var(--ease-paper); }

.tabbar { display: none; }
@media (max-width: 760px) {
  .nav__inner { grid-template-columns: 1fr auto; height: 56px; }
  .nav__link { display: none; }
  .nav__home { display: block; width: 132px; }
  .nav__home .logotype { --logo-color: currentColor; }
  .nav .nav__cta { display: none; }
  /* Bottom bar, one thumb */
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
    display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgb(248 247 242 / 0.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    min-height: 48px; display: grid; place-items: center; border-radius: var(--r-pill); text-decoration: none;
    font-family: var(--font-sans); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  }
  .tabbar a[aria-current="true"] { background: rgb(42 18 15 / 0.07); }
  .tabbar a.tabbar__cta { background: var(--burgundy); color: var(--cream); }
  .tabbar a.tabbar__cta[aria-current="true"] { background: var(--oxblood); box-shadow: inset 0 0 0 2px var(--kraft); }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* ---------- Logotype (real logo, recolorable through a CSS mask) ---------- */
.logotype { --logo-color: var(--brown); position: relative; display: block; width: 100%; aspect-ratio: 1277 / 224; }
.logotype__latin, .logotype__arabic {
  position: absolute; inset: 0; background: var(--logo-color);
  -webkit-mask: url("/brand/logotype.png") center / contain no-repeat;
  mask: url("/brand/logotype.png") center / contain no-repeat;
  transition: opacity var(--dur-3) var(--ease-paper);
}
.logotype__arabic { inset: -11% 0 -2% 1.3%; -webkit-mask-image: url("/brand/logotype-arabic.png"); mask-image: url("/brand/logotype-arabic.png"); opacity: 0; }
.logotype--dual:hover .logotype__latin { opacity: 0; }
.logotype--dual:hover .logotype__arabic { opacity: 1; }
.baseline {
  font-family: var(--font-sans); font-weight: 500; text-transform: uppercase; letter-spacing: var(--track-caps);
  font-size: clamp(0.62rem, 0.5rem + 0.45vw, 0.95rem); white-space: nowrap;
}

/* ======================================================================
   MATERIAL · Paper (shared by notes, sheets, folders, polaroids)
   ====================================================================== */
.paper-tex { background-color: var(--sheet); background-image: var(--paper-tex); }

/* Tape: yellowed, translucent, with torn ends and a few creases */
.tape {
  position: absolute; z-index: 4; width: clamp(64px, 36%, 120px); height: 1.7em; left: 32%; top: -0.75em;
  background:
    linear-gradient(100deg, transparent 0 30%, rgb(255 255 255 / 0.18) 32%, transparent 36% 64%, rgb(120 90 40 / 0.08) 66%, transparent 70%),
    rgb(233 222 190 / 0.68);
  box-shadow: 0 1px 1px rgb(42 18 15 / 0.1);
  clip-path: polygon(2% 12%, 7% 0, 13% 9%, 21% 1%, 30% 8%, 41% 0, 52% 7%, 63% 1%, 74% 10%, 85% 0, 93% 9%, 100% 3%, 98% 90%, 92% 100%, 83% 91%, 71% 100%, 60% 92%, 47% 100%, 35% 91%, 24% 100%, 12% 92%, 4% 100%, 0 86%);
  transform: rotate(var(--tape-r, -4deg));
  mix-blend-mode: multiply;
}
.tape--tl { left: -1.2em; top: 0.4em; --tape-r: -38deg; width: clamp(56px, 22%, 96px); }
.tape--tr { left: auto; right: -1.2em; top: 0.4em; --tape-r: 36deg; width: clamp(56px, 22%, 96px); }
/* Paperclip: two-tone wire so it reads as metal, not a line icon */
.clip { position: absolute; z-index: 5; width: 22px; height: 64px; filter: drop-shadow(1px 2px 1.5px rgb(42 18 15 / 0.3)); }
.clip path:first-child { stroke: #858b92; }  /* chrome wire */
.clip path:last-child { stroke: #f4f6f8; }   /* highlight */

/* ======================================================================
   COMPONENT · Polaroid
   ====================================================================== */
.polaroid {
  --tilt: 0deg; position: relative; width: var(--w, 220px);
  padding: clamp(8px, 0.85vw, 14px) clamp(8px, 0.85vw, 14px) 0;
  background-color: var(--polaroid); background-image: var(--paper-tex);
  box-shadow: var(--shadow-doc); transform: rotate(var(--tilt));
  transition: transform var(--dur-2) var(--ease-paper), box-shadow var(--dur-2) var(--ease-paper);
}
.polaroid img, .polaroid .ph { width: 100%; aspect-ratio: 1 / 1.05; object-fit: cover; background: var(--cream); filter: sepia(0.08) saturate(0.95); }
.polaroid figcaption {
  font-family: var(--font-type); font-size: 0.6875rem; color: var(--ink-muted);
  padding: 0.85em 0 1.2em; display: flex; justify-content: space-between; gap: 1em;
}
.polaroid figcaption b { color: var(--ink); font-weight: 400; }
a:hover > .polaroid, .polaroid.is-hoverable:hover, .polaroid.is-lifted {
  transform: rotate(calc(var(--tilt) * -0.6)) translateY(-6px); box-shadow: var(--shadow-lift);
}

/* ======================================================================
   COMPONENT · ProjectSheet / Note — aged, typed, torn, taped
   .sheet        = the placement (rotation, shadow, tape, clip — never clipped)
   .sheet__paper = the paper itself (texture, torn outline, typed content)
   ====================================================================== */
.sheet {
  --tilt: 0deg; position: relative; transform: rotate(var(--tilt)) translate(var(--dx, 0), var(--dy, 0));
  filter: drop-shadow(0 1px 1px rgb(42 18 15 / 0.2)) drop-shadow(0 12px 14px rgb(42 18 15 / 0.16));
  transition: transform var(--dur-3) var(--ease-paper), filter var(--dur-3) var(--ease-paper);
}
.sheet.is-lifted, .sheet:hover { transform: rotate(calc(var(--tilt) * 0.4)) translate(var(--dx, 0), calc(var(--dy, 0px) - 4px)); }
.sheet__paper {
  position: relative; color: var(--ink);
  background-color: var(--sheet); background-image: var(--paper-tex),
    radial-gradient(circle at 12% 88%, rgb(140 100 50 / 0.1), transparent 22%),
    radial-gradient(circle at 92% 14%, rgb(140 100 50 / 0.08), transparent 18%);
  box-shadow: inset 0 0 48px var(--sheet-edge), inset 0 0 6px rgb(132 98 52 / 0.18);
  padding: clamp(1.4rem, 1rem + 1.8vw, 2.5rem) clamp(1.25rem, 0.9rem + 1.8vw, 2.5rem) clamp(1.8rem, 1.2rem + 2vw, 2.9rem);
  font-family: var(--font-type); font-size: clamp(0.84rem, 0.8rem + 0.12vw, 0.92rem); line-height: 1.75;
  text-shadow: 0 0 0.6px rgb(42 18 15 / 0.45); /* ink bleed */
}
/* Spiral-notebook page: perforations + a torn top (the holes show the table beneath) */
.sheet__paper--spiral { padding-top: clamp(2.6rem, 2rem + 1.6vw, 3.4rem); }
.sheet__paper--spiral::before {
  content: ""; position: absolute; left: 6%; right: 6%; top: 1rem; height: 9px;
  background: radial-gradient(circle at 50% 50%, var(--hole, var(--paper)) 0 3.4px, rgb(132 98 52 / 0.35) 3.6px 4.3px, transparent 4.6px) 0 0 / 22px 9px repeat-x;
}
.sheet__head {
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.75rem;
  padding-bottom: 0.8em; margin-bottom: 1em; border-bottom: 1px dashed rgb(42 18 15 / 0.38);
}
.sheet b, .sheet strong { font-weight: 400; text-shadow: 0.35px 0 0 currentColor, -0.2px 0.2px 0 currentColor, 0 0 0.6px rgb(42 18 15 / 0.5); }
.sheet__rows { display: grid; gap: 0.3em; }
.sheet__row { display: grid; grid-template-columns: minmax(7em, auto) 1fr; gap: 1.1em; }
.sheet__row dt { text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); font-size: 0.75rem; padding-top: 0.15em; }
.sheet__row dd { min-width: 0; }
.leader { display: flex; align-items: baseline; gap: 0.5em; }
.leader__dots { flex: 1; border-bottom: 1px dotted rgb(42 18 15 / 0.55); transform: translateY(-0.3em); min-width: 1.5em; }
.leader__value { color: var(--burgundy); white-space: nowrap; text-shadow: 0.35px 0 0 currentColor; }
.sheet__style { margin-top: 1.4em; padding-top: 0.8em; border-top: 1px dashed rgb(42 18 15 / 0.38); }
.sheet__hand { position: absolute; font-size: clamp(0.85rem, 0.75rem + 0.4vw, 1.1rem); transform: rotate(var(--r, -6deg)); white-space: nowrap; }
@media (max-width: 560px) { .sheet__row { grid-template-columns: 1fr; gap: 0; } .sheet__row + .sheet__row { margin-top: 0.4em; } }

/* Stamp — the studio seal, slightly uneven ink */
.stamp {
  position: absolute; width: clamp(90px, 8vw, 124px); aspect-ratio: 1; color: var(--burgundy);
  opacity: 0.78; mix-blend-mode: multiply; transform: rotate(var(--tilt, -12deg)); pointer-events: none;
  /* broken ink: mostly solid, with speckled gaps where the stamp didn't take */
  --ink-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='m'><feTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='2' seed='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3 2.3'/></filter><rect width='100%' height='100%' filter='url(%23m)'/></svg>");
  -webkit-mask: var(--ink-mask) 0 0 / 180px; mask: var(--ink-mask) 0 0 / 180px;
}

/* ======================================================================
   COMPONENT · ProjectFolder (manila folder, slanted tab)
   ====================================================================== */
.folder {
  --body: var(--burgundy); --tab: var(--burgundy); --tab-ink: var(--cream); --tab-x: 6%;
  position: relative; display: block; text-decoration: none; color: inherit; padding-top: 2.1rem;
}
.folder--kraft { --body: var(--kraft); --tab: var(--kraft); --tab-ink: var(--kraft-ink); }
.folder--olive { --body: var(--olive); --tab: var(--olive); --tab-ink: var(--cream); }
.folder__back, .folder__front, .folder__tab { background-color: var(--body); background-image: var(--paper-tex); background-blend-mode: multiply; }
.folder__back { position: relative; aspect-ratio: 4 / 3; border-radius: 0 var(--r-folder) var(--r-folder) var(--r-folder); box-shadow: var(--shadow-doc); }
.folder__tab {
  position: absolute; top: 0; left: var(--tab-x); right: var(--tab-r, auto); height: 2.15rem; padding: 0 1.6rem; max-width: 64%;
  display: flex; align-items: center; gap: 0.6em; color: var(--tab-ink); background-color: var(--tab);
  clip-path: polygon(0 100%, 12px 6%, 16px 0, calc(100% - 16px) 0, calc(100% - 12px) 6%, 100% 100%);
  font-family: var(--font-sans); font-weight: 500; font-size: var(--fs-micro); letter-spacing: var(--track-wide); text-transform: uppercase; white-space: nowrap;
  transition: transform var(--dur-2) var(--ease-drawer);
}
.folder__tab span { overflow: hidden; text-overflow: ellipsis; }
.folder__tab sup { font-family: var(--font-mono); letter-spacing: 0; font-size: 0.95em; opacity: 0.8; }
.folder__paper {
  position: absolute; left: 7%; right: 9%; top: 7%; bottom: 30%;
  background-color: var(--sheet); background-image: var(--paper-tex); box-shadow: inset 0 0 24px var(--sheet-edge), 0 1px 2px rgb(42 18 15 / 0.2);
  transform: rotate(-1.4deg); transition: transform var(--dur-3) var(--ease-paper);
  padding: 0.9rem 1rem; font-family: var(--font-type); font-size: 0.6875rem; line-height: 1.6; color: var(--ink-muted);
}
.folder__paper b { color: var(--ink); font-weight: 400; }
.folder__polaroid { position: absolute; right: 8%; top: 4%; width: 50%; --tilt: 4deg; --w: 100%; transition: transform var(--dur-3) var(--ease-paper); }
.folder__polaroid .clip { left: 18%; top: -26px; }
.folder__front {
  position: absolute; inset: 47% 0 0; border-radius: var(--r-folder);
  box-shadow: 0 -1px 0 rgb(255 255 255 / 0.06) inset, 0 -10px 22px -14px rgb(42 18 15 / 0.55);
  transform-origin: 50% 100%; transition: transform var(--dur-3) var(--ease-paper);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 1rem 1.15rem; color: var(--tab-ink);
}
.folder__front::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 1px; background: rgb(0 0 0 / 0.12); }
.folder__title { font-size: var(--fs-h3); font-weight: 400; line-height: 1.05; }
.folder__meta { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.5rem; font-family: var(--font-mono); font-size: 0.6875rem; opacity: 0.9; }
.folder:hover .folder__tab, .folder:focus-visible .folder__tab, .folder.is-open .folder__tab { transform: translateY(-5px); }
.folder:hover .folder__polaroid, .folder:focus-visible .folder__polaroid, .folder.is-open .folder__polaroid { transform: translateY(-26%) rotate(-3deg); }
.folder:hover .folder__paper, .folder:focus-visible .folder__paper, .folder.is-open .folder__paper { transform: translateY(-9%) rotate(-2.5deg); }
.folder:hover .folder__front, .folder:focus-visible .folder__front, .folder.is-open .folder__front { transform: perspective(900px) rotateX(9deg); }
.folder:focus-visible { outline-offset: 8px; }

/* ======================================================================
   COMPONENT · Pill tags
   ====================================================================== */
.pills { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.pill {
  display: inline-flex; align-items: center; gap: 0.5em; min-height: 2.25rem; padding: 0 1.05rem;
  border: 1px solid currentColor; border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.02em; white-space: nowrap;
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
}
button.pill:hover { background: rgb(42 18 15 / 0.06); }
.pill[aria-pressed="true"] { background: var(--brown); color: var(--cream); border-color: var(--brown); }
.pill--olive { color: var(--olive); }
.pill--brand { background: var(--burgundy); color: var(--cream); border-color: var(--burgundy); }
.pill sup { font-size: 0.85em; opacity: 0.7; }
@media (max-width: 760px) { .pill { min-height: 44px; } .index__brand sup, .logos__name { font-size: 0.6875rem; } }

/* ======================================================================
   COMPONENT · IndexList (Work / Archive) — tighter rows in v2
   ====================================================================== */
.index { border-top: 1px solid var(--line); }
.index__row { border-bottom: 1px solid var(--line); }
.index__link {
  display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; align-items: baseline; gap: var(--s-4);
  padding: clamp(0.65rem, 0.45rem + 0.6vw, 1rem) 0; text-decoration: none; position: relative;
}
.index__num { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-muted); }
.index__brand {
  font-size: clamp(1.75rem, 1.25rem + 1.8vw, 3.1rem); font-weight: 300; line-height: 1; letter-spacing: var(--track-tight);
  transition: transform var(--dur-2) var(--ease-paper), color var(--dur-1);
}
.index__row:nth-child(even) .index__brand { font-style: italic; }
.index__brand sup { font-family: var(--font-mono); font-style: normal; font-size: 0.75rem; letter-spacing: 0; vertical-align: 1.9em; margin-left: 0.5em; color: var(--ink-muted); white-space: nowrap; }
.index__title { display: block; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-muted); margin-top: 0.4rem; letter-spacing: 0.02em; }
.index__cat { justify-self: end; }
a.index__link:hover .index__brand, a.index__link:focus-visible .index__brand { transform: translateX(0.6rem); color: var(--burgundy); }
.index__row.is-hidden { display: none; }
.index-preview {
  position: fixed; left: 0; top: 0; z-index: 60; width: clamp(200px, 17vw, 300px); pointer-events: none; opacity: 0;
  transform: translate(-50%, -50%) scale(0.92) rotate(-3deg); transition: opacity var(--dur-2) var(--ease-paper);
}
.index-preview.is-on { opacity: 1; }
.index-preview .polaroid { --w: 100%; --tilt: 0deg; }
@media (hover: none), (pointer: coarse) { .index-preview { display: none; } }

/* ======================================================================
   COMPONENT · TabDivider — v2: one row of file tabs over a single card
   (tabs pattern: arrow keys move between tabs; wraps on mobile)
   ====================================================================== */
.dividers { --card: var(--kraft); }
.dividers__tabs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 2px; padding-left: 4px; }
.dividers__tab {
  position: relative; min-height: 48px; padding: 0.55rem 1.5rem 0.5rem; display: flex; align-items: center; gap: 0.7rem;
  background-color: #8f7552; color: var(--cream); background-image: var(--paper-tex); background-blend-mode: multiply;
  clip-path: polygon(0 100%, 12px 8%, 17px 0, calc(100% - 17px) 0, calc(100% - 12px) 8%, 100% 100%);
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.03em; text-align: left;
  transform: translateY(6px); transition: transform var(--dur-2) var(--ease-drawer), background-color var(--dur-1);
}
.dividers__tab:hover { transform: translateY(1px); }
.dividers__tab[aria-selected="true"] { background-color: var(--card); color: var(--kraft-ink); transform: none; z-index: 2; }
.dividers__tab .n { opacity: 0.75; }
.dividers__card {
  position: relative; z-index: 1; background-color: var(--card); background-image: var(--paper-tex); background-blend-mode: multiply; color: var(--brown);
  border-radius: 0 var(--r-folder) var(--r-folder) var(--r-folder); box-shadow: 0 -10px 24px -16px rgb(0 0 0 / 0.6), var(--shadow-doc);
  padding: clamp(1.4rem, 1rem + 2vw, 3rem);
}
.dividers__panel { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: center; }
.dividers__panel[hidden] { display: none; }
.dividers__panel h3 { font-size: var(--fs-h2); font-weight: 300; line-height: 1.02; margin-bottom: var(--s-4); }
.dividers__panel p { max-width: 32rem; font-size: var(--fs-lead); line-height: 1.4; }
.dividers__panel .code { font-family: var(--font-mono); font-size: 0.75rem; color: var(--kraft-ink); margin-bottom: var(--s-3); }
.dividers__panel .polaroid { --w: min(100%, 260px); justify-self: center; --tilt: 2.5deg; }
@media (max-width: 760px) {
  .dividers__tabs { gap: 4px 2px; }
  .dividers__tab { flex: 1 1 30%; justify-content: center; padding: 0.5rem 0.9rem; transform: none; clip-path: polygon(0 100%, 8px 6%, 12px 0, calc(100% - 12px) 0, calc(100% - 8px) 6%, 100% 100%); }
  .dividers__tab .n { display: none; } /* on a phone the name says more than the number */
  .dividers__panel { grid-template-columns: 1fr; }
  .dividers__panel .polaroid { --w: 62%; justify-self: start; }
}

/* ======================================================================
   COMPONENT · BeforeAfter — pointer + touch drag, keyboard via range
   ====================================================================== */
.ba { position: relative; overflow: hidden; background: var(--brown); user-select: none; -webkit-user-select: none; touch-action: pan-y; cursor: ew-resize; }
.ba img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ba__after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos, 50%)); }
.ba__line { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 1px; background: var(--cream); transform: translateX(-0.5px); pointer-events: none; }
.ba__knob {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; border-radius: 50%;
  background: var(--cream); color: var(--burgundy); display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.875rem; box-shadow: var(--shadow-doc);
}
.ba__range { position: absolute; inset: auto 0 0; width: 100%; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
.ba__range:focus-visible + .ba__line .ba__knob { outline: 2px solid var(--cream); outline-offset: 4px; }
.ba__label {
  position: absolute; bottom: var(--s-4); padding: 0.35rem 0.8rem; border-radius: var(--r-pill); background: rgb(42 18 15 / 0.72); color: var(--cream);
  pointer-events: none; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.04em;
}
.ba__label--before { left: var(--s-4); }
.ba__label--after { right: var(--s-4); }
.ba__label .script { font-size: 1.6em; color: var(--kraft); vertical-align: -0.15em; }

/* ======================================================================
   COMPONENT · LogoWall — v2: logos link to their project(s)
   ====================================================================== */
.logos { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.logos > li { min-width: 0; }
.logos__cell {
  position: relative; display: grid; place-items: center; aspect-ratio: 3 / 2; text-decoration: none;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden;
  transition: background var(--dur-2) var(--ease-paper);
}
.logos__mark {
  width: var(--lw, 58%); aspect-ratio: var(--ar, 3); background: var(--brown);
  -webkit-mask: var(--src) center / contain no-repeat; mask: var(--src) center / contain no-repeat;
  transition: background var(--dur-2) var(--ease-paper), transform var(--dur-2) var(--ease-paper);
}
.logos__name {
  position: absolute; bottom: 0.6rem; left: 0; right: 0; text-align: center; color: var(--burgundy);
  font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.06em; text-transform: uppercase;
  opacity: 0; transform: translateY(6px); transition: opacity var(--dur-2), transform var(--dur-2) var(--ease-paper);
}
/* Linked logos carry a small ↗ at all times (visible on touch too) */
a.logos__cell::after {
  content: "↗"; position: absolute; top: 0.55rem; right: 0.7rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-muted);
  transition: transform var(--dur-2) var(--ease-paper), color var(--dur-1);
}
a.logos__cell:hover, a.logos__cell:focus-visible { background: var(--cream); }
a.logos__cell:hover::after, a.logos__cell:focus-visible::after { color: var(--burgundy); transform: translate(2px, -2px); }
a.logos__cell:hover .logos__mark, a.logos__cell:focus-visible .logos__mark { background: var(--burgundy); transform: scale(1.05) translateY(-4px); }
a.logos__cell:hover .logos__name, a.logos__cell:focus-visible .logos__name { opacity: 1; transform: none; }
a.logos__cell:focus-visible { outline-offset: -4px; }
.logos__more { font-size: var(--fs-h3); font-style: italic; font-weight: 300; color: var(--burgundy); }
.logos__note { margin-top: var(--s-3); font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-muted); }
@media (min-width: 901px) { .logos__cell--more { grid-column: span 2; aspect-ratio: auto; } }
@media (max-width: 900px) {
  .logos { grid-template-columns: repeat(3, 1fr); }
  .logos__cell--more { grid-column: span 3; aspect-ratio: auto; padding: 1.2rem 0; }
}

/* ======================================================================
   Custom cursor — a small burgundy dot that becomes "Open" over projects
   ====================================================================== */
.cursor {
  position: fixed; left: 0; top: 0; z-index: var(--z-cursor); pointer-events: none;
  width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--burgundy); color: var(--cream);
  display: grid; place-items: center; opacity: 0;
  transition: width var(--dur-2) var(--ease-paper), height var(--dur-2) var(--ease-paper), margin var(--dur-2) var(--ease-paper), opacity var(--dur-1);
}
.cursor span { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.06em; opacity: 0; transition: opacity var(--dur-1); }
.cursor.is-visible { opacity: 1; }
.cursor.is-open { width: 76px; height: 76px; margin: -38px 0 0 -38px; }
.cursor.is-open span { opacity: 1; }
.cursor.on-dark-bg { background: var(--cream); color: var(--burgundy); }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ======================================================================
   Page transition — the folder closes, the next one opens
   ====================================================================== */
.turn { position: fixed; inset: 0; z-index: 150; pointer-events: none; transform: translateY(101%); visibility: hidden; }
.turn__folder { position: absolute; inset: 3.2rem 0 0; background-color: var(--burgundy); background-image: var(--paper-tex); background-blend-mode: multiply; }
.turn__tab {
  position: absolute; top: 0; left: var(--gutter); height: 3.2rem; padding: 0 2rem; display: flex; align-items: center; gap: 1rem;
  background: var(--burgundy); color: var(--cream); clip-path: polygon(0 100%, 14px 6%, 19px 0, calc(100% - 19px) 0, calc(100% - 14px) 6%, 100% 100%);
  font-family: var(--font-sans); font-size: var(--fs-micro); letter-spacing: var(--track-caps); text-transform: uppercase;
}
.turn__emboss {
  position: absolute; inset: 3.2rem 0 0; display: grid; place-items: center; font-family: var(--font-arabic);
  font-size: clamp(8rem, 30vw, 24rem); color: var(--burgundy); text-shadow: -1px -1px 0 rgb(255 255 255 / 0.07), 2px 3px 4px rgb(0 0 0 / 0.35);
}

/* ---------- Reveal helpers (JS adds masks; without JS everything is visible) */
.line-mask { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.line-mask > span { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
