/* ==========================================================================
   YaTeLoAvise — CSS base del sitio publico
   ========================================================================== */

/* --- Variables de diseno --- */
:root {
  /* Paleta */
  --color-primary: #1a5276;
  --color-primary-strong: #0e3a56;
  --color-primary-soft: #e8f1f8;
  --color-surface: #ffffff;
  --color-surface-muted: #f4f6f8;
  --color-border: #e1e5ea;
  --color-text: #1b2330;
  --color-text-muted: #5a6573;
  --color-accent-incident: #c0392b;
  --color-accent-construction: #b7791f;
  --color-accent-closure: #7f1d1d;
  --color-accent-info: #1a5276;
  --color-accent-pending: #6b7280;
  --color-focus: #1a5276;

  /* Tipografia */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-lg: 1.125rem;     /* 18px */
  --font-size-h1: 2rem;         /* 32px */
  --font-size-h2: 1.5rem;       /* 24px */
  --font-size-h3: 1.25rem;      /* 20px */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-body: 1.55;
  --line-height-heading: 1.25;

  /* Spacing */
  --space-1: 0.25rem;           /* 4px */
  --space-2: 0.5rem;            /* 8px */
  --space-3: 0.75rem;           /* 12px */
  --space-4: 1rem;              /* 16px */
  --space-5: 1.5rem;            /* 24px */
  --space-6: 2rem;              /* 32px */
  --space-7: 3rem;              /* 48px */
  --space-8: 4rem;              /* 64px */

  /* Radius y sombras */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.625rem;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow-md: 0 8px 24px rgb(15 23 42 / 0.10);

  /* Layout */
  --container-max: 1120px;
  --container-narrow: 720px;

  /* Aliases retrocompatibles */
  --color-primary-dark: var(--color-primary-strong);
  --color-primary-light: #2980b9;
  --color-accent: #2c3e50;
  --color-bg: var(--color-surface-muted);
  --color-bg-alt: var(--color-surface);
  --color-text-secondary: var(--color-text-muted);
  --spacing-xs: var(--space-1);
  --spacing-sm: var(--space-2);
  --spacing-md: var(--space-4);
  --spacing-lg: var(--space-5);
  --spacing-xl: var(--space-6);
  --spacing-xxl: var(--space-7);
  --line-height: var(--line-height-body);

  /* Header */
  --header-bg: var(--color-primary);
  --header-text: #ffffff;
}

/* --- Base --- */
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-surface-muted);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

img,
video {
  max-width: 100%;
}

/* --- Tipografia --- */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--line-height-heading);
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-sm);
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }

p {
  margin-bottom: var(--spacing-md);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid rgb(26 82 118 / 0.28);
  outline-offset: 2px;
}

.btn:focus-visible,
.page-link:focus-visible,
.navbar-toggler:focus-visible,
.alert-card__title-link:focus-visible {
  box-shadow: 0 0 0 0.2rem rgb(26 82 118 / 0.22);
  outline: 0;
}

/* --- Media de alertas publicas --- */
.alert-media {
  margin-block: var(--space-5);
}

.alert-media__frame {
  overflow: hidden;
  background: #101820;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  max-height: min(60vh, 34rem);
}

.alert-media__object {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #101820;
}

/* --- Home --- */
.home-hero {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.home-hero__title {
  max-width: 46rem;
}

.home-hero__lead {
  max-width: 42rem;
  color: var(--color-text-muted);
}

.home-alerts {
  margin-top: var(--space-6);
}

.home-empty {
  padding: var(--space-5);
  color: var(--color-text-muted);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
}

.home-empty p {
  max-width: 38rem;
  margin-bottom: 0;
}

/* --- Alert list --- */
.alert-list-hero {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.alert-list-hero__title {
  max-width: 46rem;
}

.alert-list-hero__lead {
  max-width: 42rem;
  color: var(--color-text-muted);
}

.alert-list-empty {
  color: var(--color-text-muted);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
}

/* --- Alert detail --- */
.alert-detail__title {
  max-width: 48rem;
}

.alert-detail__meta {
  line-height: 1.45;
}

.alert-detail__meta span + span::before {
  content: "·";
  margin-right: var(--space-2);
  color: var(--color-border);
}

.alert-detail__body {
  color: var(--color-text);
  font-size: var(--font-size-lg);
  line-height: 1.65;
}

.alert-detail__body p:last-child {
  margin-bottom: 0;
}

.alert-card {
  overflow: hidden;
  border-color: var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.alert-card:hover {
  border-color: rgb(26 82 118 / 0.28);
  box-shadow: 0 8px 22px rgb(15 23 42 / 0.10);
  transform: translateY(-1px);
}

.alert-card:focus-within {
  border-color: rgb(26 82 118 / 0.42);
  box-shadow: 0 0 0 0.18rem rgb(26 82 118 / 0.16), var(--shadow-sm);
}

.alert-card__media {
  background: var(--color-surface-muted);
}

.alert-card__media-object {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.alert-card video.alert-card__media-object {
  background: #101820;
}

.alert-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  line-height: 1.35;
}

.alert-card__meta span + span::before {
  content: "·";
  margin-right: 0.5rem;
  color: var(--color-border);
}

.alert-card__title {
  min-width: 0;
  line-height: var(--line-height-heading);
}

.alert-card__title-link {
  color: var(--color-text);
  text-decoration: none;
}

.alert-card__title-link:hover,
.alert-card__title-link:focus {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.alert-card__summary {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.container--narrow {
  max-width: var(--container-narrow);
}

/* --- Main --- */
.site-main {
  flex: 1;
  padding: var(--spacing-xxl) 0 calc(var(--space-8) + var(--space-6));
}

/* --- Footer --- */
.site-footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  padding: var(--spacing-lg) 0;
  font-size: var(--font-size-sm);
  margin-top: auto;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  :root {
    --font-size-h1: 1.625rem;
    --font-size-h2: 1.3rem;
    --font-size-h3: 1.1rem;
  }

  .home-hero__lead {
    font-size: var(--font-size-base);
  }

  .home-actions {
    align-items: stretch;
  }

  .home-actions .btn {
    width: 100%;
  }

  .alert-list-hero__lead {
    font-size: var(--font-size-base);
  }

  .alert-detail__body {
    font-size: var(--font-size-base);
  }

  .alert-detail__actions .btn {
    width: 100%;
  }

  .site-main {
    padding-block: var(--spacing-xl) calc(var(--space-8) + var(--space-5));
  }
}

@media (prefers-reduced-motion: reduce) {
  .alert-card {
    transition: none;
  }
}

/* --- Geocoding map embed --- */
.alert-detail__map-frame iframe {
  border: 0;
}

.alert-detail__map .btn {
  min-height: 2.25rem;
}

@media (max-width: 575.98px) {
  .alert-detail__map .btn {
    width: 100%;
    text-align: center;
  }
}
