/*
  Camino del Dharma — Main stylesheet
  Single entry point. Order: variables → base → layout → components → pages → utilities → states
  Refs: 02-identidad-corporativa, 14-css-architecture, 19-accesibilidad-estandares, 20-layout-principles
*/

/* ==========================================================================
   0. Fonts (autohosted in assets/fonts; font-display: swap)
   ========================================================================== */

/* Inter — body text (Fontsource, SIL OFL) */
@font-face {
  font-family: Inter;
  src: url("../fonts/inter/inter-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Inter;
  src: url("../fonts/inter/inter-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Inter;
  src: url("../fonts/inter/inter-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Fjalla One — Google Fonts (SIL OFL 1.1); self-hosted */
@font-face {
  font-family: "Fjalla One";
  src: url("../fonts/fjalla-one/fjalla-one-latin-400-normal.woff2") format("woff2"),
       url("../fonts/fjalla-one/fjalla-one.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* MarloweEscapade — OnlineWebFonts (CC BY 4.0); credit in footer */
@font-face {
  font-family: MarloweEscapade;
  src: url("../fonts/marlowe-escapade/marlowe-escapade.woff2") format("woff2"),
       url("../fonts/marlowe-escapade/marlowe-escapade.woff") format("woff"),
       url("../fonts/marlowe-escapade/marlowe-escapade.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   1. Variables ( :root )
   ========================================================================== */
:root {
  /* Brand (manual de marca — 4 colors only) */
  --brand-1: #8c2b3d;
  --brand-2: #b27474;
  --brand-3: #d1aeab;
  --brand-4: #3e424b;

  /* Accessibility tints — derived from brand-1/brand-2, added to reach WCAG AA
     where the original brand colors fall short as text/background-with-text.
     brand-1 and brand-2 themselves are never modified and keep every other
     use (buttons, header, decorative accents) unchanged. */
  --brand-1-deep: #7a2436; /* brand-1, darkened: ~4.85:1 as text on --bg (was 4.10:1) */
  --brand-2-deep: #9d6666; /* brand-2, darkened: ~4.64:1 under white text (was 3.72:1) */

  /* Semantic roles — fondos principales: brand-1/2/3; texto: brand-4 o blanco sobre fondo oscuro */
  --bg: var(--brand-3);
  --text: var(--brand-4);
  --text-muted: var(--brand-4);
  --surface: var(--brand-3);
  --border: var(--brand-3);
  --link: var(--brand-1-deep);
  --link-hover: var(--brand-4);
  --primary: var(--brand-1);
  --primary-hover: var(--brand-2-deep);
  --header-bg: var(--brand-1);
  --footer-bg: var(--brand-2-deep);
  --text-on-dark: #fff;

  /* Typography */
  --font-display: "MarloweEscapade", serif;
  --font-heading: "Fjalla One", "MarloweEscapade", serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  /* Grid & rhythm */
  --container-max: 70rem;
  --read-max: 65ch;
  --gutter: 1.5rem;
  --section-gap: 3rem;
  --header-offset: 7rem; /* space below fixed header (body padding-top, scroll-margin) */
  --grid-gap: 1.5rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --line-height-body: 1.6;
  --line-height-tight: 1.35;

  /* Breakpoints (for reference; use in media queries) */

  /* Mobile: default. Tablet: 768px. Desktop: 1024px. Large: 1280px */
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  padding-top: var(--header-offset);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height-body);
  color: var(--text);
  background-color: var(--bg);
  position: relative;
}

/* Logo as subtle background texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("../images/logo.png");
  background-repeat: repeat;
  background-size: 140px auto;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

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

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--link-hover);
}

a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ==========================================================================
   3. Layout
   ========================================================================== */
.layout-container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.read-width {
  max-width: var(--read-max);
}

.page-main {
  padding-block: var(--space-xl);
  scroll-margin-top: var(--header-offset);
}

@media (width <= 767px) {
  .page-main {
    padding-top: var(--space-sm);
  }
}

.section-gap {
  margin-bottom: var(--section-gap);
}

.section-gap:last-child {
  margin-bottom: 0;
}

/* Grid for multi-column blocks (e.g. Cómo practicamos, Caminos) */
.grid-auto {
  display: grid;
  gap: var(--grid-gap);
}

@media (width >= 768px) {
  .grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  }
}

@media (width >= 1024px) {
  .grid-auto.grid-three {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   4. Components
   ========================================================================== */

/* --- Skip link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--gutter);
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--primary);
  color: var(--text-on-dark);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 4px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  z-index: 1001; /* above fixed header */
  outline: 2px solid var(--text-on-dark);
  outline-offset: 2px;
}

/* --- Site header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: var(--header-bg);
  color: var(--text-on-dark);
}

.site-header a {
  color: inherit;
  text-decoration: none;
}

.site-header a:hover,
.site-header a:focus-visible {
  color: var(--text-on-dark);
  opacity: 0.9;
}

.site-header .layout-container {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding-block: var(--space-sm);
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px));
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  height: 2.75rem;
  margin-inline-end: var(--space-md);
}

.site-logo img {
  height: 100%;
  width: auto;
}

.site-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

@media (width >= 768px) {
  .site-logo {
    height: 3rem;
  }

  .site-name {
    font-size: 1.375rem;
  }
}

/* --- Navigation --- */
.nav-main {
  display: flex;
  align-items: center;
}

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--text-on-dark);
  border-radius: 4px;
  color: inherit;
  cursor: pointer;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: rgb(255 255 255 / 15%);
  outline: 2px solid var(--text-on-dark);
  outline-offset: 2px;
}

.nav-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Nav collapses to a hamburger through tablet widths: the 5-item main
   menu + subnav + logo + language switcher don't fit in one row until
   the "Large" tier (1280px, see the --container-max note above and
   docs/14, docs/20 — single responsive system, no per-page grids). */
@media (width >= 1280px) {
  .nav-toggle {
    display: none;
  }
}

.nav-menus {
  display: none;
  flex-direction: column;
  margin: 0;
  padding: 0;
  gap: 0;
}

.nav-menus.is-open {
  display: flex;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--header-bg);
  padding: var(--space-md);
  box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
}

@media (width >= 1280px) {
  .nav-menus,
  .nav-menus.is-open {
    display: flex;
    flex-direction: column;
    position: static;
    box-shadow: none;
    padding: 0;
    gap: 2px var(--space-sm);
    background: transparent;
  }
}

.nav-menu,
.nav-sub {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (width >= 1280px) {
  .nav-menu {
    display: grid;
    grid-template-columns: repeat(5, auto);
    gap: 2px var(--space-xs);
  }

  .nav-sub {
    display: flex;
    flex-flow: row wrap;
    gap: var(--space-xs) var(--space-sm);
    padding-top: 2px;
    border-top: 1px solid rgb(255 255 255 / 25%);
    font-size: 0.875rem;
  }
}

.nav-menu a,
.nav-sub a {
  display: flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  min-height: 44px;
  padding-block: 0;
}

/* Header background equals --primary, so the default focus-visible outline
   (also --primary) is invisible here; override to match .nav-toggle/.lang-btn */
.nav-menu a:focus-visible,
.nav-sub a:focus-visible {
  outline: 2px solid var(--text-on-dark);
  outline-offset: 2px;
}

@media (width >= 1280px) {
  .nav-menu a,
  .nav-sub a {
    min-height: 36px;
    padding: var(--space-xs);
  }
}

/* --- Language switcher (non-functional in this version) --- */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.9375rem;
}

.lang-btn {
  padding: var(--space-xs) var(--space-sm);
  min-height: 44px;
  min-width: 44px;
  background: transparent;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border-radius: 4px;
}

.lang-btn:hover,
.lang-btn:focus-visible {
  background: rgb(255 255 255 / 15%);
  outline: 2px solid var(--text-on-dark);
  outline-offset: 2px;
}

.lang-btn[aria-current="true"] {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.lang-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lang-btn:disabled:hover,
.lang-btn:disabled:focus-visible {
  background: transparent;
  outline: none;
}

.lang-switcher-sep {
  opacity: 0.7;
  pointer-events: none;
}

/* Below the large nav tier, logo + hamburger + language switcher share one row.
   Hide the wordmark so ES|EN is never clipped on narrow phones (e.g. ~360px). */
@media (width <= 1279px) {
  .site-name {
    display: none;
  }

  .site-logo {
    flex: 1 1 auto;
    min-width: 0;
    margin-inline-end: 0;
  }

  .nav-main,
  .lang-switcher {
    flex-shrink: 0;
  }
}

@media (width <= 479px) {
  .site-header .layout-container {
    gap: var(--space-xs);
    padding-inline: max(var(--space-sm), env(safe-area-inset-left, 0px)) max(var(--space-sm), env(safe-area-inset-right, 0px));
  }

  .lang-switcher {
    gap: 0.125rem;
  }

  .lang-btn {
    min-width: 2.75rem;
    padding-inline: 0.375rem;
  }
}

/* --- Lucide-style icons (inline SVG) --- */
.lucide-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.25em;
  stroke: currentcolor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lucide-icon--sm {
  width: 1rem;
  height: 1rem;
  vertical-align: -0.2em;
}

.btn .lucide-icon {
  margin-right: var(--space-xs);
  vertical-align: -0.35em;
}

/* Decorative large icons in body (styling only) */
.deco-icon-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-lg) 0;
  pointer-events: none;
}

.lucide-icon--deco {
  width: 4rem;
  height: 4rem;
  opacity: 0.35;
  stroke: var(--brand-1);
}

.lucide-icon--deco-lg {
  width: 5rem;
  height: 5rem;
  opacity: 0.28;
  stroke: var(--brand-1);
}

/* --- Figures and media (20: tipografía primero; imagen apoya) --- */
.section-figure {
  margin: 0 0 var(--space-lg);
}

.section-figure img {
  width: 100%;
  border-radius: 4px;
}

.section-figure figcaption {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* --- Video block (15: preload metadata, no autoplay) --- */
.media-block {
  margin-bottom: var(--section-gap);
}

.media-block video {
  width: 100%;
  max-width: 50rem;
  border-radius: 4px;
  background: var(--brand-4);
}

.media-block .video-caption {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* Vimeo: help text as tooltip on hover */
.media-block--vimeo {
  position: relative;
}

.video-embed-help {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  font-size: 0.8125rem;
  color: var(--text);
  margin: 0;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.media-block--vimeo:hover .video-embed-help,
.media-block--vimeo:focus-within .video-embed-help {
  opacity: 1;
  visibility: visible;
}

.practica-videos-more {
  margin-top: var(--space-lg);
  margin-bottom: 0;
}

/* --- Home: videos preview (mirrors home-blog pattern) --- */
.home-videos-intro {
  margin-bottom: var(--space-lg);
  color: var(--text-muted);
}

.home-videos-grid {
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: 1fr;
  margin: 0 0 var(--space-md);
}

@media (width >= 768px) {
  .home-videos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.home-videos-grid .media-block {
  margin-bottom: 0;
}

.home-videos-more {
  margin-bottom: 0;
  text-align: center;
}

.home-videos-more a {
  color: var(--link);
}

.practica-videos-more a {
  color: var(--link);
}

.page-back {
  margin-bottom: var(--space-md);
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.page-back a {
  color: var(--link);
}

.embed-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin-bottom: var(--space-md);
  border-radius: 4px;
  overflow: hidden;
  background: var(--brand-4);
}

.embed-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* --- Gallery grid --- */
.gallery-albums {
  display: grid;
  gap: var(--section-gap);
  margin-block: var(--section-gap);
}

.gallery-album {
  scroll-margin-top: var(--header-offset);
}

.gallery-album + .gallery-album {
  padding-top: var(--section-gap);
  border-top: 1px solid var(--border);
}

.gallery-album h2 {
  margin-top: 0;
}

.gallery-grid {
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: repeat(2, 1fr);
}

@media (width >= 768px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (width >= 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.gallery-grid img,
.gallery-row img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
}

/* --- Gallery pagination --- */
.gallery-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  padding-block: var(--space-lg);
}

.gallery-pagination-prev,
.gallery-pagination-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
}

.gallery-pagination-prev:hover,
.gallery-pagination-next:hover {
  color: var(--link);
  text-decoration: underline;
}

.gallery-pagination-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: inherit;
}

.gallery-pagination-info {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.gallery-pagination-pages {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  justify-content: center;
}

.gallery-pagination-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  text-decoration: none;
  color: var(--link);
  font-weight: 500;
}

.gallery-pagination-num:hover {
  text-decoration: underline;
}

.gallery-pagination-num.is-current {
  background-color: var(--brand-2-deep);
  color: var(--text-on-dark);
  text-decoration: none;
  pointer-events: none;
}

.gallery-row {
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: repeat(2, 1fr);
}

@media (width >= 768px) {
  .gallery-row {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Linaje --- */
.linaje-tradition-focus {
  margin: 0 0 var(--space-md);
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.linaje-masters {
  margin: var(--space-md) 0 var(--space-lg);
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.linaje-masters li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
  line-height: var(--line-height-body);
}

/* --- Linaje: vertical timeline (legacy) --- */
.linaje-timeline-wrap {
  margin-top: var(--space-xl);
}

.linaje-timeline-intro {
  margin-bottom: var(--space-lg);
  color: var(--text-muted);
}

.linaje-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-left: var(--space-lg);
  border-left: 2px solid var(--border);
  position: relative;
}

.linaje-timeline-item {
  position: relative;
  padding-bottom: var(--space-xl);
}

.linaje-timeline-item:last-child {
  padding-bottom: 0;
}

.linaje-timeline-marker {
  position: absolute;
  left: calc(-1 * (var(--space-lg) + 6px));
  top: 0.35em;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--primary);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--primary);
}

.linaje-timeline-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: var(--space-md);
}

.linaje-timeline-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  margin: 0 0 var(--space-sm);
  color: var(--brand-1-deep);
}

.linaje-timeline-content p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: var(--line-height-body);
}

.linaje-timeline-content p + p {
  margin-top: var(--space-sm);
}

/* --- Hero --- */
.site-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 600;
  text-align: center;
  margin: 0 0 var(--space-sm);
  color: var(--brand-1);
  letter-spacing: 0.02em;
  line-height: var(--line-height-tight);
}

.site-tagline {
  margin: 0 auto var(--space-sm);
  max-width: 36rem;
  text-align: center;
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  line-height: var(--line-height-body);
  color: var(--text-muted);
}

.site-intro-link {
  margin: 0 0 var(--space-lg);
}

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: auto;
  padding: var(--space-xl) var(--gutter);
  text-align: center;
  color: var(--text-on-dark);
  background-color: var(--brand-2);
  border-radius: 8px;
  border: 1px solid rgb(255 255 255 / 25%);
  box-shadow: 0 2px 12px rgb(0 0 0 / 15%);
}

.hero-figure {
  margin: 0 auto var(--space-md);
  max-width: 42rem;
  max-height: 28vh;
  overflow: hidden;
  border-radius: 6px;
}

.hero-figure picture,
.section-figure picture {
  display: block;
}

.hero-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.hero .hero-title,
.hero .hero-lead {
  color: var(--text-on-dark);
  text-shadow: 0 1px 2px rgb(0 0 0 / 40%);
}

.hero .hero-lead {
  opacity: 0.95;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: var(--line-height-tight);
  margin: 0 0 var(--space-sm);
}

.hero-lead {
  font-size: 1.125rem;
  margin: 0 0 var(--space-md);
}

.hero .btn-primary {
  background-color: var(--brand-1);
  color: #fff;
}

.hero .btn-primary:hover {
  background-color: var(--brand-2-deep);
  color: #fff;
}

/* --- Home: blog preview (3 articles with thumbnails) --- */
.home-blog-grid {
  list-style: none;
  margin: 0 0 var(--space-md);
  padding: 0;
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: 1fr;
}

@media (width >= 768px) {
  .home-blog-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Shared article-card primitives (home preview + blog list share the same
   card shell, thumbnail treatment and hover behavior; only layout differs) */
.home-blog-card,
.blog-list-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.home-blog-thumb,
.blog-list-thumb {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.home-blog-thumb img,
.blog-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-blog-link:hover .home-blog-title,
.home-blog-link:focus-visible .home-blog-title,
.blog-list-link:hover .blog-list-title,
.blog-list-link:focus-visible .blog-list-title {
  color: var(--link);
}

.home-blog-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.home-blog-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  margin: 0;
  padding: var(--space-sm) var(--space-md);
  padding-bottom: var(--space-xs);
}

.home-blog-excerpt {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0 var(--space-md) var(--space-md);
  line-height: var(--line-height-body);
}

.home-blog-more {
  margin-bottom: 0;
  text-align: center;
}

/* --- Blog list (blog index) --- */
.blog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--section-gap);
}

.blog-list-link {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  text-decoration: none;
  color: inherit;
}

@media (width >= 768px) {
  .blog-list-link {
    grid-template-columns: 280px 1fr;
  }
}

.blog-list-body {
  padding: var(--space-sm) var(--space-md);
  padding-right: var(--space-md);
}

@media (width >= 768px) {
  .blog-list-body {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

.blog-list-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin: 0 0 var(--space-xs);
}

.blog-list-excerpt {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0;
  line-height: var(--line-height-body);
}

.article-meta {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 var(--space-xs);
}

.article-meta a {
  color: var(--link);
}

.article-deck {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin: 0 0 var(--space-md);
  line-height: var(--line-height-body);
}

.article-byline {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 var(--space-lg);
  line-height: var(--line-height-body);
}

.article-byline p {
  margin: 0 0 var(--space-xs);
}

.article-references {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.article-references h2 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 var(--space-md);
}

.article-references ol {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.article-references li + li {
  margin-top: var(--space-sm);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: var(--space-sm) var(--space-lg);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-on-dark);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-primary:focus-visible {
  outline-color: var(--text-on-dark);
}

/* Secondary action: same shape/size as primary, lower visual weight.
   Implements the primary/secondary link taxonomy from the IA doc. */
.btn-secondary {
  background-color: transparent;
  color: var(--brand-1-deep);
  border: 1.5px solid var(--primary);
}

.btn-secondary:hover {
  background-color: var(--primary);
  color: var(--text-on-dark);
}

.btn-secondary:focus-visible {
  outline-color: var(--primary);
}

/* --- Share controls (event and blog items) --- */
.share-actions {
  margin: var(--space-md) 0 0;
}

.evento-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  margin: var(--space-md) 0 0;
}

.evento-actions .share-actions {
  margin: 0;
}

.evento-actions .btn-secondary {
  gap: var(--space-xs);
}

.calendar-trigger {
  gap: var(--space-xs);
}

.evento-actions .btn-secondary .lucide-icon {
  width: 1.125rem;
  height: 1.125rem;
}

.blog-list-item .share-actions {
  padding: 0 var(--space-md) var(--space-md);
}

.share-trigger {
  gap: var(--space-xs);
}

.share-trigger .lucide-icon {
  width: 1.125rem;
  height: 1.125rem;
}

.share-dialog {
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: var(--space-lg);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 1rem 3rem rgb(62 66 75 / 28%);
}

.share-dialog::backdrop {
  background: rgb(62 66 75 / 65%);
}

.share-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.share-dialog-header h2 {
  margin: 0;
}

.share-dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: 4px;
  cursor: pointer;
}

.share-dialog-close:hover,
.share-dialog-close:focus-visible {
  color: var(--text-on-dark);
  background: var(--primary);
}

.share-dialog-close:focus-visible,
.share-option:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.share-dialog-close .lucide-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.share-dialog-content-title {
  margin: 0 0 var(--space-md);
  color: var(--text-muted);
}

.share-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xs);
}

.share-option {
  display: flex;
  align-items: center;
  min-height: 44px;
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  color: var(--brand-1-deep);
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: 4px;
  cursor: pointer;
}

.share-option:hover {
  color: var(--text-on-dark);
  background: var(--primary);
}

.share-status {
  min-height: 1.5em;
  margin: var(--space-md) 0 0;
  color: var(--text-muted);
}

@media (width >= 768px) {
  .share-options {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Meditation block --- */
.meditation-block {
  background-color: var(--brand-3);
  padding: var(--space-lg);
  border-radius: 4px;
  margin-bottom: var(--section-gap);
  color: var(--text);
}

/* --- Mantras para la práctica (Práctica) --- */
.mantra-card {
  display: grid;
  gap: 1.25rem;
}

.mantra-section .mantra-card + .mantra-card {
  margin-block-start: 2.5rem;
}

.mantra-card h3,
.mantra-card h4,
.mantra-card p,
.mantra-card figure,
.mantra-card dl,
.mantra-card dd {
  margin: 0;
}

.mantra-reading {
  width: fit-content;
  max-width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid currentcolor;
  border-radius: 0.9rem;
}

.mantra-reading-label {
  margin-bottom: 0.9rem;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.mantra-ruby {
  font-size: 1.25rem;
  line-height: 2.15;
  letter-spacing: 0.035em;
}

.mantra-ruby ruby {
  ruby-align: center;
  ruby-position: over;
}

.mantra-ruby rt {
  font-size: 0.62em;
  font-weight: 650;
  letter-spacing: 0.045em;
  opacity: 1;
}

.mantra-language-data {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid currentcolor;
  font-size: 0.85rem;
}

.mantra-language-data div {
  display: flex;
  gap: 0.45rem;
}

.mantra-language-data dt {
  font-weight: 700;
}

.mantra-language-data dd {
  opacity: 0.78;
}

.mantra-audio audio {
  display: block;
  width: min(100%, 32rem);
}

.mantra-audio figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.75;
}

@media (width <= 36rem) {
  .mantra-reading {
    width: 100%;
  }

  .mantra-ruby {
    font-size: 1.1rem;
  }
}

@media (forced-colors: active) {
  .mantra-reading {
    border-color: CanvasText;
  }

  .mantra-language-data {
    border-top-color: CanvasText;
  }
}

.meditation-block h2 {
  margin-top: 0;
  color: var(--text);
}

.meditation-block ul {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-md);
}

.meditation-block li {
  margin-bottom: var(--space-xs);
}

/* --- Founder block (divisor suave) --- */
.founder-block {
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--space-lg);
}

.founder-block .founder-blog-link {
  font-size: 0.9375rem;
  margin-top: var(--space-md);
}

.founder-block .founder-blog-link a {
  font-weight: 600;
}

/* --- Evento (página Eventos cuando hay evento vigente) --- */
.eventos-section {
  margin-bottom: var(--space-xl);
}

.eventos-section:last-of-type {
  margin-bottom: 0;
}

/* --- Eventos: calendario estático (un mes) --- */
.eventos-calendar {
  margin-inline: auto;
}

.eventos-calendar-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  margin: 0 0 var(--space-md);
  color: var(--text);
}

.eventos-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  max-width: 20rem;
  margin-inline: auto;
  font-size: 0.875rem;
}

/* Row grouping for valid ARIA grid structure without breaking the CSS grid layout */
.eventos-calendar-row {
  display: contents;
}

.eventos-calendar-weekday {
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  padding: var(--space-xs) 0;
}

.eventos-calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}

.eventos-calendar-day.has-event {
  background: var(--brand-2-deep);
  border-color: var(--brand-2-deep);
  color: var(--text-on-dark);
  font-weight: 600;
}

/* The event day is a <span role="gridcell"> wrapping a real <a> (rather than
   role="gridcell" on the link itself), so the link keeps its native role
   while the grid structure stays valid for assistive tech. */
.eventos-calendar-day a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  text-decoration: none;
  color: inherit;
}

.eventos-calendar-day a:hover,
.eventos-calendar-day a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.eventos-calendar-day.has-event a:hover,
.eventos-calendar-day.has-event a:focus-visible {
  background: var(--brand-1);
  color: var(--text-on-dark);
}

.eventos-calendar-legend {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  margin: var(--space-sm) 0 0;
}

.eventos-card-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-xl) 0;
  max-width: var(--read-max);
}

.eventos-divider {
  border: 0;
  border-top: 1px solid var(--text-muted);
  margin: var(--space-xl) 0;
}

.eventos-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--text-muted);
}

.eventos-section-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--primary);
}

.evento-card {
  margin: 0 0 var(--section-gap);
  padding: var(--space-xl);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 6%);
  scroll-margin-top: var(--header-offset);
}

.evento-card:last-of-type {
  margin-bottom: 0;
}

.evento-type {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 var(--space-xs);
}

.evento-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin: 0 0 var(--space-md);
}

.evento-title a {
  color: inherit;
  text-decoration: none;
}

.evento-title a:hover {
  color: var(--link);
}

.evento-figure {
  margin: 0 0 var(--space-lg);
}

.evento-figure img {
  width: 100%;
  border-radius: 4px;
}

.evento-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  padding: var(--space-xl);
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 4px;
}

.evento-placeholder img {
  width: auto;
  max-width: 160px;
  height: auto;
  opacity: 0.5;
}

.evento-lead {
  font-size: 1.125rem;
  margin-bottom: var(--space-md);
}

.evento-tagline {
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.evento-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-xs) var(--space-md);
  margin: 0 0 var(--space-lg);
}

.evento-meta dt {
  font-weight: 600;
  margin: 0;
}

.evento-meta dd {
  margin: 0;
}

.evento-incluye {
  font-size: 0.9375rem;
  color: var(--text-muted);
  font-weight: normal;
}

.evento-links {
  margin-top: var(--space-lg);
  margin-bottom: 0;
}

.eventos-section-links {
  margin: var(--space-lg) 0 0;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.eventos-section-links a {
  color: var(--link);
}

.evento-badge {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-xs);
}

.evento-badge--finalizado {
  color: var(--text-muted);
}

.evento-card--past .evento-figure img,
.evento-card--finalizado .evento-figure img {
  opacity: 0.5;
}

.evento-card--finalizado .evento-title,
.evento-card--past .evento-title {
  margin-top: 0;
}

/* Single event (single-event.php / eventos/{slug}/) */
.single-event .single-event-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin: 0 0 var(--space-lg);
}

.single-event-nav {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.single-event-nav a {
  color: var(--link);
}

.single-event-nav p {
  margin: 0 0 var(--space-sm);
}

.single-event-nav p:last-child {
  margin-bottom: 0;
}

.evento-highlights {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg);
}

.evento-highlights li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: var(--space-xs);
}

.evento-highlights li::before {
  content: "▪";
  position: absolute;
  left: 0;
  color: var(--primary);
}

/* --- Cards (caminos, cómo practicamos) --- */
.card {
  padding: var(--space-lg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.card h3 {
  margin-top: 0;
  font-size: 1.125rem;
}

/* --- Footer --- */
.site-footer {
  background-color: var(--footer-bg);
  color: var(--text-on-dark);
  padding-block: var(--space-xl);
  margin-top: var(--section-gap);
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.site-footer a:hover {
  color: var(--text-on-dark);
  opacity: 0.9;
}

/* Footer background is brand-2; the default focus-visible outline (--primary)
   only reaches ~2.2:1 against it. Override for the 3:1 non-text minimum. */
.site-footer a:focus-visible {
  outline: 2px solid var(--text-on-dark);
  outline-offset: 2px;
}

.site-footer .layout-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* Top row: identity, links, contact */
.footer-top {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: 1fr;
}

@media (width >= 768px) {
  .footer-top {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
  }
}

@media (width >= 1024px) {
  .footer-top {
    grid-template-columns: repeat(4, 1fr);
  }
}

.footer-block {
  min-width: 0;
}

.footer-heading {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 var(--space-sm);
  color: var(--text-on-dark);
}

.footer-org {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.footer-block p {
  margin: 0 0 var(--space-xs);
}

.footer-block p:last-child {
  margin-bottom: 0;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: var(--space-xs);
}

.footer-links li:last-child {
  margin-bottom: 0;
}

/* Donate section: full-width block with separator */
.footer-donate {
  padding-top: var(--space-lg);
  border-top: 1px solid rgb(255 255 255 / 20%);
}

.footer-donate .footer-heading {
  margin-top: var(--space-sm);
}

.footer-donate .footer-heading:first-child {
  margin-top: 0;
}

.footer-donate p {
  margin: 0 0 var(--space-sm);
  max-inline-size: 52ch;
}

.footer-table {
  width: 100%;
  max-width: 24rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: var(--space-sm) 0 var(--space-md);
}

.footer-table th,
.footer-table td {
  text-align: left;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid rgb(255 255 255 / 25%);
}

.footer-table th {
  font-weight: 600;
  width: 40%;
}

/* Donaciones page: table on light background */
.donate-lead {
  font-size: 1.125rem;
  margin-bottom: var(--space-md);
}

.donate-table {
  width: 100%;
  max-width: 24rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: var(--space-sm) 0 var(--space-md);
}

.donate-table th,
.donate-table td {
  text-align: left;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--text-muted);
  color: var(--text);
}

.donate-table th {
  font-weight: 600;
  width: 40%;
  color: var(--text-muted);
}

/* Credits block */
.footer-credits {
  padding-top: var(--space-lg);
  border-top: 1px solid rgb(255 255 255 / 20%);
  font-size: 0.8125rem;
}

.footer-credits p {
  margin: 0 0 var(--space-xs);
}

.footer-credits p:last-child {
  margin-bottom: 0;
}

.footer-copyright {
  margin: 0;
  padding-top: var(--space-lg);
  border-top: 1px solid rgb(255 255 255 / 20%);
  font-size: 0.875rem;
}

/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.form-group input,
.form-group textarea {
  width: 100%;
  max-width: 100%;
  padding: var(--space-sm);
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--brand-2);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
}

.form-group textarea {
  min-height: 8rem;
  resize: vertical;
}

/* ==========================================================================
   5. Page-specific (minimal)
   ========================================================================== */
.page-contact .read-width {
  margin-inline: 0;
}

.contact-social {
  padding: var(--space-lg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.contact-social-heading {
  margin-top: 0;
  margin-bottom: var(--space-xs);
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
}

.contact-social-lead {
  margin-bottom: var(--space-lg);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.contact-social-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.contact-social-links li {
  display: flex;
}

.contact-social-links a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 500;
}

.contact-social-links .lucide-icon {
  flex-shrink: 0;
}

/* ==========================================================================
   6. Utilities
   ========================================================================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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

.center-block {
  margin-inline: auto;
}

.mt-0 { margin-top: 0; }
.mb-lg { margin-bottom: var(--space-lg); }

.list-unstyled {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ==========================================================================
   7. States and accessibility
   ========================================================================== */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Pressed / active feedback (functional, not decorative) --- */
.btn:active {
  filter: brightness(0.92);
}

a:active {
  color: var(--link-hover);
}

.nav-toggle:active,
.lang-btn:active {
  background: rgb(255 255 255 / 25%);
}

.gallery-pagination-prev:active,
.gallery-pagination-next:active,
.gallery-pagination-num:active {
  color: var(--link-hover);
}

.eventos-calendar-day a:active {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --- Form validation state --- */
.form-group.is-error input,
.form-group.is-error textarea {
  border-color: var(--brand-1);
  border-width: 2px;
}

.form-error-message {
  display: block;
  margin-top: var(--space-xs);
  font-size: 0.875rem;
  color: var(--brand-1);
}

/* Typography scale for headings */
h1, h2, h3 {
  line-height: var(--line-height-tight);
  color: var(--text);
}

h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0 0 var(--space-md);
}

h2 {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  margin: 0 0 var(--space-md);
}

h3 {
  font-size: 1.125rem;
  margin: 0 0 var(--space-sm);
}

p {
  margin: 0 0 var(--space-md);
}

p:last-child {
  margin-bottom: 0;
}
