/* Punto de entrada compartido. Sin fuentes externas ni dependencias. */
@layer reset, base, layout, components;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body { margin: 0; }
  img, video { display: block; max-width: 100%; height: auto; }
  input, button, textarea, select { font: inherit; }
}

@layer base {
  :root {
    color-scheme: light;
    --font-heading: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --font-body: "Manrope", Arial, sans-serif;
    --color-text: #202a35;
    --color-background: #fff;
    --color-accent: #164ea1;
    --color-border: #d5dbe2;
    --content-width: 72rem;
    --reading-width: 68ch;
    --space: clamp(1rem, 3vw, 2rem);
  }
  html { font-family: var(--font-body); line-height: 1.6; }
  body { color: var(--color-text); background: var(--color-background); overflow-wrap: break-word; }
  h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; line-height: 1.2; text-wrap: balance; }
  h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
  a { color: var(--color-accent); text-underline-offset: .2em; }
  a:hover { text-decoration-thickness: .15em; }
  :focus-visible { outline: 3px solid var(--color-accent); outline-offset: 4px; }
}

@layer layout {
  .container { width: min(var(--content-width), 100% - 2 * var(--space)); margin-inline: auto; }
  .section { padding-block: clamp(2rem, 6vw, 5rem); }
  .site-header, .site-footer { padding-block: 1.25rem; }
  .site-header { border-bottom: 1px solid var(--color-border); }
  .site-header nav { display: flex; flex-wrap: wrap; gap: 1.5rem; }
  .site-footer { border-top: 1px solid var(--color-border); }
  .prose { max-width: var(--reading-width); }
  .post-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: var(--space); }
}

@layer components {
  .skip-link { position: absolute; inset-block-start: 1rem; inset-inline-start: 1rem; padding: .75rem 1rem; background: white; transform: translateY(-200%); z-index: 10; }
  .skip-link:focus { transform: translateY(0); }
  .post-card { padding: 1.5rem; border: 1px solid var(--color-border); border-radius: .5rem; }
  .post-card h2 { margin-block-start: 0; }
  .post-meta { font-size: .95rem; }
}

/* Contacto fijo en móviles: compartido por todas las páginas. */
@layer components {
  .mobile-contact-bar { display: none; }
  @media (max-width: 640px) {
    html { scroll-padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); }
    .has-mobile-contact-bar { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
    .mobile-contact-bar {
      position: fixed;
      z-index: 1000;
      bottom: max(.5rem, env(safe-area-inset-bottom, 0px));
      inset-inline: .5rem;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: .5rem;
      padding: .5rem;
      margin: 0;
      background: #fff;
      border: 1px solid #d5dbe2;
      border-radius: 12px;
      box-shadow: 0 .35rem 1.25rem rgb(0 0 0 / 18%);
    }
    .mobile-contact-bar a {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: .4rem;
      min-width: 0;
      min-height: 3.1rem;
      padding: .6rem .4rem;
      border: 1px solid transparent;
      border-radius: 7px;
      font-family: var(--font-body);
      font-size: .8125rem;
      font-weight: 700;
      line-height: 1.2;
      text-align: center;
      text-decoration: none;
    }
    .mobile-contact-bar a.mobile-contact-call { color: #102e3e; background: #ffbd13; border-color: #ffbd13; }
    .mobile-contact-bar a.mobile-contact-whatsapp { color: #fff; background: #087f3e; }
    .mobile-contact-bar a.mobile-contact-call:hover { background: #ffd04d; }
    .mobile-contact-bar a.mobile-contact-whatsapp:hover { background: #066732; }
    .mobile-contact-bar a:focus-visible { outline: 3px solid #102e3e; outline-offset: 2px; }
    .mobile-contact-bar svg { width: 1.15rem; height: 1.15rem; flex: none; fill: currentColor; }
    .mobile-contact-bar span { min-width: 0; }
  }
  @media print {
    .mobile-contact-bar { display: none; }
    .has-mobile-contact-bar { padding-bottom: 0; }
  }
}

/* Accesibilidad compartida: foco contrastado y objetivos de navegación. */
@layer components {
  :root body :is(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid #102e3e;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px #fff;
  }
  nav a { min-height: 24px; display: inline-flex; align-items: center; }
  :target { scroll-margin-top: 1rem; }
  @media (forced-colors: active) {
    :root body :is(a, button, input, select, textarea, summary):focus-visible {
      outline-color: Highlight;
      box-shadow: none;
    }
  }
}
