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

:root {
  --stone: #2c2c2c;
  --stone-light: #4a4a4a;
  --parchment: #f5f0e8;
  --parchment-dark: #e8e0d0;
  --accent: #8b0000;
  --accent-light: #a52a2a;
  --green-dark: #1a3a1a;
  --gold: #c9a227;
  --text: #333;
  --text-light: #666;
  --shadow: rgba(0,0,0,0.15);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--parchment);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(26,58,26,0.92), rgba(60,20,20,0.88)),
    url('https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Tuinda_castle_main_building.jpg/1280px-Tuinda_castle_main_building.jpg') center/cover;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(255,255,255,0.03) 40px, rgba(255,255,255,0.03) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(255,255,255,0.03) 40px, rgba(255,255,255,0.03) 41px);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, transparent 0%, rgba(0,0,0,0.4) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
  padding: 40px;
}

.hero-label {
  display: inline-block;
  background: var(--gold);
  color: var(--green-dark);
  padding: 6px 20px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 400;
  line-height: 1.15;
  text-shadow: 2px 4px 20px rgba(0,0,0,0.5);
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 1.15rem;
  max-width: 500px;
  margin: 0 auto 36px;
  opacity: 0.9;
  font-style: italic;
}

.btn-hero {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 14px 40px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 1px;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.btn-hero:hover {
  background: transparent;
  border-color: var(--gold);
  color: var(--gold);
}

/* ===== Sections ===== */
.section {
  padding: 100px 0;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 400;
  color: var(--accent);
  margin-bottom: 60px;
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  background: var(--gold);
  margin: 16px auto 0;
}

/* ===== About ===== */
.about {
  background: #fff;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}

.about-text p {
  margin-bottom: 16px;
  font-size: 1.05rem;
}

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.stat-card {
  background: var(--parchment);
  border: 2px solid var(--parchment-dark);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ===== Features ===== */
.style {
  background: var(--parchment);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-card {
  background: #fff;
  border: 1px solid var(--parchment-dark);
  border-radius: 8px;
  padding: 32px 24px;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px var(--shadow);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.feature-card p {
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.6;
}

/* ===== Timeline ===== */
.timeline-section {
  background: #fff;
}

.timeline {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--gold), var(--accent));
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  padding-left: 60px;
  margin-bottom: 48px;
}

.timeline-dot {
  position: absolute;
  left: 12px;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px var(--gold);
}

.timeline-year {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 8px;
}

.timeline-content h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  color: var(--green-dark);
}

.timeline-content p {
  font-size: 0.95rem;
  color: var(--text-light);
}

/* ===== Castles ===== */
.castles {
  background: linear-gradient(135deg, var(--green-dark), #2a3a2a);
  color: #fff;
}

.castles .section-title {
  color: var(--gold);
}

.castles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.castle-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, border-color 0.3s;
}

.castle-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
}

.castle-img {
  height: 180px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.castle-img::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}

/* Castle image placeholders */
.turaida {
  background: linear-gradient(135deg, #654321 30%, #8B7355 70%);
}
.turaida::before {
  content: '🏰';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-size: 3rem;
  opacity: 0.4;
}

.volmar {
  background: linear-gradient(135deg, #556B2F 30%, #6B8E23 70%);
}
.volmar::before {
  content: '🏰';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-size: 3rem;
  opacity: 0.4;
}

.karkse {
  background: linear-gradient(135deg, #4A4A4A 30%, #696969 70%);
}
.karkse::before {
  content: '🏰';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-size: 3rem;
  opacity: 0.4;
}

.pernu {
  background: linear-gradient(135deg, #1a3a5a 30%, #2a4a6a 70%);
}
.pernu::before {
  content: '🏰';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-size: 3rem;
  opacity: 0.4;
}

.neru {
  background: linear-gradient(135deg, #8B4513 30%, #A0522D 70%);
}
.neru::before {
  content: '🏰';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-size: 3rem;
  opacity: 0.4;
}

.dome {
  background: linear-gradient(135deg, #4a2a2a 30%, #6a3a3a 70%);
}
.dome::before {
  content: '🏰';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-size: 3rem;
  opacity: 0.4;
}

.castle-info {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.castle-info h3 {
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.castle-loc, .castle-date {
  display: block;
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 4px;
}

.castle-info p {
  font-size: 0.95rem;
  opacity: 0.85;
  line-height: 1.6;
  margin-top: 12px;
  flex: 1;
}

.castle-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  background: rgba(201,162,39,0.2);
  color: var(--gold);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  border: 1px solid rgba(201,162,39,0.3);
}

/* ===== Map ===== */
.map-section {
  background: var(--parchment);
}

.map-desc {
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 40px;
}

.map-container {
  max-width: 800px;
  margin: 0 auto;
  background: #1a2a1a;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 8px 30px var(--shadow);
}

.map-svg {
  width: 100%;
  height: auto;
}

.map-marker {
  cursor: pointer;
  transition: transform 0.2s;
}

.map-marker:hover {
  transform: scale(1.2);
}

.marker-dot {
  fill: var(--accent);
  stroke: var(--gold);
  stroke-width: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  transition: fill 0.2s;
}

.map-marker:hover .marker-dot {
  fill: var(--gold);
}

.marker-label {
  fill: #fff;
  font-size: 11px;
  font-family: Georgia, serif;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

/* ===== Legacy ===== */
.legacy {
  background: #fff;
}

.legacy-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 60px;
  align-items: start;
}

.legacy-text blockquote {
  font-size: 1.3rem;
  font-style: italic;
  color: var(--accent);
  border-left: 4px solid var(--gold);
  padding-left: 24px;
  margin-bottom: 24px;
}

.legacy-countries h3 {
  font-size: 1.1rem;
  color: var(--green-dark);
  margin-bottom: 20px;
}

.country-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--parchment);
  border-radius: 8px;
  margin-bottom: 12px;
}

.country-flag {
  font-size: 1.5rem;
}

.country-name {
  font-weight: bold;
  flex: 1;
}

.country-count {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ===== Footer ===== */
.footer {
  background: var(--green-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 40px 24px;
}

.footer-sub {
  font-size: 0.85rem;
  margin-top: 8px;
  opacity: 0.6;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
  .about-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .castles-grid {
    grid-template-columns: 1fr;
  }
  .legacy-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
  .about-stats {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .timeline-item {
    padding-left: 50px;
  }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate {
  opacity: 0;
}

.animate.visible {
  animation: fadeInUp 0.6s ease forwards;
}
