/* 
 * HISTORI — Design System
 * Patrimonio Cultural de España
 * Founded 1926, Granada
 * 
 * A heritage-specific design language: timeless, scholarly, warm, rooted in Iberian earth, 
 * classical architecture, and the layered history of Spain.
 * 
 * NO generic SaaS, no glass, no stats dashboards, no forced social proof.
 * Every element justified by cultural reverence, historical depth, and sensory experience of place.
 */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=EB+Garamond:ital,wght@family=EB+Garamond:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
  /* Core Heritage Palette — inspired by Andalusian earth, vellum, terracotta roofs, gold leaf, aged stone */
  --cream: #F8F4ED;
  --vellum: #F5EDE0;
  --parchment: #EDE6DC;
  --stone: #6B5F58;
  --dark: #2C2522;
  --terracotta: #8B5E3C;
  --deep-terracotta: #6B4632;
  --gold: #C5A46E;
  --gold-dark: #A68A5A;
  --text: #3F2E2A;
  --text-light: #665A53;
  --accent: #8B5E3C;

  /* Spacing — generous for contemplative reading */
  --space-xs: 0.5rem;
  --space-sm: 0.875rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;

  /* Typography scale — classical book proportions */
  --font-display: 'Cinzel', Georgia, serif;
  --font-body: 'EB Garamond', Georgia, serif;
  --font-ui: 'Inter', system-ui, sans-serif;

  --fs-xs: 0.8rem;
  --fs-sm: 0.95rem;
  --fs-base: 1.05rem;
  --fs-lg: 1.2rem;
  --fs-xl: 1.45rem;
  --fs-2xl: 1.85rem;
  --fs-3xl: 2.4rem;
  --fs-4xl: 3.2rem;
  --fs-hero: clamp(2.8rem, 6vw, 4.6rem);

  /* Effects — subtle, architectural */
  --shadow-soft: 0 10px 30px rgba(44, 37, 34, 0.08);
  --shadow-medium: 0 20px 50px rgba(44, 37, 34, 0.12);
  --shadow-deep: 0 25px 70px rgba(0, 0, 0, 0.18);
  --border-subtle: 1px solid #EDE6DC;
  --border-gold: 1px solid #C5A46E40;

  /* Motion — slow, dignified, never decorative */
  --ease-heritage: cubic-bezier(0.4, 0.0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--cream);
  line-height: 1.72;
  font-size: var(--fs-base);
  -webkit-font-smoothing: antialiased;
}

/* Typography — enhanced for depth and readability */
h1, h2, h3, h4, .logo, .section-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.4px;
  line-height: 1.1;
}

h1 { font-size: var(--fs-hero); }
h2 { font-size: var(--fs-3xl); margin-bottom: var(--space-md); }
h3 { font-size: var(--fs-xl); margin-bottom: var(--space-sm); }
h4 { font-size: var(--fs-lg); font-weight: 600; margin-bottom: var(--space-xs); color: var(--deep-terracotta); }

p, .lead, .body-text {
  font-size: var(--fs-base);
  color: var(--text-light);
  margin-bottom: var(--space-md);
}

.lead {
  font-size: var(--fs-lg);
  line-height: 1.65;
  color: var(--text);
  max-width: 68ch;
}

.immersive-text {
  font-size: var(--fs-lg);
  max-width: 72ch;
  line-height: 1.78;
}

.drop-cap {
  font-family: var(--font-display);
  font-size: 3.8rem;
  line-height: 0.85;
  float: left;
  margin: 0.1em 0.15em 0 0;
  color: var(--terracotta);
}

.small-caps {
  font-variant: small-caps;
  letter-spacing: 1.5px;
  font-size: 0.9em;
}

/* Layout */
.premium-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

@media (max-width: 768px) {
  .premium-container { padding: 0 var(--space-md); }
}

.section {
  padding: var(--space-2xl) 0;
}

.section-header {
  margin-bottom: var(--space-xl);
  max-width: 720px;
}

.section-header.centered {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.section-header h2 {
  color: var(--dark);
  margin-bottom: var(--space-sm);
}

.section-header p {
  font-size: var(--fs-lg);
  color: var(--stone);
}

/* Elegant architectural dividers */
.elegant-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #C5A46E35, transparent);
  margin: var(--space-xl) 0;
}

.gold-rule {
  width: 68px;
  height: 2px;
  background: var(--gold);
  margin: var(--space-sm) 0 var(--space-md);
}

/* Navbar — fixed, elegant, heritage feel */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(248, 244, 237, 0.96);
  backdrop-filter: blur(18px);
  z-index: 1000;
  border-bottom: 1px solid #EDE6DC;
  transition: all 0.3s var(--ease-heritage);
}

.navbar.scrolled {
  background: rgba(248, 244, 237, 0.985);
  box-shadow: 0 2px 18px rgba(44, 37, 34, 0.07);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem var(--space-lg);
  max-width: 1280px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--dark);
}

.logo img {
  height: 38px;
  width: auto;
  border-radius: 2px;
}

.logo-text {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.logo-tagline {
  font-size: 0.62rem;
  font-family: var(--font-ui);
  letter-spacing: 2.2px;
  color: var(--terracotta);
  margin-top: -3px;
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2.1rem;
  list-style: none;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-family: var(--font-ui);
  font-weight: 500;
  transition: color 0.2s ease;
  position: relative;
}

.nav-links a:hover {
  color: var(--terracotta);
}

.nav-links a.active {
  color: var(--terracotta);
  font-weight: 600;
}

.nav-links a.active:after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: linear-gradient(to right, var(--gold), var(--terracotta));
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.45rem;
  color: var(--dark);
  cursor: pointer;
  padding: 0.35rem;
}

/* Buttons — dignified, not salesy */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1.55rem;
  font-size: 0.88rem;
  font-family: var(--font-ui);
  font-weight: 600;
  border-radius: 9999px;
  text-decoration: none;
  transition: all 0.3s var(--ease-heritage);
  cursor: pointer;
  border: none;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--terracotta);
  color: white;
  box-shadow: 0 4px 14px rgba(139, 94, 60, 0.28);
}

.btn-primary:hover {
  background: var(--deep-terracotta);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(139, 94, 60, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--terracotta);
  border: 1.5px solid var(--terracotta);
}

.btn-outline:hover {
  background: var(--terracotta);
  color: white;
}

.btn-gold {
  background: var(--gold);
  color: var(--dark);
  font-weight: 600;
}

.btn-gold:hover {
  background: var(--gold-dark);
  transform: translateY(-1px);
}

.btn-small {
  padding: 0.45rem 1.05rem;
  font-size: 0.78rem;
}

/* Hero — cinematic but reverent */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  background: linear-gradient(rgba(44, 37, 34, 0.38), rgba(44, 37, 34, 0.48)), url('images/alhambra-hero.jpg');
  background-size: cover;
  background-position: center 35%;
  background-attachment: fixed;
}

.hero-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  position: relative;
  z-index: 2;
  color: white;
}

.hero h1 {
  font-size: var(--fs-hero);
  line-height: 1.02;
  max-width: 18ch;
  margin-bottom: var(--space-md);
  text-shadow: 0 3px 25px rgba(0, 0, 0, 0.45);
}

.hero p {
  font-size: 1.28rem;
  max-width: 52ch;
  margin-bottom: var(--space-xl);
  font-family: var(--font-ui);
  font-weight: 400;
  color: rgba(255,255,255,0.92);
  line-height: 1.55;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.82rem;
  font-family: var(--font-ui);
  color: rgba(255,255,255,0.7);
}

.hero-meta .divider {
  width: 1px;
  height: 13px;
  background: rgba(255,255,255,0.35);
}

/* Cards — varied by context, never generic */
.card, .destination-card, .museum-card, .unesco-card, .tradition-card {
  background: white;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform 0.45s var(--ease-heritage), box-shadow 0.45s var(--ease-heritage);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card:hover, .destination-card:hover, .museum-card:hover, .unesco-card:hover, .tradition-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-medium);
}

.card-image, .destination-image, .museum-image, .unesco-image, .tradition-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.card-image img, .destination-image img, .museum-image img, .unesco-image img, .tradition-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease-heritage);
}

.card:hover .card-image img,
.destination-card:hover .destination-image img,
.museum-card:hover .museum-image img,
.unesco-card:hover .unesco-image img,
.tradition-card:hover .tradition-image img {
  transform: scale(1.065);
}

.card-badge, .destination-badge, .museum-badge, .unesco-badge, .tradition-badge {
  position: absolute;
  top: 14px;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.28rem 0.85rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.96);
  color: var(--terracotta);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  letter-spacing: 0.4px;
}

.unesco-badge {
  background: var(--gold);
  color: var(--dark);
  font-weight: 700;
}

.card-body, .destination-body, .museum-body, .unesco-body, .tradition-body {
  padding: var(--space-lg) var(--space-lg) 1.35rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-body h3, .destination-body h3, .museum-body h3, .unesco-body h3, .tradition-body h3 {
  font-size: 1.32rem;
  line-height: 1.15;
  margin-bottom: 0.45rem;
  color: var(--dark);
}

.location, .city, .region {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--terracotta);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 0.85rem;
  font-weight: 500;
}

.card p, .destination-body p, .museum-body p, .unesco-body p, .tradition-body p {
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text-light);
  margin-bottom: 1.1rem;
  flex: 1;
}

.card-meta, .destination-meta {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--stone);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: var(--space-sm);
  border-top: var(--border-subtle);
}

/* Storytelling / Immersive sections — the heart of the site */
.storytelling, .immersive-section, .palimpsest-layer {
  background: var(--vellum);
  padding: var(--space-2xl) 0;
}

.story-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: var(--space-xl);
  align-items: center;
}

.story-content h2 {
  font-size: var(--fs-3xl);
}

.story-quote {
  border-left: 4px solid var(--gold);
  padding-left: var(--space-md);
  font-style: italic;
  color: var(--deep-terracotta);
  font-size: var(--fs-lg);
  margin: var(--space-lg) 0;
}

/* Heritage-specific: Time Layers / Stratigraphy */
.stratigraphy {
  display: grid;
  gap: var(--space-lg);
}

.layer {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--space-lg);
  background: white;
  padding: var(--space-lg);
  border-radius: 12px;
  border-left: 5px solid var(--terracotta);
}

.layer-era {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--terracotta);
  padding-top: 4px;
}

.layer-content h4 {
  margin-bottom: 0.35rem;
}

.layer-content p {
  font-size: 0.97rem;
  margin-bottom: 0.4rem;
}

/* Fact / Context blocks */
.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-md);
}

.fact {
  background: white;
  padding: var(--space-md) var(--space-lg);
  border-radius: 10px;
  border-left: 3px solid var(--gold);
}

.fact-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--terracotta);
  letter-spacing: 0.8px;
  margin-bottom: 0.15rem;
}

.fact-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.3;
}

/* Grids */
.featured-grid, .destinations-grid, .museums-grid, .unesco-grid, .traditions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: var(--space-lg);
}

/* Page Headers — varied per section for visual distinction */
.page-header {
  padding-top: 7.5rem;
  padding-bottom: var(--space-xl);
  color: white;
  position: relative;
}

.page-header.destinos {
  background: linear-gradient(rgba(44,37,34,0.52), rgba(44,37,34,0.42)), url('images/toledo.jpg');
  background-size: cover;
  background-position: center;
}

.page-header.museos {
  background: linear-gradient(rgba(44,37,34,0.48), rgba(44,37,34,0.38)), url('images/prado-museum.jpg');
  background-size: cover;
  background-position: center 30%;
}

.page-header.unesco {
  background: linear-gradient(rgba(44,37,34,0.52), rgba(44,37,34,0.42)), url('images/alhambra-unesco.jpg');
  background-size: cover;
  background-position: center;
}

.page-header.tradiciones {
  background: linear-gradient(rgba(44,37,34,0.48), rgba(44,37,34,0.35)), url('images/flamenco.jpg');
  background-size: cover;
  background-position: center 28%;
}

.page-header h1 {
  font-size: clamp(2.55rem, 5.5vw, 3.55rem);
  margin-bottom: 0.55rem;
  color: white;
}

.page-header p {
  font-size: 1.15rem;
  max-width: 58ch;
  opacity: 0.95;
  font-family: var(--font-ui);
}

/* Modals — scholarly, generous reading space */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(44, 37, 34, 0.78);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal-content {
  background: white;
  max-width: 860px;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-deep);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-header {
  padding: 1.35rem var(--space-xl);
  border-bottom: var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--vellum);
}

.modal-header h3 {
  font-size: 1.48rem;
  color: var(--dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.85rem;
  color: var(--stone);
  cursor: pointer;
  line-height: 1;
  padding: 0 0.4rem;
}

.modal-body {
  padding: var(--space-xl);
}

.modal-body img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: var(--space-lg);
  box-shadow: 0 6px 22px rgba(0,0,0,0.1);
}

.modal-footer {
  padding: 1.1rem var(--space-xl);
  background: var(--vellum);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  border-top: var(--border-subtle);
}

/* Toast — quiet, non-intrusive */
.toast {
  position: fixed;
  bottom: 1.65rem;
  right: 1.65rem;
  background: var(--dark);
  color: white;
  padding: 0.95rem 1.35rem;
  border-radius: 11px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(44, 37, 34, 0.32);
  z-index: 3000;
  transform: translateY(90px);
  opacity: 0;
  transition: all 0.4s var(--ease-heritage);
  max-width: 340px;
  font-family: var(--font-ui);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.55);
  font-size: 1.15rem;
  cursor: pointer;
  margin-left: auto;
  padding: 0 0.25rem;
}

/* Footer */
.footer {
  background: var(--dark);
  color: #C9B8A8;
  padding: var(--space-2xl) 0 1.75rem;
  font-size: 0.93rem;
  font-family: var(--font-ui);
}

.footer-content {
  display: grid;
  grid-template-columns: 2.1fr 1fr 1fr 1.35fr;
  gap: var(--space-xl);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.footer-brand .logo-text { color: white; font-size: 1.55rem; }
.footer-brand p { margin-top: 0.85rem; line-height: 1.6; opacity: 0.78; max-width: 34ch; }

.footer h4 {
  color: white;
  font-size: 0.95rem;
  margin-bottom: var(--space-sm);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.footer ul {
  list-style: none;
}

.footer ul li {
  margin-bottom: 0.55rem;
}

.footer a {
  color: #C9B8A8;
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--gold);
}

.footer-bottom {
  border-top: 1px solid rgba(201, 184, 168, 0.14);
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  text-align: center;
  font-size: 0.78rem;
  opacity: 0.6;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

/* Search bar — refined for museos */
.search-bar {
  background: white;
  border: 1px solid #EDE6DC;
  border-radius: 999px;
  padding: 0.5rem 1.15rem;
  display: flex;
  align-items: center;
  max-width: 360px;
  margin-bottom: var(--space-lg);
}

.search-bar input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 0.98rem;
  font-family: var(--font-ui);
  padding: 0 0.65rem;
  color: var(--text);
}

/* Niche components: Itinerary builder teaser, conservation note, etc. */
.itinerary-planner {
  background: white;
  border: 1px solid #EDE6DC;
  border-radius: 14px;
  padding: var(--space-lg);
}

.conservation-note {
  background: #F8F4ED;
  border-left: 4px solid var(--gold);
  padding: var(--space-md) var(--space-lg);
  font-size: 0.97rem;
  margin: var(--space-lg) 0;
}

.conservation-note strong {
  color: var(--deep-terracotta);
}

/* Responsive — mobile first, every component considered */
@media (max-width: 992px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--cream);
    flex-direction: column;
    padding: 1.35rem var(--space-lg);
    box-shadow: 0 12px 28px rgba(0,0,0,0.09);
    border-top: 1px solid #EDE6DC;
    gap: 0.35rem;
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .nav-links li {
    width: 100%;
    padding: 0.55rem 0;
  }
  
  .hamburger {
    display: block;
  }

  .story-grid,
  .immersive-story {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }

  .layer {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 3.15rem;
  }
}

@media (max-width: 640px) {
  .premium-container {
    padding: 0 var(--space-md);
  }

  .nav-container {
    padding: 0.85rem var(--space-md);
  }

  .featured-grid,
  .destinations-grid,
  .museums-grid,
  .unesco-grid,
  .traditions-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .page-header h1 {
    font-size: 2.35rem;
  }

  .hero {
    background-attachment: scroll;
    min-height: 92vh;
  }

  .hero-content {
    padding-top: 3rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }

  .modal-content {
    border-radius: 12px;
  }

  .modal-body, .modal-header, .modal-footer {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .stratigraphy .layer {
    padding: var(--space-md);
  }
}

/* Accessibility & motion respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Print styles — for scholars */
@media print {
  .navbar, .footer, .btn, .hamburger, .modal { display: none !important; }
  body { background: white; font-size: 11pt; }
  .premium-container { max-width: 100%; padding: 0; }
  .hero { background: none; color: black; min-height: auto; padding: 2rem 0; }
}

/* Subtle azulejo-inspired background motif (used sparingly) */
.azulejo-bg {
  background-image: 
    linear-gradient(45deg, #C5A46E08 25%, transparent 25%) 50% 50% / 18px 18px,
    linear-gradient(-45deg, #C5A46E08 25%, transparent 25%) 50% 50% / 18px 18px;
}

/* Final polish: better link styling in prose */
a {
  color: var(--terracotta);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

a:hover {
  color: var(--deep-terracotta);
}