/*
Theme Name: Terres de l'Ebre
Theme URI: https://example.com/terres-ebre
Author: Diseño web turístico personalizado
Description: Tema de WordPress para destinos turísticos de naturaleza. Todo editable desde el Personalizador: colores, tipografías, textos, imágenes y secciones. Incluye contenidos propios para Atractivos, Actividades, Alojamiento, Agenda y Galería.
Version: 1.0.1
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: terres-ebre
Tags: tourism, custom-colors, custom-logo, custom-menu, featured-images, translation-ready, block-styles, wide-blocks
*/

/* ==========================================================================
   1. Tokens (los valores reales se inyectan desde el Personalizador)
   ========================================================================== */
:root {
  --te-bg: #F6F1E7;
  --te-ink: #1C2B27;
  --te-green: #24413A;
  --te-accent: #D97B4F;
  --te-sand: #F0E6D3;
  --te-cream: #F3D8B0;
  --te-muted: #5C6864;
  --te-muted-2: #8A9490;
  --te-font-head: 'Instrument Serif', Georgia, serif;
  --te-font-body: 'Work Sans', system-ui, -apple-system, sans-serif;
  --te-max: 1280px;
  --te-radius: 18px;
}

/* ==========================================================================
   2. Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--te-bg);
  color: var(--te-ink);
  font-family: var(--te-font-body);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--te-accent); color: #fff; }

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

a { color: var(--te-accent); }

h1, h2, h3, h4 {
  font-family: var(--te-font-head);
  font-weight: 400;
  color: var(--te-ink);
  margin: 0;
}

.te-wrap {
  max-width: var(--te-max);
  margin: 0 auto;
  padding-left: 40px;
  padding-right: 40px;
  width: 100%;
}

.te-wrap--narrow { max-width: 1000px; }
.te-wrap--tight  { max-width: 760px; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed; top: 12px; left: 12px; z-index: 999;
  background: #fff; color: var(--te-ink);
  padding: 12px 20px; border-radius: 100px;
  clip: auto; clip-path: none; width: auto; height: auto;
}

:focus-visible {
  outline: 3px solid var(--te-accent);
  outline-offset: 3px;
}

/* ==========================================================================
   3. Cabecera / navegación
   ========================================================================== */
.te-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  transition: background .3s ease, box-shadow .3s ease;
}

.te-header.is-scrolled,
.te-header.te-header--solid {
  background: var(--te-bg);
  box-shadow: 0 2px 20px rgba(0,0,0,.06);
}

.te-header__inner {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.te-brand {
  font-family: var(--te-font-head);
  font-size: 26px;
  letter-spacing: .3px;
  text-decoration: none;
  color: #fff;
  transition: color .3s ease;
  display: inline-flex;
  align-items: center;
}

.te-brand img { max-height: 46px; width: auto; }

.te-header.is-scrolled .te-brand,
.te-header--solid .te-brand { color: var(--te-ink); }

.te-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 32px;
  margin: 0;
  padding: 0;
}

.te-nav a {
  color: #fff;
  opacity: .92;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: opacity .2s ease, color .3s ease;
}

.te-nav a:hover { opacity: .65; }

.te-header.is-scrolled .te-nav a,
.te-header--solid .te-nav a { color: var(--te-ink); }

/* Último elemento del menú = botón destacado. Añade la clase CSS "te-cta" al
   elemento del menú desde Apariencia > Menús para forzar este estilo. */
.te-nav li.te-cta > a,
.te-header .te-nav li:last-child.menu-item-cta > a {
  background: var(--te-accent);
  color: #fff !important;
  padding: 11px 22px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 14px;
  opacity: 1;
}

.te-nav li.te-cta > a:hover { opacity: .85; }

.te-nav .sub-menu {
  display: none;
  position: absolute;
  background: #fff;
  padding: 10px;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.1);
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}

.te-nav li { position: relative; }
.te-nav li:hover > .sub-menu { display: flex; }
.te-nav .sub-menu a { color: var(--te-ink) !important; padding: 8px 12px; }

.te-burger {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 10px;
  color: #fff;
}

.te-header.is-scrolled .te-burger,
.te-header--solid .te-burger { color: var(--te-ink); }

.te-burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  margin: 5px 0;
  transition: transform .25s ease, opacity .25s ease;
}

.te-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.te-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.te-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   4. Hero
   ========================================================================== */
.te-hero {
  position: relative;
  min-height: 640px;
  height: 100vh;
  display: flex;
  align-items: flex-end;
  margin-top: -84px;
}

.te-hero__media { position: absolute; inset: 0; overflow: hidden; background: var(--te-green); }

.te-hero--sin-imagen .te-hero__media {
  background: linear-gradient(160deg, var(--te-green) 0%, var(--te-ink) 100%);
}

.te-hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.te-hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(28,43,39,.15) 0%, rgba(28,43,39,.25) 45%, rgba(20,32,29,.85) 100%);
}

.te-hero__inner {
  position: relative;
  color: #fff;
  padding-bottom: 100px;
  padding-top: 120px;
}

.te-hero__eyebrow {
  font-size: 15px;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--te-cream);
  margin: 0 0 20px;
}

.te-hero h1 {
  font-size: clamp(40px, 6.2vw, 88px);
  line-height: .98;
  color: #fff;
  margin: 0 0 24px;
  max-width: 820px;
}

.te-hero__text {
  font-size: 20px;
  line-height: 1.5;
  max-width: 560px;
  margin: 0 0 40px;
  font-weight: 300;
  opacity: .95;
}

/* ==========================================================================
   5. Botones
   ========================================================================== */
.te-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 16px 28px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 15px;
  border: 0;
  cursor: pointer;
  font-family: var(--te-font-body);
  transition: transform .2s ease, opacity .2s ease;
}

.te-btn:hover { transform: translateY(-2px); }

.te-btn--light { background: #fff; color: var(--te-ink); }
.te-btn--accent { background: var(--te-accent); color: #fff; }

/* ==========================================================================
   6. Cabeceras de sección
   ========================================================================== */
.te-section { padding: 140px 0; }
.te-section--dark { background: var(--te-green); padding: 130px 0; }
.te-section--sand { background: var(--te-sand); padding: 130px 0; }

.te-eyebrow {
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--te-accent);
  margin: 0 0 12px;
}

.te-section--dark .te-eyebrow { color: var(--te-cream); }

.te-shead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

.te-shead--center { justify-content: center; text-align: center; }
.te-shead--stack { display: block; }

.te-shead h2 {
  font-size: clamp(32px, 3.6vw, 46px);
  margin: 0;
  max-width: 700px;
}

.te-section--dark h2,
.te-section--dark h3 { color: #fff; }

.te-shead__aside {
  max-width: 420px;
  color: #4A5854;
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
}

/* ==========================================================================
   7. Intro (cita)
   ========================================================================== */
.te-intro {
  max-width: 980px;
  margin: 0 auto;
  padding: 140px 40px 100px;
  text-align: center;
}

.te-intro p {
  font-family: var(--te-font-head);
  font-style: italic;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.5;
  color: var(--te-green);
  margin: 0;
}

.te-intro__rule {
  width: 60px;
  height: 3px;
  background: var(--te-accent);
  margin: 36px auto 0;
  border-radius: 2px;
}

/* ==========================================================================
   8. Rejillas de contenido
   ========================================================================== */
.te-grid { display: grid; gap: 24px; }
.te-grid--4 { grid-template-columns: repeat(4, 1fr); }
.te-grid--3 { grid-template-columns: repeat(3, 1fr); gap: 28px; }
.te-grid--2 { grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }

/* Tarjeta Atractivo */
.te-card { display: flex; flex-direction: column; gap: 18px; }

.te-card__img {
  width: 100%;
  height: 320px;
  border-radius: var(--te-radius);
  overflow: hidden;
  background: rgba(28,43,39,.06);
  position: relative;
}

.te-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.te-card:hover .te-card__img img { transform: scale(1.04); }

.te-card h3 { font-size: 24px; margin: 0 0 8px; }
.te-card p { font-size: 15px; line-height: 1.55; color: var(--te-muted); margin: 0; }

/* Tarjeta Actividad (sobre fondo oscuro) */
.te-actividad {
  background: rgba(255,255,255,.06);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.te-actividad__img { height: 220px; overflow: hidden; }
.te-actividad__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.te-actividad:hover .te-actividad__img img { transform: scale(1.05); }
.te-actividad__body { padding: 28px; }
.te-actividad h3 { font-size: 22px; margin: 0 0 10px; }
.te-actividad p { font-size: 14.5px; line-height: 1.55; color: rgba(255,255,255,.72); margin: 0; }

/* Tarjeta Alojamiento */
.te-aloj__media { position: relative; }
.te-aloj__media .te-card__img { height: 260px; }

.te-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  background: #fff;
  color: var(--te-green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 100px;
}

/* Agenda */
.te-eventos { display: flex; flex-direction: column; }

.te-evento {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 28px 0;
  border-bottom: 1px solid rgba(28,43,39,.12);
}

.te-evento__date { min-width: 100px; text-align: center; }

.te-evento__day {
  font-family: var(--te-font-head);
  font-size: 36px;
  margin: 0;
  color: var(--te-green);
  line-height: 1;
}

.te-evento__month {
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #8A7A5E;
  margin: 4px 0 0;
  font-weight: 600;
}

.te-evento__body { flex: 1; }
.te-evento__body h3 { font-size: 24px; margin: 0 0 6px; }
.te-evento__body p { font-size: 14.5px; color: var(--te-muted); margin: 0; }

.te-evento__link {
  text-decoration: none;
  color: var(--te-accent);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

/* Galería */
.te-galeria {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 180px;
  gap: 20px;
}

.te-galeria__item {
  border-radius: 16px;
  overflow: hidden;
  background: rgba(28,43,39,.06);
}

.te-galeria__item img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.te-galeria__item:hover img { transform: scale(1.05); }

.te-size-grande  { grid-column: span 2; grid-row: span 2; }
.te-size-ancho   { grid-column: span 2; grid-row: span 1; }
.te-size-normal  { grid-column: span 1; grid-row: span 1; }

/* Blog */
.te-post { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 18px; }
.te-post__img { height: 200px; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.08); }
.te-post__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.te-post:hover .te-post__img img { transform: scale(1.05); }

.te-post__cat {
  font-size: 12.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--te-accent);
  font-weight: 700;
  margin: 0 0 10px;
}

.te-post h3 { font-size: 21px; margin: 0 0 8px; line-height: 1.3; }
.te-post__date { font-size: 14px; color: rgba(255,255,255,.65); margin: 0; }

/* Cómo llegar */
.te-llegar__text { font-size: 16px; line-height: 1.7; color: #4A5854; margin: 0 0 28px; }
.te-llegar h2 { font-size: clamp(30px, 3.2vw, 42px); margin: 0 0 24px; }
.te-llegar__list { display: flex; flex-direction: column; gap: 16px; }
.te-llegar__row { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.te-llegar__label { font-family: var(--te-font-head); font-size: 22px; color: var(--te-green); }
.te-llegar__value { color: var(--te-muted-2); font-size: 14px; }

.te-llegar__img { width: 100%; height: 420px; border-radius: 20px; overflow: hidden; background: rgba(28,43,39,.06); }
.te-llegar__img img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   9. Contacto
   ========================================================================== */
.te-contacto { text-align: center; }
.te-contacto h2 { font-size: clamp(30px, 3.2vw, 42px); margin: 0 0 20px; }
.te-contacto__text { font-size: 16px; line-height: 1.6; color: var(--te-muted); margin: 0 0 44px; }

.te-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.te-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.te-form input[type="text"],
.te-form input[type="email"],
.te-form textarea {
  width: 100%;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid rgba(28,43,39,.15);
  font-family: var(--te-font-body);
  font-size: 15px;
  background: #fff;
  color: var(--te-ink);
}

.te-form textarea { resize: vertical; min-height: 120px; }
.te-form .te-btn { align-self: flex-start; }
.te-form__hp { position: absolute; left: -9999px; }

.te-notice {
  padding: 14px 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  font-size: 15px;
}

.te-notice--ok { background: rgba(36,65,58,.1); color: var(--te-green); }
.te-notice--error { background: rgba(217,123,79,.15); color: #9c4a24; }

/* ==========================================================================
   10. Pie
   ========================================================================== */
.te-footer { background: var(--te-ink); padding: 64px 0 32px; color: rgba(255,255,255,.72); }

.te-footer__cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.te-footer__brand { font-family: var(--te-font-head); font-size: 24px; color: #fff; margin: 0 0 14px; }
.te-footer__about { font-size: 14px; color: rgba(255,255,255,.55); line-height: 1.6; margin: 0; max-width: 260px; }

.te-footer__title {
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin: 0 0 16px;
  font-weight: 600;
}

.te-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.te-footer a { color: rgba(255,255,255,.72); text-decoration: none; font-size: 14.5px; }
.te-footer a:hover { color: #fff; }
.te-footer__contact { display: flex; flex-direction: column; gap: 10px; font-size: 14.5px; }
.te-footer__legal { text-align: center; color: rgba(255,255,255,.35); font-size: 13px; margin: 28px 0 0; }

/* ==========================================================================
   11. Páginas interiores, entradas y archivos
   ========================================================================== */
.te-page-hero {
  background: var(--te-green);
  padding: 160px 0 80px;
  color: #fff;
  margin-top: -84px;
}

.te-page-hero h1 { color: #fff; font-size: clamp(34px, 4.4vw, 56px); max-width: 900px; }
.te-page-hero .te-eyebrow { color: var(--te-cream); }
.te-page-hero__meta { color: rgba(255,255,255,.6); font-size: 14.5px; margin: 16px 0 0; }

.te-content { padding: 80px 0 120px; }

.te-entry {
  max-width: 760px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.75;
  color: #35433F;
}

.te-entry h2 { font-size: 34px; margin: 48px 0 16px; }
.te-entry h3 { font-size: 26px; margin: 36px 0 12px; }
.te-entry p { margin: 0 0 20px; }
.te-entry img, .te-entry .wp-block-image img { border-radius: var(--te-radius); }
.te-entry blockquote {
  border-left: 3px solid var(--te-accent);
  margin: 32px 0;
  padding: 4px 0 4px 24px;
  font-family: var(--te-font-head);
  font-style: italic;
  font-size: 22px;
  color: var(--te-green);
}

.te-thumb-lead {
  max-width: var(--te-max);
  margin: -60px auto 60px;
  padding: 0 40px;
}

.te-thumb-lead img { border-radius: 24px; width: 100%; height: 520px; object-fit: cover; }

.te-pagination { display: flex; gap: 10px; justify-content: center; margin-top: 60px; flex-wrap: wrap; }
.te-pagination .page-numbers {
  padding: 10px 16px;
  border-radius: 100px;
  text-decoration: none;
  color: var(--te-ink);
  background: rgba(28,43,39,.06);
  font-size: 14px;
  font-weight: 600;
}
.te-pagination .page-numbers.current { background: var(--te-accent); color: #fff; }

.te-back {
  display: inline-block;
  margin-top: 48px;
  color: var(--te-accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 15px;
}

.te-404 { text-align: center; padding: 200px 0 160px; }
.te-404 h1 { font-size: clamp(40px, 6vw, 72px); margin: 0 0 16px; }
.te-404 p { color: var(--te-muted); margin: 0 0 32px; }

/* ==========================================================================
   12. Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .te-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .te-grid--3 { grid-template-columns: repeat(2, 1fr); }
  .te-card__img { height: 260px; }
}

@media (max-width: 860px) {
  .te-wrap { padding-left: 24px; padding-right: 24px; }
  .te-burger { display: block; }

  .te-nav {
    position: absolute;
    top: 84px;
    left: 0;
    right: 0;
    background: var(--te-bg);
    box-shadow: 0 20px 40px rgba(0,0,0,.08);
    display: none;
  }

  .te-nav.is-open { display: block; }

  .te-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 24px 24px;
  }

  .te-nav li { border-bottom: 1px solid rgba(28,43,39,.08); }
  .te-nav li:last-child { border-bottom: 0; }
  .te-nav a { color: var(--te-ink); display: block; padding: 16px 0; font-size: 17px; }
  .te-nav li.te-cta > a { display: inline-block; margin-top: 12px; }
  .te-nav .sub-menu { position: static; display: flex; box-shadow: none; background: transparent; padding: 0 0 10px 14px; }

  .te-section { padding: 90px 0; }
  .te-section--dark, .te-section--sand { padding: 90px 0; }
  .te-intro { padding: 90px 24px 70px; }

  .te-grid--3, .te-grid--4 { grid-template-columns: 1fr; }
  .te-grid--2 { grid-template-columns: 1fr; gap: 40px; }

  .te-galeria { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; }
  .te-size-grande { grid-column: span 2; grid-row: span 2; }
  .te-size-ancho, .te-size-normal { grid-column: span 1; grid-row: span 1; }

  .te-evento { flex-wrap: wrap; gap: 16px; }
  .te-evento__date { min-width: 64px; text-align: left; }
  .te-evento__day { font-size: 30px; }

  .te-form__row { grid-template-columns: 1fr; }

  .te-footer__cols { grid-template-columns: 1fr 1fr; gap: 32px; }

  .te-hero { min-height: 560px; height: auto; padding-top: 84px; }
  .te-hero__inner { padding-bottom: 70px; padding-top: 140px; }
  .te-hero__text { font-size: 17px; }

  .te-thumb-lead img { height: 300px; }
  .te-page-hero { padding: 140px 0 60px; }
}

@media (max-width: 520px) {
  .te-footer__cols { grid-template-columns: 1fr; }
  .te-galeria { grid-template-columns: 1fr; }
  .te-size-grande, .te-size-ancho { grid-column: span 1; grid-row: span 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
