/* 
   ByTheRiver — Main Styles 
   Palette:
   - White (bg): #FFFFFF
   - Dark Green (primary): #2D5A27
   - White (surface): #FFFFFF
   - Terracotta (accent): #E27D60 — chatbot messages & send button
   - Gray Text: #8E8E93
   - Black Text: #1A1A1A
*/

:root {
  --color-bg: #ffffff;
  --color-primary: #2d5a27;
  --color-surface: #ffffff;
  --color-accent: #e27d60;
  --color-text-gray: #8e8e93;
  --color-text-main: #1a1a1a;

  --font-main: "Plus Jakarta Sans", system-ui, sans-serif;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 28px;

  --container-max: 1200px;
}

/* --- Header & Lang Selector --- */
.main-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px 0;
  z-index: 100;
}

.header-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.lang-selector {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  background-color: var(--color-surface);
  padding: 8px 16px;
  border-radius: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(45, 90, 39, 0.1);
}

.lang-current {
  opacity: 1;
  cursor: default;
  font-weight: 700;
}

.lang-link {
  text-decoration: none;
  color: var(--color-primary);
  opacity: 0.5;
  transition: opacity 0.2s;
}

.lang-link:hover {
  opacity: 1;
}

.lang-divider {
  opacity: 0.3;
}

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

body {
  background-color: var(--color-bg);
  font-family: var(--font-main);
  color: var(--color-text-main);
  line-height: 1.5;
  font-weight: 400;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  color: var(--color-text-main);
  line-height: 1.2;
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero Section */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  padding: 140px 20px 140px;
  background-color: #ffffff;
  background-image:
    linear-gradient(to bottom,
      rgba(0, 0, 0, 0.3) 0%,
      rgba(0, 0, 0, 0.5) 100%),
    url("../assets/foto_header_caja2.jpg");
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 120px;
  background: linear-gradient(to bottom,
      rgba(255, 255, 255, 0) 0%,
      #ffffff 100%);
  pointer-events: none;
  z-index: 2;
}

.hero__title {
  font-size: 56px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.hero__subtitle {
  font-size: 24px;
  color: #ffffff;
  font-weight: 600;
  max-width: 650px;
  margin: 24px auto 0;
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .hero__title {
    font-size: 36px;
  }

  .hero__subtitle {
    font-size: 18px;
  }
}

/* Sections General */
.section-title {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--color-text-main);
}

.text-center {
  text-align: center;
}

/* Narrative Sections */
.narrative-section {
  padding: 60px 0;
}

.narrative-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 40px;
}

.narrative-section--reverse .narrative-grid {
  direction: rtl;
}

.narrative-section--reverse .narrative-text {
  direction: ltr;
}

.narrative-image img {
  width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
  transform: scale(1.08);
}

.narrative-text {
  max-width: 500px;
}

.narrative-text p {
  font-size: 18px;
  color: var(--color-text-main);
}

/* How it Works */
.how-it-works {
  padding: 60px 0;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-top: 60px;
  text-align: center;
  width: 100%;
}

.step__icon {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.step__icon img {
  width: 100%;
  max-width: 240px;
  height: auto;
  aspect-ratio: 1/1;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.step__icon img:hover {
  transform: scale(1.05);
}

.step__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.step__text {
  font-size: 16px;
  color: var(--color-text-gray);
  font-weight: 400;
}

@media (max-width: 768px) {
  .narrative-section {
    padding: 40px 0;
  }

  .narrative-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }

  .narrative-section--reverse .narrative-grid {
    direction: ltr;
  }

  .narrative-text {
    margin: 0 auto;
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 0 10px;
  }

  .step__icon img {
    max-width: 180px;
    /* Tamaño generoso pero seguro para móvil */
  }

  .section-title {
    font-size: 24px;
  }
}

/* Download Section */
.download-section {
  padding: 60px 0 0;
  /* Bottom padding 0 because of mockup */
  background-color: var(--color-surface);
}

.download-container {
  text-align: center;
}

.download-subtitle {
  font-size: 20px;
  color: var(--color-text-gray);
  margin-bottom: 40px;
}

.download-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 40px;
}

.btn-download {
  transition: transform 0.3s ease;
  display: inline-block;
  border-radius: 12px;
}

/* CSS Cropping for PNG badge reference */
.badge-wrapper {
  width: 170px;
  height: 51px;
  overflow: hidden;
  position: relative;
  border-radius: 12px;
  background-color: #000000;
  /* Fills empty space if inner image is scaled down */
}

/* Base scaling for Apple Store (fills the container closely) */
.badge-img {
  position: absolute;
  width: 210px !important;
  height: 210px !important;
  max-width: none !important;
}

/* Reduced scale for Google Play to give inner elements breathing room */
.badge-img.google-play {
  width: 175px !important;
  height: 175px !important;
  left: -3px;
  top: -91px;
  /* Clips the native white border lines from the shrunken graphic */
  clip-path: inset(93px 13px 35px 13px);
}

.badge-img.app-store {
  left: -21px;
  top: -37px;
}

.btn-download:hover {
  transform: translateY(-4px);
}

.download-mockup {
  max-width: 800px;
  margin: 0 auto;
}

.download-mockup img {
  width: 100%;
  height: auto;
  max-width: 800px;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, #3a7531 0%, var(--color-primary) 100%);
  color: var(--color-surface);
  padding: 60px 0 20px;
  text-align: center;
}

.footer-logo {
  margin-bottom: 24px;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.footer-social img {
  width: 24px;
  height: 24px;
  transition: opacity 0.3s;
}

.footer-logo img,
.footer-social img {
  filter: brightness(0) invert(1);
}

.footer-social a:hover img {
  opacity: 0.8;
}

.footer-contact {
  margin-bottom: 20px;
}

.footer-contact a {
  color: var(--color-surface);
  text-decoration: none;
  font-weight: 500;
}

.footer-contact a:hover {
  text-decoration: underline;
}

.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 48px;
}

.footer-nav a {
  color: var(--color-surface);
  text-decoration: none;
  font-size: 14px;
  opacity: 0.9;
}

.footer-nav a:hover {
  text-decoration: underline;
  opacity: 1;
}

.footer-trust {
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.trust-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
}

.trust-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  opacity: 0.8;
}

.trust-icons img {
  height: 24px;
  width: auto;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.trust-icons img:hover {
  opacity: 1;
  transform: scale(1.05);
}

.footer-copyright {
  font-size: 14px;
  opacity: 0.7;
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--color-surface);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  padding: 24px 0;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.4s ease-out;
}

.cookie-banner.visible {
  transform: translateY(0);
}

.cookie-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.cookie-content p {
  font-size: 14px;
  color: var(--color-text-main);
  max-width: 700px;
}

.cookie-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn {
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition:
    transform 0.2s,
    opacity 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-surface);
  border: none;
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text-gray);
  border: 1px solid var(--color-text-gray);
}

.cookie-config {
  font-size: 14px;
  color: var(--color-primary);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .download-section {
    padding: 80px 0 0;
  }

  .download-actions {
    flex-direction: column;
    align-items: center;
  }

  .cookie-content {
    flex-direction: column;
    text-align: center;
  }

  .cookie-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }
}

/* Animations (Generic) */
.fade-in {
  opacity: 0;
  transform: translateY(40px) scale(0.98);
  transition:
    opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* --- DATA IMPACT SECTION (Lo que no llega a tu mesa) --- */
.ff-section-data {
  padding: 100px 0;
  background-color: #f0f7ee;
  /* Soft green */
}

.ff-data-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-top: 80px;
  /* Increased from 48px to separate title more */
  margin-bottom: 32px;
  text-align: center;
}

.ff-data-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.ff-data-number {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-primary);
  font-family: var(--font-main);
}

.ff-data-description {
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text-gray);
  margin: 0;
  max-width: 220px;
}

.ff-data-source {
  font-size: 11px;
  color: var(--color-text-gray);
  opacity: 0.7;
  text-align: right;
  margin-top: 24px;
}

.ff-data-highlight {
  text-align: center;
  color: #2d5a27;
  font-size: 16px;
  font-weight: 600;
  margin-top: 64px;
}



@media (max-width: 1024px) {

  .ff-data-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 24px;
  }

  /* Diseño 2x2 para tablets, mucho más equilibrado que forzar 4 o poner 1 */
  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 48px 24px;
  }

  .step__icon img {
    max-width: 200px;
    /* Un poco más pequeño en tablet */
  }
}

@media (max-width: 768px) {
  .ff-section-data {
    padding: 80px 0;
  }

  .ff-data-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px 16px;
    margin-top: 56px;
    /* Balance spacing on mobile */
  }



  .ff-data-number {
    font-size: 36px;
  }

  .ff-data-source {
    text-align: center;
    margin-top: 40px;
    /* Small increase for mobile layout */
  }
}

/* Chatbot */
.chatbot-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 50px;
  height: 50px;
  background-color: var(--color-text-main);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 12px rgba(26, 26, 26, 0.4);
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.chatbot-btn:hover {
  transform: scale(1.05);
}

.chatbot-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background-color: var(--color-text-main);
  z-index: -1;
  animation: pulse 2s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
}

.chatbot-btn.clicked::before {
  animation: none;
  display: none;
}

.chatbot-icon {
  width: 28px;
  height: 28px;
  fill: var(--color-surface);
}

.chatbot-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  background-color: var(--color-primary);
  border-radius: 50%;
  border: 3px solid var(--color-surface);
}

.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 340px;
  height: 440px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
  z-index: 999;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: bottom right;
}

.chatbot-window.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

.chatbot-header {
  padding: 20px 16px;
  background-color: var(--color-primary);
  color: var(--color-surface);
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
}

.chatbot-close {
  background: none;
  border: none;
  color: var(--color-surface);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.chatbot-close:hover {
  opacity: 1;
}

.chatbot-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: rgba(255, 255, 255, 0.5);
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}

.chatbot-body::-webkit-scrollbar {
  width: 6px;
}

.chatbot-body::-webkit-scrollbar-thumb {
  background-color: var(--color-primary);
  border-radius: 10px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.4;
  animation: msgAppear 0.3s ease-out;
}

.chat-msg.bot {
  align-self: flex-start;
  background-color: #faf8dc;
  color: var(--color-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(45, 90, 39, 0.1);
}

.chat-msg.user {
  align-self: flex-end;
  background-color: var(--color-accent);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

@keyframes msgAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chatbot-input-area {
  padding: 16px;
  border-top: 1px solid rgba(45, 90, 39, 0.1);
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.4);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.chatbot-input-area input {
  flex-grow: 1;
  padding: 12px 16px;
  border: 1px solid rgba(45, 90, 39, 0.2);
  border-radius: 24px;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  background: var(--color-surface);
  transition: border-color 0.2s;
}

.chatbot-input-area input:focus {
  border-color: var(--color-primary);
}

.chatbot-input-area button {
  background-color: var(--color-primary);
  color: var(--color-surface);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.2s,
    background-color 0.2s;
}

.chatbot-input-area button:hover {
  transform: scale(1.05);
  background-color: #1f3d1a;
}

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

  50% {
    transform: scale(1.4);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .chatbot-window {
    width: calc(100% - 32px);
    right: 16px;
    bottom: 90px;
  }

  .chatbot-btn {
    right: 16px;
    bottom: 16px;
  }
}