/* ==========================================================================
   چامه - Chaameh
   پژوهشکده شعر فارسی | Persian Poetry Research Institute
   Disputed Attribution Analysis System
   
   Design System v2.0 — Institutional, Modern, Scholarly
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties — Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Core palette — derived from logo */
  --deep-navy: #0F1C2E;
  --navy: #1A2D47;
  --navy-light: #243B5C;
  --slate: #3D4F65;
  
  --ivory: #FDFCFA;
  --cream: #F8F6F2;
  --parchment: #EDE9E1;
  --stone: #D4CFC5;
  
  --turquoise: #2BA4A0;
  --turquoise-bright: #38C4BF;
  --turquoise-dark: #1E8480;
  --turquoise-muted: rgba(43, 164, 160, 0.12);
  
  --gold: #C9A962;
  --gold-bright: #DBBD78;
  --gold-dark: #A68B42;
  --gold-muted: rgba(201, 169, 98, 0.15);
  
  /* Semantic */
  --text-primary: #1A1A1A;
  --text-secondary: #4A4A4A;
  --text-tertiary: #7A7A7A;
  --text-inverse: #FFFFFF;
  
  --bg-page: var(--ivory);
  --bg-elevated: #FFFFFF;
  --bg-sunken: var(--cream);
  
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.15);
  
  /* Shadows — layered depth */
  --shadow-xs: 0 1px 2px rgba(15, 28, 46, 0.04);
  --shadow-sm: 0 2px 4px rgba(15, 28, 46, 0.04), 0 1px 2px rgba(15, 28, 46, 0.06);
  --shadow-md: 0 4px 8px rgba(15, 28, 46, 0.04), 0 2px 4px rgba(15, 28, 46, 0.06);
  --shadow-lg: 0 12px 24px rgba(15, 28, 46, 0.06), 0 4px 8px rgba(15, 28, 46, 0.04);
  --shadow-xl: 0 24px 48px rgba(15, 28, 46, 0.08), 0 12px 24px rgba(15, 28, 46, 0.04);
  --shadow-glow: 0 0 0 1px var(--turquoise), 0 4px 16px rgba(43, 164, 160, 0.2);
  
  /* Typography */
  --font-display: 'Vazirmatn', 'IRANSans', 'Tahoma', 'Arial', system-ui, sans-serif;
  --font-body: 'Vazirmatn', 'IRANSans', 'Tahoma', 'Arial', system-ui, sans-serif;
  
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  --leading-tight: 1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.8;
  
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.02em;
  
  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  
  /* Layout */
  --container-max: 1280px;
  --header-height: 72px;
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;
  
  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-page);
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* Ensure all text elements use Persian font */
*, *::before, *::after {
  font-family: inherit;
}

/* Elegant background texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 20% 0%, var(--turquoise-muted), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, var(--gold-muted), transparent);
  pointer-events: none;
  z-index: -1;
}

/* Subtle Persian geometry watermark (very low opacity) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='240' height='240' viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23000000' stroke-opacity='0.07' stroke-width='1'%3E%3Cpath d='M120 18l30 30-30 30-30-30 30-30zM120 90l30 30-30 30-30-30 30-30zM120 162l30 30-30 30-30-30 30-30zM48 90l30 30-30 30-30-30 30-30zM192 90l30 30-30 30-30-30 30-30z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 240px 240px;
  opacity: 0.20;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: -2;
}

::selection {
  background: var(--turquoise);
  color: white;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
  line-height: var(--leading-relaxed);
}

a {
  color: var(--turquoise-dark);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--turquoise);
}

strong, b {
  font-weight: 600;
}

/* Digit styling for Persian numerals */
.digit {
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.03em;
}

/* --------------------------------------------------------------------------
   Layout Containers
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-8);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--space-12);
  }
}

/* --------------------------------------------------------------------------
   Header — Institutional, Bold, Refined
   -------------------------------------------------------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1.5px solid var(--border-subtle);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (min-width: 768px) {
  .header-inner {
    padding: 0 var(--space-8);
  }
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  text-decoration: none;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.brand:hover {
  opacity: 0.85;
}

.brand:focus {
  outline: none;
}

.brand:focus-visible {
  outline: 2px solid var(--turquoise);
  outline-offset: 4px;
  border-radius: var(--radius-md);
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--deep-navy);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand-tagline {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: var(--tracking-wide);
}

/* Navigation */
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-out);
}

.nav-link:hover {
  color: var(--turquoise-dark);
  border-color: var(--turquoise);
  background: var(--turquoise-muted);
}

.nav-link:focus {
  outline: none;
}

.nav-link:focus-visible {
  outline: 2px solid var(--turquoise);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(43, 164, 160, 0.15);
}

.nav-link svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

/* --------------------------------------------------------------------------
   Dashboard Container — Academic Tool Layout (No Hero)
   -------------------------------------------------------------------------- */
.dashboard-container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

@media (min-width: 768px) {
  .dashboard-container {
    padding: var(--space-10) var(--space-8);
  }
}

@media (min-width: 1024px) {
  .dashboard-container {
    padding: var(--space-12) var(--space-12);
  }
}

/* Legacy hero class - hidden */
.hero {
  display: none;
  position: relative;
  background: radial-gradient(1200px 700px at 80% 10%, rgba(43, 164, 160, 0.18), transparent 55%),
              radial-gradient(900px 560px at 15% 85%, rgba(201, 169, 98, 0.16), transparent 60%),
              radial-gradient(720px 520px at 55% 50%, rgba(255, 255, 255, 0.06), transparent 60%),
              linear-gradient(180deg, #0B1727 0%, #0F1C2E 55%, #0C1625 100%);
  color: var(--text-inverse);
  padding: var(--space-16) 0;
  overflow: hidden;
}

/* Ink-wash + manuscript texture */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(800px 500px at 70% 20%, rgba(43, 164, 160, 0.14), transparent 60%),
    radial-gradient(760px 520px at 20% 80%, rgba(201, 169, 98, 0.12), transparent 65%),
    linear-gradient(135deg, rgba(255,255,255,0.04), transparent 60%),
    url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M60 10l10 10-10 10-10-10 10-10zm0 40l10 10-10 10-10-10 10-10zm0 40l10 10-10 10-10-10 10-10zm-40-40l10 10-10 10-10-10 10-10zm80 0l10 10-10 10-10-10 10-10z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  mix-blend-mode: screen;
  opacity: 0.9;
  transform: translate3d(0,0,0) scale(1.02);
  animation: heroDrift 18s var(--ease-in-out) infinite alternate;
}

/* Subtle vignette + bottom glow */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 520px at 55% 55%, rgba(255,255,255,0.07), transparent 60%),
    radial-gradient(1000px 680px at 50% 120%, rgba(43,164,160,0.18), transparent 55%),
    radial-gradient(980px 620px at 70% 120%, rgba(201,169,98,0.16), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,0.20), rgba(0,0,0,0.38));
  opacity: 1;
  pointer-events: none;
}

.hero-shell {
  position: relative;
  z-index: 1;
  min-height: clamp(420px, 58vh, 640px);
  display: flex;
  align-items: center;
}

@media (min-width: 768px) {
  .hero {
    padding: var(--space-20) 0;
  }
}

.hero-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: clamp(var(--space-6), 5vw, var(--space-16));
  align-items: center;
}

.hero-copy {
  text-align: right;
  max-width: 680px;
}

/* Hero institute subtitle */
.hero-institute {
  margin-top: var(--space-3);
  margin-bottom: 0;
  font-size: clamp(1.1rem, 0.6vw + 1rem, 1.35rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
}

.hero-institute-reveal {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  animation: heroReveal 900ms var(--ease-out) forwards;
  animation-delay: 180ms;
}

.hero-poetic {
  font-style: normal;
  letter-spacing: 0.01em;
  color: rgba(255,255,255,0.78);
  border-right: 2px solid rgba(201,169,98,0.55);
  padding-right: var(--space-4);
}

.hero-title {
  margin: var(--space-6) 0 0;
  color: white;
  letter-spacing: -0.04em;
  font-weight: 900;
  font-size: clamp(3.5rem, 4vw + 2rem, 5.5rem);
  line-height: 1.05;
}

.hero-title-reveal {
  display: inline-block;
  position: relative;
  transform: translateY(10px);
  opacity: 0;
  filter: blur(0.3px);
  animation: heroReveal 900ms var(--ease-out) forwards;
}

.hero-title-reveal--sub {
  display: block;
  margin-top: var(--space-2);
  font-weight: 750;
  color: rgba(255,255,255,0.88);
  animation-delay: 120ms;
}

.hero-subtitle {
  margin-top: var(--space-8);
  font-size: clamp(1.1rem, 0.5vw + 1rem, 1.3rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  line-height: 2;
  max-width: 58ch;
  opacity: 0;
  transform: translateY(10px);
  animation: heroReveal 900ms var(--ease-out) forwards;
  animation-delay: 280ms;
}

.hero-kicker {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-6);
}

.hero-kicker-text {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.78);
}

.hero-kicker-sub {
  font-size: var(--text-xs);
  font-weight: 520;
  color: rgba(255,255,255,0.58);
  letter-spacing: 0.05em;
}

.hero-kicker-mark {
  display: inline-block;
  width: 54px;
  height: 2px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, rgba(56,196,191,0.0), rgba(56,196,191,0.85), rgba(201,169,98,0.75));
  box-shadow: 0 0 0 1px rgba(56,196,191,0.14), 0 12px 40px rgba(56,196,191,0.08);
  animation: heroShimmer 6.5s var(--ease-in-out) infinite;
}

.hero-divider {
  margin-top: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  opacity: 0;
  transform: translateY(6px);
  animation: heroReveal 900ms var(--ease-out) forwards;
  animation-delay: 340ms;
}

.hero-divider-line {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(255,255,255,0.0), rgba(255,255,255,0.22), rgba(56,196,191,0.28));
}

.hero-divider-line:last-child {
  background: linear-gradient(90deg, rgba(56,196,191,0.28), rgba(255,255,255,0.22), rgba(255,255,255,0.0));
}

.hero-divider-glyph {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, rgba(56,196,191,0.9), rgba(201,169,98,0.7));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.14), 0 10px 30px rgba(201,169,98,0.14);
  transform: rotate(45deg);
}

.hero-art {
  position: relative;
  width: min(440px, 36vw);
  justify-self: start;
  opacity: 0;
  transform: translateY(10px);
  animation: heroReveal 1100ms var(--ease-out) forwards;
  animation-delay: 180ms;
}

.hero-calligraphy {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  filter: drop-shadow(0 20px 50px rgba(0,0,0,0.35));
}

.hero-calligraphy svg {
  width: 100%;
  height: 100%;
}

.hero-calligraphy .c-halo {
  fill: rgba(255,255,255,0.03);
  filter: url(#soft);
}

.hero-calligraphy .c-stroke {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4.5;
  stroke-dasharray: 1100;
  stroke-dashoffset: 1100;
  opacity: 0.85;
  filter: url(#soft);
  animation: calligraphyWrite 2.6s var(--ease-out) forwards;
}

.hero-calligraphy .s1 { stroke: url(#inkA); stroke-width: 5.5; animation-delay: 220ms; }
.hero-calligraphy .s2 { stroke: url(#inkB); stroke-width: 4.4; animation-delay: 520ms; opacity: 0.65; }
.hero-calligraphy .s3 { stroke: rgba(255,255,255,0.28); stroke-width: 3.2; animation-delay: 820ms; opacity: 0.55; }
.hero-calligraphy .s4 { stroke: rgba(56,196,191,0.35); stroke-width: 3.0; animation-delay: 1040ms; opacity: 0.45; }
.hero-calligraphy .s5 { stroke: rgba(201,169,98,0.28); stroke-width: 3.0; animation-delay: 1220ms; opacity: 0.40; }

/* Nuqta (dots) */
.hero-calligraphy .c-dot {
  opacity: 0;
  transform-origin: center;
  animation: dotBloom 900ms var(--ease-out) forwards;
}
.hero-calligraphy .d1 { animation-delay: 980ms; fill: rgba(56,196,191,0.35); }
.hero-calligraphy .d2 { animation-delay: 1180ms; fill: rgba(201,169,98,0.32); }
.hero-calligraphy .d3 { animation-delay: 1320ms; fill: rgba(255,255,255,0.22); }

@keyframes calligraphyWrite {
  to { stroke-dashoffset: 0; }
}

@keyframes dotBloom {
  0% { opacity: 0; transform: scale(0.7); filter: blur(1px); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes heroReveal {
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes heroDrift {
  0% { transform: translate3d(0,0,0) scale(1.02); }
  100% { transform: translate3d(12px, -8px, 0) scale(1.04); }
}

@keyframes heroShimmer {
  0% { filter: saturate(1); opacity: 0.88; }
  50% { filter: saturate(1.2); opacity: 1; }
  100% { filter: saturate(1); opacity: 0.88; }
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .hero-art {
    width: min(420px, 86vw);
    justify-self: center;
    margin-top: var(--space-10);
  }
}

/* --------------------------------------------------------------------------
   Page Header (Inner Pages)
   -------------------------------------------------------------------------- */
.page-header {
  padding: var(--space-10) 0 var(--space-8);
}

.page-header-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .page-header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
  }
}

.page-title {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--deep-navy);
}

.page-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  flex-shrink: 0;
}

.back-btn:hover {
  color: var(--turquoise-dark);
  border-color: var(--turquoise);
  box-shadow: var(--shadow-glow);
  transform: translateX(2px);
}

.back-btn:focus {
  outline: none;
}

.back-btn:focus-visible {
  outline: 2px solid var(--turquoise);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(43, 164, 160, 0.15);
}

.back-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

/* --------------------------------------------------------------------------
   Stats Bar
   -------------------------------------------------------------------------- */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  color: var(--text-tertiary);
  font-weight: 500;
}

.stat-value {
  font-weight: 700;
  color: var(--turquoise-dark);
}

/* --------------------------------------------------------------------------
   Section Header — Elegant with Ornamental Divider
   -------------------------------------------------------------------------- */
.section-header {
  position: relative;
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-6);
}

.section-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, var(--turquoise), transparent);
  border-radius: var(--radius-full);
}

.section-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--deep-navy);
  margin-bottom: var(--space-3);
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.2em;
  margin-left: var(--space-3);
  background: linear-gradient(180deg, var(--turquoise), var(--gold));
  border-radius: var(--radius-full);
  vertical-align: middle;
  opacity: 0.7;
}

.section-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.8;
}

/* --------------------------------------------------------------------------
   Cards Grid
   -------------------------------------------------------------------------- */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }
}

/* --------------------------------------------------------------------------
   Group Card — Refined & Impactful
   -------------------------------------------------------------------------- */
.group-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-decoration: none;
  color: inherit;
  box-shadow: 
    var(--shadow-md),
    0 2px 0 rgba(255, 255, 255, 0.9) inset,
    0 -2px 0 rgba(0, 0, 0, 0.03) inset;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  transform: translateY(0);
  gap: var(--space-6);
}

/* Layered shadow effect for 3D depth */
.group-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 1.5px;
  background: linear-gradient(135deg, 
    rgba(43, 164, 160, 0.15) 0%,
    rgba(201, 169, 98, 0.1) 50%,
    rgba(43, 164, 160, 0.15) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

/* Gradient accent bar */
.group-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 0;
  background: linear-gradient(180deg, 
    var(--turquoise-bright) 0%,
    var(--turquoise) 50%,
    var(--gold) 100%);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(43, 164, 160, 0.4);
}

.group-card:hover {
  border-color: rgba(43, 164, 160, 0.3);
  box-shadow: 
    var(--shadow-xl),
    0 8px 24px rgba(15, 28, 46, 0.12),
    0 0 0 1px rgba(43, 164, 160, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  transform: translateY(-6px) scale(1.01);
}

.group-card:hover::before {
  opacity: 1;
}

.group-card:hover::after {
  height: 100%;
  box-shadow: 0 0 16px rgba(43, 164, 160, 0.5);
}

.group-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 2px solid var(--border-subtle);
  position: relative;
}

.group-card-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--turquoise), transparent);
  border-radius: var(--radius-full);
}

.group-id {
  font-size: var(--text-2xl);
  font-weight: 800;
  font-family: var(--font-body);
  color: var(--deep-navy);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.group-stats {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, 
    rgba(43, 164, 160, 0.08) 0%,
    rgba(201, 169, 98, 0.05) 100%);
  border: 1px solid rgba(43, 164, 160, 0.15);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Ownership Section */
.ownership-section {
  padding: var(--space-5) 0;
  background: linear-gradient(135deg, 
    rgba(43, 164, 160, 0.04) 0%,
    rgba(201, 169, 98, 0.02) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-5);
  border: 1px solid rgba(43, 164, 160, 0.1);
}

.ownership-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  font-weight: 500;
}

.ownership-header > span:first-child {
  color: var(--text-tertiary);
}

.ownership-poet {
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--turquoise-dark);
  font-size: var(--text-base);
}

.ownership-pct {
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--gold-dark);
  font-size: var(--text-base);
  margin-right: var(--space-2);
}

.progress-bar {
  height: 8px;
  background: var(--bg-sunken);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, 
    var(--turquoise-dark) 0%,
    var(--turquoise) 50%,
    var(--turquoise-bright) 100%);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
  box-shadow: 0 0 8px rgba(43, 164, 160, 0.4);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%);
  border-radius: var(--radius-full);
}

/* Poets Tags */
.poets-section {
  margin-top: 0;
}

.poets-label {
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.poets-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.poet-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  font-family: var(--font-body);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xs);
}

.poet-tag:hover {
  border-color: var(--turquoise);
  background: linear-gradient(135deg, 
    rgba(43, 164, 160, 0.08) 0%,
    rgba(43, 164, 160, 0.04) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.poet-tag-name {
  color: var(--text-primary);
  font-weight: 600;
}

.poet-tag-pct {
  color: var(--turquoise-dark);
  font-weight: 700;
  padding: var(--space-1) var(--space-2);
  background: linear-gradient(135deg, 
    rgba(43, 164, 160, 0.1) 0%,
    rgba(43, 164, 160, 0.15) 100%);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(43, 164, 160, 0.2);
}

/* Card Footer */
.group-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-secondary);
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-card:hover .group-card-footer {
  color: var(--turquoise-dark);
}

.card-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, 
    rgba(43, 164, 160, 0.1) 0%,
    rgba(43, 164, 160, 0.15) 100%);
  border: 1.5px solid rgba(43, 164, 160, 0.2);
  border-radius: 50%;
  color: var(--turquoise-dark);
  font-size: var(--text-lg);
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xs);
}

.group-card:hover .card-arrow {
  background: linear-gradient(135deg, 
    var(--turquoise) 0%,
    var(--turquoise-bright) 100%);
  color: white;
  border-color: var(--turquoise);
  transform: translateX(-6px) scale(1.1);
  box-shadow: var(--shadow-md), 0 0 12px rgba(43, 164, 160, 0.4);
}

.group-card:focus {
  outline: none;
}

.group-card:focus-visible {
  outline: 3px solid var(--turquoise);
  outline-offset: 3px;
  border-radius: var(--radius-xl);
}

/* --------------------------------------------------------------------------
   Mode Toggle — Modern Segmented Control
   -------------------------------------------------------------------------- */
.mode-toggle {
  display: inline-flex;
  background: var(--bg-sunken);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-8);
  position: relative;
  gap: 4px;
}

.mode-btn {
  position: relative;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-lg) - 2px);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  z-index: 1;
  white-space: nowrap;
}

.mode-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.5);
}

.mode-btn.active {
  color: var(--deep-navy);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(15, 28, 46, 0.08);
  transform: translateY(-1px);
}

.mode-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 164, 160, 0.2);
}

.mode-btn:focus-visible {
  outline: 2px solid var(--turquoise);
  outline-offset: 2px;
}

/* View Switching */
.views-container {
  position: relative;
}

.view-content {
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.view-content.hidden {
  display: none;
}

.view-content:not(.active):not(.hidden) {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.view-content.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Poem Card
   -------------------------------------------------------------------------- */
.poem-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  margin-bottom: var(--space-8);
  box-shadow: 
    var(--shadow-md),
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 -1px 0 rgba(0, 0, 0, 0.02) inset;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
  overflow: hidden;
}

.poem-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-2xl);
  padding: 1.5px;
  background: linear-gradient(135deg, 
    rgba(43, 164, 160, 0.12) 0%,
    rgba(201, 169, 98, 0.08) 50%,
    rgba(43, 164, 160, 0.12) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.poem-card:hover {
  box-shadow: 
    var(--shadow-xl),
    0 12px 32px rgba(15, 28, 46, 0.14),
    0 0 0 1px rgba(43, 164, 160, 0.15),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  border-color: rgba(43, 164, 160, 0.25);
  transform: translateY(-4px) scale(1.005);
}

.poem-card:hover::before {
  opacity: 1;
}

.poem-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: var(--space-6);
  position: relative;
}

.poem-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, var(--turquoise), transparent);
}

@media (min-width: 768px) {
  .poem-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}

.poem-info {
  flex: 1;
}

.poem-id {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.poem-poet {
  font-weight: 700;
  color: var(--turquoise-dark);
}

.poem-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gold-dark);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}

.poem-link:hover {
  color: var(--gold);
  text-decoration-color: var(--gold);
}

.poem-link:focus {
  outline: none;
}

.poem-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.poem-link svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.poem-link:hover svg {
  transform: translateX(-2px);
}

.poem-units-count {
  padding: var(--space-2) var(--space-4);
  background: var(--bg-sunken);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.poem-ownership {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
}

/* --------------------------------------------------------------------------
   Unit Card
   -------------------------------------------------------------------------- */
.units-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.unit-card {
  position: relative;
  background: var(--bg-sunken);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.6) inset;
  transform: translateY(0);
}

.unit-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, 
    rgba(43, 164, 160, 0.08) 0%,
    rgba(201, 169, 98, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.unit-card:hover {
  border-color: rgba(43, 164, 160, 0.3);
  box-shadow: 
    var(--shadow-md),
    0 4px 12px rgba(15, 28, 46, 0.08),
    0 0 0 1px rgba(43, 164, 160, 0.15),
    0 1px 0 rgba(255, 255, 255, 0.7) inset;
  transform: translateY(-2px);
  background: var(--bg-elevated);
}

.unit-card:hover::before {
  opacity: 1;
}

.unit-header {
  margin-bottom: var(--space-4);
}

.unit-index {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.unit-text {
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 2.2;
  color: var(--text-primary);
  padding: var(--space-5);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border-right: 4px solid var(--turquoise);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-xs);
}

/* --------------------------------------------------------------------------
   Data Table — Professional with Sticky Header & Zebra Rows
   -------------------------------------------------------------------------- */
.table-wrapper {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  margin: 0 calc(-1 * var(--space-2));
  padding: 0 var(--space-2);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
  background: var(--bg-elevated);
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-elevated);
}

.data-table thead th {
  text-align: right;
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--deep-navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--turquoise);
  background: linear-gradient(180deg, 
    var(--bg-elevated) 0%,
    rgba(43, 164, 160, 0.03) 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.data-table tbody tr {
  transition: background var(--duration-fast) var(--ease-out);
}

/* Zebra striping */
.data-table tbody tr:nth-child(even) {
  background: var(--bg-sunken);
}

.data-table tbody tr:nth-child(odd) {
  background: var(--bg-elevated);
}

.data-table tbody tr:hover {
  background: rgba(43, 164, 160, 0.08) !important;
  transform: translateX(-2px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top row highlight */
.data-table tbody tr:first-child {
  background: linear-gradient(90deg, var(--turquoise-muted), var(--bg-elevated)) !important;
}

.data-table tbody tr:first-child:hover {
  background: linear-gradient(90deg, rgba(43, 164, 160, 0.16), rgba(43, 164, 160, 0.06)) !important;
}

.data-table tbody td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody tr:first-child td {
  font-weight: 600;
  color: var(--text-primary);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .poet-name {
  color: var(--text-primary);
  font-weight: 500;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.data-table .highest-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, var(--turquoise), var(--turquoise-dark));
  color: white;
  border-radius: 50%;
  font-size: var(--text-xs);
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(43, 164, 160, 0.3);
  flex-shrink: 0;
}

.data-table .prob-value-cell {
  position: relative;
  min-width: 120px;
}

.data-table .prob-bar-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.data-table .prob-bar {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
    rgba(43, 164, 160, 0.15) 0%,
    rgba(43, 164, 160, 0.25) 100%);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

.data-table .row-highest .prob-bar {
  background: linear-gradient(90deg, 
    rgba(43, 164, 160, 0.25) 0%,
    rgba(43, 164, 160, 0.35) 100%);
}

.data-table .prob-value {
  position: relative;
  z-index: 1;
  color: var(--deep-navy);
  font-weight: 600;
  font-family: var(--font-body);
  font-feature-settings: "tnum" 1;
}

.data-table .row-highest .prob-value {
  color: var(--turquoise-dark);
  font-weight: 700;
}

.data-table .pct-value-cell {
  text-align: left;
}

.data-table .pct-value {
  color: var(--turquoise-dark);
  font-weight: 600;
  font-family: var(--font-body);
  font-feature-settings: "tnum" 1;
}

.data-table .pct-highest {
  color: var(--turquoise-dark);
  font-weight: 700;
  font-size: var(--text-base);
  position: relative;
  padding: var(--space-1) var(--space-3);
  background: linear-gradient(135deg, 
    rgba(43, 164, 160, 0.1) 0%,
    rgba(43, 164, 160, 0.15) 100%);
  border-radius: var(--radius-full);
  display: inline-block;
  border: 1.5px solid rgba(43, 164, 160, 0.3);
}

.data-table .row-highest {
  background: linear-gradient(90deg, 
    rgba(43, 164, 160, 0.08) 0%,
    rgba(43, 164, 160, 0.03) 50%,
    transparent 100%) !important;
  border-right: 3px solid var(--turquoise);
}

.data-table .row-highest:hover {
  background: linear-gradient(90deg, 
    rgba(43, 164, 160, 0.16) 0%,
    rgba(43, 164, 160, 0.08) 50%,
    rgba(43, 164, 160, 0.04) 100%) !important;
  border-right-color: var(--turquoise-bright);
}

.data-table .row-highest td {
  border-bottom-color: rgba(43, 164, 160, 0.2);
}

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--text-tertiary);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state p {
  font-size: var(--text-base);
}

/* --------------------------------------------------------------------------
   Footer — Institutional
   -------------------------------------------------------------------------- */
.footer {
  background: var(--deep-navy);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--space-10) 0;
  margin-top: var(--space-16);
}

.footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: right;
    padding: 0 var(--space-8);
  }
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.footer-logo {
  width: 36px;
  height: 36px;
  opacity: 0.9;
}

.footer-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: white;
}

.footer-tagline {
  font-size: var(--text-xs);
  opacity: 0.6;
}

.footer-text {
  font-size: var(--text-sm);
  opacity: 0.7;
}

.footer-text a {
  color: var(--turquoise-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeInUp 0.6s var(--ease-out) both;
}

.slide-in {
  animation: slideInRight 0.6s var(--ease-out) both;
}

/* Stagger for cards */
.cards-grid .group-card {
  opacity: 0;
  animation: fadeInUp 0.5s var(--ease-out) forwards;
}

.cards-grid .group-card:nth-child(1) { animation-delay: 0.05s; }
.cards-grid .group-card:nth-child(2) { animation-delay: 0.1s; }
.cards-grid .group-card:nth-child(3) { animation-delay: 0.15s; }
.cards-grid .group-card:nth-child(4) { animation-delay: 0.2s; }
.cards-grid .group-card:nth-child(5) { animation-delay: 0.25s; }
.cards-grid .group-card:nth-child(6) { animation-delay: 0.3s; }
.cards-grid .group-card:nth-child(n+7) { animation-delay: 0.35s; }

/* --------------------------------------------------------------------------
   Responsive Fine-tuning
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  :root {
    --header-height: 64px;
  }
  
  .brand-logo {
    width: 44px;
    height: 44px;
  }
  
  .brand-name {
    font-size: var(--text-xl);
  }
  
  .dashboard-container {
    padding: var(--space-6) var(--space-4);
  }
  
  .section-title {
    font-size: var(--text-xl);
  }
  
  .section-header {
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-5);
  }
  
  .poem-card {
    padding: var(--space-5);
    border-radius: var(--radius-xl);
  }
  
  .unit-text {
    font-size: var(--text-lg);
    padding: var(--space-4);
  }
  
  .data-table {
    font-size: var(--text-xs);
  }
  
  .data-table thead th,
  .data-table tbody td {
    padding: var(--space-3) var(--space-3);
  }
  
  .table-wrapper {
    margin: 0 calc(-1 * var(--space-1));
    padding: 0 var(--space-1);
  }
}

/* --------------------------------------------------------------------------
   Reduced Motion (Accessibility)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  .header,
  .footer,
  .mode-toggle,
  .back-btn,
  .nav-link {
    display: none !important;
  }
  
  body {
    background: white;
  }
  
  body::before {
    display: none;
  }
  
  .group-card,
  .poem-card,
  .unit-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0; }
