:root {
  --bg: #0b0d10;
  --fg: #f4f1ea;
  --muted: rgba(244, 241, 234, 0.6);
  --line: rgba(244, 241, 234, 0.2);
  --mat: #ece8de;
  --mat-edge: transparent;
  --rest-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  --lift-shadow: 0 2px 3px rgba(0, 0, 0, 0.3), 0 10px 18px -8px rgba(0, 0, 0, 0.4), 0 30px 46px -28px rgba(0, 0, 0, 0.5);
  --fg-soft: rgba(244, 241, 234, 0.88);
  --overlay: rgba(11, 13, 16, 0.94);
  --shadow-text: rgba(0, 0, 0, 0.8);
  /* Accent: the pink from the artworks, used for hover, focus and active states */
  --accent: #ee9b9b;
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  /* Fluid type scale: sizes grow smoothly between 360px and 1728px wide */
  --fs-xs: clamp(0.71875rem, 0.6776rem + 0.1827vw, 0.875rem);
  --fs-s: clamp(0.9375rem, 0.8882rem + 0.2193vw, 1.125rem);
  --fs-m: clamp(1rem, 0.9013rem + 0.4386vw, 1.375rem);
  --fs-h2: clamp(1.25rem, 1.1513rem + 0.4386vw, 1.625rem);
  --fs-lead: clamp(1.25rem, 1.0526rem + 0.8772vw, 2rem);
  --fs-bar: clamp(0.71875rem, 0.6447rem + 0.3289vw, 1rem);
  --fs-title: clamp(1.5rem, 1.2368rem + 1.1696vw, 2.5rem);
  --fs-h1: clamp(2rem, 1.6711rem + 1.4620vw, 3.25rem);
  --fs-next: clamp(1.5rem, 1.1053rem + 1.7544vw, 3rem);
  --fs-name: clamp(1.6875rem, 1.0789rem + 2.7047vw, 4rem);
  --fs-display: clamp(2.5625rem, 1.0000rem + 6.9444vw, 8.5rem);
  --font-text: "Jost", "Helvetica Neue", Arial, sans-serif;
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: 1rem;
}

/* Light theme: warm paper, ink text, a deeper pink so it stays readable */
:root[data-theme="light"] {
  --bg: #fbfbf9;
  --fg: #0d0f12;
  --muted: rgba(13, 15, 18, 0.58);
  --line: rgba(13, 15, 18, 0.2);
  --mat: #ffffff;
  --mat-edge: rgba(13, 15, 18, 0.14);
  --fg-soft: rgba(13, 15, 18, 0.88);
  --overlay: rgba(251, 251, 249, 0.96);
  --shadow-text: rgba(251, 251, 249, 0.8);
  --accent: #d2575f;
  --rest-shadow: 0 1px 1px rgba(70, 55, 40, 0.08), 0 3px 8px -3px rgba(70, 55, 40, 0.1);
  --lift-shadow: 0 1px 2px rgba(70, 55, 40, 0.1), 0 8px 14px -6px rgba(70, 55, 40, 0.13), 0 24px 36px -20px rgba(70, 55, 40, 0.18);
  color-scheme: light;
}

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

html {
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-s);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 1rem;
  background: var(--fg);
  color: var(--bg);
  z-index: 100;
}

.skip-link:focus {
  top: var(--gutter);
}

/* Header + nav (inner pages) */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 1.25rem var(--gutter) 1rem;
  border-bottom: 1px solid var(--line);
}

.site-header__name {
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  font-family: var(--font-text);
  display: inline-block;
  padding: 0.6rem 0;
  min-height: 44px;
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--fg);
}

.ig-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--fg);
}

.ig-link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

/* Home: fixed stage, scroll drives the sphere */
.scroll-space {
  height: calc((var(--series-count, 5) + 1) * 100vh);
}

.stage {
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  /* The headline blends with this colour (mix-blend-mode), so the stage needs its own backdrop */
  background: var(--bg);
}

.sphere-wrap {
  position: absolute;
  inset: 0;
  perspective: 2000px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sphere {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: calc(var(--cw) * 1.25);
  margin: calc(var(--cw) * -0.625) 0 0 calc(var(--cw) * -0.5);
  padding: calc(var(--cw) * 0.09) calc(var(--cw) * 0.09) calc(var(--cw) * 0.13);
  background: var(--mat);
  box-shadow: 0 0 0 1px var(--mat-edge), var(--rest-shadow);
  backface-visibility: hidden;
  filter: brightness(var(--depth, 1));
  transition: opacity 0.35s ease;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* The cards are never clicked: no ghost image when dragging the sphere */
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

:root[data-theme="light"] .card {
  filter: brightness(var(--lift, 1));
}

.stage.is-dragging {
  cursor: grabbing;
}

.card.is-swapping {
  opacity: 0;
}

.hero-name {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  mix-blend-mode: difference;
  text-shadow: 0 0 24px rgba(0, 0, 0, 0.35);
}

.hero-name a {
  pointer-events: auto;
  display: block;
  padding: 1rem;
  font-family: var(--font-display);
  font-size: var(--fs-name);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: 0.16em;
  line-height: 1.1;
  text-transform: uppercase;
  text-decoration: none;
  color: #fff;
}

.hero-name span {
  display: block;
}

@media (min-width: 768px) {
  .hero-name span {
    display: inline;
  }
}

.stage-meta {
  pointer-events: none;
  position: absolute;
  z-index: 11;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 1.25rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-text);
  font-size: var(--fs-bar);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-soft);
  text-shadow: 0 0 14px var(--shadow-text);
}

.stage-meta a {
  pointer-events: auto;
  display: inline-block;
  text-decoration: none;
}

/* Bottom bar: series on the left, link on the right */
.stage-meta a {
  position: relative;
  transition: color 0.2s ease;
}

/* Larger touch target without moving the text */
.stage-meta a::after {
  content: "";
  position: absolute;
  inset: -0.9rem -0.5rem;
}

.stage-meta a:hover,
.stage-meta a:focus-visible {
  color: var(--accent);
  opacity: 1;
}

/* The series label is a button: it jumps to the next series */
.stage-meta__series {
  position: relative;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.2s ease;
}

.stage-meta__series::after {
  content: " \2192";
  opacity: 0.55;
}

.stage-meta__series::before {
  /* larger touch target without moving the text */
  content: "";
  position: absolute;
  inset: -0.9rem -0.5rem;
}

.stage-meta__series:hover,
.stage-meta__series:focus-visible {
  color: var(--accent);
}

.fallback-grid {
  display: none;
}

/* Inner pages */
.page {
  padding: 2rem var(--gutter) 4rem;
}

.about {
  max-width: 44rem;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
}

.about__title,
.series__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: 0.03em;
}

.about__eyebrow {
  font-family: var(--font-text);
  margin: 0;
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.about__heading {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.about p {
  margin: 0 0 1.25rem;
  font-size: var(--fs-s);
}

.about__links {
  font-family: var(--font-text);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.about__links a {
  display: inline-block;
  padding: 0.6rem 0;
}

.series {
  margin: 0 auto 5rem;
  max-width: 90rem;
}

.series__meta {
  font-family: var(--font-text);
  margin: 0 0 1.5rem;
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.series__desc {
  max-width: 36rem;
  margin: 0 0 2rem;
  color: var(--muted);
}

.masonry {
  columns: 1;
  column-gap: 1.25rem;
}

.masonry figure {
  margin: 0 0 1.25rem;
  break-inside: avoid;
}

@media (min-width: 480px) {
  .masonry {
    columns: 2;
  }
}

@media (min-width: 1024px) {
  .masonry {
    columns: 3;
  }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--overlay);
}

.lightbox.is-open {
  display: flex;
}

.lightbox img {
  max-height: 90vh;
  max-width: 100%;
  object-fit: contain;
}

.lightbox__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--fg);
  font-size: 1.75rem;
  cursor: pointer;
}

.masonry button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }
}

/* Theme switch: sun and moon, the knob slides to the active one */
.theme-toggle {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 3.2rem;
  height: 1.7rem;
  padding: 0 0.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.theme-toggle::after {
  /* larger touch target */
  content: "";
  position: absolute;
  inset: -0.6rem -0.4rem;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle__knob {
  position: absolute;
  top: 50%;
  left: 0.2rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(1.5rem, -50%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* dark = knob on the moon (right); light = knob on the sun (left) */
:root[data-theme="light"] .theme-toggle__knob {
  transform: translate(0, -50%);
}

.theme-toggle__icon {
  position: relative;
  z-index: 1;
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: color 0.2s ease;
}

:root:not([data-theme="light"]) .theme-toggle__icon--moon,
:root[data-theme="light"] .theme-toggle__icon--sun {
  color: var(--bg);
}


@media (prefers-reduced-motion: reduce) {
  .theme-toggle__knob {
    transition: none;
  }
}

:root[data-theme="light"] .hero-name {
  text-shadow: none;
}

/* Bottom bar, right side: Projects and the theme switch sit on one line */
.stage-meta__right {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
  pointer-events: auto;
}

.stage-meta__right .theme-toggle {
  pointer-events: auto;
}

/* Phones and tablets: the page is one fixed screen, the finger turns the sphere, nothing scrolls */
html.is-touch,
html.is-touch body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html.is-touch .scroll-space {
  display: none;
}

html.is-touch .stage {
  height: 100dvh;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
