/* ============================================================
   SCRATCH.SG — design system
   Paper #F2EFE9 · Ink #1A1815 · Lime #89F336
   Fraunces (editorial serif) + Space Grotesk (labels/UI)
   ============================================================ */

:root {
  --paper: #f2efe9;
  --paper-deep: #e9e4da;
  --ink: #1a1815;
  --ink-soft: #4a463f;
  --accent: #89f336;        /* lime */
  --accent-text: #3f6212;   /* AA on paper at small sizes */
  --accent-bright: #89f336; /* AA on ink at small sizes */
  --line: rgba(26, 24, 21, 0.14);
  --serif: "Fraunces", "Georgia", serif;
  --grot: "Space Grotesk", "Helvetica Neue", sans-serif;
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --head-h: 4.5rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--grot);
  font-weight: 350;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
body[data-loading] { overflow: hidden; }

/* faint blueprint grid over the whole paper */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 25vh,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 25vw 100%;
  opacity: 0.18;
  z-index: 0;
}

main { position: relative; z-index: 1; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
em { font-family: var(--serif); font-style: italic; }
::selection { background: var(--accent); color: var(--paper); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.menu :focus-visible, .footer :focus-visible, .lightbox :focus-visible { outline-color: var(--accent-bright); }
section[id] { scroll-margin-top: var(--head-h); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
body.menu-open, body.lb-open { overflow: hidden; }
.lenis.lenis-stopped { overflow: hidden; }

/* ============ PRELOADER ============ */
.preloader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: var(--gutter);
}
.preloader__row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 1rem;
}
.preloader__word {
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 4.5rem);
  font-weight: 400; letter-spacing: 0.04em;
}
.preloader__count {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(2rem, 6vw, 4.5rem);
  color: var(--accent);
}
.preloader__bar { height: 1px; background: rgba(242, 239, 233, 0.2); }
.preloader__bar span { display: block; height: 100%; width: 0; background: var(--accent); }

/* ============ CURSOR ============ */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 99; pointer-events: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  transform: translate(-50%, -50%);
  transition: width 0.25s ease, height 0.25s ease, background-color 0.25s ease;
}
.cursor span {
  font-family: var(--grot); font-size: 0.65rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper);
  opacity: 0; transition: opacity 0.2s;
  white-space: nowrap;
}
.cursor.is-label { width: 64px; height: 64px; background: var(--ink); }
.cursor.is-label span { opacity: 1; }
.cursor.is-dot { width: 40px; height: 40px; background: rgba(137, 243, 54, 0.28); }
.cursor.is-down { width: 7px; height: 7px; }
.cursor.is-label.is-down { width: 56px; height: 56px; }
@media (hover: none) { .cursor { display: none; } }

/* ============ HEADER ============ */
.site-head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--head-h);
  display: flex; align-items: center; gap: 2.5rem;
  padding: 0 var(--gutter);
  mix-blend-mode: normal;
  transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1), background-color 0.3s;
}
.site-head.is-scrolled { background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(12px); }
.site-head.is-hidden { transform: translateY(-100%); }
/* themed when floating over ink sections */
.site-head--on-dark { color: var(--paper); }
.site-head--on-dark.is-scrolled { background: color-mix(in srgb, var(--ink) 85%, transparent); }
.site-head--on-dark .site-head__nav a::after { background: var(--paper); }
.site-head--on-dark .site-head__cta { border-color: var(--paper); }
.site-head--on-dark .site-head__cta:hover { background: var(--paper); color: var(--ink); }
.site-head--on-dark .burger span { background: var(--paper); }
.site-head__logo {
  font-family: var(--serif); font-weight: 600; font-size: 1.15rem; letter-spacing: 0.06em;
  transition: color 0.35s;
}
body.menu-open .site-head__logo { color: var(--paper); }
.site-head__nav { display: flex; gap: 1.75rem; margin-left: auto; }
.site-head__nav a, .site-head__cta {
  font-size: 0.78rem; font-weight: 450; letter-spacing: 0.14em; text-transform: uppercase;
  position: relative; padding: 0.25rem 0;
}
.site-head__nav a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: var(--ink); transform: scaleX(0); transform-origin: right;
  transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1);
}
.site-head__nav a:hover::after { transform: scaleX(1); transform-origin: left; }
.site-head__cta {
  border: 1px solid var(--ink); border-radius: 999px;
  padding: 0.55rem 1.1rem;
  transition: background-color 0.3s, color 0.3s;
}
.site-head__cta:hover { background: var(--ink); color: var(--paper); }
.burger { display: none; }

/* ============ MOBILE MENU ============ */
.menu {
  position: fixed; inset: 0; z-index: 49;
  background: var(--ink); color: var(--paper);
  display: flex; flex-direction: column; justify-content: center; gap: 3rem;
  padding: var(--gutter);
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
}
.menu__links { display: flex; flex-direction: column; gap: 0.5rem; }
.menu__links a {
  font-family: var(--serif); font-size: clamp(2.5rem, 10vw, 4rem); font-weight: 400;
  display: flex; align-items: baseline; gap: 1rem;
  border-bottom: 1px solid rgba(242, 239, 233, 0.15);
  padding: 0.75rem 0;
}
.menu__links a em { font-size: 0.85rem; color: var(--accent-bright); font-style: normal; font-family: var(--grot); }
.menu__foot { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.menu__cta { font-family: var(--grot); letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.8rem; color: var(--accent-bright); }

/* ============ HERO ============ */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--head-h) + 2rem) var(--gutter) 2rem;
  overflow: clip;
}
.hero__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0;
}
.hero__meta {
  display: flex; gap: 2rem; flex-wrap: wrap;
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 450;
  color: var(--ink-soft);
  margin-bottom: clamp(1.5rem, 4vh, 3rem);
  position: relative; z-index: 1;
}
.hero__meta span::before { content: "◯ "; color: var(--accent); font-size: 0.6em; vertical-align: 2px; }
.hero__title {
  position: relative; z-index: 1;
  font-family: var(--serif); font-weight: 380;
  font-size: clamp(3.4rem, 13vw, 11.5rem);
  line-height: 0.92; letter-spacing: -0.015em;
  text-transform: uppercase;
  display: flex; flex-direction: column;
  margin-left: -0.035em; /* optical left alignment of the S against the gutter rail */
}
.hero__line { display: block; overflow: hidden; }
.hero__word { display: inline-block; will-change: transform; }
.hero__line--mid { align-self: flex-start; margin-left: clamp(2rem, 18vw, 18rem); }
.hero__word--italic {
  font-style: italic; font-weight: 320; text-transform: lowercase;
  font-size: 0.62em; line-height: 1; color: var(--accent);
}
.hero__dot { color: var(--accent); font-style: normal; }
.hero__sub {
  position: relative; z-index: 1;
  margin-top: clamp(1.5rem, 4vh, 2.75rem);
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  color: var(--ink-soft); max-width: 34rem;
}
.hero__foot {
  position: relative; z-index: 1;
  margin-top: auto; padding-top: 2rem;
  display: flex; justify-content: space-between; align-items: flex-end;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft);
}
.hero__scrollhint { display: inline-flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.hero__scrollline { width: 1px; height: 3.2rem; background: var(--ink); display: block; transform-origin: top; animation: scrollPulse 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
@keyframes scrollPulse { 0% { transform: scaleY(0); } 45% { transform: scaleY(1); transform-origin: top; } 55% { transform: scaleY(1); transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ============ MARQUEE ============ */
.marquee {
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  overflow: clip; padding: 0.7rem 0;
  background: var(--paper);
  position: relative; z-index: 1;
}
.marquee__track { display: flex; gap: 2rem; width: max-content; align-items: center; }
.marquee__track span {
  font-family: var(--grot); font-size: clamp(0.78rem, 1.1vw, 0.95rem);
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.24em;
}
.marquee__track i { color: var(--accent); font-style: normal; font-size: 0.5rem; }

/* ============ SECTION LABEL ============ */
.sec-label {
  display: inline-block;
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: clamp(1.5rem, 3vh, 2.5rem);
}
.sec-label--center { display: block; text-align: center; }

/* ============ MANIFESTO ============ */
.manifesto { padding: clamp(6rem, 14vh, 11rem) var(--gutter); max-width: 78rem; }
.manifesto__text {
  font-family: var(--serif); font-weight: 350;
  font-size: clamp(1.7rem, 3.6vw, 3.3rem);
  line-height: 1.22; letter-spacing: -0.01em;
}
.manifesto__text .mline { display: block; overflow: hidden; }
.manifesto__text .mline > span { display: block; }
.manifesto__text .mword, .manifesto__text em { display: inline-block; }
.manifesto__text em { color: var(--accent); }
.manifesto__tags { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 3rem; }
.manifesto__tags span {
  font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.5rem 1rem;
  color: var(--ink-soft);
}

/* ============ WORKS (featured) ============ */
.works { padding: clamp(4rem, 10vh, 8rem) var(--gutter); }
.works__head { margin-bottom: clamp(2rem, 5vh, 3.5rem); }

.work {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  align-items: end;
  padding: clamp(2.5rem, 6vh, 4.5rem) 0;
  border-top: 1px solid var(--line);
  position: relative;
}
.work__media {
  grid-column: 1 / 8;
  overflow: clip; border-radius: 2px;
  aspect-ratio: 16 / 11;
  position: relative;
}
.work:nth-child(even) .work__media { grid-column: 6 / 13; order: 2; }
.work:nth-child(even) .work__info { grid-column: 1 / 6; order: 1; }
.work__media img {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 118%; object-fit: cover;
  will-change: transform;
}
.work__info { grid-column: 8 / 13; padding-bottom: 0.5rem; }
.work__cat {
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 500;
  color: var(--accent-text); display: block; margin-bottom: 0.5rem;
}
.work__name {
  font-family: var(--serif); font-weight: 420;
  font-size: clamp(1.6rem, 3vw, 2.6rem); line-height: 1.05;
  margin-bottom: 0.75rem;
}
.work__blurb { color: var(--ink-soft); font-size: 0.95rem; max-width: 26rem; text-wrap: pretty; }
.work:focus-visible, .tile:focus-visible { outline-offset: 6px; }

/* ============ SPLIT ============ */
.split { padding: clamp(5rem, 12vh, 9rem) var(--gutter); }
.split__panels {
  display: flex; gap: 1rem; height: clamp(420px, 70vh, 640px);
}
.split__panel {
  position: relative; flex: 1; overflow: clip; border-radius: 4px;
  display: flex; align-items: flex-end;
  color: var(--paper);
  transition: flex 0.7s cubic-bezier(0.65, 0, 0.35, 1);
}
.split__panel:hover { flex: 2.2; }
.split__bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  transition: transform 0.8s cubic-bezier(0.33, 1, 0.68, 1);
  transform: scale(1.06);
}
.split__panel:hover .split__bg { transform: scale(1); }
.split__panel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(20, 18, 15, 0.78) 0%, rgba(20, 18, 15, 0.12) 55%, transparent 100%);
}
.split__content { position: relative; z-index: 1; padding: clamp(1.5rem, 3vw, 2.5rem); }
.split__content h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.8rem, 3.4vw, 3rem); line-height: 1;
  margin-bottom: 0.6rem;
}
.split__content p { font-size: 0.92rem; opacity: 0.85; max-width: 24rem; margin-bottom: 1rem; }
.split__count {
  font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 500;
  color: var(--paper);
  border: 1px solid rgba(242, 239, 233, 0.4); border-radius: 999px;
  padding: 0.45rem 0.9rem; display: inline-block;
}

/* ============ ARCHIVE / INDEX ============ */
.archive { padding: clamp(4rem, 10vh, 8rem) var(--gutter); }
.archive__head { margin-bottom: clamp(2.5rem, 6vh, 4rem); }
.archive__filters { display: flex; gap: 0.6rem; margin-top: 2rem; flex-wrap: wrap; }
.chip {
  font-size: 0.76rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.85rem 1.3rem; min-height: 44px;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.chip sup { color: var(--accent-text); margin-left: 0.3rem; }
.chip:hover { border-color: var(--ink); }
.chip.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.is-active sup { color: var(--accent); }

.archive__grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.tile { position: relative; cursor: pointer; }
.tile__media { overflow: clip; border-radius: 2px; aspect-ratio: 4 / 3; background: var(--paper-deep); }
.tile__media img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.01);
  transition: transform 0.8s cubic-bezier(0.33, 1, 0.68, 1), filter 0.4s;
}
.tile:hover .tile__media img { transform: scale(1.06); }
.tile__row {
  display: flex; align-items: baseline; gap: 0.75rem;
  padding: 0.8rem 0.1rem 0;
}
.tile__num {
  font-family: var(--serif); font-style: italic;
  color: var(--accent-text); font-size: 0.95rem;
}
.tile__name { font-family: var(--serif); font-size: 1.15rem; font-weight: 420; }
.tile__cat { margin-left: auto; font-size: 0.7rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.tile.is-hidden { display: none; }

/* ============ CLIENTS ============ */
.clients { padding: clamp(5rem, 12vh, 8rem) 0 clamp(4rem, 8vh, 6rem); overflow: clip; }
.clients__marquee { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1.6rem 0; }
.clients__track { display: flex; gap: 3rem; width: max-content; align-items: center; }
.clients__track span {
  font-family: var(--serif); font-style: italic; font-weight: 350;
  font-size: clamp(1rem, 1.6vw, 1.35rem); white-space: nowrap;
  color: var(--ink-soft);
}

/* ============ CONTACT ============ */
.contact { padding: clamp(6rem, 16vh, 12rem) var(--gutter); text-align: left; position: relative; overflow: clip; }
.contact__ghost {
  position: absolute; right: -0.05em; top: 50%; transform: translateY(-58%);
  font-family: var(--serif); font-style: italic; font-weight: 320;
  font-size: clamp(8rem, 26vw, 24rem); line-height: 1;
  color: transparent; -webkit-text-stroke: 1px var(--line);
  pointer-events: none; user-select: none;
}
.contact__big { display: block; position: relative; }
.contact__line {
  display: block; overflow: hidden;
  font-family: var(--serif); font-weight: 380; text-transform: uppercase;
  font-size: clamp(3rem, 12vw, 11rem); line-height: 0.92; letter-spacing: -0.015em;
  margin-left: -0.035em;
}
.contact__line > span { display: inline-block; will-change: transform; }
.contact__line--two em {
  font-style: italic; color: var(--accent);
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.contact__big:hover .contact__line--two em { transform: translateX(0.18em) rotate(-45deg); }
.contact__note { margin-top: 2.5rem; color: var(--ink-soft); font-size: 1rem; text-wrap: pretty; position: relative; }

/* ============ FOOTER ============ */
.footer { background: var(--ink); color: var(--paper); padding: clamp(3rem, 7vh, 5rem) var(--gutter) 1.5rem; position: relative; z-index: 1; }
.footer__top { display: flex; gap: clamp(2rem, 8vw, 8rem); flex-wrap: wrap; margin-bottom: 4rem; }
.footer__logo { font-family: var(--serif); font-weight: 600; font-size: 1.6rem; letter-spacing: 0.05em; margin-right: auto; }
.footer__col { display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.9rem; }
.footer__col a { opacity: 0.9; transition: opacity 0.25s, color 0.25s; }
.footer__col a:hover { opacity: 1; color: var(--accent-bright); }
.footer__col span { opacity: 0.55; }
.footer__head { font-size: 0.74rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-bright); margin-bottom: 0.4rem; opacity: 1; }
.footer__bottom {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid rgba(242, 239, 233, 0.15);
  padding-top: 1.25rem;
  font-size: 0.72rem; letter-spacing: 0.08em; color: rgba(242, 239, 233, 0.75);
}

/* ============ LIGHTBOX ============ */
.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20, 18, 15, 0.985);
  backdrop-filter: blur(10px);
  color: var(--paper);
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s, visibility 0.35s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__close {
  position: absolute; top: 1rem; right: var(--gutter); z-index: 2;
  font-size: 1.2rem; padding: 0.75rem; min-width: 44px; min-height: 44px;
}
.lightbox__stage { flex: 1; display: flex; align-items: center; gap: 1rem; padding: 3.5rem var(--gutter) 0; min-height: 0; max-width: 1320px; width: 100%; margin-inline: auto; }
.lightbox__figure { flex: 1; height: 100%; display: flex; align-items: center; justify-content: center; min-width: 0; }
.lightbox__figure img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 2px; }
.lightbox__nav { font-size: 1.6rem; padding: 1rem 1.1rem; min-width: 56px; min-height: 56px; opacity: 0.9; transition: opacity 0.25s, color 0.25s; flex: 0 0 auto; }
.lightbox__nav:hover { opacity: 1; color: var(--accent-bright); }
.lightbox__meta {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem var(--gutter) 1.5rem;
  font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.lightbox__meta #lbTitle { font-family: var(--serif); font-style: italic; text-transform: none; letter-spacing: 0; font-size: 1.05rem; }

/* ============ REVEAL DEFAULTS (no-JS safe) ============ */
[data-reveal] { opacity: 1; }
.js [data-reveal] { opacity: 0; transform: translateY(28px); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .archive__grid { grid-template-columns: repeat(2, 1fr); }
  .work__media { grid-column: 1 / 13 !important; order: 1 !important; }
  .work__info { grid-column: 1 / 13 !important; order: 2 !important; }
}

@media (max-width: 768px) {
  :root { --head-h: 3.75rem; }
  .site-head__nav, .site-head__cta { display: none; }
  .burger {
    display: flex; flex-direction: column; gap: 6px; margin-left: auto;
    justify-content: center; align-items: center;
    min-width: 44px; min-height: 44px;
    padding: 0.6rem; z-index: 51; position: relative;
  }
  .burger span { width: 26px; height: 1.5px; background: var(--ink); transition: transform 0.35s, opacity 0.35s, background-color 0.35s; }
  .burger.is-open span:nth-child(1) { transform: translateY(3.75px) rotate(45deg); background: var(--paper); }
  .burger.is-open span:nth-child(2) { transform: translateY(-3.75px) rotate(-45deg); background: var(--paper); }

  .hero__title { font-size: clamp(3.4rem, 17vw, 12.5rem); }
  .hero__line--mid { margin-left: 10vw; }

  .split__panels { flex-direction: column; height: auto; }
  .split__panel { min-height: 320px; }
  .split__panel:hover { flex: 1; }

  .archive__grid { grid-template-columns: 1fr; gap: 2rem; }

  .contact__note br { display: none; }
  .lightbox__nav { position: absolute; bottom: 4.5rem; z-index: 2; }
  .lightbox__nav--prev { left: var(--gutter); }
  .lightbox__nav--next { right: var(--gutter); }
  .lightbox__stage { padding: 3.5rem 1rem 0; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
