:root {
  /* Palette: Stone & Rose */
  --bg: #eeefec;
  --surface: #ffffff;
  --ink: #241a1f;
  --ink-soft: #716263;
  --line: #d6d7d2;
  --accent: #9c5570;
  --radius: 14px;
  --max: 1800px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Unna", Georgia, "Times New Roman", serif;
  --font-body: "Albert Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191a18;
    --surface: #232422;
    --ink: #f3ece9;
    --ink-soft: #a89490;
    --line: #2b2c29;
  }
}
:root[data-theme="dark"] {
  --bg: #191a18;
  --surface: #232422;
  --ink: #f3ece9;
  --ink-soft: #a89490;
  --line: #2b2c29;
}
:root[data-theme="light"] {
  --bg: #eeefec;
  --surface: #ffffff;
  --ink: #241a1f;
  --ink-soft: #716263;
  --line: #d6d7d2;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 6vw, 100px);
}

/* ---------- Nav (all pages) ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 20px 0;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-body);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  position: relative;
  font-size: 14px;
  color: var(--ink-soft);
  padding-bottom: 2px;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s var(--ease);
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a:hover::after {
  width: 100%;
}

/* ---------- Section label (shared: case study "Next project" label) --- */

.section-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Scroll reveal (used throughout case study pages) ---------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Footer / contact (shared wrapper + heading; case study
   pages use this for their simple "Next project" block, the homepage's
   richer contact section lives in .cp4-contact below) ---------- */

.footer {
  padding: clamp(1.5rem, 4vw, 3rem) 0 60px;
  border-top: 1px solid var(--line);
}

.footer h2 {
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 400;
  letter-spacing: -0.01em;
  max-width: 40ch;
  margin-bottom: 36px;
  text-wrap: balance;
}

.footer-meta {
  margin-top: 64px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* =====================================================================
   HOMEPAGE — hero poster with cursor reveal
   ===================================================================== */

.cp4 {
  --mx: 50%;
  --my: 38%;
  --hmx: 50%;
  --hmy: 38%;
  --cp4-radius: 220px;
  /* the reveal gradient is derived entirely from the locked palette —
     a light accent wash, pure accent, and an ink/accent blend — so the
     "hidden" layer never introduces colors outside the approved system */
  --cp4-pattern-a: color-mix(in srgb, var(--accent) 22%, var(--bg));
  --cp4-pattern-b: var(--accent);
  --cp4-pattern-c: color-mix(in srgb, var(--ink) 82%, var(--accent) 18%);
}

@media (max-width: 640px) {
  .cp4 { --cp4-radius: 130px; }
}

.cp4 * { box-sizing: border-box; }

/* ---------------- POSTER ---------------- */

.cp4-poster {
  position: relative;
  overflow: hidden;
  cursor: default;
  isolation: isolate;
}

/* the poster's background/pattern stay full-bleed, the content column
   matches the same 1800px safety cap + 100px-max side padding as the
   projects/contact sections below, so all three stay aligned at any
   viewport width instead of one being narrower than the others.
   No forced viewport-height min-height — the hero now hugs its content
   so "Selected work" lands in the fold instead of a full screen down. */
.cp4-poster-inner {
  position: relative;
  z-index: 3;
  max-width: 1800px;
  margin: 0 auto;
  /* top padding gets extra clearance for the now-persistent fixed nav
     bar (added on every page, including the homepage) */
  padding: calc(clamp(1.5rem, 4vw, 3rem) + 70px) clamp(1.25rem, 6vw, 100px) clamp(1.5rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cp4-poster-eyebrow {
  position: relative;
  z-index: 3;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.9rem;
}

.cp4-poster-main {
  position: relative;
  z-index: 3;
}

/* the reveal headline (position:absolute; inset:0) needs a positioning
   box that matches the base headline exactly — sizing it off the whole
   .cp4-poster-main instead (which also holds the eyebrow/statement text)
   stretched it over a taller area and made the two layers visibly drift
   apart instead of overlapping */
.cp4-headline-wrap {
  position: relative;
}

.cp4-headline {
  position: relative;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.4rem, 6.5vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
  /* tighter than the site-wide 40ch so the headline always breaks into
     two balanced lines, even on wide screens */
  max-width: 24ch;
  margin: 0;
}

.cp4-headline em {
  font-style: italic;
  color: var(--accent);
}

.cp4-headline-base {
  color: var(--ink);
}

.cp4-headline-reveal {
  position: absolute;
  inset: 0;
  margin: 0;
  background: linear-gradient(120deg, var(--cp4-pattern-b), var(--accent) 45%, var(--cp4-pattern-c) 85%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  pointer-events: none;
  /* uses --hmx/--hmy (scoped to the headline's own box), not --mx/--my
     (scoped to the full poster width) — the headline sits in a
     narrower centered column, not the full poster width, so it needs
     its own coordinate pair or the spotlight drifts from the cursor */
  -webkit-mask-image: radial-gradient(circle var(--cp4-radius) at var(--hmx) var(--hmy), #000 0%, rgba(0,0,0,0.6) 45%, transparent 72%);
  mask-image: radial-gradient(circle var(--cp4-radius) at var(--hmx) var(--hmy), #000 0%, rgba(0,0,0,0.6) 45%, transparent 72%);
  transition: -webkit-mask-image 0.05s linear;
}

.cp4-headline-reveal em { color: inherit; }

.cp4-poster-statement {
  position: relative;
  z-index: 3;
  margin-top: 1.3rem;
  font-size: clamp(0.95rem, 1.7vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* phones: let the statement wrap (must come after the rule above to win) */
@media (max-width: 640px) {
  .cp4-poster-statement { white-space: normal; }
}

.cp4-pattern {
  position: absolute;
  inset: -10%;
  z-index: 1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 30%, var(--cp4-pattern-b) 0%, transparent 45%),
    radial-gradient(circle at 80% 20%, var(--cp4-pattern-a) 0%, transparent 40%),
    radial-gradient(circle at 60% 75%, var(--cp4-pattern-c) 0%, transparent 50%),
    repeating-linear-gradient(135deg, var(--cp4-pattern-b) 0 2px, transparent 2px 28px);
  background-size: 140% 140%, 140% 140%, 140% 140%, auto;
  background-blend-mode: normal, normal, normal, overlay;
  opacity: 0.9;
  -webkit-mask-image: radial-gradient(circle var(--cp4-radius) at var(--mx) var(--my), #000 0%, rgba(0,0,0,0.5) 50%, transparent 75%);
  mask-image: radial-gradient(circle var(--cp4-radius) at var(--mx) var(--my), #000 0%, rgba(0,0,0,0.5) 50%, transparent 75%);
  transition: -webkit-mask-image 0.05s linear;
  animation: cp4PatternDrift 26s ease-in-out infinite;
}

@keyframes cp4PatternDrift {
  0%, 100% { background-position: 0% 0%, 100% 0%, 50% 100%, 0 0; }
  50% { background-position: 8% 6%, 92% 8%, 44% 92%, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cp4-pattern { animation: none; }
}

.cp4-pattern-base {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--line) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.5;
}

@media (prefers-reduced-motion: reduce) {
  .cp4-headline-reveal,
  .cp4-pattern {
    -webkit-mask-image: none;
    mask-image: none;
    opacity: 0.16;
  }
}

.cp4-poster.cp4-static .cp4-headline-reveal,
.cp4-poster.cp4-static .cp4-pattern {
  -webkit-mask-image: none;
  mask-image: none;
  opacity: 0.14;
}

/* ---------------- PROJECTS ---------------- */

.cp4-projects {
  padding-top: clamp(1.5rem, 4vw, 3rem);
  padding-bottom: clamp(3rem, 8vw, 6rem);
  padding-left: clamp(1.25rem, 6vw, 100px);
  padding-right: clamp(1.25rem, 6vw, 100px);
  max-width: 1800px;
  margin: 0 auto;
}

.cp4-section-label {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 2.5rem;
}

.cp4-project-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cp4-project {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  padding: 1.6rem 0;
  border-top: 1px solid var(--line);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.cp4-project-list li:last-child { border-bottom: 1px solid var(--line); }

.cp4-project.cp4-in-view {
  opacity: 1;
  transform: translateY(0);
}
.cp4-project:nth-child(1).cp4-in-view { transition-delay: 0s; }
.cp4-project:nth-child(2).cp4-in-view { transition-delay: 0.08s; }
.cp4-project:nth-child(3).cp4-in-view { transition-delay: 0.16s; }
.cp4-project:nth-child(4).cp4-in-view { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  .cp4-project { transition: none; transform: none; opacity: 1; }
}

.cp4-project-index {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--ink-soft);
}

.cp4-project-title {
  grid-column: 2 / 3;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  margin: 0;
  line-height: 1.25;
}

.cp4-project-desc {
  grid-column: 2 / 3;
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  max-width: calc(48ch + 100px);
}

.cp4-project-meta {
  grid-column: 3 / 4;
  grid-row: 1 / 3;
  align-self: start;
  text-align: end;
  font-size: 0.78rem;
  color: var(--ink-soft);
  white-space: nowrap;
  padding-top: 0.15rem;
}

/* the whole row is a real link — not just a hover-styled list item */
a.cp4-project {
  text-decoration: none;
  color: inherit;
}

.cp4-project:hover .cp4-project-title,
.cp4-project:focus-visible .cp4-project-title {
  color: var(--accent);
  transition: color 0.2s var(--ease);
}

.cp4-project:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
  border-radius: 2px;
}

@media (max-width: 640px) {
  .cp4-project {
    grid-template-columns: 2rem 1fr;
  }
  .cp4-project-meta {
    grid-column: 2 / 3;
    grid-row: auto;
    text-align: start;
    margin-top: 0.3rem;
  }
}

/* ---------------- CONTACT ---------------- */

.cp4-contact {
  padding-top: clamp(1.5rem, 4vw, 3rem);
  padding-bottom: clamp(4rem, 10vw, 6rem);
  padding-left: clamp(1.25rem, 6vw, 100px);
  padding-right: clamp(1.25rem, 6vw, 100px);
  max-width: 1800px;
  margin: 0 auto;
  text-align: start;
}

.cp4-contact-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.08;
  margin: 0 0 2rem;
  max-width: 40ch;
  text-wrap: balance;
}

.cp4-contact-headline em { font-style: italic; color: var(--accent); }

/* icon + label, no underline; same row as the About page */
.cp4-contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  font-size: 1.05rem;
}

.cp4-contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

/* Phosphor Thin icons (one family, each in its full 256 box as designed);
   hairline strokes to match the site's 1px rules */
.cp4-contact-links svg {
  width: 1.35em;
  height: 1.35em;
  flex: none;
  fill: currentColor;
}

.cp4-contact-links a:hover,
.cp4-contact-links a:focus-visible {
  color: var(--accent);
}


/* cards for case studies that aren't published yet: not links, no hover */
.cp4-project-soon .cp4-project-meta { font-style: italic; }
.cp4-project-soon:hover .cp4-project-title { color: inherit; }
