/* ---------- Themes (light is the default; set on <html data-theme>) ---------- */
:root, [data-theme="dark"] {
  --bg: #0f0e0d;
  --raise: #1a1917;
  --ink: #efeae2;
  --muted: #8b857c;
  --soft: #c4beb4;
  --line: #2a2825;
  --blob-a: #5a3a12;
  --blob-b: #123238;
  --glow: rgba(255, 214, 150, .10);
  --grain: .08;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f3eee7;
  --raise: #e8e1d7;
  --ink: #161514;
  --muted: #77716a;
  --soft: #3d3a36;
  --line: #d9d1c6;
  --blob-a: #f2cf9c;
  --blob-b: #c9dcd8;
  --glow: rgba(255, 255, 255, .55);
  --grain: .05;
  color-scheme: light;
}
:root {
  --sans: "Manrope", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --pad: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --header: 96px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
  transition: background-color .5s var(--ease), color .5s var(--ease);
  overflow-x: clip;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0; }
main { position: relative; z-index: 1; }

/* ---------- Background ---------- */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg__blob {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(90px); opacity: .55; transition: background-color .6s;
}
.bg__blob--a { background: var(--blob-a); top: -25vmax; left: -15vmax; }
.bg__blob--b { background: var(--blob-b); bottom: -30vmax; right: -20vmax; }
.bg__glow {
  position: absolute; width: 520px; height: 520px; left: -260px; top: -260px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 65%);
}
.bg__grain {
  position: absolute; inset: -50%; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-4%, 3%); } 40% { transform: translate(3%, -5%); }
  60% { transform: translate(-6%, -2%); } 80% { transform: translate(5%, 4%); } 100% { transform: translate(0, 0); }
}
.progress {
  position: fixed; left: 0; top: 0; z-index: 40; height: 2px; width: 100%;
  background: var(--ink); transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- Header ---------- */
.top {
  position: fixed; inset: 0 0 auto; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px var(--pad);
  border-bottom: 1px solid transparent;
  transition: transform .5s var(--ease), background-color .4s, border-color .4s, padding .4s var(--ease);
}
.top.is-scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
  padding-top: 10px; padding-bottom: 10px;
}
.top.is-hidden { transform: translateY(-101%); }
.top__logo { display: block; color: var(--ink); }
.top .logo { display: block; height: 64px; width: auto; transition: height .4s var(--ease); }
.top.is-scrolled .logo { height: 50px; }
/* The "Creative" script is a hairline; a thin stroke keeps it readable at header size. */
.logo path:nth-child(-n+8) { stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.top nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 40px); font-size: 14px; }
.top nav a { opacity: .75; transition: opacity .2s; }
.top nav a:hover { opacity: 1; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px;
  font-size: 13px; transition: border-color .3s;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle__dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(90deg, var(--ink) 50%, transparent 50%);
  border: 1px solid var(--ink);
  transition: transform .5s var(--ease);
}
[data-theme="light"] .theme-toggle__dot { transform: rotate(180deg); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: clamp(32px, 5vw, 80px); align-items: center;
  padding: calc(var(--header) + 24px) var(--pad) 56px;
}
.hero__title {
  margin: 22px 0 40px;
  font-size: clamp(38px, 5.4vw, 84px); line-height: 1.04;
  font-weight: 300; letter-spacing: -.04em;
}
/* Masks for the slide-up text reveal. Extra bottom padding (cancelled by negative margin)
   keeps descenders like g, y, p fully visible without changing line spacing. */
.hero__title .line { display: block; overflow: hidden; padding-bottom: .22em; margin-bottom: -.22em; }
.hero__title .line > .in { display: inline-block; }
.hero__title .dim { color: var(--muted); }
.hero__cta {
  display: inline-flex; gap: 10px; align-items: center;
  padding: 14px 22px; border: 1px solid var(--line); border-radius: 99px; font-size: 15px;
  transition: border-color .3s, background-color .3s, color .3s;
}
.hero__cta:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.hero__feature { margin: 0; }
.hero__stack { position: relative; aspect-ratio: 1; background: var(--raise); overflow: hidden; cursor: pointer; }
.hero__stack img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.hero__stack img:first-child { opacity: 1; }
.hero__feature figcaption { display: flex; justify-content: space-between; padding-top: 12px; }

/* ---------- Client marquee ---------- */
.marquee {
  overflow: hidden; padding: 28px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.marquee__track { display: flex; width: max-content; }
.marquee__track span {
  flex: none; padding-right: 48px;
  font-size: clamp(28px, 4.4vw, 64px); font-weight: 300; letter-spacing: -.03em; line-height: 1.1;
  white-space: nowrap;
}
.marquee__track span:nth-child(even) { color: transparent; -webkit-text-stroke: 1px var(--muted); }
.marquee__track i { font-style: normal; color: var(--muted); padding-right: 48px; font-size: .6em; vertical-align: .3em; }

/* ---------- Work ---------- */
.work { padding: 40px 0 80px; }
.shelf__head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 20px;
  padding: 18px var(--pad); border-top: 1px solid var(--line);
}
.shelf__head h2 {
  margin: 0; font-size: clamp(26px, 3vw, 44px); font-weight: 300; letter-spacing: -.03em; line-height: 1.1;
  overflow: hidden; padding-bottom: .22em; margin-bottom: -.22em;
}
.shelf__head h2 span { display: inline-block; }
.shelf__count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.shelf__bar { grid-column: 1 / -1; height: 1px; background: var(--line); position: relative; display: none; }
.shelf__bar i { position: absolute; inset: 0; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); }

.shelf__track { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 12px; padding: 8px var(--pad) 48px; }
.piece { display: block; width: 100%; text-align: left; }
.piece__img { overflow: hidden; background: var(--raise); }
.piece img { width: 100%; height: auto; transition: filter .5s var(--ease); }
.piece__cap { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; font-size: 14px; line-height: 1.35; }
.piece__cap i { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* Desktop: each shelf pins and the page's vertical scroll moves it sideways */
@media (min-width: 861px) {
  .shelf { height: 100vh; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
  .shelf__head { padding-top: calc(var(--header) - 10px); border-top: 0; }
  .shelf__bar { display: block; }
  .shelf__track {
    display: flex; gap: clamp(14px, 1.6vw, 24px); width: max-content;
    padding: 24px var(--pad) 0; will-change: transform;
  }
  .piece { width: auto; flex: none; }
  .piece img { height: min(56vh, 540px); width: auto; }
  .piece__cap { flex-direction: row; justify-content: space-between; gap: 16px; }
  .shelf__track:hover .piece img { filter: brightness(.6) saturate(.7); }
  .shelf__track .piece:hover img, .shelf__track .piece:focus-visible img { filter: none; }
  .shelf__end {
    flex: none; align-self: center; width: 22vw; padding-left: 4vw;
    font-size: 14px; color: var(--muted);
  }
}
.shelf__end { display: none; }
@media (min-width: 861px) { .shelf__end { display: block; } }

/* ---------- About ---------- */
.about {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 100px);
  padding: 120px var(--pad); border-top: 1px solid var(--line);
}
.about__photo { margin: 0; align-self: start; position: sticky; top: 110px; }
.about__frame { overflow: hidden; aspect-ratio: 4 / 5; }
.about__frame img { width: 100%; height: 120%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.about h2 { margin: 18px 0 24px; font-size: clamp(28px, 3.2vw, 46px); line-height: 1.12; font-weight: 300; letter-spacing: -.03em; }
.reveal-words .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .22em; margin-bottom: -.22em; }
.reveal-words .w > span { display: inline-block; }
.about__body > p:not(.mono) { color: var(--soft); max-width: 58ch; margin: 0 0 16px; }
.about__cols { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.about__cols ul { margin-top: 12px; font-size: 15px; }
.clients { columns: 2; column-gap: 24px; }

/* ---------- Contact ---------- */
.contact { padding: 140px var(--pad) 40px; border-top: 1px solid var(--line); }
.contact__mail {
  display: block; margin: 20px 0 90px;
  font-size: clamp(28px, 7.2vw, 116px); line-height: 1.05; font-weight: 300; letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.contact__mail .ch { display: inline-block; transition: color .3s; }
.contact__mail:hover .ch { color: var(--muted); }
.contact__mail .ch:hover { color: var(--ink); }
.contact__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 40px; font-size: 14px; color: var(--muted); }
.contact__row a { color: var(--ink); display: inline-block; }
.contact__row span:last-child { margin-left: auto; }

/* ---------- Custom cursor (mouse only) ---------- */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none;
  width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center; font-size: 13px; font-weight: 500;
  transform: scale(0); opacity: 0;
}
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ---------- Viewer ---------- */
.viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--ink);
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.viewer[open] { display: grid; }
.viewer::backdrop { background: var(--bg); }
.viewer__bar { display: flex; justify-content: space-between; padding: 22px var(--pad); }
.viewer__close { font: inherit; letter-spacing: inherit; color: var(--ink); }
.viewer__stage { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; min-height: 0; padding: 0 calc(var(--pad) - 16px); }
.viewer__stage img { max-width: 100%; height: 100%; margin: 0 auto; object-fit: contain; min-height: 0; }
.viewer__nav { height: 64px; font-size: 22px; color: var(--muted); transition: color .2s; }
.viewer__nav:hover { color: var(--ink); }
.viewer__info { display: grid; grid-template-columns: 1fr auto; gap: 4px 40px; padding: 20px var(--pad) 28px; }
.viewer__title { margin: 0; font-size: 24px; font-weight: 300; letter-spacing: -.02em; }
.viewer__meta { align-self: center; text-align: right; }
.viewer__desc { grid-column: 1 / -1; margin: 0; max-width: 70ch; color: var(--soft); font-size: 15px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  :root { --header: 76px; }
  .top .logo { height: 50px; }
  .top.is-scrolled .logo { height: 42px; }
  .hero { grid-template-columns: 1fr; }
  .hero__feature { max-width: 520px; }
  .about { grid-template-columns: 1fr; padding: 90px var(--pad); }
  .about__photo { position: static; max-width: 420px; }
  .about__cols { grid-template-columns: 1fr; }
  .viewer__stage { grid-template-columns: 1fr; padding: 0 var(--pad); }
  .viewer__nav { display: none; }
  .viewer__info { grid-template-columns: 1fr; }
  .viewer__meta { text-align: left; }
}
@media (max-width: 520px) {
  .top nav { gap: 14px; font-size: 13px; }
  .theme-toggle { padding: 8px; }
  .theme-toggle__label { display: none; }
  .shelf__head { grid-template-columns: auto 1fr; }
  .shelf__count { display: none; }
  .clients { columns: 1; }
  .contact__row span:last-child { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .bg__grain { animation: none; }
}
