/* styles.css */
/* 
  CSS organization:
  1) Variables
  2) Base
  3) Layout
  4) Components
  5) Utilities
  6) Responsive tweaks
*/

/* 1) Variables */
:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #4a4a4a;
  --border: #e5e7eb;
  --accent: #0b5fff; /* accessible blue */
  --accent-contrast: #ffffff;
  --warning-bg: #fff4cc; /* pale yellow with dark text */
  --warning-text: #3a2f00;
  --danger: #c62828;
  --success: #1b873f;

  --radius: 12px;
  --shadow: 0 6px 20px rgba(0,0,0,0.08);
  --container: 1100px;
  --gap: 1rem;
}

/* 2) Base */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  height: 100%;
  scroll-behavior: smooth; /* also implemented in JS if needed */
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.7; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
p { margin: 0 0 1rem; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  z-index: 10000;
}

/* 3) Layout */
.site-header {
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 1rem;
}
.brand { font-weight: 700; }
.nav-list {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  margin: 0; padding: 0;
}
.nav-list a, .nav-list .btn {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

.hero {
  background: #f5f7ff;
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  /* Reduced overall height per request; rely on padding and grid */
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: 2rem 0 2rem;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.hero-center { text-align: center; display: grid; gap: 0.75rem; }
.hero-side {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
}
.seo-list { margin: 0; padding-left: 1rem; }
.seo-list li { margin: 0.15rem 0; font-size: 0.95rem; color: var(--muted); }
.hero-title { font-size: clamp(1.5rem, 5vw, 2.25rem); font-weight: 900; letter-spacing: 0.02em; }
.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--muted);
}
.hero-figure {
  margin: 0.25rem auto 0.5rem;
  max-width: 560px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
}
.hero-figure img { width: 100%; height: auto; border-radius: 8px; }
.hero-figure figcaption { font-size: 0.85rem; color: var(--muted); }
.hero-phone {
  display: inline-block;
  margin-top: 0.25rem;
  font-weight: 700;
  font-size: 1.25rem;
  background: #eef2ff;
  color: #102a83;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #c7d2fe;
}
.hero-phone.is-disabled { pointer-events: none; cursor: default; }
.hero-phone .phone-blur {
  /* Minimal blur to indicate placeholder/obfuscation while staying readable */
  filter: blur(1px);
  transition: filter 160ms ease;
}
/* Keep blur constant even on hover/focus (requested) */
.hero-phone:hover .phone-blur,
.hero-phone:focus .phone-blur { filter: blur(1px); }
@media (prefers-reduced-motion: reduce) {
  .hero-phone .phone-blur { transition: none; }
}
.hero-instruction {
  font-size: 0.95rem;
  color: var(--muted);
}
.hero-cta { margin-top: 0.5rem; }

.warning-banner {
  background: var(--warning-bg);
  color: var(--warning-text);
  padding: 0.75rem 1rem;
  border-top: 1px solid #ffe699;
  border-bottom: 1px solid #ffe699;
  text-align: center;
}

.caution {
  margin: 1rem auto;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.reports {
  margin: 2rem auto;
}
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}
.card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #f0f0f0;
}
.card-body {
  padding: 0.75rem 1rem 1rem;
}
.card-title { margin-top: 0.25rem; }
.card-phone {
  display: inline-block;
  margin: 0.25rem 0 0.5rem;
  font-weight: 600;
}
.card-note { color: var(--muted); }

.summary {
  margin: 2rem auto 3rem;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: #fafafa;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}

/* 4) Components */
.btn {
  background: #f3f4f6;
  border: 1px solid var(--border);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  color: var(--text);
}
.btn:hover { filter: brightness(0.98); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-accent {
  background: #111827;
  color: #fff;
  border-color: #111827;
}
.btn-accent:hover { filter: brightness(1.05); }

/* Small button size for compact UI (used in alert) */
.btn-sm {
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  border-radius: 8px;
}

.disclaimer {
  background: #111827;
  color: #ffffff;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.alert-modal[hidden] { display: none !important; }
.alert-modal {
  position: fixed;
  left: 50%;
  top: 0.75rem;
  transform: translateX(-50%);
  z-index: 1100; /* Above other UI, below system UI */
  width: min(92vw, 860px);
}
.alert-modal__content {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem 1rem;
  background: #fff6e5; /* high contrast warm tone */
  color: #3a2f00;
  border: 2px solid #ffb100;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  padding: 0.75rem 0.75rem;
  outline: none;
  animation: alert-pulse 900ms steps(2, start) infinite; /* blink-like */
}
.alert-modal__icon { font-size: 1.5rem; }
.alert-modal__title { margin: 0; font-size: 1.1rem; }
.alert-modal__text { margin: 0.15rem 0 0; overflow-wrap: break-word; word-break: normal; }
.alert-modal__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }

/* After a while, we may remove the strong attention effect via a class toggle */
.alert-modal__content.is-subtle { animation: none; border-color: #ffd166; }

@keyframes alert-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 145, 0, 0.65); }
  100% { box-shadow: 0 0 0 6px rgba(255, 145, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .alert-modal__content { animation: none; }
}

/* Responsive tweaks for alert on small screens */
@media (max-width: 520px) {
  .alert-modal { width: min(96vw, 520px); left: 50%; transform: translateX(-50%); }
  .alert-modal__content {
    grid-template-columns: 1fr; /* stack icon/body/actions */
    text-align: left;
  }
  .alert-modal__icon { display: none; }
  .alert-modal__title { font-size: 1rem; }
  .alert-modal__text { font-size: 0.95rem; }
  .alert-modal__actions { justify-content: flex-end; }
}

.modal[aria-hidden="true"] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
}
.modal-content {
  position: relative;
  z-index: 1;
  /* Anchor near top-right so content is immediately visible */
  margin: 2vh 1rem auto auto;
  max-width: 720px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  max-height: 90vh;
}
.modal-header, .modal-footer {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-footer { border-top: 1px solid var(--border); border-bottom: 0; }
.modal-header { display: flex; align-items: center; gap: 0.5rem; }
.modal-titlewrap { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.modal-titleimg { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.modal-titletext { margin: 0; font-size: 1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-body {
  padding: 1rem;
  /* Allow the grid child to actually scroll within max-height container */
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto; /* enable horizontal scroll if needed */
}
.modal-body p,
.modal-body li {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  margin-left: auto; /* push to top-right */
}

/* On narrow screens, center modal and allow full width */
@media (max-width: 600px) {
  .modal-content {
    margin: 4vh auto;
    width: calc(100% - 1.5rem);
    max-height: 92vh; /* a bit taller allowance on mobile */
  }
}
.modal-figure {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 0.75rem;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}
.modal-figure img {
  width: 80px; height: 80px; object-fit: cover; border-radius: 8px;
}
.timeline ol {
  margin: 0.5rem 0 1rem 1rem;
}
.share-controls {
  display: flex; gap: 0.5rem; margin: 0.75rem 0;
}

/* Report form */
.form-field { margin-bottom: 0.75rem; }
.form-field label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.form-field input, .form-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
}
.form-field input:focus, .form-field textarea:focus {
  outline: 3px solid #bfdbfe;
  border-color: #93c5fd;
}
.error {
  display: block;
  color: var(--danger);
  min-height: 1.1em;
  font-size: 0.9rem;
}
.form-actions { margin-top: 0.5rem; }
.form-note { color: var(--muted); font-size: 0.9rem; }

/* 5) Utilities */
.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* 6) Responsive */
/* On small screens, hide SEO side lists to avoid clutter */
@media (max-width: 599.98px) {
  .hero-side { display: none !important; }
}
@media (min-width: 600px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr minmax(0,1.2fr) 1fr; align-items: start; }
}

@media (min-width: 900px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .modal-content { margin: 7vh auto; }
}