/* ============================================
   MANIFEST PAGE STYLES
   Optimized for long-form reading
   ============================================ */

/* Base Overrides for Manifest */
body {
  background: #0a0a0f;
  color: var(--text, #fffdf7);
  line-height: 1.8;
  font-size: 18px;
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
}

/* Table of Contents */
.toc {
  background: linear-gradient(135deg, rgba(78, 168, 222, 0.08) 0%, rgba(199, 164, 91, 0.08) 100%);
  border: 2px solid rgba(199, 164, 91, 0.3);
  border-radius: 12px;
  padding: 2rem;
  margin: 0 0 4rem;
  position: sticky;
  top: 20px;
  z-index: 100;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(199, 164, 91, 0.3);
}

.toc-header h2 {
  font-size: 1.5rem;
  margin: 0;
  padding: 0;
  border: none;
  color: var(--accent, #c7a45b);
  letter-spacing: 0.05em;
}

.toc-header h2::after {
  display: none;
}

.toc-toggle {
  background: rgba(199, 164, 91, 0.2);
  border: 1px solid var(--accent, #c7a45b);
  color: var(--accent, #c7a45b);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  padding: 0;
  line-height: 1;
}

.toc-toggle:hover {
  background: var(--accent, #c7a45b);
  color: #0a0a0f;
  transform: scale(1.1);
}

.toc-list {
  list-style: none;
  counter-reset: toc-counter;
  padding: 0;
  margin: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  overflow: hidden;
  max-height: 1000px;
  opacity: 1;
}

.toc.collapsed .toc-list {
  max-height: 0;
  opacity: 0;
  margin: 0;
}

.toc-list > li {
  margin-bottom: 0.75rem;
  padding-left: 0;
}

.toc-list > li:last-child {
  margin-bottom: 0;
}

.toc-list a {
  color: var(--text, #fffdf7);
  text-decoration: none;
  display: block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-weight: 500;
  position: relative;
  padding-left: 2.5rem;
}

.toc-list > li {
  counter-increment: toc-counter;
}

.toc-list a::before {
  content: counter(toc-counter);
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  background: var(--accent, #c7a45b);
  color: #0a0a0f;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.toc-list a:hover {
  background: rgba(199, 164, 91, 0.15);
  transform: translateX(4px);
  color: var(--accent, #c7a45b);
}

.toc-list a:active {
  transform: translateX(2px);
}

/* TOC Active State */
.toc-list a.active {
  background: rgba(199, 164, 91, 0.2);
  color: var(--accent, #c7a45b);
  border-left: 3px solid var(--accent, #c7a45b);
}

/* Header */
header {
  margin-bottom: 6rem;
  text-align: center;
  padding-bottom: 3rem;
  border-bottom: 2px solid rgba(199, 164, 91, 0.2);
}

header h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1rem;
  color: var(--text, #fffdf7);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fffdf7 0%, #c7a45b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  color: var(--accent, #c7a45b);
  font-weight: 400;
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 1rem;
}

.meta {
  font-size: 0.95rem;
  color: var(--muted, #aba89f);
  line-height: 1.6;
  margin-top: 2rem;
}

/* Typography */
h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  margin-top: 6rem;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent, #c7a45b);
  color: var(--text, #fffdf7);
  font-weight: 700;
  letter-spacing: -0.01em;
  position: relative;
}

h2::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--glow, #4ea8de);
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  color: var(--accent, #c7a45b);
  font-weight: 600;
  letter-spacing: -0.01em;
}

h4 {
  font-size: 1.125rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text, #fffdf7);
  font-weight: 600;
}

p {
  margin-bottom: 1.5rem;
  color: var(--muted, #aba89f);
  line-height: 1.8;
}

p strong {
  color: var(--text, #fffdf7);
  font-weight: 600;
}

/* Lists */
ul, ol {
  margin-bottom: 2rem;
  padding-left: 2rem;
  color: var(--muted, #aba89f);
}

li {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

li::marker {
  color: var(--accent, #c7a45b);
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--accent, #c7a45b);
  padding: 1.5rem 2rem;
  margin: 3rem 0;
  background: rgba(199, 164, 91, 0.05);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text, #fffdf7);
  font-size: 1.25rem;
  line-height: 1.7;
  position: relative;
}

blockquote::before {
  content: '"';
  position: absolute;
  top: 0.5rem;
  left: -0.5rem;
  font-size: 4rem;
  color: var(--accent, #c7a45b);
  opacity: 0.2;
  font-family: Georgia, serif;
}

/* Law Sections */
.law-section {
  margin-top: 8rem;
  margin-bottom: 6rem;
  padding-top: 2rem;
  position: relative;
}

.law-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: -2rem;
  right: -2rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(199, 164, 91, 0.3), transparent);
}

.law-number {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent, #c7a45b);
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.5rem 1.5rem;
  background: rgba(199, 164, 91, 0.1);
  border-left: 4px solid var(--accent, #c7a45b);
  border-radius: 0 4px 4px 0;
}

.law-section h2 {
  margin-top: 1rem;
  padding-top: 0;
}

/* Synopsis Box */
.synopsis {
  background: rgba(78, 168, 222, 0.05);
  border: 1px solid rgba(78, 168, 222, 0.2);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0 3rem;
}

.synopsis h3 {
  margin-top: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--glow, #4ea8de);
  margin-bottom: 1.25rem;
}

.synopsis p {
  color: var(--text, #fffdf7);
  margin-bottom: 1rem;
}

.synopsis p:last-child {
  margin-bottom: 0;
}

/* Code Blocks */
pre {
  background: rgba(20, 20, 30, 0.8);
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 2rem;
  border-left: 4px solid var(--accent, #c7a45b);
}

code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--text, #fffdf7);
}

p code {
  background: rgba(199, 164, 91, 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--accent, #c7a45b);
  font-size: 0.9em;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  background: rgba(20, 20, 30, 0.5);
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
  font-weight: 600;
  color: var(--accent, #c7a45b);
  background: rgba(199, 164, 91, 0.1);
  border-bottom: 2px solid var(--accent, #c7a45b);
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

td {
  color: var(--muted, #aba89f);
}

tr:last-child td {
  border-bottom: none;
}

/* Special Sections */
section {
  margin-bottom: 4rem;
}

section:first-of-type {
  margin-top: 0;
}

/* Imperative Section */
.imperative {
  background: linear-gradient(135deg, rgba(199, 164, 91, 0.1) 0%, rgba(78, 168, 222, 0.1) 100%);
  border: 2px solid var(--accent, #c7a45b);
  border-radius: 12px;
  padding: 2.5rem;
  margin: 4rem 0;
  position: relative;
  overflow: hidden;
}

.imperative::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent, #c7a45b), var(--glow, #4ea8de));
}

.imperative h2 {
  margin-top: 0;
  color: var(--text, #fffdf7);
  border-bottom: none;
}

.imperative h2::after {
  display: none;
}

.imperative p {
  color: var(--text, #fffdf7);
  font-size: 1.05rem;
}

/* Anexa Sections */
section h2[id*="ANEXA"],
section h2:contains("ANEXA") {
  color: var(--glow, #4ea8de);
  border-bottom-color: var(--glow, #4ea8de);
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--accent, #c7a45b);
  color: #0a0a0f;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(199, 164, 91, 0.3);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(199, 164, 91, 0.5);
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent, #c7a45b), var(--glow, #4ea8de));
  z-index: 9999;
  transition: width 0.1s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 2rem 1.25rem 4rem;
  }

  header {
    margin-bottom: 4rem;
    padding-bottom: 2rem;
  }

  header h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  h2 {
    font-size: 1.5rem;
    margin-top: 4rem;
  }

  h3 {
    font-size: 1.25rem;
    margin-top: 2rem;
  }

  .law-section {
    margin-top: 5rem;
  }

  .law-section::before {
    left: -1.25rem;
    right: -1.25rem;
  }

  .synopsis {
    padding: 1.5rem;
  }

  blockquote {
    padding: 1.25rem 1.5rem;
    font-size: 1.125rem;
  }

  ul, ol {
    padding-left: 1.5rem;
  }

  table {
    font-size: 0.9rem;
  }

  th, td {
    padding: 0.75rem 1rem;
  }

  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }

  /* TOC Mobile Styles */
  .toc {
    position: relative;
    top: 0;
    padding: 1.5rem;
    margin: 0 0 3rem;
  }

  .toc-header h2 {
    font-size: 1.25rem;
  }

  .toc-list a {
    font-size: 0.95rem;
    padding: 0.4rem 0.75rem 0.4rem 2.25rem;
  }

  .toc-list a::before {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.7rem;
    left: 0.5rem;
  }

  /* Auto-collapse on mobile */
  .toc.collapsed {
    padding-bottom: 1.5rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }

  .container {
    padding: 1.5rem 1rem 3rem;
  }

  header h1 {
    font-size: 1.75rem;
  }

  .law-number {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
  }

  .imperative {
    padding: 1.5rem;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }

  .back-to-top,
  .reading-progress {
    display: none;
  }

  h2 {
    page-break-after: avoid;
  }

  .law-section {
    page-break-before: always;
  }

  blockquote {
    page-break-inside: avoid;
  }
}

/* Accessibility & Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* CTA Buttons Hover Effects */
.btn-protocol:hover,
.btn-manifest:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(199, 164, 91, 0.4);
}

.btn-protocol-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(78, 168, 222, 0.5);
}

/* Selection */
::selection {
  background: rgba(199, 164, 91, 0.3);
  color: var(--text, #fffdf7);
}

::-moz-selection {
  background: rgba(199, 164, 91, 0.3);
  color: var(--text, #fffdf7);
}

