:root {
  --bg: #0a0a0c;
  --fg: #e8e7e1;
  --dim: #8a8a87;
  --accent: #ffffff;
  --rule: rgba(255,255,255,0.08);
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Syne', system-ui, sans-serif;
  --ease: cubic-bezier(0.33, 1, 0.68, 1);
  --gutter: clamp(2rem, 6vw, 8rem);

  /* Type scale */
  --text-xs: 0.875rem;
  --text-sm: 1rem;
  --text-base: 1.25rem;
  --text-lg: 1.5rem;
  --text-xl: 1.875rem;
}

[data-theme="light"] {
  --bg: #f2f1ed;
  --fg: #1a1a1d;
  --dim: #6e6e68;
  --accent: #000000;
  --rule: rgba(0,0,0,0.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }

body {
  font: 400 var(--text-base)/1.65 var(--font);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s var(--ease), color 0.25s var(--ease);
  overflow-x: hidden;
}

::selection { background: var(--fg); color: var(--bg); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
a:hover { color: var(--fg); }

.skip {
  position: absolute; top: -100%; left: 1rem;
  background: var(--fg); color: var(--bg);
  padding: 0.5rem 1rem; border-radius: 4px; font-weight: 600; z-index: 100;
  text-decoration: none;
}
.skip:focus { top: 1rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- Container ---- */
.container {
  max-width: 100rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
  padding-left: calc(var(--gutter) + clamp(1rem, 3vw, 4rem));
  position: relative;
  overflow: clip;
}

/* ---- Nav ---- */
nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2rem 0;
  position: sticky; top: 0; z-index: 50;
  background: transparent;
}


.home {
  font-family: var(--font-display);
  font-weight: 500; font-size: var(--text-sm);
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--fg); text-decoration: none;
}
.home:hover { color: var(--dim); }

#theme-toggle {
  all: unset; cursor: pointer; font-size: var(--text-base);
  color: var(--dim); transition: color 0.2s, transform 0.3s var(--ease);
}
#theme-toggle:hover { color: var(--fg); transform: rotate(20deg); }

/* ---- Header / Hero ---- */
header {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0 clamp(3rem, 6vw, 8rem);
  padding: clamp(4rem, 8vw, 10rem) 0 clamp(4rem, 8vw, 8rem);
}

.hero-brag {
  grid-column: 1 / -1;
  max-width: 90ch;
  margin-top: clamp(4rem, 8vw, 8rem);
  color: var(--dim);
  line-height: 1.65;
  text-wrap: pretty;
}

.brag-loud {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--fg);
}

.brag-display {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--accent);
  line-height: 1.4;
}

.brag-dim {
  font-size: var(--text-sm);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(5rem, 14vw, 16rem);
  font-weight: 700;
  line-height: 0.82;
  letter-spacing: -0.05em;
  align-self: start;
}

header blockquote {
  align-self: end;
  border: 0; padding: 0;
  max-width: 42ch;
}

header blockquote p {
  font-size: var(--text-base);
  color: var(--dim);
  line-height: 1.65;
  text-wrap: pretty;
}
header blockquote p + p { margin-top: 1.25rem; }
header blockquote .meta {
  margin-top: 1.75rem;
  color: var(--fg);
  font-size: var(--text-base);
}

/* ---- Sections ---- */
section {
  padding: clamp(4rem, 7vw, 7rem) 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 180px minmax(0, 64ch);
  gap: 0 clamp(2rem, 5vw, 6rem);
  align-items: start;
}

h2 {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--dim);
  position: sticky;
  top: 5rem;
  grid-row: 1 / -1;
}

section > :not(h2) {
  grid-column: 2;
}

/* Articles — 2-col grid */
.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.role-grid article {
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: clamp(8rem, 12vw, 12rem);
}
.role-grid article:nth-child(2n) { border-right: 0; }
.role-grid article:nth-last-child(-n+2) { border-bottom: 0; }
.role-grid article:last-child:nth-child(odd) { border-right: 0; }

/* Fallback for non-grid articles */
section > article {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--rule);
}
section > article:first-of-type { padding-top: 0; }
section > article:last-of-type { border-bottom: 0; }

.role-grid article p {
  margin-top: 0.5rem;
  color: var(--dim);
  font-size: var(--text-sm);
  text-wrap: pretty;
}
.role-grid article h3 { overflow-wrap: break-word; }

article h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

article p { margin-top: 0.375rem; }
article p + p { margin-top: 0.75rem; }

/* Before — prose */
section div p + p { margin-top: 1.25rem; }

/* Muted / supporting copy */
.meta { color: var(--dim); }

/* ---- Footer ---- */
footer {
  padding: clamp(5rem, 9vw, 9rem) 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem clamp(4rem, 8vw, 10rem);
}

footer div:first-of-type p {
  font-size: var(--text-sm);
  color: var(--dim);
  line-height: 1.65;
  text-wrap: pretty;
}

footer div:last-of-type {
  text-align: right;
  align-self: end;
}

footer .contact {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

footer small {
  display: block;
  margin-top: 1.5rem;
  color: var(--dim);
  font-size: var(--text-xs);
  letter-spacing: 0.5px;
}

/* ---- Crystals ---- */
.crystal {
  position: absolute;
  display: block;
  opacity: 0.9;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.18)) contrast(1.1) saturate(1.25);
  cursor: grab;
  z-index: 10;
  transition: filter 0.2s var(--ease);
}
.crystal img { width: 100%; height: auto; display: block; pointer-events: none; }
.crystal.dragging {
  cursor: grabbing;
  filter: drop-shadow(0 8px 40px rgba(0,0,0,0.5));
  z-index: 100;
}


.crystal-nav {
  width: clamp(194px, 24vw, 387px);
  top: -4rem;
  left: -8rem;
  transform: rotate(10deg);
}

.crystal-0 {
  width: clamp(209px, 26vw, 411px);
  top: 1%;
  left: 40%;
  transform: rotate(-13deg);
}

.crystal-1 {
  width: clamp(240px, 32vw, 480px);
  top: 42%;
  right: -10rem;
  transform: rotate(6deg);
}

.crystal-2 {
  width: clamp(270px, 38vw, 549px);
  top: 66%;
  left: -5rem;
  transform: rotate(-4deg);
}

.crystal-3 {
  width: clamp(267px, 37vw, 534px);
  top: 76%;
  right: -8rem;
  transform: rotate(12deg);
}

.crystal-4 {
  width: clamp(298px, 38vw, 595px);
  top: 25%;
  left: -10rem;
  transform: rotate(45deg);
}

.crystal-5 {
  width: clamp(181px, 23vw, 362px);
  top: 50%;
  right: -6rem;
  left: auto;
  transform: rotate(-8deg);
}

/* ---- Motion ---- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes up { from { opacity: 0; transform: translateY(24px); } }
  header, section, footer { animation: up 0.6s var(--ease) both; }
  section:nth-of-type(1) { animation-delay: 0.08s; }
  section:nth-of-type(2) { animation-delay: 0.16s; }
  footer { animation-delay: 0.24s; }

  @keyframes wiggle {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    20% { translate: 3px -2px; rotate: -1.5deg; }
    40% { translate: -2px 3px; rotate: 1deg; }
    60% { translate: 2px 1px; rotate: -0.5deg; }
    80% { translate: -1px -2px; rotate: 1deg; }
  }
  .crystal.wiggle { animation: wiggle 0.6s var(--ease) both; }
}


/* ---- Responsive: tablet ---- */
@media (max-width: 1024px) {
  section {
    grid-template-columns: 140px 1fr;
    gap: 0 clamp(1.5rem, 3vw, 4rem);
  }
}

/* ---- Responsive: mobile ---- */
@media (max-width: 768px) {
  :root { --gutter: 1.5rem; }
  .container { padding-left: var(--gutter); }

  /* Hero: collapse to single column, reset negative margin */
  header {
    grid-template-columns: 1fr;
    min-height: auto;
    margin-left: 0;
    padding-top: clamp(4rem, 14vw, 8rem);
    padding-bottom: clamp(3rem, 10vw, 5rem);
  }
  h1 {
    font-size: clamp(3.5rem, 14vw, 7rem);
    margin-bottom: 2.5rem;
  }
  header blockquote { max-width: none; }

  /* Sections: single column */
  section {
    grid-template-columns: 1fr;
  }
  h2 {
    position: static;
    margin-bottom: 1.5rem;
    grid-row: auto;
  }
  section > :not(h2) {
    grid-column: 1;
  }
  .hero-brag { max-width: 100%; }
  .role-grid { grid-template-columns: 1fr; }
  .role-grid article { border-right: 0; }
  .role-grid article:last-child { border-bottom: 0; }

  /* Footer: stack and reset alignment */
  footer {
    grid-template-columns: 1fr;
  }
  footer div:last-of-type {
    text-align: left;
    align-self: auto;
  }
  footer .contact { font-size: var(--text-sm); }

  /* Crystals: page-relative positions for mobile */
  .crystal-nav { width: 29vw; left: -3rem; top: -2rem; }
  .crystal-0 { width: 42vw; top: 2rem; left: auto; right: -6rem; transform: rotate(-13deg); }
  .crystal-1 { width: 40vw; top: 30%; right: -4rem; left: auto; }
  .crystal-2 { width: 46vw; top: 50%; left: -3rem; right: auto; }
  .crystal-3 { width: 47vw; top: 70%; bottom: auto; left: auto; right: -3rem; transform: rotate(12deg); }
  .crystal-4 { width: 47vw; top: 85%; left: -4rem; right: auto; }
  .crystal-5 { width: 30vw; top: 42%; left: -3rem; right: auto; }
}
