/* ===========================================================
   矛盾.ai — Museum of Machine Contradictions
   Sunset-warm neubrutalism × serif-revival opulence
   Palette:
     #f4ead6 vellum   | #0d0a08 ink black | #7a2418 oxblood
     #c8932b marigold | #3a1810 sunset deep| #e8c089 amber glow
     #a64428 terracotta| #1d4a4d teal patina
   =========================================================== */

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

:root {
  --vellum:    #f4ead6;
  --ink:       #0d0a08;
  --oxblood:   #7a2418;
  --marigold:  #c8932b;
  --sunset:    #3a1810;
  --amber:     #e8c089;
  --terracotta:#a64428;
  --teal:      #1d4a4d;
}

html { scroll-behavior: smooth; }

body {
  font-family: "Cormorant Garamond", Georgia, serif;
  color: var(--ink);
  background-color: var(--vellum);
  /* persistent grid-lines underlay painted on body, offset 7px (brutalist refusal to align) */
  background-image:
    linear-gradient(to right, rgba(13,10,8,0.14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(13,10,8,0.14) 1px, transparent 1px),
    linear-gradient(to right, rgba(13,10,8,0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(13,10,8,0.06) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: 7px 7px, 7px 7px, 0 0, 0 0;
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---------- pulse-attention heartbeat (the only ambient motion) ---------- */
@keyframes pulse-attn {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%      { opacity: 0.78; transform: scale(1.012); }
}
@keyframes pulse-attn-strong {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%      { opacity: 0.7;  transform: scale(1.03); }
}

/* ===================== FIXED CHROME ===================== */

/* grid underlay marker element kept for layering, body paints the grid */
.grid-underlay {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
}

/* sunset horizon bar pinned to viewport bottom */
.horizon {
  position: fixed; left: 0; bottom: 0;
  width: 100vw; height: 18vh;
  z-index: 1; pointer-events: none;
  background: linear-gradient(180deg,
      transparent 0%,
      rgba(58,24,16,0.0) 5%,
      var(--sunset) 25%,
      var(--oxblood) 55%,
      var(--marigold) 85%,
      var(--amber) 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border-top: 4px solid var(--ink);
}
.horizon__numeral {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(12rem, 30vh, 24rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px var(--vellum);
  text-stroke: 2px var(--vellum);
  letter-spacing: -0.02em;
  transform: translateY(8%);
  user-select: none;
  transition: opacity 0.5s ease;
  animation: pulse-attn 2.4s ease-in-out infinite;
}

/* ===================== HALLS ===================== */

main { position: relative; z-index: 2; }

.hall {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;             /* the only breathing room */
  padding-bottom: calc(18vh + 24px);
}

/* thick chiseled outer frame inset 24px from viewport edge */
.hall::before {
  content: "";
  position: absolute;
  inset: 24px;
  border: 8px solid var(--ink);
  pointer-events: none;
}

/* roman-numeral hall marker pinned top-left of frame */
.hall__marker {
  position: absolute;
  top: 44px; left: 48px;
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: 0.875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--vellum);
  padding: 0.35rem 0.75rem;
  border: 3px solid var(--ink);
  z-index: 4;
}

/* giant outlined floor numeral, anchored bottom-left, sinking into horizon */
.hall__floor-numeral {
  position: absolute;
  left: 36px; bottom: 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(12rem, 30vh, 24rem);
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 3px var(--ink);
  text-stroke: 3px var(--ink);
  letter-spacing: -0.02em;
  pointer-events: none;
  user-select: none;
  z-index: 1;
  transform: translateY(18%);
  animation: pulse-attn 2.4s ease-in-out infinite;
}

/* ===================== PORTICO (HALL I) ===================== */

.hall--portico { text-align: center; }

.portico { position: relative; z-index: 3; max-width: 92vw; }

.portico__wordmark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 0.92;
  animation: pulse-attn-strong 2.4s ease-in-out infinite;
}
.portico__glyphs {
  width: clamp(14rem, 38vw, 30rem);
  height: auto;
  display: block;
}
.portico__type {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(8rem, 22vw, 18rem);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-left: -0.08em;
  font-style: italic;
}
.portico__sub {
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: clamp(0.8rem, 1.4vw, 1rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--oxblood);
  margin-top: 2.5rem;
}
.portico__curatorial {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.65;
  max-width: 56ch;
  margin: 1.75rem auto 0;
  color: var(--ink);
  font-style: italic;
  border-top: 4px solid var(--ink);
  padding-top: 1.5rem;
}

/* ===================== BAND BETWEEN HALLS ===================== */

.band {
  width: 100vw;
  background: var(--ink);
  border-top: 4px solid var(--ink);
  border-bottom: 4px solid var(--ink);
  text-align: center;
  padding: 1.4rem 1rem;
  position: relative;
  z-index: 2;
}
.band__text {
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: clamp(1rem, 2.6vw, 1.6rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vellum);
  display: inline-block;
  animation: pulse-attn 2.4s ease-in-out infinite;
}

/* ===================== PLINTH ===================== */

.plinth {
  background: var(--vellum);
  border: 6px solid var(--ink);
  box-shadow: 16px 16px 0 0 var(--oxblood);
  width: min(60vw, 720px);
  min-height: min(55vh, 520px);
  margin: 0 auto;
  padding: 4rem 3rem 3.5rem;
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
}
.plinth--marigold { box-shadow: 16px 16px 0 0 var(--marigold); }
.plinth--oxblood  { box-shadow: 16px 16px 0 0 var(--oxblood); }
.plinth--narrow   { width: min(34vw, 380px); min-height: min(42vh, 380px); padding: 2.5rem 2rem; }
.plinth--tall     { min-height: min(62vh, 580px); }

/* secondary terracotta inner frame line */
.plinth::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(166,68,40,0.45);
  pointer-events: none;
}

/* spear+shield watermark at every plinth corner */
.plinth__watermark {
  position: absolute;
  bottom: -6px; right: -6px;
  width: 64px; height: auto;
  opacity: 0.18;
  transform: rotate(-7deg);
  pointer-events: none;
  z-index: 2;
}

/* ---------- artifacts ---------- */

.plinth__artifact {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-align: center;
  position: relative;
  z-index: 3;
}
.artifact__line { display: inline; }
.artifact__line--italic { font-style: italic; color: var(--oxblood); }

.artifact__loop-arrow {
  display: block;
  width: clamp(8rem, 20vw, 14rem);
  height: auto;
  margin: 1.5rem auto 0.5rem;
}
.artifact__caption-line {
  display: block;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: clamp(1rem, 1.8vw, 1.4rem);
  line-height: 1.4;
  color: var(--ink);
  margin-top: 0.75rem;
}

/* juxtaposition layout (hall III) */
.artifact--juxtapose {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 1.5rem;
  font-size: clamp(1.6rem, 3.6vw, 3rem);
}
.artifact__half { flex: 1; align-self: center; line-height: 1.05; }
.artifact__half--alt {
  font-style: italic;
  color: var(--terracotta);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
}
.artifact__divider {
  width: 6px;
  background: var(--oxblood);
  flex: 0 0 6px;
}

/* stacked / self-cancelling (hall VI) */
.artifact--stack { display: flex; flex-direction: column; gap: 0.4rem; }
.artifact__strike {
  font-style: italic;
  color: var(--oxblood);
  position: relative;
  display: inline-block;
  align-self: center;
}
.artifact__strike::after {
  content: "";
  position: absolute;
  left: -4%; right: -4%;
  top: 52%;
  height: 6px;
  background: var(--teal);
  transform: rotate(-1.5deg);
}

/* ---------- brass plate caption ---------- */

.brass-plate {
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--oxblood);
  background: var(--vellum);
  border: 3px solid var(--ink);
  border-left: 8px solid var(--oxblood);
  padding: 0.7rem 1rem;
  line-height: 1.7;
  position: relative;
  z-index: 3;
  /* one-shot fade-in via JS toggling .is-revealed */
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.brass-plate.is-revealed { opacity: 1; transform: translateY(0); }

/* ===================== PAIRED HALL (IV) ===================== */

.hall--paired .paired {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: nowrap;
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 96vw;
}
.contradiction-arrow {
  width: clamp(8rem, 18vw, 20rem);
  height: auto;
  flex: 0 0 auto;
  margin: 0 -1rem;
  z-index: 4;
}
.contradiction-arrow__path {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  transition: stroke-dashoffset 1.6s ease;
}
.contradiction-arrow.is-drawn .contradiction-arrow__path { stroke-dashoffset: 0; }

/* ===================== FINALE (VII) ===================== */

.hall--finale { }
.finale__close {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: clamp(1.05rem, 2vw, 1.5rem);
  line-height: 1.6;
  max-width: 56ch;
  text-align: center;
  margin: 2.5rem auto 0;
  color: var(--ink);
  border-top: 4px solid var(--ink);
  padding-top: 1.5rem;
  position: relative;
  z-index: 3;
  animation: pulse-attn 2.4s ease-in-out infinite;
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 880px) {
  .hall::before { inset: 12px; }
  .hall { padding: 12px; padding-bottom: calc(18vh + 12px); }
  .hall__marker { top: 24px; left: 26px; }
  .hall__floor-numeral { left: 14px; }
  .plinth { width: min(86vw, 560px); padding: 2.5rem 1.6rem 2.2rem; min-height: auto; }
  .hall--paired .paired { flex-direction: column; gap: 1rem; }
  .plinth--narrow { width: min(86vw, 480px); }
  .contradiction-arrow { transform: rotate(90deg); margin: -1rem 0; width: 8rem; }
  .portico__wordmark { flex-direction: column; }
  .portico__type { margin-left: 0; }
}
