@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Inter:wght@400;500;600&family=Space+Grotesk:wght@400;500;600&display=swap');

:root {

/* -----------------------------
   FONT TOKENS
----------------------------- */

--font-title: "Cinzel", serif;
--font-body: "Inter", sans-serif;
--font-button: "Space Grotesk", sans-serif;

/* -----------------------------
   COLOR SYSTEM (OKLCH)
   Cosmic Void Theme
----------------------------- */

/* Base surfaces */
--color-bg-0: oklch(8% 0.02 260);   /* deep void */
--color-bg-1: oklch(12% 0.03 260);  /* panels */
--color-bg-2: oklch(16% 0.04 260);  /* elevated */

/* Text */
--color-text-primary: oklch(92% 0.01 260);
--color-text-secondary: oklch(70% 0.02 260);
--color-text-muted: oklch(55% 0.02 260);

/* Accent — Arcane Cyan */
--color-accent: oklch(78% 0.19 210);
--color-accent-soft: oklch(65% 0.12 210);
--color-accent-glow: oklch(85% 0.22 210);

/* Borders */
--color-border-subtle: oklch(30% 0.03 260 / 0.4);
--color-border-strong: oklch(50% 0.05 260);

/* States */
--color-danger: oklch(65% 0.22 25);
--color-success: oklch(70% 0.18 150);

/* -----------------------------
   SPACING SCALE (fluid)
----------------------------- */

--space-xs: clamp(0.4rem, 0.3rem + 0.2vw, 0.6rem);
--space-sm: clamp(0.6rem, 0.5rem + 0.3vw, 0.9rem);
--space-md: clamp(1rem, 0.8rem + 0.4vw, 1.4rem);
--space-lg: clamp(1.6rem, 1.2rem + 0.6vw, 2.4rem);
--space-xl: clamp(2.4rem, 2rem + 1vw, 3.5rem);

/* -----------------------------
   TYPOGRAPHY SCALE
----------------------------- */

--text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.85rem);
--text-sm: clamp(0.9rem, 0.85rem + 0.2vw, 1rem);
--text-md: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
--text-lg: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem);
--text-xl: clamp(1.6rem, 1.3rem + 1vw, 2.2rem);
--text-hero: clamp(2.4rem, 1.8rem + 3vw, 4rem);

/* -----------------------------
   RADIUS
----------------------------- */

--radius-sm: 6px;
--radius-md: 12px;
--radius-lg: 18px;
--radius-pill: 999px;

/* -----------------------------
   SHADOW + GLOW
----------------------------- */

--shadow-elev-1:
  0 2px 10px oklch(0% 0 0 / 0.35);

--shadow-elev-2:
  0 10px 30px oklch(0% 0 0 / 0.5);

--glow-accent:
  0 0 6px var(--color-accent),
  0 0 18px var(--color-accent-soft);

/* -----------------------------
   MOTION
----------------------------- */

--ease-smooth: cubic-bezier(.22,.61,.36,1);
--duration-fast: 120ms;
--duration-mid: 240ms;
--duration-slow: 600ms;

/* -----------------------------
   LAYOUT WIDTH
----------------------------- */

--content-width: 72ch;
--wide-width: 1200px;

}

/* -----------------------------
   GLOBAL RESET + BASE
----------------------------- */

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

:where(html) {
  color-scheme: dark;
  hanging-punctuation: first last;
}

:where(body) {
  min-height: 100dvh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background: var(--color-bg-0);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
}

/* Remove default margins safely */
:where(h1, h2, h3, h4, p, figure, blockquote, dl, dd) {
  margin: 0;
}

/* Media defaults */
:where(img, picture, video, canvas, svg) {
  display: block;
  max-width: 100%;
}

/* Form elements inherit fonts */
:where(input, button, textarea, select) {
  font: inherit;
}

/* Page wrapper becomes a query container */
.page {
  container-type: inline-size;
  container-name: layout;
}

/* Example container query */
@container layout (min-width: 900px) {
  .main {
    padding: var(--space-xl);
  }
}

a {
  color: var(--color-accent);
  text-decoration: none;
  position: relative;
}

a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -2px;
  height: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-fast) var(--ease-smooth);
}

a:hover::after {
  transform: scaleX(1);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-accent-soft) var(--color-bg-1);
}

*::-webkit-scrollbar {
  width: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--color-bg-1);
}

*::-webkit-scrollbar-thumb {
  background: var(--color-accent-soft);
  border-radius: var(--radius-pill);
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto;
  }
}

p {
  color: var(--color-text-secondary);
  max-width: 70ch;
}

strong {
  color: var(--color-text-primary);
}

small {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* -----------------------------
   LAYOUT UTILITIES
----------------------------- */

.main {
  max-width: var(--wide-width);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

/* Panel component for cards */
.panel {
  background: var(--color-bg-1);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-elev-1);
}

/* -----------------------------
   HEADER
----------------------------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-md) 0;
  background: transparent;
  transition: background var(--duration-mid) var(--ease-smooth),
              backdrop-filter var(--duration-mid) var(--ease-smooth),
              box-shadow var(--duration-mid) var(--ease-smooth);
}

.site-header.scrolled {
  background: oklch(10% 0.02 260 / 0.8);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px oklch(0% 0 0 / 0.3);
}

.header-container {
  max-width: var(--wide-width);
  margin-inline: auto;
  padding-inline: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-title);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  text-decoration: none;
}

.site-logo::after {
  display: none;
}

.sigil-icon {
  width: 32px;
  height: 32px;
  color: var(--color-accent);
  filter: drop-shadow(0 0 8px var(--color-accent-soft));
}

.site-title {
  white-space: nowrap;
}

/* Navigation */
.main-nav {
  flex: 1;
}

.nav-list {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
  padding: 0;
  margin: 0;
  justify-content: center;
}

.nav-list a {
  font-family: var(--font-button);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-smooth);
}

.nav-list a::after {
  display: none;
}

.nav-list a:hover {
  color: var(--color-accent);
}

/* Account Button */
.btn-account {
  font-family: var(--font-button);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-primary);
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  text-decoration: none;
}

.btn-account::after {
  display: none;
}

.btn-account:hover {
  border-color: var(--color-accent);
  background: var(--color-bg-1);
  color: var(--color-accent);
}

/* Responsive Header */
@media (max-width: 768px) {
  .nav-list {
    gap: var(--space-md);
  }
  
  .site-title {
    display: none;
  }
}

@media (max-width: 600px) {
  .main-nav {
    display: none;
  }
}

/* -----------------------------
   HERO SECTION
----------------------------- */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
  overflow: hidden;
}

.hero-ambient {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 50%,
    oklch(12% 0.08 210 / 0.2) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.hero-sigil {
  width: clamp(120px, 20vw, 200px);
  height: clamp(120px, 20vw, 200px);
  color: var(--color-accent);
  filter: drop-shadow(var(--glow-accent));
  opacity: 0.9;
}

.hero-title {
  font-family: var(--font-title);
  font-size: var(--text-hero);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.hero-tagline {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 60ch;
  margin: 0;
}

/* -----------------------------
   BUTTONS
----------------------------- */

.btn-primary,
.btn-secondary {
  font-family: var(--font-button);
  font-size: var(--text-md);
  font-weight: 600;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--duration-mid) var(--ease-smooth);
  text-decoration: none;
  display: inline-block;
  border: none;
}

.btn-primary::after,
.btn-secondary::after {
  display: none;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-bg-0);
  box-shadow: var(--glow-accent);
}

.btn-primary:hover {
  background: var(--color-accent-glow);
  transform: translateY(-2px);
  box-shadow: 0 0 12px var(--color-accent),
              0 0 24px var(--color-accent-soft);
}

.btn-secondary {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.btn-secondary:hover {
  background: var(--color-accent);
  color: var(--color-bg-0);
  box-shadow: var(--glow-accent);
}

/* -----------------------------
   SECTION TITLES
----------------------------- */

.section-title {
  font-family: var(--font-title);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-primary);
  text-align: center;
  margin-bottom: var(--space-xl);
  letter-spacing: 0.02em;
}

/* -----------------------------
   LATEST CHAPTER SECTION
----------------------------- */

.latest-chapter {
  padding: var(--space-xl) 0;
  background: var(--color-bg-0);
}

.chapter-highlight {
  max-width: var(--content-width);
  margin-inline: auto;
}

.chapter-meta {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.chapter-number {
  font-weight: 600;
  color: var(--color-accent);
}

.chapter-title {
  font-family: var(--font-title);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-md);
}

.chapter-excerpt {
  margin-bottom: var(--space-lg);
  line-height: 1.8;
}

/* -----------------------------
   UNIVERSE PORTAL GRID
----------------------------- */

.universe-portals {
  padding: var(--space-xl) 0;
  background: var(--color-bg-0);
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.portal-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: all var(--duration-mid) var(--ease-smooth);
  cursor: pointer;
}

.portal-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-elev-2);
  border-color: var(--color-accent-soft);
}

.portal-icon {
  width: 48px;
  height: 48px;
  color: var(--color-accent);
  opacity: 0.8;
}

.portal-title {
  font-family: var(--font-title);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
}

.portal-description {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  flex: 1;
  margin: 0;
}

.portal-link {
  font-family: var(--font-button);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-accent);
  align-self: flex-start;
  transition: transform var(--duration-fast) var(--ease-smooth);
}

.portal-link:hover {
  transform: translateX(4px);
}

/* -----------------------------
   ABOUT PROJECT SECTION
----------------------------- */

.about-project {
  padding: var(--space-xl) 0;
  background: var(--color-bg-0);
}

.about-content {
  display: grid;
  gap: var(--space-xl);
  max-width: var(--content-width);
  margin-inline: auto;
}

.about-story h3,
.about-author h3 {
  font-family: var(--font-title);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-md);
}

.about-story p,
.about-author p {
  margin-bottom: var(--space-md);
}

.about-story p:last-child,
.about-author p:last-child {
  margin-bottom: 0;
}

@media (min-width: 900px) {
  .about-content {
    grid-template-columns: 2fr 1fr;
    max-width: var(--wide-width);
  }
}

/* -----------------------------
   FOOTER
----------------------------- */

.site-footer {
  padding: var(--space-xl) 0 var(--space-lg);
  background: var(--color-bg-1);
  border-top: 1px solid var(--color-border-subtle);
  margin-top: var(--space-xl);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer-copyright {
  margin: 0;
}

.footer-social {
  display: flex;
  gap: var(--space-lg);
}

.footer-social a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-smooth);
}

.footer-social a:hover {
  color: var(--color-accent);
}

/* -----------------------------
   TOAST NOTIFICATIONS
----------------------------- */

.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 2000;
}

.toast {
  background: var(--color-bg-1);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  box-shadow: var(--shadow-elev-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-width: 280px;
  max-width: 400px;
  animation: toastSlideIn 0.3s var(--ease-smooth);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-fade-out {
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s var(--ease-smooth);
}

.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast-error {
  border-left: 4px solid var(--color-danger);
}

.toast-info {
  border-left: 4px solid var(--color-accent);
}

.toast-content {
  font-size: var(--text-sm);
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.toast-close:hover {
  color: var(--color-text-primary);
}

@media (max-width: 600px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}
