/* =============================================================
   KEEPSAKE — landing page
   Aesthetic: deep night blue/black, warm amber window glow,
   muted teal and crimson accents, restrained and patient.
   ============================================================= */

:root {
  --night:        #0a0d14;
  --night-deep:   #060812;
  --ink:          #e8e4dc;
  --ink-soft:     #b8b4ac;
  --ink-muted:    #6e6a64;
  --amber:        #d8a256;
  --amber-glow:   #ffb866;
  --teal:         #4f7c7e;
  --teal-deep:    #2c4a4c;
  --crimson:      #b54235;
  --crimson-deep: #8a3327;
  --paper:        #ece8df;

  --serif:  "Cormorant Garamond", "Times New Roman", serif;
  --script: "Pinyon Script", "Allura", cursive;
  --sans:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ease-curtain: cubic-bezier(0.7, 0.04, 0.18, 1.0);
  --ease-soft:    cubic-bezier(0.33, 1, 0.68, 1);
}

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

html, body {
  background: var(--night-deep);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

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

a { color: var(--amber); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.3s ease; }
a:hover { border-color: var(--amber); }

::selection { background: var(--amber); color: var(--night-deep); }

/* =============================================================
   LOCK SCREEN — the lid
   ============================================================= */

.lock {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--night-deep);
  overflow: hidden;
}

/* SVG filter defs are positioned off-screen but still render to DOM. */
.svg-defs {
  position: absolute;
  width: 0; height: 0;
  pointer-events: none;
}

/* --burn drives the burned-out radius. Animating it cascades to the mask
   and ember radial-gradients so the hole + fire-ring move together. */
@property --burn {
  syntax: '<length>';
  inherits: true;
  initial-value: 0px;
}

.lock { --burn: 0px; }

.lid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* The "paper" — the cover image with a radial mask that opens from center. */
.lid-paper {
  position: absolute;
  inset: 0;
  background-image: url('assets/cover-portrait.jpg');
  background-size: cover;
  background-position: center 38%;
  background-color: var(--night-deep);
  background-repeat: no-repeat;
  -webkit-mask: radial-gradient(
    circle at 50% 50%,
    transparent 0px,
    transparent var(--burn),
    rgba(0,0,0,0.55) calc(var(--burn) + 6px),
    rgba(0,0,0,0.92) calc(var(--burn) + 22px),
    #000 calc(var(--burn) + 44px)
  );
          mask: radial-gradient(
    circle at 50% 50%,
    transparent 0px,
    transparent var(--burn),
    rgba(0,0,0,0.55) calc(var(--burn) + 6px),
    rgba(0,0,0,0.92) calc(var(--burn) + 22px),
    #000 calc(var(--burn) + 44px)
  );
}

/* Wider screens: use the 16:9 cover with full bleed */
@media (min-aspect-ratio: 1/1) {
  .lid-paper {
    background-image: url('assets/cover.jpg');
    background-size: cover;
  }
}

/* Charcoal char ring — thick BLACK band at the burn front, sits over the
   paper to hide the clean mask edge with a turbulence-jagged charred outline.
   Made deliberately wide so the char is the dominant feature of the burn. */
.lid-char {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
  background: radial-gradient(
    circle at 50% 50%,
    transparent 0,
    transparent calc(var(--burn) - 6px),
    rgba(0, 0, 0, 1)        calc(var(--burn) + 2px),
    rgba(5, 2, 1, 1)        calc(var(--burn) + 16px),
    rgba(15, 7, 3, 0.96)    calc(var(--burn) + 32px),
    rgba(30, 14, 6, 0.78)   calc(var(--burn) + 52px),
    rgba(45, 22, 10, 0.42)  calc(var(--burn) + 78px),
    rgba(55, 26, 12, 0.18)  calc(var(--burn) + 110px),
    transparent calc(var(--burn) + 150px)
  );
  filter: url(#char-edge);
  will-change: background, opacity;
}

/* Burning-paper ember — contained orange/red ring just outside the char.
   Sized small so the visual stays "paper edge on fire", not "fire pillar". */
.lid-ember {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  background: radial-gradient(
    circle at 50% 50%,
    transparent 0,
    transparent calc(var(--burn) - 6px),
    rgba(140, 30, 0, 0.7) calc(var(--burn) + 2px),
    rgba(255, 110, 20, 0.95) calc(var(--burn) + 8px),
    rgba(255, 200, 100, 1)   calc(var(--burn) + 14px),
    rgba(255, 130, 30, 0.85) calc(var(--burn) + 22px),
    rgba(120, 30, 0, 0.4) calc(var(--burn) + 36px),
    transparent calc(var(--burn) + 56px)
  );
  mix-blend-mode: screen;
  filter: url(#fire-flame);
  will-change: background, opacity, filter, transform;
}

/* Asymmetric flames licking UPWARD — a tall ellipse offset above center. */
.lid-flame-up {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  background: radial-gradient(
    ellipse 75% 145% at 50% 56%,
    transparent 0,
    transparent calc(var(--burn) - 18px),
    rgba(180, 40, 0, 0.7)  calc(var(--burn) - 6px),
    rgba(255, 140, 30, 1)  calc(var(--burn) + 6px),
    rgba(255, 220, 130, 1) calc(var(--burn) + 18px),
    rgba(255, 100, 20, 0.85) calc(var(--burn) + 40px),
    rgba(80, 16, 0, 0.45) calc(var(--burn) + 80px),
    transparent calc(var(--burn) + 140px)
  );
  mix-blend-mode: screen;
  filter: url(#fire-flame);
  will-change: background, opacity, filter, transform;
}

/* Smoke — wispy dark drift above and around the burn, biased upward. */
.lid-smoke {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 4;
  background: radial-gradient(
    ellipse 130% 220% at 50% 70%,
    transparent 0,
    transparent calc(var(--burn) + 30px),
    rgba(15, 8, 4, 0.55)  calc(var(--burn) + 80px),
    rgba(35, 18, 10, 0.32) calc(var(--burn) + 160px),
    rgba(45, 22, 12, 0.12) calc(var(--burn) + 240px),
    transparent calc(var(--burn) + 360px)
  );
  filter: url(#smoke-wisp);
  mix-blend-mode: multiply;
  will-change: background, opacity;
}

/* =============================================================
   LOCK UI — code entry
   ============================================================= */

.lock-ui {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 1.5rem max(env(safe-area-inset-bottom), 3rem);
  text-align: center;
  transition: opacity 600ms ease, transform 1400ms var(--ease-soft);
}

.lock-prompt {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
  text-shadow: 0 0 18px rgba(0,0,0,0.7);
  opacity: 0;
  animation: fadeUp 1400ms var(--ease-soft) 800ms forwards;
}

.code-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.code-cells {
  display: flex;
  gap: 0.65rem;
  opacity: 0;
  animation: fadeUp 1400ms var(--ease-soft) 1100ms forwards;
}

.cell {
  width: clamp(48px, 14vw, 64px);
  height: clamp(64px, 18vw, 84px);
  border: 1px solid rgba(216, 162, 86, 0.35);
  background:
    linear-gradient(180deg, rgba(20,16,10,0.78) 0%, rgba(8,6,4,0.85) 100%);
  border-radius: 4px;
  text-align: center;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  color: var(--amber-glow);
  outline: none;
  caret-color: transparent;
  transition:
    border-color 400ms ease,
    box-shadow   600ms ease,
    background   400ms ease,
    color        300ms ease;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.5),
    0 4px 18px rgba(0,0,0,0.6);
  -webkit-appearance: none;
  appearance: none;
}

.cell:focus {
  border-color: rgba(216, 162, 86, 0.7);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.5),
    0 0 0 2px rgba(216, 162, 86, 0.18),
    0 4px 18px rgba(0,0,0,0.6);
}

/* "Window lights up" when filled */
.cell.is-filled {
  background:
    radial-gradient(ellipse at 50% 60%, rgba(255,184,102,0.28) 0%, rgba(20,12,4,0.9) 75%);
  border-color: rgba(255,184,102,0.55);
  color: var(--amber-glow);
  box-shadow:
    inset 0 0 18px rgba(255,184,102,0.22),
    0 0 24px rgba(255,184,102,0.18),
    0 4px 18px rgba(0,0,0,0.6);
  text-shadow: 0 0 12px rgba(255,184,102,0.55);
}

/* Wrong code: shake + extinguish */
.code-cells.is-wrong {
  animation: shake 520ms var(--ease-soft);
}
.code-cells.is-wrong .cell {
  border-color: rgba(181, 66, 53, 0.6);
  box-shadow:
    inset 0 0 18px rgba(181,66,53,0.25),
    0 0 18px rgba(181,66,53,0.15),
    0 4px 18px rgba(0,0,0,0.6);
}

/* Correct code: cells brighten momentarily */
.code-cells.is-right .cell {
  border-color: rgba(255,200,140,0.95);
  background:
    radial-gradient(ellipse at 50% 60%, rgba(255,200,140,0.55) 0%, rgba(40,24,8,0.95) 80%);
  box-shadow:
    inset 0 0 28px rgba(255,200,140,0.45),
    0 0 38px rgba(255,200,140,0.3),
    0 4px 18px rgba(0,0,0,0.6);
  transition:
    border-color 800ms ease,
    background   800ms ease,
    box-shadow   800ms ease;
}

.lock-hint {
  min-height: 1.4em;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  transition: color 300ms ease;
  text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}
.lock-hint.is-error { color: var(--crimson); }

/* =============================================================
   UNLOCK ANIMATION — the box opens
   ============================================================= */

.lock.is-unlocking .lock-ui {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 400ms ease, transform 400ms ease;
  pointer-events: none;
}

/* The burn animation: hole grows from a spark, expands past the viewport edges.
   Keyframes give explicit timing — quick ignition, then a fast spread outward. */
@keyframes burnPaper {
  0%   { --burn: 0px; }
  15%  { --burn: 30px; }
  35%  { --burn: 90px; }
  55%  { --burn: 200px; }
  75%  { --burn: 380px; }
  100% { --burn: 800px; }
}
.lock.is-unlocking { animation: burnPaper 1400ms cubic-bezier(0.42, 0, 0.6, 1) forwards; }

.lock.is-unlocking .lid-ember {
  opacity: 1;
  transition: opacity 220ms ease-out;
  animation: emberFlicker 240ms ease-in-out infinite alternate;
}
.lock.is-unlocking .lid-char {
  opacity: 1;
  transition: opacity 180ms ease-out;
}
.lock.is-unlocking .lid-smoke {
  opacity: 1;
  transition: opacity 600ms ease-out 200ms;
}
/* Brief flash of the ember as it ignites */
.lock.is-unlocking .lid-paper { animation: paperHeat 1500ms ease-out forwards; }

.lock.is-open {
  pointer-events: none;
  opacity: 0;
  transition: opacity 500ms ease 100ms;
}

/* =============================================================
   THE SITE (revealed)
   ============================================================= */

.site {
  opacity: 0;
  transition: opacity 1200ms ease 400ms;
  display: block;
}
.site.is-visible {
  opacity: 1;
}

/* HERO */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.hero-image {
  position: absolute;
  inset: 0;
  background-image: url('assets/road.jpg');
  background-size: cover;
  background-position: center;
  filter: brightness(0.55) saturate(0.85) contrast(1.05);
  transform: scale(1.04);
  z-index: 0;
}
.hero-image::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(6,8,18,0) 0%, rgba(6,8,18,0.55) 70%, rgba(6,8,18,1) 100%),
    radial-gradient(ellipse at 50% 60%, transparent 0%, rgba(0,0,0,0.5) 100%);
}
.hero-content {
  position: relative;
  z-index: 1;
  padding: 2rem 1.5rem;
}
.wordmark {
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(3.4rem, 14vw, 7rem);
  line-height: 1;
  color: var(--ink);
  letter-spacing: 0.005em;
  text-shadow:
    0 2px 24px rgba(0,0,0,0.85),
    0 0 80px rgba(216,162,86,0.15);
  margin-bottom: 0.5rem;
}
.hero-tag {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-shadow: 0 1px 8px rgba(0,0,0,0.85);
}

.scroll-cue {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}
.scroll-cue span {
  display: block;
  width: 1px; height: 38px;
  background: linear-gradient(180deg, transparent 0%, rgba(232,228,220,0.8) 100%);
  animation: scrollPulse 2400ms ease-in-out infinite;
}

/* BLOCKS */
.block {
  padding: clamp(3.5rem, 8vw, 6rem) clamp(1.5rem, 5vw, 4rem);
  max-width: 1180px;
  margin: 0 auto;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 1.25rem;
}
.eyebrow-light { color: rgba(255,255,255,0.85); }

.block p {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2.4vw, 1.2rem);
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 1rem;
  font-weight: 400;
}
.block p:last-child { margin-bottom: 0; }

.block-image img {
  width: 100%;
  border-radius: 2px;
  filter: brightness(0.95) contrast(1.05);
}

/* LOGLINE — single, large, breathy */
.block-logline {
  text-align: center;
  padding-top: clamp(5rem, 11vw, 8rem);
  padding-bottom: clamp(3rem, 7vw, 5rem);
}
.block-logline .eyebrow { display: inline-block; }
.block-logline .logline {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.5rem, 4.5vw, 2.4rem);
  line-height: 1.35;
  color: var(--ink);
  max-width: 28ch;
  margin: 0 auto;
}

/* TWO-COLUMN BLOCKS */
.block-synopsis,
.block-feel,
.block-opportunity {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}
@media (min-width: 820px) {
  .block-synopsis,
  .block-feel,
  .block-opportunity {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
  }
}

/* DIRECTOR'S STATEMENT — crimson background, like deck slide 9 */
.block-statement {
  background: var(--crimson-deep);
  color: var(--ink);
  max-width: none;
  padding: clamp(4rem, 9vw, 6rem) clamp(1.5rem, 6vw, 6rem);
  margin: 0;
}
.block-statement p { color: rgba(255,255,255,0.92); max-width: 60ch; margin-left: auto; margin-right: auto; }
.block-statement .eyebrow { text-align: center; display: block; margin-bottom: 2rem; color: rgba(255,255,255,0.95); }
.signature {
  font-family: var(--serif) !important;
  font-style: italic;
  text-align: center;
  margin-top: 2.5rem !important;
  color: rgba(255,255,255,0.7) !important;
  font-size: 1rem !important;
}

/* TEAM */
.block-team .eyebrow { text-align: center; margin-bottom: 2.5rem; }
.team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 600px) {
  .team-grid { grid-template-columns: repeat(2, 1fr); gap: 2rem; }
}
@media (min-width: 1000px) {
  .team-grid { grid-template-columns: repeat(4, 1fr); gap: 2rem; }
}
.team-card {
  border-top: 1px solid rgba(232,228,220,0.18);
  padding-top: 1.5rem;
}
.team-card h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
  color: var(--ink);
}
.team-card .role {
  font-family: var(--sans) !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 1rem !important;
}
.team-card p {
  font-size: 0.95rem !important;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* FOOTER */
.foot {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  border-top: 1px solid rgba(232,228,220,0.12);
  margin-top: 3rem;
}
.foot-mark {
  font-family: var(--script);
  font-size: 2.6rem;
  color: var(--ink);
  margin-bottom: 1rem;
}
.foot-meta {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.foot-tiny {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 1.5rem;
}

/* =============================================================
   AUDIO TOGGLE
   ============================================================= */
.audio-toggle {
  position: fixed;
  right: 1rem;
  top: max(env(safe-area-inset-top), 1rem);
  z-index: 200;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(232,228,220,0.25);
  background: rgba(10,13,20,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: opacity 400ms ease, transform 200ms ease;
}
.audio-toggle[hidden] { display: none; }
.audio-toggle:hover { transform: scale(1.05); }
.audio-icon {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
  transition: background 300ms ease;
}
.audio-toggle.is-muted .audio-icon {
  background: var(--ink-muted);
  box-shadow: none;
}

/* =============================================================
   ANIMATIONS
   ============================================================= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-7px); }
  30%      { transform: translateX(6px); }
  45%      { transform: translateX(-5px); }
  60%      { transform: translateX(4px); }
  75%      { transform: translateX(-2px); }
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.2; transform: scaleY(0.6); transform-origin: top; }
  50%      { opacity: 1;   transform: scaleY(1); }
}
/* Paper warming up before/during the burn */
@keyframes paperHeat {
  0%   { filter: url(#fire-edge); }
  60%  { filter: url(#fire-edge) sepia(0.35) saturate(1.4) brightness(1.05); }
  100% { filter: url(#fire-edge) sepia(0.55) saturate(1.6) brightness(0.9); }
}
/* Ember flicker — gentle opacity/scale jitter on top of the SVG turbulence,
   tuned for a smouldering paper edge rather than chaotic blaze. */
@keyframes emberFlicker {
  0%   { opacity: 0.92; transform: scale(1.00); }
  35%  { opacity: 1.00; transform: scale(1.012); }
  70%  { opacity: 0.95; transform: scale(0.994); }
  100% { opacity: 0.98; transform: scale(1.005); }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 250ms !important;
  }
}

/* =============================================================
   CONTACT — attic door
   ============================================================= */

.block-contact {
  text-align: center;
  padding-top: clamp(4rem, 9vw, 6rem);
  padding-bottom: clamp(4rem, 9vw, 6rem);
}
.block-contact .eyebrow { display: inline-block; margin-bottom: 1.25rem; }

.contact-lede {
  font-family: var(--serif) !important;
  font-style: italic;
  font-size: clamp(1.05rem, 2.6vw, 1.25rem) !important;
  color: var(--ink-soft) !important;
  margin-bottom: 2.5rem !important;
  max-width: 32ch;
  margin-left: auto !important;
  margin-right: auto !important;
  line-height: 1.55;
}

/* ATTIC DOOR — old farmhouse attic. Dark stained vertical planks, iron
   hinges on the left, brass knob + keyhole. Click to creak open and reveal
   a candlelit interior + the message below. */
.attic-door {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--sans);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  transition: transform 400ms var(--ease-soft);
}
.attic-door:hover { transform: translateY(-2px); }
.attic-door:focus-visible { outline: 2px solid var(--amber); outline-offset: 16px; border-radius: 6px; }

/* The scene — wraps the door in horizontal-log attic walls so the door
   reads as embedded in an attic, not floating in dark space. */
.door-scene {
  position: relative;
  display: block;
  width: 220px;
  height: 240px;
  border-radius: 3px;
  /* Horizontal log-wall planking around the door */
  background:
    /* dark log seam shadows */
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 22px,
      rgba(0,0,0,0.55) 22px,
      rgba(0,0,0,0.55) 24px
    ),
    /* subtle horizontal grain */
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.025) 0,
      rgba(255,255,255,0.025) 1px,
      transparent 1px,
      transparent 6px
    ),
    /* base wall color — slightly warmer than the door */
    linear-gradient(180deg, #3a261a 0%, #2c1d11 60%, #20140b 100%);
  box-shadow:
    0 22px 40px rgba(0,0,0,0.65),
    inset 0 0 0 1px rgba(0,0,0,0.5),
    inset 0 0 60px rgba(0,0,0,0.55);
  overflow: hidden;
}
/* Wall grain noise for an aged, rough plank look */
.door-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.6'/></svg>");
  mix-blend-mode: overlay;
  opacity: 0.4;
  pointer-events: none;
}

/* Frame is the doorway — recessed into the wall. The dark interior is what
   the door leaf reveals when it swings open. */
.door-frame {
  position: absolute;
  left: 50%;
  top: 14px;
  bottom: 14px;
  width: 140px;
  margin-left: -70px;
  perspective: 900px;
  perspective-origin: 50% 50%;
  border-radius: 3px 3px 2px 2px;
  background: linear-gradient(180deg, #150c06 0%, #1c1208 50%, #0d0904 100%);
  box-shadow:
    0 0 0 3px rgba(20, 12, 6, 0.85),
    inset 0 0 0 1px rgba(0,0,0,0.7),
    0 12px 22px rgba(0,0,0,0.55);
}

.door-interior {
  position: absolute;
  inset: 5px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(80, 40, 12, 0.18) 0%, rgba(6,4,2,1) 70%),
    linear-gradient(180deg, #050302 0%, #0a0604 100%);
  border-radius: 1px;
  overflow: hidden;
}
.door-interior::after {
  content: "";
  position: absolute;
  left: 50%; top: 60%;
  width: 80%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(255, 170, 70, 0.22) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 800ms ease 300ms;
}

/* The door leaf — many narrow vertical planks (~14px each), heavy grain. */
.door-leaf {
  position: absolute;
  inset: 5px;
  border-radius: 1px;
  background:
    /* tight plank seams (~14px wide) */
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 13px,
      rgba(0,0,0,0.7) 13px,
      rgba(0,0,0,0.7) 14px
    ),
    /* horizontal grain striations */
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.02) 0,
      rgba(255,255,255,0.02) 1px,
      transparent 1px,
      transparent 5px
    ),
    /* base wood color, slightly darker than wall */
    linear-gradient(180deg, #2e1d10 0%, #221408 50%, #170e05 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.6),
    inset 0 6px 14px rgba(0,0,0,0.45),
    inset 0 -6px 14px rgba(0,0,0,0.55),
    0 6px 14px rgba(0,0,0,0.5);
  transform-origin: 0% 50%;
  transform-style: preserve-3d;
  transition: transform 1100ms cubic-bezier(0.32, 0, 0.4, 1);
  backface-visibility: visible;
  z-index: 2;
}
.door-leaf::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
  mix-blend-mode: overlay;
  opacity: 0.45;
  pointer-events: none;
  border-radius: 1px;
}
.door-leaf::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 6%;
  bottom: 6%;
  width: 2px;
  background: transparent;
  transition: background 700ms ease;
  pointer-events: none;
}

/* Iron strap hinges — horizontal bands across the door face with a
   spear-shaped tip on the swing-side end and stud rivets along the length. */
.door-strap {
  position: absolute;
  left: 0;
  width: 86%;
  height: 12px;
  background:
    linear-gradient(180deg, #2a221a 0%, #100b06 60%, #0a0603 100%);
  /* spear-tip shape on the right (inner) end */
  clip-path: polygon(0 0, 100% 0, 100% 50%, calc(100% - 8px) 100%, 0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 1px rgba(0,0,0,0.6),
    0 1px 2px rgba(0,0,0,0.65);
  z-index: 3;
}
.door-strap-top { top: 16%; }
.door-strap-bot { bottom: 16%; }
/* Stud rivets — small dark dots along the strap */
.door-strap .stud {
  position: absolute;
  top: 50%;
  width: 4px; height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #5a4634 0%, #1c130a 65%, #08050300 100%);
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.6), 0 1px 1px rgba(0,0,0,0.5);
}
.door-strap .stud:nth-child(1) { left: 6px; }
.door-strap .stud:nth-child(2) { left: 26%; }
.door-strap .stud:nth-child(3) { left: 50%; }
.door-strap .stud:nth-child(4) { left: 74%; }

/* Vertical iron pull handle on the right side of the door */
.door-handle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 50px;
  border-radius: 3px;
  background:
    linear-gradient(90deg, #3a2e22 0%, #100a05 50%, #2a2118 100%);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.6);
  z-index: 4;
}
/* Top/bottom mounting plates */
.door-handle::before,
.door-handle::after {
  content: "";
  position: absolute;
  left: -3px;
  width: 12px;
  height: 4px;
  background: linear-gradient(180deg, #2a2218 0%, #100a05 100%);
  border-radius: 1px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.55);
}
.door-handle::before { top: -2px; }
.door-handle::after  { bottom: -2px; }

/* Small brass-rimmed keyhole — sits at the vertical mid-point of the door,
   slightly inset from the swing-side edge. */
.door-keyhole {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 9px; height: 13px;
  z-index: 4;
}
.door-keyhole::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #06030a;
  box-shadow: 0 0 0 1px rgba(216,162,86,0.5);
}
.door-keyhole::after {
  content: "";
  position: absolute;
  top: 5px; left: 50%;
  transform: translateX(-50%);
  width: 2px; height: 7px;
  background: #06030a;
  box-shadow: 0 0 0 1px rgba(216,162,86,0.5);
}

/* OPEN STATE: leaf swings inward on its left hinge, candlelight blooms,
   message slides up below. */
.attic-door.is-open .door-leaf {
  transform: rotateY(-78deg);
  filter: brightness(0.7);
}
.attic-door.is-open .door-leaf::after {
  background: linear-gradient(180deg, rgba(255,180,90,0) 0%, rgba(255,180,90,0.55) 50%, rgba(255,180,90,0) 100%);
}
.attic-door.is-open .door-interior::after { opacity: 1; }
.attic-door.is-open .door-cta { opacity: 0; transition: opacity 200ms ease; }

.attic-door.is-open + .envelope-message {
  margin-top: 1.5rem;
}

/* The revealed message */
.envelope-message {
  margin: 2.5rem auto 0;
  max-width: 36rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 600ms ease 300ms, transform 600ms var(--ease-soft) 300ms;
}
.envelope-message.is-revealed {
  opacity: 1;
  transform: translateY(0);
}
.envelope-message[hidden] { display: none; }

.message-greeting {
  font-family: var(--serif) !important;
  font-style: italic;
  color: var(--ink-soft) !important;
  font-size: 1.05rem !important;
  margin-bottom: 1rem !important;
}
.message-body {
  font-family: var(--serif) !important;
  font-size: 1.05rem !important;
  color: var(--ink) !important;
  line-height: 1.6;
  margin-bottom: 1.5rem !important;
}
.message-cta { margin-bottom: 1rem !important; }
.message-link {
  font-family: var(--sans) !important;
  font-size: 1rem !important;
  letter-spacing: 0.04em;
  color: var(--amber) !important;
  border-bottom: 1px solid rgba(216, 162, 86, 0.4) !important;
  padding-bottom: 2px;
}
.message-link:hover { border-bottom-color: var(--amber) !important; }
.message-sign {
  font-family: var(--serif) !important;
  font-style: italic;
  color: var(--ink-muted) !important;
  font-size: 0.9rem !important;
  margin-top: 1.5rem !important;
}
