/* Hexart landing — noir-bouquet chrome sewn into the artwork, never boxed
   over it. Gold is thread, not a slab; data lives in the corners like a
   gallery placard. */

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../../assets/fonts/bricolage-grotesque-latin.woff2') format('woff2');
}

/* Crossing between rooms is a dissolve, not a jump — the cloth persists
   into the studio. Browsers without cross-document view transitions simply
   navigate. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.45s;
}

:root {
  --bg: #0A0A0C;
  --cream: #EAE5D8;
  --cream-soft: #D8D2C2;
  --gold: #E8A020;
  --gold-light: #F2BC49;
  --muted: #8A8578;
  --ink: #141208;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--cream);
  font-family: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: fixed;
  inset: 0;
}

/* The stitched panel: the whole cloth tilts as one object under the light. */
.cloth {
  position: absolute;
  inset: 0;
  will-change: transform;
  cursor: pointer;
}

#art,
#life {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#life {
  pointer-events: none;
}

/* A warm light source above the artwork. It drifts to a seeded spot over
   each specimen — daylight moving across a gallery wall, never the cursor. */
@property --glow-x {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 50%;
}

@property --glow-y {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 36%;
}

.glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  background: radial-gradient(ellipse 62% 46% at var(--glow-x, 50%) var(--glow-y, 36%),
    rgba(232, 160, 32, 0.09),
    rgba(232, 160, 32, 0.03) 48%,
    transparent 72%);
  transition: --glow-x 3.2s ease-in-out, --glow-y 3.2s ease-in-out, opacity 1.9s ease;
}

/* The prelude: the gallery light lowers before the cloth is re-dyed, and
   rises again as the next specimen grows. */
.glow-lowered {
  opacity: 0.38;
}

/* The hem: the cloth darkens where the label is sewn — light falling off at
   the bottom of the frame, so the chrome reads on full-field artworks too.
   On the noir pieces it is invisible. Falloff, never a panel. */
.hem {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 34vh;
  pointer-events: none;
  background: linear-gradient(to top,
    rgba(10, 10, 12, 0.82),
    rgba(10, 10, 12, 0.32) 48%,
    transparent);
}

/* The invitation rises on its own clock, timed to the late phase of growth,
   so it arrives whether or not scripts ever ran. */
.invite {
  position: absolute;
  inset-inline: 0;
  bottom: max(6.5vh, 44px);
  display: grid;
  justify-items: center;
  padding: 0 24px;
  text-align: center;
  pointer-events: none;
  animation: invite-rise 0.9s cubic-bezier(0.16, 1, 0.3, 1) 2.4s both;
}

.invite > * {
  pointer-events: auto;
}

@keyframes invite-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* The action is typographic: cream words on the cloth, underlined by a gold
   running stitch that sews itself in as the bouquet finishes. */
.cta {
  position: relative;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.005em;
  color: var(--cream);
  text-decoration: none;
  padding: 2px 4px 13px;
  transition: color 0.25s ease-out;
}

.cta .stitch {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 0;
  width: calc(100% - 4px);
  height: 4px;
  overflow: visible;
  clip-path: inset(-2px 0 -2px 0);
  animation: stitch-in 0.9s ease-out 3.2s both;
}

.cta .stitch line {
  stroke: var(--gold);
  stroke-width: 2.4;
  stroke-dasharray: 5 3.6;
}

@keyframes stitch-in {
  from {
    clip-path: inset(-2px 100% -2px 0);
  }
  to {
    clip-path: inset(-2px 0 -2px 0);
  }
}

.cta:hover {
  color: var(--gold-light);
}

.cta:hover .stitch line {
  stroke: var(--gold-light);
  animation: stitch-crawl 1.1s linear infinite;
}

@keyframes stitch-crawl {
  to {
    stroke-dashoffset: -8.6;
  }
}

.cta:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 4px;
}

.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

/* Gallery placard, bottom-left corner. */
.placard {
  position: absolute;
  left: clamp(18px, 3vw, 44px);
  bottom: clamp(16px, 3vh, 36px);
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  animation: invite-rise 0.9s cubic-bezier(0.16, 1, 0.3, 1) 2.8s both;
}

#specimen-id,
.seed-word {
  color: var(--cream-soft);
}

/* The style name is the placard's quiet third truth — muted, like a medium
   line on a museum label ("oil on linen"). */
.placard-dot,
#style-word {
  color: var(--muted);
}

.noscript {
  position: absolute;
  top: 28px;
  inset-inline: 0;
  margin: 0 auto;
  max-width: 44ch;
  padding: 0 24px;
  text-align: center;
  font-size: clamp(1.02rem, 0.9rem + 0.7vw, 1.3rem);
  color: var(--muted);
}

@media (max-width: 640px) {
  .invite {
    bottom: max(11vh, 92px);
  }

  .cta {
    font-size: 1.3rem;
  }

  .placard {
    line-height: 1.6;
  }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  .invite,
  .placard,
  .cta .stitch {
    animation: none;
  }

  .cta:hover .stitch line {
    animation: none;
  }

  .glow {
    transition: none;
  }
}
