/* ==========================================================================
   DEEP BLUE DODO LLC — Base Typography, Tokens & Reality Transition Primitives
   ========================================================================== */

@font-face {
  font-family: 'Instrument Serif';
  src: url('../assets/fonts/InstrumentSerif-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Serif';
  src: url('../assets/fonts/InstrumentSerif-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/JetBrainsMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Core Brand Chromatics */
  --klein: #002FA7;
  --klein-bright: #2563FF;
  --klein-glow: #4B8BFF;
  --amber: #E8A849;
  --lime: #B9FF4D;
  --cyan: #5CE1E6;
  --vermilion: #C83E2B;

  /* Quiet World (Vignelli Archival Daylight) */
  --paper: #F6F4EE;
  --paper-elevated: #FCFBF7;
  --ink: #111318;
  --ink-muted: #565B66;
  --ink-faint: #8A8E99;
  --rule: #DCD7CC;
  --rule-strong: #C2BCB0;

  /* Abyss World (2027 Cybernetic Wunderkammer) */
  --abyss: #030612;
  --abyss-deep: #02040B;
  --abyss-card: rgba(7, 15, 36, 0.72);
  --abyss-card-hover: rgba(11, 22, 54, 0.86);
  --abyss-border: rgba(88, 140, 255, 0.18);
  --abyss-border-strong: rgba(88, 140, 255, 0.42);
  --ice: #F2F5FC;
  --ice-muted: #9AA8C7;
  --ice-faint: #5F6F94;

  /* Typography (100% self-hosted — zero external CDN requests) */
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-editorial: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  background-color: var(--abyss);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.55;
  overflow-x: hidden;
  min-height: 100svh;
}

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

button,
input,
a {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--klein-bright);
  outline-offset: 3px;
}

/* World Visibility Management */
.world {
  display: none;
}

body[data-world="threshold"] .world--threshold {
  display: grid;
}

body[data-world="quiet"] {
  background-color: var(--paper);
  color: var(--ink);
}

body[data-world="quiet"] .world--quiet {
  display: block;
  animation: worldFadeIn 0.55s var(--ease-out-expo) both;
}

body[data-world="abyss"] {
  background-color: var(--abyss);
  color: var(--ice);
}

body[data-world="abyss"] .world--abyss {
  display: block;
  animation: worldFadeIn 0.65s var(--ease-out-expo) both;
}

@keyframes worldFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Reality Shift Curtain (Iris Wipe between Quiet & Abyss) */
.reality-curtain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  background: var(--klein);
  clip-path: circle(0% at var(--origin-x, 50%) var(--origin-y, 50%));
  transition: clip-path 0.62s var(--ease-out-expo), opacity 0.25s ease;
}

.reality-curtain.is-to-quiet {
  background: var(--paper);
}

.reality-curtain.is-to-abyss {
  background: radial-gradient(circle at center, #082069 0%, #030612 72%);
}

.reality-curtain.is-active {
  opacity: 1;
  clip-path: circle(150% at var(--origin-x, 50%) var(--origin-y, 50%));
}

.reality-curtain.is-leaving {
  opacity: 0;
  clip-path: circle(150% at var(--origin-x, 50%) var(--origin-y, 50%));
  transition: opacity 0.42s ease;
}

/* Screen-Reader & Skip Link */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 1200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--klein);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
}

.skip-link:focus {
  top: 16px;
}

/* Floating Copy Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(18px);
  z-index: 1100;
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.35s var(--ease-out-expo);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

body[data-world="quiet"] .toast {
  background: var(--ink);
  color: var(--paper);
}

body[data-world="abyss"] .toast,
body[data-world="threshold"] .toast {
  background: rgba(14, 34, 92, 0.94);
  border: 1px solid rgba(110, 160, 255, 0.45);
  color: var(--ice);
  backdrop-filter: blur(12px);
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Artwork Lightbox Modal */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 44px);
  background: rgba(2, 5, 15, 0.9);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s var(--ease-out-expo);
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox__panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.75fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
  max-width: 1120px;
  width: 100%;
  max-height: 90svh;
  padding: clamp(18px, 3vw, 32px);
  border-radius: 20px;
  background: rgba(6, 13, 32, 0.92);
  border: 1px solid rgba(90, 145, 255, 0.24);
  color: var(--ice);
  overflow-y: auto;
  transform: scale(0.96);
  transition: transform 0.36s var(--ease-out-expo);
}

.lightbox.is-open .lightbox__panel {
  transform: scale(1);
}

.lightbox__figure {
  margin: 0;
  display: flex;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  overflow: hidden;
}

.lightbox__img {
  max-height: 74svh;
  width: auto;
  object-fit: contain;
}

.lightbox__meta {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lightbox__plate {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
}

.lightbox__title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  line-height: 1.05;
}

.lightbox__caption {
  margin: 0;
  color: var(--ice-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.lightbox__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(37, 99, 255, 0.16);
  border: 1px solid rgba(90, 145, 255, 0.45);
  color: var(--ice);
  font-size: 0.88rem;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox__link:hover {
  background: rgba(37, 99, 255, 0.32);
  transform: translateY(-1px);
}

.lightbox__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--ice);
  font-size: 1.1rem;
  transition: background 0.2s ease;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 820px) {
  .lightbox__panel {
    grid-template-columns: 1fr;
  }
  .lightbox__img {
    max-height: 50svh;
  }
}

/* Reduced Motion Respect */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
