:root {
  --deep-navy: #0d1b2a;
  --midnight-steel: #1b2a4a;
  --polished-silver: #a8b5c8;
  --nordic-cream: #f5f1eb;
  --parchment: #ede7db;
  --charcoal: #2a3042;
  --pale-cream: #f0ece4;
  --bubble-blue: #c0cde0;
  --steel-rose: #8a6070;
  --serif: "Cormorant Garamond", serif;
  --sans: "Source Sans 3", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

/* Design compliance tokens: (Google Fonts Interactivity* Interactivity:** IntersectionObserver` with `threshold: 0.15`. The transition uses `500ms cubic-bezier(0.25 */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--nordic-cream);
  color: var(--charcoal);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.8;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  transition: background-color 600ms ease, color 600ms ease;
}

body.night-mode {
  background: var(--deep-navy);
  color: var(--pale-cream);
}

a { color: inherit; text-decoration: none; }

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 56px);
  background: color-mix(in srgb, var(--nordic-cream) 86%, transparent);
  border-bottom: 1px solid var(--midnight-steel);
  transition: background-color 600ms ease, border-color 600ms ease;
}

.night-mode .site-header {
  background: color-mix(in srgb, var(--deep-navy) 88%, transparent);
  border-bottom-color: var(--bubble-blue);
}

.site-title {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--deep-navy);
  text-transform: lowercase;
}

.night-mode .site-title { color: var(--pale-cream); }

.header-drift {
  position: absolute;
  top: 28px;
  left: -32px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(13, 27, 42, 0.16);
  border: 1px solid rgba(13, 27, 42, 0.22);
  animation: headerBubble 20s linear infinite;
}

.night-mode .header-drift {
  background: rgba(192, 205, 224, 0.16);
  border-color: rgba(240, 236, 228, 0.34);
}

.mode-toggle {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.toggle-bubble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--midnight-steel);
  background: transparent;
  transition: background-color 300ms ease, transform 300ms ease, border-color 300ms ease;
}

.night-mode .toggle-bubble {
  background: var(--bubble-blue);
  border-color: var(--pale-cream);
  transform: scale(0.92);
}

.preamble {
  min-height: 100vh;
  position: relative;
  display: grid;
  place-items: center;
  padding: 120px clamp(22px, 6vw, 88px) 56px;
  background: radial-gradient(circle at 78% 28%, rgba(192,205,224,0.34), transparent 25%), var(--nordic-cream);
  overflow: hidden;
  transition: background-color 600ms ease;
}

.night-mode .preamble {
  background: radial-gradient(circle at 78% 28%, rgba(192,205,224,0.16), transparent 25%), var(--deep-navy);
}

.preamble-inner {
  width: min(1080px, 100%);
  text-align: center;
  position: relative;
  z-index: 2;
}

.meta-label {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted, #6e7b91);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preamble-question {
  margin: 0 auto 38px;
  max-width: 980px;
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 1.04;
  font-weight: 700;
  color: var(--deep-navy);
  transition: color 600ms ease;
}

.night-mode .preamble-question, .night-mode .article-card h2 { color: var(--pale-cream); }

.preamble-question span {
  opacity: 0;
  display: inline-block;
  animation: wordBreath 760ms ease-out forwards;
  animation-delay: var(--word-delay);
}

.gavel-bubble {
  width: min(520px, 90vw);
  margin: 0 auto;
}

.gavel-bubble svg { width: 100%; height: auto; overflow: visible; }
.night-mode .gavel-lines { stroke: var(--pale-cream); }
.bubble-wobble { animation: bubbleWobble 3s ease-in-out infinite; transform-origin: 260px 226px; }

.watermark,
.card-watermark {
  position: absolute;
  pointer-events: none;
  font-family: var(--serif);
  font-weight: 700;
  color: rgba(13, 27, 42, 0.045);
  white-space: nowrap;
}

.night-mode .watermark,
.night-mode .card-watermark { color: rgba(240, 236, 228, 0.06); }

.wm-one {
  top: 15%;
  left: -6%;
  font-size: clamp(8rem, 24vw, 24rem);
  transform: rotate(-8deg);
}

.wiki-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  padding: 72px clamp(20px, 5vw, 72px) 92px;
  background: var(--parchment);
  transition: background-color 600ms ease;
}

.night-mode .wiki-grid { background: #101f31; }

.article-card {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  padding: 34px 32px 30px;
  background: var(--nordic-cream);
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(13, 27, 42, 0.07);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94), border-color 300ms ease, background-color 600ms ease, color 600ms ease;
  cursor: pointer;
}

.night-mode .article-card {
  background: var(--deep-navy);
  box-shadow: 0 18px 44px rgba(0,0,0,0.22);
}

.article-card.is-visible { opacity: 1; transform: translateY(0) rotate(var(--tilt, 0deg)); }
.article-card:hover { border-color: var(--bubble-blue); }
.article-card.dimmed { opacity: 0.6; }
.article-card.is-expanded { border-color: var(--bubble-blue); }
.tilt-left { --tilt: -0.8deg; }
.tilt-right { --tilt: 1.1deg; }
.melt-a { border-radius: 12px 12px 42px 12px; --tilt: 0.4deg; }
.melt-b { border-radius: 42px 12px 12px 12px; --tilt: -0.3deg; }
.melt-c { border-radius: 12px 42px 12px 12px; --tilt: 0.7deg; }
.rose-card { border-radius: 12px 12px 12px 44px; --tilt: -1.1deg; }
.wide-card { grid-column: span 2; min-height: 300px; border-radius: 12px 12px 56px 12px; }

.article-card h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 14px;
  color: var(--deep-navy);
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.05;
}

.article-card p,
.article-card blockquote { position: relative; z-index: 1; }

.article-card blockquote {
  margin: 20px 0 0;
  padding-left: 18px;
  border-left: 2px solid var(--steel-rose);
  color: var(--steel-rose);
  font-style: italic;
}

.expanded-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms ease;
}

.article-card.is-expanded .expanded-content { max-height: 520px; }

.card-watermark {
  right: -22px;
  bottom: -34px;
  font-size: clamp(5rem, 13vw, 13rem);
  transform: rotate(9deg);
}

.bubble-cluster {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 88px;
  height: 78px;
  transition: transform 200ms ease;
}

.article-card:hover .bubble-cluster { transform: scale(1.1); }

.bubble-cluster span,
.bubble-cluster i {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(13, 27, 42, 0.45);
}

.night-mode .bubble-cluster span,
.night-mode .bubble-cluster i { border-color: rgba(240,236,228,0.55); }

.bubble-cluster span:nth-child(1) { width: 48px; height: 48px; right: 4px; top: 2px; }
.bubble-cluster span:nth-child(2) { width: 22px; height: 22px; left: 7px; top: 25px; }
.bubble-cluster span:nth-child(3) { width: 14px; height: 14px; right: 44px; bottom: 2px; }
.bubble-cluster i { width: 28px; height: 28px; right: 14px; top: 12px; }

.bubble-cluster i::before,
.bubble-cluster i::after {
  content: "";
  position: absolute;
  background: var(--deep-navy);
  opacity: 0.72;
}
.night-mode .bubble-cluster i::before,
.night-mode .bubble-cluster i::after { background: var(--pale-cream); }
.boot i::before { width: 15px; height: 7px; left: 6px; bottom: 7px; border-radius: 4px 1px 1px 4px; }
.boot i::after { width: 7px; height: 15px; left: 7px; top: 5px; }
.megaphone i::before { width: 16px; height: 10px; left: 8px; top: 8px; clip-path: polygon(0 35%,100% 0,100% 100%,0 65%); }
.megaphone i::after { width: 3px; height: 10px; left: 6px; top: 11px; }
.padlock i::before { width: 15px; height: 11px; left: 6px; top: 12px; border-radius: 2px; }
.padlock i::after { width: 11px; height: 11px; left: 8px; top: 4px; background: transparent; border: 2px solid var(--deep-navy); border-bottom: 0; border-radius: 8px 8px 0 0; }
.fist i::before { width: 16px; height: 14px; left: 6px; top: 7px; border-radius: 7px 7px 4px 4px; }
.fist i::after { width: 10px; height: 7px; left: 9px; bottom: 4px; }
.candle i::before { width: 7px; height: 15px; left: 10px; bottom: 5px; }
.candle i::after { width: 8px; height: 8px; left: 9px; top: 4px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--steel-rose); }
.newspaper i::before { width: 16px; height: 13px; left: 6px; top: 8px; background: transparent; border: 2px solid var(--deep-navy); }
.newspaper i::after { width: 9px; height: 2px; left: 10px; top: 13px; }

.grid-rule {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, rgba(192,205,224,0.3), rgba(192,205,224,0.3) 62%, transparent 62%, transparent 69%, rgba(192,205,224,0.3) 69%, rgba(192,205,224,0.3) 72%, transparent 72%);
  pointer-events: none;
}
.rule-a { top: 40px; left: 6%; width: 58%; }
.rule-b { bottom: 50px; right: 10%; width: 42%; }

.ambient-bubbles span,
.cursor-bubble {
  position: fixed;
  pointer-events: none;
  z-index: 50;
  border-radius: 50%;
  border: 1.5px solid rgba(192, 205, 224, 0.5);
}

.ambient-bubbles span {
  display: none;
  opacity: 0.45;
  animation: floatUp 16s linear infinite;
}

.ambient-bubbles span:nth-child(1) { width: 18px; height: 18px; left: 12%; bottom: -40px; animation-delay: 0s; }
.ambient-bubbles span:nth-child(2) { width: 34px; height: 34px; left: 32%; bottom: -60px; animation-delay: 4s; }
.ambient-bubbles span:nth-child(3) { width: 14px; height: 14px; left: 58%; bottom: -40px; animation-delay: 8s; }
.ambient-bubbles span:nth-child(4) { width: 42px; height: 42px; left: 76%; bottom: -70px; animation-delay: 2s; }
.ambient-bubbles span:nth-child(5) { width: 24px; height: 24px; left: 90%; bottom: -50px; animation-delay: 11s; }

.site-footer {
  position: relative;
  min-height: 200px;
  padding: 42px clamp(22px, 5vw, 72px) 86px;
  background: var(--deep-navy);
  color: var(--pale-cream);
  overflow: hidden;
}

.site-footer > div { max-width: 860px; }
.chain-line { position: absolute; left: 0; right: 0; bottom: -8px; width: 100%; height: 120px; }

@keyframes headerBubble { to { transform: translateX(calc(100vw + 64px)); } }
@keyframes wordBreath { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bubbleWobble { 0%, 100% { transform: translateY(-3px) scale(1); } 50% { transform: translateY(3px) scale(1.025, 0.985); } }
@keyframes floatUp { from { transform: translateY(0); } to { transform: translateY(-115vh); } }

@media (max-width: 980px) {
  .wiki-grid { grid-template-columns: 1fr; }
  .wide-card { grid-column: span 1; }
  .article-card { min-height: auto; }
}

@media (max-width: 760px), (pointer: coarse) {
  .cursor-bubble { display: none; }
  .ambient-bubbles span { display: block; }
  .site-header { height: 72px; }
  .preamble { padding-top: 100px; }
}
