@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
  --doc-paper: #EDE8E0;
  --doc-paper-dark: #E0D9CE;
  --doc-ink: #1C1917;
  --doc-ink-light: #44403C;
  --doc-red: #B91C1C;
  --doc-red-light: #DC2626;
  --doc-seal: #B91C1C;
  --doc-stamp: rgba(185, 28, 28, 0.12);
  --doc-border: #A8A29E;
  --doc-folder: #D4A574;
  --doc-folder-dark: #B8935F;
  --doc-highlight: #FEF3C7;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Crimson Text', Georgia, serif;
  background: #2C2420;
  color: var(--doc-ink);
  font-size: 17px;
  line-height: 1.75;
}

/* ===== TEXTURE OVERLAY ===== */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' 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.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ===== FOLDER CONTAINER ===== */
.doc-folder {
  max-width: 900px;
  margin: 2rem auto;
  background: var(--doc-folder);
  border-radius: 0 12px 12px 12px;
  padding: 0 6px 6px 0;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.5),
    0 0 0 1px rgba(0,0,0,0.2);
  position: relative;
}

.doc-folder::before {
  content: '';
  position: absolute;
  top: -24px;
  left: 0;
  width: 180px;
  height: 24px;
  background: var(--doc-folder-dark);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
}

/* ===== PAPER SHEET ===== */
.doc-paper {
  background: var(--doc-paper);
  padding: 3rem 3.5rem;
  position: relative;
  box-shadow:
    inset 0 0 80px rgba(139, 119, 91, 0.08),
    2px 2px 8px rgba(0,0,0,0.1);
}

/* ===== STAMP ===== */
.doc-stamp {
  display: inline-block;
  font-family: 'Courier Prime', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--doc-red);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.4rem 0.8rem;
  border: 2px solid var(--doc-red);
  transform: rotate(-4deg);
  opacity: 0.85;
  position: relative;
}

.doc-stamp::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--doc-stamp);
  z-index: -1;
}

/* ===== NAVBAR (membrete) ===== */
.doc-header {
  border-bottom: 2px solid var(--doc-ink);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.doc-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.doc-header-left img {
  width: 56px;
  height: 56px;
  border: 1px solid var(--doc-border);
  padding: 3px;
  background: white;
}

.doc-header-title {
  font-family: 'Courier Prime', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--doc-ink-light);
  line-height: 1.6;
}

.doc-header-title strong {
  font-size: 1.1rem;
  color: var(--doc-ink);
  letter-spacing: 0.05em;
}

.doc-stamp-header {
  transform: rotate(6deg);
  margin-top: 0.5rem;
}

/* ===== NAV TABS ===== */
.doc-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--doc-border);
  margin-bottom: 2.5rem;
  overflow-x: auto;
}

.doc-tabs a {
  font-family: 'Courier Prime', monospace;
  font-size: 0.72rem;
  color: var(--doc-ink-light);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.7rem 1.2rem;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
}

.doc-tabs a:hover,
.doc-tabs a.active {
  color: var(--doc-ink);
  border-bottom-color: var(--doc-red);
  background: rgba(185, 28, 28, 0.04);
}

/* ===== DOC META ===== */
.doc-meta {
  font-family: 'Courier Prime', monospace;
  font-size: 0.7rem;
  color: var(--doc-ink-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.doc-meta span::before {
  content: attr(data-label) ': ';
  font-weight: 700;
  color: var(--doc-ink);
}

/* ===== SECTION ===== */
.doc-section {
  margin-bottom: 3rem;
  position: relative;
}

.doc-section-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--doc-border);
  padding-bottom: 0.75rem;
}

.doc-section-num {
  font-family: 'Courier Prime', monospace;
  font-size: 0.65rem;
  color: var(--doc-red);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.doc-section h2 {
  font-family: 'Crimson Text', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--doc-ink);
  letter-spacing: -0.01em;
}

.doc-section p {
  margin-bottom: 1rem;
  text-align: justify;
  hyphens: auto;
}

/* ===== PHOTO EVIDENCE ===== */
.doc-photo {
  margin: 1.5rem 0;
  border: 1px solid var(--doc-border);
  padding: 8px;
  background: white;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.1);
  position: relative;
}

.doc-photo img {
  width: 100%;
  display: block;
  filter: sepia(15%) contrast(1.05);
}

.doc-photo-caption {
  font-family: 'Courier Prime', monospace;
  font-size: 0.6rem;
  color: var(--doc-ink-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.5rem;
  padding: 0.3rem 0;
  border-top: 1px solid var(--doc-border);
}

.doc-photo-stamp {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
}

/* ===== HIGHLIGHTED TEXT ===== */
.doc-highlight {
  background: var(--doc-highlight);
  padding: 0.1rem 0.2rem;
  border-bottom: 2px solid #FCD34D;
}

/* ===== BLOCKQUOTE ===== */
.doc-quote {
  margin: 1.5rem 0 1.5rem 2rem;
  padding-left: 1.5rem;
  border-left: 3px solid var(--doc-red);
  font-style: italic;
}

.doc-quote p {
  font-size: 1.05rem;
  text-align: left;
}

.doc-quote footer {
  font-family: 'Courier Prime', monospace;
  font-size: 0.65rem;
  font-style: normal;
  color: var(--doc-ink-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.5rem;
}

/* ===== SIDEBAR NOTE ===== */
.doc-note {
  float: right;
  width: 220px;
  margin: 0 0 1.5rem 1.5rem;
  padding: 1rem;
  background: white;
  border: 1px solid var(--doc-border);
  box-shadow: 2px 2px 6px rgba(0,0,0,0.08);
  font-family: 'Courier Prime', monospace;
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--doc-ink-light);
}

.doc-note-title {
  font-weight: 700;
  color: var(--doc-ink);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--doc-border);
  padding-bottom: 0.3rem;
  margin-bottom: 0.5rem;
}

/* ===== DATA TABLE ===== */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-family: 'Courier Prime', monospace;
  font-size: 0.78rem;
}

.doc-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--doc-ink);
  color: var(--doc-paper);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.65rem;
}

.doc-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--doc-border);
  color: var(--doc-ink-light);
}

.doc-table tr:nth-child(even) {
  background: rgba(0,0,0,0.02);
}

/* ===== ANNOTATIONS ===== */
.doc-annotation {
  display: inline-block;
  font-family: 'Courier Prime', monospace;
  font-size: 0.6rem;
  color: var(--doc-red);
  vertical-align: super;
  cursor: help;
  font-weight: 700;
}

/* ===== FOOTER ===== */
.doc-footer {
  border-top: 2px solid var(--doc-ink);
  margin-top: 2rem;
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.doc-footer-left {
  font-family: 'Courier Prime', monospace;
  font-size: 0.65rem;
  color: var(--doc-ink-light);
  line-height: 1.8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.doc-footer-left a {
  color: var(--doc-ink);
  text-decoration: none;
}

.doc-footer-left a:hover {
  color: var(--doc-red);
}

.doc-footer-stamp {
  transform: rotate(-8deg);
}

/* ===== BARCODE ===== */
.doc-barcode {
  height: 40px;
  background: repeating-linear-gradient(
    90deg,
    var(--doc-ink) 0px,
    var(--doc-ink) 2px,
    transparent 2px,
    transparent 4px,
    var(--doc-ink) 4px,
    var(--doc-ink) 5px,
    transparent 5px,
    transparent 8px,
    var(--doc-ink) 8px,
    var(--doc-ink) 10px,
    transparent 10px,
    transparent 12px
  );
  width: 150px;
  margin-top: 0.5rem;
  opacity: 0.5;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .doc-folder {
    margin: 1rem;
    border-radius: 0 8px 8px 8px;
  }

  .doc-folder::before {
    width: 120px;
    height: 18px;
    top: -18px;
  }

  .doc-paper {
    padding: 1.5rem;
  }

  .doc-note {
    float: none;
    width: 100%;
    margin: 1rem 0;
  }

  .doc-section h2 {
    font-size: 1.3rem;
  }

  .doc-header {
    flex-direction: column;
    gap: 1rem;
  }

  .doc-tabs {
    flex-wrap: wrap;
  }

  .doc-tabs a {
    padding: 0.5rem 0.8rem;
    font-size: 0.6rem;
  }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #2C2420; }
::-webkit-scrollbar-thumb { background: #6B5B4F; border-radius: 4px; }

/* ===== REVEAL ===== */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.4s ease-out;
}
.reveal.visible { opacity: 1; transform: translateY(0); }
