/* ============================================================
   SOMNIUM — Global Styles
   Lucid Bleed palette: void black → crimson → plum → mist
   ============================================================ */

/* ── FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&family=DM+Mono:ital,wght@0,300;0,400;1,300&family=Cinzel:wght@400;600&display=swap');

/* ── VARIABLES ── */
:root {
  --void:        #0d0010;
  --deep:        #1e0028;
  --deeper:      #160020;
  --crimson:     #c0003c;
  --red:         #e8004a;
  --plum:        #8b1a6b;
  --mist:        #f5e6ff;
  --mist2:       #d97ef5;
  --paper:       #f2e8d9;
  --paper-dark:  #e8d8c0;
  --ink:         #1a0a0a;

  --text:        #f5e6ff;
  --text-dim:    rgba(245,230,255,0.55);
  --text-dimmer: rgba(245,230,255,0.28);
  --text-faint:  rgba(245,230,255,0.12);

  --border:      rgba(245,230,255,0.07);
  --border-mid:  rgba(245,230,255,0.12);
  --border-red:  rgba(192,0,60,0.35);

  --nav-h:       60px;
  --sidebar-w:   300px;

  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;

  --font-display: 'Cinzel', serif;
  --font-body:    'Cormorant Garamond', serif;
  --font-mono:    'DM Mono', monospace;

  --transition:  0.2s ease;
  --transition-slow: 0.4s ease;
}

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--void);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-mono); cursor: pointer; }
input, textarea, select { font-family: var(--font-mono); }
ul, ol { list-style: none; }

/* ── NOISE TEXTURE ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.032'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9000;
  opacity: 0.5;
}

/* ── CUSTOM CURSOR ── */
.cursor {
  width: 7px; height: 7px;
  background: var(--crimson);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%,-50%);
  transition: width .15s, height .15s, background .15s;
}
.cursor-ring {
  width: 26px; height: 26px;
  border: 1px solid rgba(192,0,60,0.45);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%,-50%);
}
body:has(a:hover) .cursor,
body:has(button:hover) .cursor { width: 12px; height: 12px; background: var(--red); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-red); border-radius: 2px; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.s-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: rgba(13,0,16,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.s-nav-logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--crimson);
  letter-spacing: 0.14em;
  white-space: nowrap;
}
.s-nav-logo span {
  display: block;
  font-size: 9px;
  font-weight: 400;
  color: var(--text-dimmer);
  letter-spacing: 0.2em;
  margin-top: -2px;
  font-family: var(--font-mono);
}
.s-nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.s-nav-links a {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dimmer);
  transition: color var(--transition);
  position: relative;
  white-space: nowrap;
}
.s-nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1px;
  background: var(--crimson);
  transition: width 0.25s;
}
.s-nav-links a:hover, .s-nav-links a.active { color: var(--text); }
.s-nav-links a:hover::after, .s-nav-links a.active::after { width: 100%; }
.s-nav-right { display: flex; align-items: center; gap: 12px; }
.s-nav-btn {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dimmer);
  padding: 7px 18px;
  transition: all var(--transition);
}
.s-nav-btn:hover { border-color: var(--text-dimmer); color: var(--text); }
.s-nav-btn.primary { border-color: var(--crimson); color: var(--crimson); }
.s-nav-btn.primary:hover { background: var(--crimson); color: var(--mist); }
.s-nav-hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.s-mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: rgba(13,0,16,0.97);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 24px 40px;
  z-index: 499;
  flex-direction: column;
  gap: 20px;
}
.s-mobile-menu.open { display: flex; }
.s-mobile-menu a {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

/* ── PAGE WRAPPER ── */
.page-wrap { padding-top: var(--nav-h); min-height: 100vh; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.t-display {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}
.t-serif { font-family: var(--font-body); font-weight: 300; }
.t-mono  { font-family: var(--font-mono); font-weight: 300; }

.t-hero {
  font-family: var(--font-body);
  font-size: clamp(48px, 8vw, 96px);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.t-hero em { font-style: italic; color: var(--crimson); }

.t-title {
  font-family: var(--font-body);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 300;
  line-height: 1.05;
}
.t-title em { font-style: italic; color: var(--crimson); }

.t-subtitle {
  font-family: var(--font-body);
  font-size: clamp(16px, 2vw, 20px);
  font-style: italic;
  font-weight: 300;
  color: var(--text-dim);
  line-height: 1.6;
}

.t-eyebrow {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--crimson);
  display: flex;
  align-items: center;
  gap: 10px;
}
.t-eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px; height: 1px;
  background: var(--crimson);
}

.t-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dimmer);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 13px 32px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--crimson);
  color: var(--mist);
}
.btn-primary:hover { background: var(--red); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-mid);
}
.btn-ghost:hover { border-color: var(--text-dim); color: var(--text); }

.btn-outline-red {
  background: transparent;
  color: var(--crimson);
  border: 1px solid var(--border-red);
}
.btn-outline-red:hover { background: rgba(192,0,60,0.1); }

.btn-sm { padding: 8px 20px; font-size: 10px; }
.btn-lg { padding: 16px 48px; font-size: 12px; }
.btn-full { width: 100%; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--deep);
  border: 1px solid var(--border);
  transition: border-color var(--transition), background var(--transition);
}
.card:hover { border-color: var(--border-mid); }
.card-red { border-left: 3px solid var(--crimson); }
.card-plum { border-left: 3px solid var(--plum); }

.story-card-sm {
  background: var(--deep);
  border: 1px solid var(--border);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.story-card-sm::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--crimson);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}
.story-card-sm:hover { background: rgba(30,0,40,0.9); border-color: var(--border-red); }
.story-card-sm:hover::before { transform: scaleX(1); }

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 48px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.section-header .s-num {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-dimmer);
  letter-spacing: 0.15em;
}
.section-header .s-title {
  font-family: var(--font-body);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 300;
}
.section-header .s-title em { font-style: italic; color: var(--crimson); }
.section-header .s-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.section-header .s-action {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dimmer);
  transition: color var(--transition);
}
.section-header .s-action:hover { color: var(--crimson); }

/* ============================================================
   TAGS & BADGES
   ============================================================ */
.tag {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
}
.tag-red    { background: rgba(192,0,60,0.12); color: var(--crimson); border: 1px solid var(--border-red); }
.tag-plum   { background: rgba(139,26,107,0.15); color: var(--mist2); border: 1px solid rgba(139,26,107,0.3); }
.tag-void   { background: rgba(245,230,255,0.05); color: var(--text-dimmer); border: 1px solid var(--border); }
.tag-green  { background: rgba(0,200,100,0.1); color: #4dbb7a; border: 1px solid rgba(0,200,100,0.2); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 2px 8px;
}
.badge-crimson { background: var(--crimson); color: var(--mist); }
.badge-plum    { background: var(--plum); color: var(--mist); }

/* ── Status dots ── */
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.status-ongoing  { background: var(--crimson); animation: pulse 2s infinite; }
.status-complete { background: var(--plum); }
.status-hiatus   { background: rgba(245,230,255,0.3); }

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.s-input, .s-textarea, .s-select {
  width: 100%;
  background: rgba(245,230,255,0.03);
  border: 1px solid var(--border-mid);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px 16px;
  outline: none;
  transition: border-color var(--transition);
}
.s-input:focus, .s-textarea:focus, .s-select:focus { border-color: var(--crimson); }
.s-input::placeholder, .s-textarea::placeholder { color: var(--text-dimmer); font-style: italic; }
.s-textarea { resize: vertical; min-height: 100px; }
.s-select { appearance: none; }
.s-field { margin-bottom: 20px; }
.s-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dimmer);
  margin-bottom: 8px;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(13,0,16,0.9);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--deep);
  border: 1px solid var(--border-red);
  padding: 48px;
  width: 480px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(16px);
  transition: transform 0.3s;
}
.modal-overlay.open .modal-box { transform: translateY(0); }
.modal-close {
  position: absolute;
  top: 14px; right: 18px;
  background: none;
  border: none;
  color: var(--text-dimmer);
  font-size: 20px;
  cursor: pointer;
  transition: color var(--transition);
  line-height: 1;
}
.modal-close:hover { color: var(--crimson); }
.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--crimson);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.modal-sub { font-size: 11px; color: var(--text-dimmer); letter-spacing: 0.12em; margin-bottom: 32px; }
.modal-divider { text-align: center; font-size: 10px; color: var(--text-dimmer); letter-spacing: 0.2em; margin: 16px 0; }
.modal-toggle { font-size: 11px; color: var(--text-dimmer); text-align: center; margin-top: 16px; }
.modal-toggle button { background: none; border: none; color: var(--crimson); cursor: pointer; text-decoration: underline; font-size: 11px; font-family: var(--font-mono); }

/* ============================================================
   TABS
   ============================================================ */
.tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 14px 22px;
  background: transparent;
  border: none;
  color: var(--text-dimmer);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
  font-family: var(--font-mono);
}
.tab-btn:hover { color: var(--text-dim); }
.tab-btn.active { color: var(--crimson); border-bottom-color: var(--crimson); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   LOADING / SKELETON
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--deep) 25%, rgba(245,230,255,0.04) 50%, var(--deep) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   UTILITY
   ============================================================ */
.container { max-width: 1280px; margin: 0 auto; padding: 0 40px; }
.section { padding: 80px 40px; }
.section-sm { padding: 48px 40px; }
.divider { height: 1px; background: var(--border); margin: 32px 0; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.opacity-0   { opacity: 0; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
@keyframes spinSlow {
  to { transform: rotate(360deg); }
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes scrollLine {
  0%   { left: -100%; }
  100% { left: 100%; }
}

.anim-fade-up { animation: fadeUp 0.6s forwards; }
.anim-fade-in { animation: fadeIn 0.4s forwards; }

/* Staggered entry */
.stagger > * { opacity: 0; animation: fadeUp 0.5s forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.1s; }
.stagger > *:nth-child(2) { animation-delay: 0.2s; }
.stagger > *:nth-child(3) { animation-delay: 0.3s; }
.stagger > *:nth-child(4) { animation-delay: 0.4s; }
.stagger > *:nth-child(5) { animation-delay: 0.5s; }
.stagger > *:nth-child(6) { animation-delay: 0.6s; }

/* ============================================================
   NOTIFICATIONS TOAST
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--deep);
  border: 1px solid var(--border-red);
  padding: 14px 20px;
  font-size: 12px;
  color: var(--text-dim);
  min-width: 220px;
  max-width: 320px;
  animation: slideIn 0.3s forwards;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--crimson); flex-shrink: 0; }
.toast.success .toast-dot { background: #4dbb7a; }
.toast.info    .toast-dot { background: var(--mist2); }

/* ============================================================
   FOOTER
   ============================================================ */
.s-footer {
  padding: 48px 40px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 40px;
  align-items: start;
}
.s-footer-logo {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--crimson);
  letter-spacing: 0.14em;
  margin-bottom: 8px;
}
.s-footer-tagline { font-size: 11px; color: var(--text-dimmer); letter-spacing: 0.1em; font-style: italic; font-family: var(--font-body); }
.s-footer-col-title { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dimmer); margin-bottom: 16px; }
.s-footer-links { display: flex; flex-direction: column; gap: 10px; }
.s-footer-links a { font-size: 12px; color: var(--text-dim); transition: color var(--transition); }
.s-footer-links a:hover { color: var(--crimson); }
.s-footer-bottom {
  grid-column: 1/-1;
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.s-footer-copy { font-size: 10px; color: var(--text-dimmer); letter-spacing: 0.12em; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-bar { height: 2px; background: var(--border); border-radius: 1px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--crimson); border-radius: 1px; transition: width 0.6s ease; }
.progress-fill.plum { background: var(--plum); }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid var(--border-red);
  background: var(--deep);
  color: var(--crimson);
}
.avatar-sm { width: 32px; height: 32px; font-size: 11px; }
.avatar-md { width: 44px; height: 44px; font-size: 14px; }
.avatar-lg { width: 80px; height: 80px; font-size: 24px; }
.avatar-xl { width: 120px; height: 120px; font-size: 36px; }
.avatar-plum { border-color: rgba(139,26,107,0.5); color: var(--mist2); }

/* ============================================================
   READING PROGRESS BAR (top of page)
   ============================================================ */
#reading-progress {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  height: 2px;
  background: var(--crimson);
  z-index: 499;
  width: 0%;
  transition: width 0.1s;
  box-shadow: 0 0 8px rgba(192,0,60,0.6);
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .s-nav-links { display: none; }
  .s-nav-hamburger { display: flex; }
  .container, .section, .section-sm { padding-left: 20px; padding-right: 20px; }
  .section { padding-top: 56px; padding-bottom: 56px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .s-footer { grid-template-columns: 1fr; gap: 32px; }
  .s-footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
}
@media (max-width: 600px) {
  :root { --nav-h: 52px; }
  .s-nav { padding: 0 20px; }
  .s-nav-logo { font-size: 15px; }
  .s-nav-logo span { display: none; }
  .modal-box { padding: 32px 24px; }
  .btn { padding: 12px 24px; }
  .t-hero { font-size: clamp(36px, 10vw, 56px); }
}
