/* ==========================================================
   Mindjax · styles
   ========================================================== */

@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Electric Studio palette */
  --void: #141B29;          /* midnight: the foundation */
  --void-deep: #0E1420;     /* darker midnight for depth at the edges */
  --graphite: #202B3B;      /* slate: secondary surfaces */
  --thread: #F1F3F7;        /* soft white text */
  --thread-dim: rgba(241, 243, 247, 0.3);
  --hairline: rgba(241, 243, 247, 0.11);
  --mist: #A3ADBE;          /* secondary text, 7:1 on midnight */
  --cyan: #39C6D6;          /* primary accent */
  --cyan-soft: #7FD8E3;     /* cyan for small text */
  --amber: #F2A65A;         /* secondary accent */
  --signal: var(--cyan);    /* links, focus, emphasis */

  --font-sans: "Instrument Sans", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --max: 1240px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--thread);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.3vw + 0.92rem, 1.125rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint film grain over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, p, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
svg { display: block; }

::selection { background: var(--signal); color: var(--void); }

:focus-visible {
  outline: 1px solid var(--signal);
  outline-offset: 4px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--signal);
  color: var(--void);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.label,
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--cyan-soft);
}

.text-link {
  position: relative;
  display: inline-flex;
  gap: 0.6rem;
  padding-bottom: 0.3rem;
  text-decoration: none;
  font-weight: 500;
}
.text-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--signal);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}
.text-link span { transition: transform 0.4s var(--ease); }
.text-link:hover span { transform: translateX(4px); }
.text-link:hover::after { transform: scaleX(0.35); }

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem var(--gutter);
  transition: background-color 0.4s, padding 0.4s var(--ease);
}
.site-header.is-scrolled {
  padding-block: 0.85rem;
  background: rgba(20, 27, 41, 0.8);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--hairline);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand-mark {
  width: 22px;
  height: 19px;
  color: var(--cyan);
  transition: transform 0.8s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-60deg); }

.site-header nav ul {
  display: flex;
  gap: clamp(1rem, 3vw, 2.25rem);
}
.site-header nav a {
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--mist);
  transition: color 0.2s;
}
.site-header nav a:hover { color: var(--thread); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
}
/* extra scroll room for the unwind, only when motion is welcome */
@media (prefers-reduced-motion: no-preference) {
  .js .hero { height: 165vh; height: 165svh; }
}

.hero-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background:
    /* a soft light that follows the cursor (script.js sets --lx / --ly) */
    radial-gradient(28vw 28vw at var(--lx, 66%) var(--ly, 46%), rgba(57, 198, 214, 0.09), transparent 70%),
    /* cool cyan halo behind the sculpture, warm amber pooling below it */
    radial-gradient(clamp(260px, 38vw, 620px) clamp(260px, 38vw, 620px) at var(--sx, 66%) var(--sy, 46%), rgba(57, 198, 214, 0.13), transparent 70%),
    radial-gradient(55vw 38vw at 80% 96%, rgba(242, 166, 90, 0.10), transparent 70%),
    /* deeper midnight in the top-left corner for depth */
    radial-gradient(70vw 60vw at 0% 0%, var(--void-deep), transparent 70%),
    linear-gradient(180deg, var(--void) 0%, #172033 100%);
}

.loom {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

.hero-copy {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(2.5rem, 11vh, 7rem);
  max-width: min(32rem, calc(100% - 2 * var(--gutter)));
  opacity: calc(1 - var(--unwind, 0) * 2.2);
  transform: translateY(calc(var(--unwind, 0) * -40px));
  pointer-events: none;
}
.hero-copy a { pointer-events: auto; }

.eyebrow { margin-bottom: 1.5rem; }

h1 {
  font-size: clamp(2.4rem, 4.6vw, 4.25rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  margin: 1.5rem 0 2rem;
  color: var(--mist);
  max-width: 30rem;
}

.hint {
  margin-top: 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: rgba(163, 173, 190, 0.75);
}

/* ---------- Section scaffolding ---------- */

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1rem 2rem;
  align-items: baseline;
  margin-bottom: clamp(3rem, 7vw, 5.5rem);
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 450;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

/* ---------- Work ---------- */

.work {
  position: relative;
  padding: clamp(5rem, 12vw, 10rem) 0 clamp(4rem, 9vw, 7rem);
}

.work-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(2rem, 4vw, 4rem);
}

/* each illustration has its own accent, from one family */
.work-item {
  --accent: var(--cyan);
  --accent-rest: rgba(57, 198, 214, 0.42);
  padding-top: 1.75rem;
  border-top: 1px solid var(--hairline);
  transition: border-color 0.5s;
}
.work-item:nth-child(2) { --accent: var(--amber); --accent-rest: rgba(242, 166, 90, 0.42); }
.work-item:nth-child(3) { --accent: #9AA6FF; --accent-rest: rgba(154, 166, 255, 0.42); }
.work-item:hover { border-color: var(--accent); }

.work-art {
  width: 100%;
  height: auto;
  margin-bottom: 2rem;
  overflow: visible;
}
.work-art .draw {
  fill: none;
  stroke: var(--thread-dim);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-dasharray: 800;   /* longer than any line, so one dash covers it */
  stroke-dashoffset: 800;
  transition: stroke-dashoffset 1.6s var(--ease), stroke 0.5s;
}
/* frames stay soft white; the inner lines carry a hint of the accent, stronger on hover */
.work-art .draw ~ .draw { stroke: var(--accent-rest); }
.work-item:hover .work-art .draw { stroke: rgba(241, 243, 247, 0.55); }
.work-item:hover .work-art .draw ~ .draw { stroke: var(--accent); }
.work-art .draw:nth-child(2) { transition-delay: 0.08s; }
.work-art .draw:nth-child(3) { transition-delay: 0.16s; }
.work-art .draw:nth-child(4) { transition-delay: 0.24s; }
.work-art .draw:nth-child(5) { transition-delay: 0.32s; }
.work-art .draw:nth-child(6) { transition-delay: 0.40s; }
.work-art .dot { fill: var(--thread-dim); transition: fill 0.4s; }
.work-art .dot + .dot { fill: var(--accent-rest); }
.work-item:hover .work-art .dot { fill: var(--amber); }
.work-item:hover .work-art .dot + .dot { fill: var(--cyan); }

.work-item.is-in .draw,
html:not(.js) .draw { stroke-dashoffset: 0; }

.work-art .accent {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linecap: round;
}

/* 01 — a line of copy writes itself */
.art-web .accent {
  stroke: var(--amber);
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  transition: stroke-dashoffset 0.8s var(--ease);
}

/* 02 — signals run through the flow */
.art-flow .run {
  stroke-dasharray: 16 400;
  stroke-dashoffset: 16;
  opacity: 0;
  transition: opacity 0.3s;
}
.art-flow .run-2 { animation-delay: 0.9s !important; stroke: var(--cyan); }
@keyframes run { to { stroke-dashoffset: -160; } }

/* 03 — the missing piece drops into place */
.art-build .block {
  fill: url(#build-grad);
  stroke: none;
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity 0.4s, transform 0.6s var(--ease);
}

.work-item:hover .art-web .accent { stroke-dashoffset: 0; }
.work-item:hover .art-flow .run { opacity: 1; animation: run 1.8s linear infinite; }
.work-item:hover .art-build .block { opacity: 0.9; transform: none; }

/* touch screens can't hover, so the accents simply play once revealed */
@media (hover: none) {
  .work-item.is-in .art-web .accent { stroke-dashoffset: 0; transition-delay: 1.2s; }
  .work-item.is-in .art-flow .run { opacity: 1; animation: run 2.4s linear 1.2s infinite; }
  .work-item.is-in .art-build .block { opacity: 0.9; transform: none; transition-delay: 1.2s; }
}

.work-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.work-item h3 {
  font-size: clamp(1.25rem, 1.6vw, 1.5rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-bottom: 0.85rem;
  transition: color 0.3s;
}
.work-item:hover h3 { color: var(--accent); }

.work-item > p:not(.work-num):not(.eg) { color: var(--mist); }

.eg {
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.7;
  color: rgba(163, 173, 190, 0.85);
}

/* ---------- Interlude ---------- */

.interlude {
  display: grid;
  place-items: center;
  min-height: 80vh;
  padding: clamp(5rem, 12vw, 9rem) var(--gutter);
}

.interlude-text {
  max-width: 24ch;
  font-size: clamp(1.6rem, 3.6vw, 3.1rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-align: center;
  text-wrap: balance;
}
.interlude-text .w {
  opacity: 0.16;
  transition: opacity 0.5s;
}
.interlude-text .w.lit { opacity: 1; }
.interlude-text .w.em { color: var(--amber); }

/* ---------- About ---------- */

.about {
  padding: clamp(5rem, 11vw, 9rem) 0;
  background: linear-gradient(var(--void), var(--graphite) 30%, var(--graphite) 70%, var(--void));
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(3rem, 8vw, 8rem);
  align-items: start;
}

.about-main h2 {
  margin: 1.25rem 0 2rem;
  font-size: clamp(2rem, 3.6vw, 3.25rem);
}
.about-main p:not(.label) {
  max-width: 36rem;
  color: var(--mist);
}
.about-main p + p { margin-top: 1.25rem; }

.spec {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
}
.spec div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--hairline);
}
.spec div:last-child { border-bottom: 1px solid var(--hairline); }
.spec dt { color: var(--mist); }
.spec dd { color: var(--thread); }

/* ---------- Contact ---------- */

.contact {
  position: relative;
  padding: 0 0 clamp(5rem, 10vw, 8rem);
  overflow: hidden;
  background:
    radial-gradient(40vw 30vw at 12% 72%, rgba(242, 166, 90, 0.13), transparent 70%),
    radial-gradient(45vw 32vw at 88% 30%, rgba(57, 198, 214, 0.12), transparent 70%),
    linear-gradient(180deg, var(--void) 0%, #182338 100%);
}
.contact .label { color: var(--amber); }

.string {
  display: block;
  width: 100%;
  height: clamp(140px, 18vw, 220px);
  touch-action: pan-y;
}

.contact-inner h2 {
  margin: 1.25rem 0 1rem;
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.contact-lede {
  max-width: 30rem;
  color: var(--mist);
}

.email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 2.5rem;
}

.email {
  position: relative;
  font-size: clamp(1.5rem, 3.4vw, 2.6rem);
  font-weight: 450;
  letter-spacing: -0.025em;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.email::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.15em;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
  transform: scaleX(0.18);
  transform-origin: left;
  transition: transform 0.7s var(--ease);
}
.email { transition: color 0.4s; }
.email:hover,
.email:focus-visible { color: #FFFFFF; }
.email:hover::after,
.email:focus-visible::after { transform: scaleX(1); }

.copy {
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: transparent;
  color: var(--mist);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy:hover { color: var(--cyan-soft); border-color: rgba(57, 198, 214, 0.5); }
.copy.is-copied { color: var(--amber); border-color: var(--amber); }

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.75rem var(--gutter) 2.25rem;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--mist);
}

/* ---------- Reveal ---------- */

.js [data-reveal] {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(14px);
  transition: opacity 1s var(--ease), filter 1s var(--ease), transform 1s var(--ease);
}
.js [data-reveal].is-in {
  opacity: 1;
  filter: none;
  transform: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .work-list { grid-template-columns: 1fr; gap: 3.5rem; }
  .work-art { max-width: 340px; }
  .section-head { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .site-header nav ul { gap: 1rem; }
  .spec div { grid-template-columns: 1fr; gap: 0.15rem; }
  .hero-copy { bottom: 1.75rem; }
  .eyebrow { margin-bottom: 1rem; }
  .lede { margin: 1rem 0 1.5rem; }
  .hint { margin-top: 1.5rem; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .js [data-reveal] { opacity: 1; filter: none; transform: none; }
  .interlude-text .w { opacity: 1; }
}
