/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2E1065;
  --secondary: #4C1D95;
  --accent: #6D28D9;
  --bg: #F0EFF5;
  --surface: #FFFFFF;
  --text: #1A0B3E;
  --muted: #8B85A0;
  --line: #D5D0E5;
  --heading-font: 'Playfair Display', Georgia, serif;
  --body-font: 'Inter', 'Segoe UI', sans-serif;
  --mono-font: 'JetBrains Mono', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--body-font);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* === HERO === */
.hero-section {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: url('./assets/generated/hero_bg.png') center/cover no-repeat;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(30,10,78,0.92) 0%, rgba(46,16,101,0.85) 40%, rgba(76,29,149,0.80) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  padding: 4rem 2rem;
}

.hero-badge {
  display: inline-block;
  background: rgba(109,40,217,0.3);
  border: 1px solid rgba(109,40,217,0.5);
  border-radius: 20px;
  padding: 0.3rem 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  color: #c4b5fd;
}

.hero-section h1 {
  font-family: var(--heading-font);
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: #ddd6fe;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.hero-authors p {
  font-size: 0.9rem;
  color: #c4b5fd;
  margin-bottom: 0.3rem;
}

.hero-affiliations {
  font-size: 0.8rem !important;
  color: #a78bfa !important;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  background: var(--accent);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(109,40,217,0.4);
}

.btn-secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #ddd6fe;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
}

/* === CONTENT SECTIONS === */
.content-section {
  padding: 4rem 0;
}

.alt-bg {
  background: #FFFFFF;
}

.content-section h2 {
  font-family: var(--heading-font);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.2rem;
  letter-spacing: -0.02em;
}

.content-section h3 {
  font-family: var(--heading-font);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--secondary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.content-section p {
  margin-bottom: 1rem;
  color: var(--text);
}

/* === ABSTRACT === */
.abstract-block {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
  border-left: 4px solid var(--accent);
  box-shadow: 0 2px 12px rgba(46,16,101,0.08);
}

.abstract-block p {
  font-size: 1.05rem;
}

/* === CARD GRID === */
.card-grid {
  display: grid;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.card-grid.four-col { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card-grid.three-col { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card-grid.two-col { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.limitation-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  border-left: 4px solid var(--accent);
  box-shadow: 0 2px 12px rgba(46,16,101,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.limitation-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46,16,101,0.12);
}

.card-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.limitation-card h4 {
  font-family: var(--body-font);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.limitation-card p {
  font-size: 0.9rem;
  color: var(--muted);
}

/* === LAYER CARDS === */
.layer-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  border-top: 4px solid var(--accent);
  box-shadow: 0 2px 12px rgba(46,16,101,0.08);
  transition: transform 0.2s;
}

.layer-card:hover { transform: translateY(-2px); }

.skill-layer { border-top-color: #a78bfa; }
.plugin-layer { border-top-color: #6D28D9; }
.watcher-layer { border-top-color: #2E1065; }

.layer-icon {
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
}

.layer-card h4 {
  font-family: var(--body-font);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.layer-card ul {
  list-style: none;
  margin-top: 0.8rem;
  padding: 0;
}

.layer-card li {
  font-size: 0.9rem;
  padding: 0.3rem 0;
  padding-left: 1.2rem;
  position: relative;
  color: var(--muted);
}

.layer-card li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* === TABLES === */
.table-container {
  overflow-x: auto;
  margin: 1.5rem 0;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(46,16,101,0.08);
}

.comparison-table thead th {
  background: var(--primary);
  color: #fff;
  padding: 0.8rem 1rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.comparison-table tbody td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}

.comparison-table tbody tr:nth-child(even) {
  background: #f9f8fc;
}

.comparison-table tbody tr:last-child td {
  border-bottom: none;
}

.highlight-row {
  background: #ede9fe !important;
  font-weight: 600;
}

.highlight-row td { color: var(--primary); }

.rating-low { color: #dc2626; font-weight: 600; }
.rating-med { color: #d97706; font-weight: 600; }
.rating-high { color: #059669; font-weight: 600; }

.check-yes { color: #059669; text-align: center; font-weight: 700; font-size: 1.1rem; }
.check-no { color: #dc2626; text-align: center; font-weight: 700; font-size: 1.1rem; }

/* === TAKEAWAY BOX === */
.takeaway-box {
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  border-left: 4px solid var(--accent);
}

.takeaway-box p {
  font-size: 1.05rem;
  color: var(--primary);
  margin-bottom: 0;
}

/* === FIGURES === */
.figure-block {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(46,16,101,0.08);
  margin: 1.5rem 0;
}

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

.figure-block figcaption {
  padding: 1rem 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.figure-grid {
  display: grid;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.figure-grid.two-col {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.figure-block.vulnerable {
  border: 2px solid #fca5a5;
}

.figure-block.protected {
  border: 2px solid #86efac;
}

/* === METRIC CARDS === */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.metric-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  border-top: 4px solid var(--accent);
  box-shadow: 0 2px 12px rgba(46,16,101,0.08);
}

.metric-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary);
  font-family: var(--heading-font);
  margin-bottom: 0.4rem;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--muted);
}

/* === BENEFIT LIST === */
.benefit-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.benefit-list li {
  padding: 0.8rem 0 0.8rem 2rem;
  position: relative;
  border-bottom: 1px solid var(--line);
}

.benefit-list li:last-child { border-bottom: none; }

.benefit-list li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  top: 0.8rem;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* === CONTRIBUTION LIST === */
.contribution-list {
  counter-reset: contribution;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.contribution-list li {
  counter-increment: contribution;
  padding: 0.8rem 0 0.8rem 2.5rem;
  position: relative;
  border-bottom: 1px solid var(--line);
}

.contribution-list li:last-child { border-bottom: none; }

.contribution-list li::before {
  content: counter(contribution);
  position: absolute;
  left: 0;
  top: 0.8rem;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

/* === REFERENCES === */
details {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 12px rgba(46,16,101,0.08);
}

details summary {
  cursor: pointer;
  font-family: var(--heading-font);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  padding: 0.5rem 0;
}

.reference-list {
  padding-left: 2rem;
  margin-top: 1rem;
}

.reference-list li {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.3rem 0;
  line-height: 1.5;
}

/* === THREAT TABLE === */
.threat-table td:first-child {
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.threat-table td {
  font-size: 0.85rem;
  vertical-align: top;
}

/* === RESULTS TABLE === */
.results-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

/* === FLECTO EXPLANATION CLASSES === */
.flecto-note,
.flecto-callout,
.flecto-card,
.flecto-panel {
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  margin: 1.5rem 0;
  position: relative;
}

.flecto-note::before,
.flecto-callout::before,
.flecto-card::before,
.flecto-panel::before {
  content: '\1F916 AI explanation';
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #60a5fa;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.5em;
}

.flecto-note {
  background: #f5f3ff;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
}

.flecto-callout {
  background: #ede9fe;
  border: 1px solid var(--line);
}

.flecto-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(46,16,101,0.06);
}

.flecto-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(46,16,101,0.08);
  padding: 1.5rem 2rem;
}

.flecto-note h4, .flecto-callout h4, .flecto-card h4, .flecto-panel h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.flecto-note p, .flecto-callout p, .flecto-card p, .flecto-panel p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.flecto-note ul, .flecto-callout ul, .flecto-card ul, .flecto-panel ul {
  padding-left: 1.2rem;
  margin: 0.5rem 0;
}

.flecto-note li, .flecto-callout li, .flecto-card li, .flecto-panel li {
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

/* === REVEAL ANIMATION === */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* === KATEX OVERRIDES === */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.5rem 0; }
.katex { font-size: 1.05em; }

/* === PRINT === */
@media print {
  .hero-bg, .hero-overlay { display: none; }
  .hero-section { min-height: auto; color: var(--text); background: #fff; }
  .hero-section h1 { color: var(--primary); text-shadow: none; }
  .btn { border: 1px solid var(--primary); color: var(--primary); }
  .reveal { opacity: 1; transform: none; }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .hero-section h1 { font-size: 1.8rem; }
  .hero-content { padding: 3rem 1.5rem; }
  .content-section { padding: 3rem 0; }
  .card-grid.four-col,
  .card-grid.three-col { grid-template-columns: 1fr; }
  .figure-grid.two-col { grid-template-columns: 1fr; }
  .metric-cards { grid-template-columns: 1fr; }
  .comparison-table { font-size: 0.8rem; }
}
