/* 
  Herencia Regional — Archivo de Patrimonio Inmaterial
  Design system: archival, ethnographic, scholarly.
  Rooted in Spanish manuscript, field-note, and museum catalog traditions.
*/

:root {
  --linen: #F5F1E8;
  --paper: #F8F4ED;
  --ink: #2C2522;
  --dark-ink: #1A1614;
  --scholar-red: #6B2C2A;
  --patina: #A68B5E;
  --taupe: #6B655D;
  --subtle: #C49A6C;
  --light-border: #D8D0C3;
  --header: #2C2522;
  --white: #FFFFFF;
  --focus: #6B2C2A;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.72;
  color: var(--ink);
  background: var(--linen);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .logo, .section-title, .accession-id {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.015em;
}

h1 { font-size: 42px; line-height: 1.05; }
h2 { font-size: 28px; line-height: 1.15; }
h3 { font-size: 21px; line-height: 1.25; }
h4 { font-size: 17px; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) {
  .container { padding: 0 28px; }
}

/* HEADER — quiet authority */
header {
  background: var(--header);
  color: #EDE4D9;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid #1A1614;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.logo {
  font-size: 21px;
  color: #C5A26F;
  text-decoration: none;
  line-height: 1;
  letter-spacing: 0.5px;
}

.logo span {
  font-size: 10px;
  letter-spacing: 2.5px;
  display: block;
  margin-top: -1px;
  color: #A68B5E;
  font-weight: 400;
}

nav ul {
  display: flex;
  gap: 28px;
  list-style: none;
}

nav a {
  color: #EDE4D9;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.4px;
  transition: color 0.15s ease;
  padding-bottom: 2px;
}

nav a:hover,
nav a.active {
  color: #C5A26F;
  border-bottom: 1px solid #C5A26F;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: #EDE4D9;
  font-size: 26px;
  cursor: pointer;
  padding: 4px;
}

/* Search */
.header-search {
  position: relative;
  width: 240px;
}

.header-search input {
  width: 100%;
  background: #1A1614;
  border: 1px solid #3F3733;
  color: #EDE4D9;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px 8px 34px;
  border-radius: 2px;
}

.header-search input:focus {
  outline: none;
  border-color: var(--patina);
}

.header-search::before {
  content: "⌕";
  position: absolute;
  left: 11px;
  top: 7px;
  color: #A68B5E;
  font-size: 15px;
}

/* Mobile nav */
.nav-mobile {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--header);
  padding: 16px 20px;
  border-bottom: 1px solid #1A1614;
}

.nav-mobile.active {
  display: block;
}

.nav-mobile ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* HERO — restrained, catalog-like */
.hero {
  background: var(--header);
  color: #EDE4D9;
  padding: 92px 0 78px;
  border-bottom: 1px solid #1A1614;
}

.hero h1 {
  font-size: 46px;
  max-width: 760px;
  color: #F5F1E8;
  margin-bottom: 18px;
}

.hero p {
  font-size: 18px;
  max-width: 620px;
  opacity: 0.9;
  line-height: 1.65;
}

.hero-meta {
  font-size: 13px;
  letter-spacing: 1px;
  color: #A68B5E;
  margin-top: 32px;
}

/* SECTIONS */
section {
  padding: 72px 0;
}

.section-title {
  font-size: 26px;
  color: var(--dark-ink);
  margin-bottom: 8px;
  position: relative;
  display: inline-block;
}

.section-title:after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 42px;
  height: 1.5px;
  background: var(--scholar-red);
}

.subtitle {
  color: var(--taupe);
  max-width: 680px;
  margin-bottom: 42px;
  font-size: 16px;
}

/* CATALOG CARDS — feel like index cards or accession slips */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(308px, 1fr));
  gap: 22px;
}

@media (max-width: 480px) {
  .catalog-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--white);
  border: 1px solid var(--light-border);
  border-radius: 1px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: var(--patina);
}

.card img {
  width: 100%;
  height: 178px;
  object-fit: cover;
  display: block;
  filter: saturate(0.92) contrast(1.02);
}

.card-content {
  padding: 18px 18px 20px;
}

.accession {
  font-family: monospace;
  font-size: 12px;
  letter-spacing: 1.2px;
  color: var(--taupe);
  margin-bottom: 3px;
}

.card h3 {
  font-size: 19px;
  margin-bottom: 6px;
  color: var(--dark-ink);
  line-height: 1.2;
}

.card .region {
  font-size: 12.5px;
  color: var(--scholar-red);
  font-weight: 600;
  letter-spacing: 0.6px;
  margin-bottom: 9px;
}

.card p {
  font-size: 15.5px;
  color: var(--taupe);
  line-height: 1.55;
  margin-bottom: 14px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  background: var(--scholar-red);
  color: #F5F1E8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.6px;
  border: none;
  border-radius: 1px;
  cursor: pointer;
  transition: background 0.2s ease;
  min-height: 40px;
  min-width: 108px;
}

.btn:hover {
  background: #4E2120;
}

.btn-outline {
  background: transparent;
  color: var(--scholar-red);
  border: 1px solid var(--scholar-red);
}

.btn-outline:hover {
  background: var(--scholar-red);
  color: #F5F1E8;
}

.btn-small {
  padding: 6px 14px;
  font-size: 12px;
  min-width: auto;
}

/* METADATA BLOCK — field note / catalog style */
.meta-block {
  background: var(--paper);
  border-left: 3px solid var(--patina);
  padding: 18px 20px;
  margin: 22px 0;
  font-size: 15px;
}

.meta-block h4 {
  font-size: 13px;
  color: var(--scholar-red);
  margin-bottom: 4px;
  letter-spacing: 0.8px;
}

.meta-row {
  display: flex;
  gap: 28px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.meta-row span {
  font-family: monospace;
  font-size: 13px;
}

/* RECORD / FICHA — deep content */
.record {
  background: var(--white);
  border: 1px solid var(--light-border);
  padding: 28px 32px;
  margin: 32px 0;
}

.record-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.record-header h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.record-meta {
  font-family: monospace;
  font-size: 13px;
  color: var(--taupe);
}

.record-body {
  max-width: 72ch;
}

.record-body p {
  margin-bottom: 16px;
}

.variants-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 15px;
}

.variants-table th,
.variants-table td {
  border: 1px solid var(--light-border);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}

.variants-table th {
  background: var(--paper);
  font-weight: 600;
  font-size: 13px;
  color: var(--scholar-red);
}

.field-notes {
  margin: 32px 0;
}

.note {
  border: 1px solid var(--light-border);
  padding: 16px 18px;
  margin-bottom: 12px;
  background: #FBF8F2;
}

.note-header {
  font-size: 12px;
  color: var(--taupe);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.note p {
  font-size: 15.5px;
  margin: 0;
}

.biblio {
  font-size: 14.5px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--light-border);
}

.biblio ul {
  list-style: none;
}

.biblio li {
  margin-bottom: 5px;
  padding-left: 14px;
  position: relative;
}

.biblio li:before {
  content: "—";
  position: absolute;
  left: 0;
}

/* FILTERS — clean, archival */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.filter-btn {
  padding: 6px 15px;
  background: var(--white);
  border: 1px solid var(--light-border);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  border-radius: 1px;
  transition: all 0.1s ease;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--scholar-red);
  color: #F5F1E8;
  border-color: var(--scholar-red);
}

/* CALENDAR */
.calendar {
  background: var(--white);
  border: 1px solid var(--light-border);
}

.month {
  padding: 18px 22px;
  border-bottom: 1px solid var(--light-border);
}

.month:last-child {
  border-bottom: none;
}

.month h4 {
  font-size: 15px;
  color: var(--scholar-red);
  margin-bottom: 10px;
}

.event {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 1px dotted var(--light-border);
  font-size: 15px;
}

.event:first-child {
  border-top: none;
}

/* INSTITUTION PROFILES */
.institution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.profile {
  background: var(--white);
  border: 1px solid var(--light-border);
  padding: 24px;
}

.profile h3 {
  margin-bottom: 4px;
}

.profile .loc {
  color: var(--scholar-red);
  font-size: 13px;
  margin-bottom: 14px;
}

/* PROJECT CASE STUDY */
.case-study {
  border: 1px solid var(--light-border);
  padding: 26px;
  background: var(--white);
  margin-bottom: 22px;
}

.case-study h3 {
  font-size: 20px;
}

/* FOOTER */
footer {
  background: var(--header);
  color: #C9BEB5;
  padding: 54px 0 32px;
  font-size: 14px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1.2fr;
  gap: 42px;
}

@media (max-width: 720px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.footer a {
  color: #C9BEB5;
  text-decoration: none;
}

.footer a:hover {
  color: #C5A26F;
}

.footer-note {
  font-size: 12px;
  opacity: 0.65;
  margin-top: 22px;
}

/* DRAWER / RECORD PANEL */
.record-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 620px;
  height: 100vh;
  background: var(--linen);
  box-shadow: -12px 0 30px rgba(0,0,0,0.18);
  z-index: 300;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.3, 1);
  border-left: 1px solid var(--light-border);
}

.record-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  position: sticky;
  top: 0;
  background: var(--paper);
  padding: 18px 24px;
  border-bottom: 1px solid var(--light-border);
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-close {
  font-size: 28px;
  cursor: pointer;
  color: var(--taupe);
  line-height: 1;
}

.drawer-body {
  padding: 24px 26px 60px;
}

.drawer-body img {
  width: 100%;
  margin-bottom: 20px;
  border: 1px solid var(--light-border);
}

/* INFO BOX — provenance style */
.provenance {
  background: #FBF8F2;
  padding: 16px 18px;
  border: 1px solid var(--light-border);
  font-size: 14.5px;
  margin: 20px 0;
}

.provenance strong {
  color: var(--scholar-red);
}

/* RESPONSIVE */
@media (max-width: 860px) {
  nav ul { display: none; }
  .hamburger { display: block; }
  .header-search { display: none; }
  
  .hero {
    padding: 62px 0 54px;
  }
  
  .hero h1 {
    font-size: 34px;
  }
  
  section {
    padding: 52px 0;
  }
  
  .record-drawer {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .card img {
    height: 152px;
  }
  
  .btn {
    padding: 10px 16px;
    font-size: 12.5px;
  }
}

/* Subtle paper texture hint */
body::after {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    linear-gradient(rgba(44,37,34,0.015) 1px, transparent 1px);
  background-size: 1px 22px;
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
}

/* Accessibility */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}