@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;1,400&family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg-primary: #fdfcf9; /* Crema cálido orgánico */
  --bg-secondary: #f6f4ee; /* Arena suave */
  --accent-primary: #5e7724; /* Verde Oliva Zaytuna Oscuro */
  --accent-hover: #495d1c;
  --accent-glow: rgba(94, 119, 36, 0.15);
  --text-main: #161b15; /* Carbón verdoso ultra oscuro */
  --text-muted: #3a4438; /* Gris musgo oscuro para legibilidad superior */
  --clay: #ad5123; /* Arcilla rústica profunda */
  --clay-glow: rgba(173, 81, 35, 0.15);
  --danger: #d94646;
  --danger-bg: #fee2e2;
  --card-bg: #ffffff;
  --card-border: #e8e6df;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Lora', serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #1a221a;
}

p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

strong {
  color: var(--accent-primary);
  font-weight: 500;
}

/* Header & Nav */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(253, 252, 249, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 1.4rem;
  font-family: var(--font-heading);
}

.logo img {
  height: 2rem;
  width: auto;
}

.logo span {
  font-size: 1.25rem;
}

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

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
}

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

.btn-portal {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  padding: 0.45rem 1.25rem;
  border-radius: 9999px;
  color: var(--text-main) !important;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-portal:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff !important;
  box-shadow: 0 4px 12px var(--accent-glow);
  transform: translateY(-2px);
}

/* Sections Common */
section {
  padding: 6.5rem 2rem 2.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-tag {
  color: var(--accent-primary);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: inline-block;
}

.section-title {
  font-size: 2.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.2;
}

.section-desc {
  max-width: 700px;
  font-size: 1.1rem;
  margin-bottom: 3rem;
}

/* Hero Section with Panoramic Photo Background (reduced overlay effect for visibility) */
.hero {
  min-height: 85vh;
  display: flex;
  align-items: center;
  padding-top: 6.5rem;
  position: relative;
  background-image: linear-gradient(to right, rgba(253, 252, 249, 0.93) 40%, rgba(253, 252, 249, 0.75) 70%, rgba(253, 252, 249, 0.3) 100%), url('fotos_finca_terrabloque/fincapanoramica.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 4rem;
  align-items: center;
  width: 100%;
}

.hero-badge {
  background: rgba(121, 152, 52, 0.15);
  border: 1px solid rgba(121, 152, 52, 0.4);
  color: var(--text-main);
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  text-shadow: 0 1px 1px rgba(255,255,255,0.9);
}

.hero-badge span {
  width: 6px;
  height: 6px;
  background-color: var(--accent-primary);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px var(--accent-primary);
}

.hero h1 {
  font-size: 3.5rem;
  line-height: 1.15;
  margin-bottom: 1.5rem;
  color: #121812;
  text-shadow: 0 1px 3px rgba(255,255,255,0.95);
}

.brand-tagline {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--clay);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: -1.25rem;
  margin-bottom: 1.75rem;
  font-family: var(--font-body);
}

.hero-subtitle {
  font-size: 1.25rem;
  margin-bottom: 2.25rem;
  color: #1c241c;
  text-shadow: 0 1px 3px rgba(255,255,255,0.95);
  font-weight: 400;
}

.hero-ctas {
  display: flex;
  gap: 1.25rem;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  text-decoration: none;
  padding: 0.8rem 1.85rem;
  border-radius: 8px;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.btn-secondary {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  text-decoration: none;
  padding: 0.8rem 1.85rem;
  border-radius: 8px;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: #d1cfc7;
  transform: translateY(-2px);
}

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.glass-card-hero {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2.25rem;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

.glass-card-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), var(--clay));
}

.hero-features {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.hero-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.hero-feature-icon {
  background: rgba(121, 152, 52, 0.08);
  padding: 0.45rem;
  border-radius: 6px;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-feature-text h4 {
  font-size: 1.1rem;
  margin-bottom: 0.15rem;
}

.hero-feature-text p {
  font-size: 0.9rem;
}

/* Grid Cards & Image Framings */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.75rem;
}

.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 2rem 1.75rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.glass-card:hover {
  transform: translateY(-5px);
  border-color: rgba(121, 152, 52, 0.3);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

.card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  border: 1px solid var(--card-border);
}

/* Specific framing adjustments to prevent cropping issues */
.cabra-img {
  object-position: center 15%; /* Crops down and centers on the goat's face */
}

.congo-img {
  object-position: center center;
}

.infografia-img {
  width: 100%;
  height: auto;
  aspect-ratio: 4/3;
  object-fit: contain; /* Shows the full diagram with labels, no cropping */
  background-color: #faf8f5;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.25rem;
  margin-bottom: 1.25rem;
}

.yegua-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center 30%; /* Focuses on the mare and foal */
  border-radius: 8px;
  border: 1px solid var(--card-border);
  margin-bottom: 1.25rem;
}

.mural-img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  object-position: center 40%; /* Focuses on the painter mural painting */
  border-radius: 8px;
  border: 1px solid var(--card-border);
  margin-bottom: 1.25rem;
}

.card-icon {
  width: 3rem;
  height: 3rem;
  background: rgba(121, 152, 52, 0.06);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  margin-bottom: 1.25rem;
  transition: var(--transition);
}

.glass-card:hover .card-icon {
  background: var(--accent-primary);
  color: #ffffff;
}

.glass-card h3 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

.glass-card ul {
  list-style: none;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.glass-card li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.glass-card li::before {
  content: '✓';
  color: var(--accent-primary);
  font-weight: bold;
}

/* Reforestation Section with Photo Background */
.regen-section {
  background-image: linear-gradient(to left, rgba(246, 244, 238, 0.96) 55%, rgba(246, 244, 238, 0.85) 85%, rgba(246, 244, 238, 0.6) 100%), url('fotos_finca_terrabloque/bioconstruccion_domo.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
  width: 100%;
  max-width: 100% !important;
}

.regen-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.regen-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 4rem;
  align-items: center;
}

.forest-badge {
  background: rgba(198, 107, 61, 0.08);
  border: 1px solid rgba(198, 107, 61, 0.2);
  color: var(--clay);
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.forest-badge span {
  width: 6px;
  height: 6px;
  background-color: var(--clay);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px var(--clay);
}

.forest-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 2rem;
}

.forest-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.forest-item-bullet {
  background: rgba(198, 107, 61, 0.08);
  padding: 0.25rem;
  border-radius: 6px;
  color: var(--clay);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.2rem;
}

.forest-item h4 {
  font-size: 1.1rem;
  color: #1a221a;
}

.forest-item p {
  font-size: 0.95rem;
  margin-top: 0.1rem;
}

/* IoT Dashboard Section */
.iot-dashboard-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2.5rem;
  margin-top: 2rem;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.03);
}

.iot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 1.25rem;
}

.iot-status-online {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  background: rgba(121, 152, 52, 0.08);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  color: var(--accent-primary);
  font-weight: 500;
}

.iot-status-online span {
  width: 8px;
  height: 8px;
  background-color: var(--accent-primary);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.8s infinite;
}

.sensors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.sensor-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.sensor-card:hover {
  border-color: #d1cfc7;
}

.sensor-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.sensor-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.sensor-icon {
  color: var(--accent-primary);
}

.sensor-value {
  font-size: 2rem;
  font-family: var(--font-heading);
  font-weight: 700;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  color: #1a221a;
  transition: var(--transition);
}

.sensor-unit {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.sensor-status {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent-primary);
}

/* Warnings */
.sensor-card.warning {
  border-color: rgba(217, 70, 70, 0.2);
  background: var(--danger-bg);
}

.sensor-card.warning .sensor-icon {
  color: var(--danger);
  animation: shake 1s infinite alternate;
}

.sensor-card.warning .sensor-status {
  color: var(--danger);
}

.sensor-card.warning .sensor-value {
  color: var(--danger);
}

/* Actuators */
.actuators-section {
  border-top: 1px solid var(--card-border);
  padding-top: 1.75rem;
}

.actuators-section h4 {
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
}

.actuators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.actuator-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.actuator-card:hover {
  border-color: #d1cfc7;
}

.actuator-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.actuator-status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.actuator-card.active .actuator-status-dot {
  background-color: var(--accent-primary);
  box-shadow: 0 0 6px var(--accent-primary);
}

.actuator-name {
  font-weight: 500;
  font-size: 0.95rem;
  color: #1a221a;
}

.actuator-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d8d6ce;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

input:checked + .slider {
  background-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* farmOS Section with Landscape Background */
#farmos {
  background-image: linear-gradient(rgba(253, 252, 249, 0.95), rgba(253, 252, 249, 0.95)), url('fotos_finca_terrabloque/diego_a_caballo.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
  width: 100%;
  max-width: 100% !important;
}

.farmos-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.farmos-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.75rem;
  margin-top: 2rem;
}

.farmos-feature-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.75rem;
  border-left: 4px solid var(--accent-primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  transition: var(--transition);
}

.farmos-feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.04);
  border-left-color: var(--clay);
}

.farmos-feature-card h4 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  color: #1a221a;
}

.farmos-feature-card p {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Footer */
footer {
  background: #1c241c;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding: 3.5rem 2rem;
  margin-top: 5rem;
  color: #f1efea;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-copy {
  font-size: 0.85rem;
  color: #a4aca1;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;
  font-family: var(--font-heading);
}

.footer-brand img {
  height: 1.8rem;
  width: auto;
  filter: brightness(0) invert(1);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a {
  color: #a4aca1;
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition);
}

.footer-links a:hover {
  color: #ffffff;
}

/* Keyframes */
@keyframes float {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-12px); }
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

@keyframes shake {
  0% { transform: rotate(-0.5deg); }
  100% { transform: rotate(0.5deg); }
}

/* Responsive */
@media (max-width: 968px) {
  .hero {
    background-position: 75% center;
  }
  
  .hero-grid, .regen-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  
  .hero h1 {
    font-size: 2.5rem;
  }
  
  .hero-visual {
    order: -1;
  }
  
  section {
    padding-top: 5rem;
  }
}

@media (max-width: 576px) {
  .nav-links {
    display: none;
  }
  
  .hero-ctas {
    flex-direction: column;
  }
  
  .iot-dashboard-card {
    padding: 1.25rem;
  }
  
  .iot-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}
