/* Foundry XD — molten scroll experience */

:root {
  --black: #000000;
  --ink: #f2ede4;
  --dim: #8a8378;
  --lava: #ff5a1f;
  --lava-hot: #ffc16b;
  --lava-deep: #7a1200;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mx: 50%;
  --my: 50%;
}

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

html { background: var(--black); overflow-x: hidden; }

body {
  background: var(--black);
  color: var(--ink);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Inter, Roboto, sans-serif;
  overflow-x: hidden;
  cursor: none;
}
@media (hover: none), (pointer: coarse) {
  body { cursor: auto; }
  #cursor { display: none; }
}

::selection { background: var(--lava); color: var(--black); }

/* ============ custom cursor ============ */
#cursor {
  position: fixed;
  left: 0; top: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--lava-hot);
  box-shadow: 0 0 10px 3px rgba(255, 90, 31, 0.5), 0 0 32px 10px rgba(255, 90, 31, 0.15);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s;
  mix-blend-mode: screen;
}
#cursor.grow { width: 22px; height: 22px; }

/* ============ lava layers ============ */
#lava-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
#lava-svg,
#dither-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}
/* isolate the heavy filtered SVG and the dither canvas on their own
   compositor layers so one updating never re-renders the other */
#lava-svg,
#dither-canvas {
  will-change: transform;
}
#drip-head {
  position: absolute;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8ec 0%, var(--lava-hot) 35%, var(--lava) 65%, transparent 72%);
  filter: blur(1px);
  box-shadow:
    0 0 18px 6px rgba(255, 122, 40, 0.8),
    0 0 60px 24px rgba(255, 90, 31, 0.35);
  opacity: 0;
}

/* ============ volcano morph backdrop ============ */
/* fixed giant dithered volcano behind everything; the artwork is a few
   screens tall — scroll pans the camera down the mountain while frames
   crossfade dormant -> erupting -> lava-flow (see js/volcano.js) */
#volcano {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--black);
}
#volcano-stage {
  position: absolute;
  top: 0;
  left: 0;
  /* width/height/left set by js/volcano.js to zoom past the viewport */
  will-change: transform;
}
.v-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  image-rendering: pixelated;  /* keep the baked dither chunky when upscaled */
}
.v-first { opacity: 1; }
/* heat at the crater mouth — wakes at rest, swells at the eruption.
   Lives inside the stage so it pans with the mountain. */
#volcano-heat {
  position: absolute;
  inset: 0;
  background: radial-gradient(32% 16% at 50% 49%,
    rgba(255, 130, 45, 0.7) 0%,
    rgba(255, 60, 10, 0.32) 45%,
    transparent 72%);
  mix-blend-mode: screen;
  opacity: 0;
}
/* darkens deep in the page so section copy stays legible */
#volcano-dim {
  position: absolute;
  inset: 0;
  background: var(--black);
  opacity: 0;
}

/* ============ page & sections ============ */
#page { position: relative; z-index: 2; }

.sec {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 22vh 6vw;
}

/* fragmented type — refined serif, restrained scale */
.poem {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.7rem, 4.4vw, 3.4rem);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.poem .ln { display: block; }
.poem .ln.big { color: var(--lava); font-style: normal; }
.poem.accent .ln { color: var(--ink); }
.poem.giant { font-size: clamp(2rem, 6vw, 4.6rem); }

.sec-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.3rem, 3vw, 2.1rem);
  letter-spacing: -0.005em;
  margin-bottom: 9vh;
  color: var(--dim);
}
.sec-title .ln { display: inline-block; }

/* reveal state: words hidden until lava passes */
[data-reveal] .ln,
[data-reveal].mail {
  opacity: 0;
  transform: translateY(0.6em);
  filter: blur(6px);
}
.no-motion [data-reveal] .ln,
.no-motion [data-reveal].mail {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

/* ============ hero ============ */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-top: 10vh;
}
.logo-stage {
  position: relative;
  width: min(88vw, 980px);
  user-select: none;
}
.logo-stage img {
  width: 100%;
  display: block;
  /* the logo art lives on a black plate — screen-blend melts the plate
     into the volcano backdrop so only the metal and fire remain */
  mix-blend-mode: screen;
}
#logo-heat {
  position: absolute;
  inset: 0;
  filter: brightness(1.9) saturate(1.8) contrast(1.05);
  -webkit-mask-image: radial-gradient(circle 170px at var(--mx) var(--my), #000 0%, transparent 70%);
  mask-image: radial-gradient(circle 170px at var(--mx) var(--my), #000 0%, transparent 70%);
  pointer-events: none;
}
.hero-line {
  margin-top: 6vh;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1rem, 1.9vw, 1.35rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--dim);
}
.hero-line .w { display: inline-block; }

/* ============ manifesto ============ */
.manifesto { padding-top: 30vh; padding-bottom: 30vh; }
.manifesto .poem + .poem { margin-top: 16vh; margin-left: auto; width: fit-content; text-align: right; }

/* ============ services ============ */
.cards {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.card {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(242, 237, 228, 0.12);
  padding: 34px 28px 42px;
  background: rgba(0, 0, 0, 0.55);
  transition: border-color 0.35s;
  min-height: 260px;
}
.card:hover { border-color: rgba(255, 90, 31, 0.55); }
.card-num {
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  color: var(--lava);
}
.card h3 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  margin: 18px 0 12px;
  font-size: 1.3rem;
  letter-spacing: 0;
}
.card p { color: var(--dim); line-height: 1.65; font-size: 0.92rem; }

/* morphing blob highlight that follows the hovered card */
.blob {
  position: absolute;
  z-index: 0;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle at 35% 35%, rgba(255, 122, 40, 0.5), rgba(122, 18, 0, 0.25) 60%, transparent 75%);
  filter: blur(28px);
  opacity: 0;
  transition: opacity 0.4s;
  animation: morph 9s ease-in-out infinite;
  pointer-events: none;
}
.cards:hover .blob { opacity: 1; }
@keyframes morph {
  0%, 100% { border-radius: 58% 42% 61% 39% / 45% 55% 45% 55%; transform: rotate(0deg) scale(1); }
  33% { border-radius: 38% 62% 45% 55% / 60% 38% 62% 40%; transform: rotate(24deg) scale(1.12); }
  66% { border-radius: 52% 48% 34% 66% / 40% 60% 42% 58%; transform: rotate(-18deg) scale(0.94); }
}

/* ============ work tiles ============ */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.tile {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  border: 1px solid rgba(242, 237, 228, 0.12);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.35s;
}
.tile:hover { border-color: rgba(255, 90, 31, 0.6); }
.tile-dither {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  opacity: 0.9;
}
.tile-inner {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 26px;
  background: linear-gradient(transparent 40%, rgba(0, 0, 0, 0.78));
}
.tile-kind {
  font-size: 0.64rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--lava);
  margin-bottom: 10px;
}
.tile-name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.1rem, 1.8vw, 1.5rem);
  letter-spacing: 0;
  line-height: 1.1;
}

/* ============ loop zone ============ */
.loopzone {
  padding-top: 34vh;
  padding-bottom: 34vh;
  text-align: left;
}
.loop-spacer { height: 110vh; }
.loopzone .poem.accent { margin-left: auto; width: fit-content; text-align: right; }

/* ============ contact ============ */
.contact {
  min-height: 90svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.mail {
  display: inline-block;
  margin: 5vh auto 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.1rem, 2.6vw, 1.8rem);
  font-weight: 400;
  color: var(--lava);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.3s, border-color 0.3s;
}
.mail:hover { color: var(--lava-hot); border-color: var(--lava-hot); }

.pool {
  margin: 12vh auto 0;
  width: min(60vw, 520px);
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 90, 31, 0.5), rgba(122, 18, 0, 0.28) 55%, transparent 72%);
  filter: blur(14px);
  animation: pool 5s ease-in-out infinite;
}
@keyframes pool {
  0%, 100% { transform: scaleX(1); opacity: 0.75; }
  50% { transform: scaleX(1.1); opacity: 1; }
}

footer {
  margin-top: 10vh;
  padding-top: 26px;
  border-top: 1px solid rgba(242, 237, 228, 0.1);
  font-size: 0.8rem;
  color: var(--dim);
}
footer nav { display: flex; gap: 22px; justify-content: center; margin-bottom: 14px; }
footer a { color: var(--dim); text-decoration: none; }
footer a:hover { color: var(--lava); }

/* ============ mobile ============ */
@media (max-width: 820px) {
  .sec { padding-left: 7vw; padding-right: 7vw; }
  .cards, .tiles { grid-template-columns: 1fr; }
  .card { min-height: 0; }
  .tile { aspect-ratio: 16 / 10; }
  .manifesto .poem + .poem { margin-left: 0; text-align: left; }
  .loopzone .poem.accent { margin-left: 0; text-align: left; }
  .loop-spacer { height: 70vh; }
}

/* ============ reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  .blob, .pool, #drip-head { animation: none; }
  #cursor { display: none; }
  body { cursor: auto; }
}
