/* ============================================================
   AlarmPermitGuide.com — Global Stylesheet
   Design: Authoritative editorial, utility-first tone
   Palette: Deep navy, signal red, warm white, slate
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&family=DM+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --navy:        #0F1B2D;
  --navy-mid:    #1A2E47;
  --navy-light:  #243B55;
  --red:         #C0392B;
  --red-bright:  #E74C3C;
  --amber:       #E67E22;
  --green:       #27AE60;
  --white:       #F9F7F4;
  --offwhite:    #EEE9E2;
  --slate:       #8A99A8;
  --slate-light: #C8D3DC;
  --text:        #1A1A2E;
  --text-muted:  #4A5568;

  --font-serif:  'DM Serif Display', Georgia, serif;
  --font-sans:   'DM Sans', system-ui, sans-serif;
  --font-mono:   'DM Mono', monospace;

  --max-w:       1120px;
  --gutter:      clamp(1rem, 5vw, 2.5rem);
  --radius:      6px;
  --radius-lg:   12px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.10);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.16);

  --transition:  0.18s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--white);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--red-bright); }
ul, ol { padding-left: 1.5rem; }
li { margin-bottom: 0.35rem; }

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  color: var(--navy);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); margin-bottom: 0.75rem; }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.5rem); margin-bottom: 0.6rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.5rem; }
p  { margin-bottom: 1.1rem; color: var(--text-muted); font-size: 1.0rem; }
p:last-child { margin-bottom: 0; }
strong { color: var(--text); font-weight: 600; }

.lead {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  display: block;
  margin-bottom: 0.5rem;
}

/* ── Layout ────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section { padding: clamp(3rem, 8vw, 6rem) 0; }
.section--alt { background: var(--offwhite); }
.section--dark { background: var(--navy); color: var(--white); }
.section--dark h1,
.section--dark h2,
.section--dark h3 { color: var(--white); }
.section--dark p   { color: var(--slate-light); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Site Header ───────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
  gap: 1rem;
}
.site-logo {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--white) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}
.site-logo .logo-icon {
  width: 28px; height: 28px;
  background: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.site-nav { display: flex; gap: 0.15rem; align-items: center; }
.site-nav a {
  color: var(--slate-light);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.site-nav a:hover { color: var(--white); background: var(--navy-light); }
.site-nav .nav-cta {
  background: var(--red);
  color: var(--white) !important;
  margin-left: 0.5rem;
}
.site-nav .nav-cta:hover { background: var(--red-bright); }

.nav-toggle {
  display: none;
  background: none; border: none;
  color: var(--white); cursor: pointer;
  font-size: 1.4rem; padding: 0.25rem;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--navy-mid);
    padding: 1rem var(--gutter);
    border-bottom: 2px solid var(--red);
    gap: 0.25rem;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 0.6rem 0.75rem; font-size: 0.95rem; }
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #1e3a5f 100%);
  color: var(--white);
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 6vw, 4rem);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(192,57,43,0.15) 0%, transparent 60%);
  pointer-events: none;
}
.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red-bright);
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.hero__eyebrow::before {
  content: '';
  width: 24px; height: 2px;
  background: var(--red-bright);
  display: inline-block;
}
.hero h1 { color: var(--white); max-width: 750px; }
.hero .lead { color: rgba(255,255,255,0.75); max-width: 640px; }
.hero__actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }

.hero__stat-row {
  display: flex; gap: 2rem; flex-wrap: wrap;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.hero__stat { text-align: center; }
.hero__stat-num {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--white);
  display: block;
  line-height: 1;
}
.hero__stat-label {
  font-size: 0.78rem;
  color: var(--slate-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
  display: block;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-bright); color: var(--white); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.35); }
.btn-outline:hover { background: rgba(255,255,255,0.1); color: var(--white); border-color: rgba(255,255,255,0.6); }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--navy-light); color: var(--white); transform: translateY(-1px); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.83rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--offwhite);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card--bordered { border-left: 4px solid var(--red); }
.card--dark { background: var(--navy-mid); border-color: var(--navy-light); }
.card--dark h3 { color: var(--white); }
.card--dark p { color: var(--slate-light); }

.card-icon {
  width: 44px; height: 44px;
  background: rgba(192,57,43,0.1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--red);
}

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--white);
}
thead { background: var(--navy); }
thead th { color: var(--white); font-weight: 600; padding: 0.85rem 1rem; text-align: left; font-family: var(--font-sans); font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr { border-bottom: 1px solid var(--offwhite); transition: background var(--transition); }
tbody tr:hover { background: #f5f0ea; }
tbody td { padding: 0.75rem 1rem; vertical-align: top; }
tbody tr:last-child { border-bottom: none; }
.td-badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-red   { background: #fde8e8; color: var(--red); }
.badge-green { background: #e8f8ef; color: var(--green); }
.badge-amber { background: #fef3e2; color: var(--amber); }

/* ── Alert / Info Boxes ────────────────────────────────────── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin: 1.5rem 0;
  display: flex; gap: 0.75rem; align-items: flex-start;
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }
.alert--warn  { background: #fff8ec; border-color: var(--amber); }
.alert--info  { background: #eef4fc; border-color: #2980b9; }
.alert--danger{ background: #fdecea; border-color: var(--red); }
.alert--ok    { background: #eafaf1; border-color: var(--green); }
.alert p { margin: 0; font-size: 0.93rem; }

/* ── FAQ ───────────────────────────────────────────────────── */
.faq-item { border-bottom: 1px solid var(--offwhite); }
.faq-question {
  width: 100%; text-align: left;
  background: none; border: none;
  padding: 1.1rem 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem;
  transition: color var(--transition);
}
.faq-question:hover { color: var(--red); }
.faq-chevron { font-size: 1rem; color: var(--red); transition: transform 0.25s; flex-shrink: 0; }
.faq-answer { overflow: hidden; max-height: 0; transition: max-height 0.35s ease, padding 0.25s; }
.faq-answer-inner { padding-bottom: 1rem; }
.faq-answer-inner p { font-size: 0.95rem; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-item.open .faq-answer { max-height: 600px; }

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex; flex-wrap: wrap; gap: 0.25rem;
  font-size: 0.82rem;
  color: var(--slate);
  padding: 0.75rem 0;
  align-items: center;
}
.breadcrumb a { color: var(--slate); }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb-sep { color: var(--slate-light); }
.breadcrumb-current { color: var(--text-muted); }

/* ── Page Layout (article + sidebar) ──────────────────────── */
.page-layout { display: grid; grid-template-columns: 1fr 320px; gap: 3rem; align-items: start; }
.sidebar { position: sticky; top: 80px; }
.sidebar-card { background: var(--offwhite); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; }
.sidebar-card h4 { font-size: 1rem; margin-bottom: 1rem; color: var(--navy); }
.sidebar-nav a { display: block; color: var(--text-muted); font-size: 0.88rem; padding: 0.3rem 0; border-bottom: 1px solid var(--slate-light); }
.sidebar-nav a:last-child { border-bottom: none; }
.sidebar-nav a:hover { color: var(--red); }

@media (max-width: 900px) {
  .page-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

/* ── TOC ───────────────────────────────────────────────────── */
.toc {
  background: var(--offwhite);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  border-left: 4px solid var(--navy);
}
.toc-title { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--navy); font-weight: 600; margin-bottom: 0.75rem; font-family: var(--font-mono); }
.toc ol { margin: 0; padding-left: 1.25rem; }
.toc li { font-size: 0.9rem; margin-bottom: 0.3rem; }
.toc a { color: var(--navy-light); font-weight: 500; }
.toc a:hover { color: var(--red); }

/* ── Step Process ──────────────────────────────────────────── */
.steps { list-style: none; padding: 0; counter-reset: step-counter; }
.step {
  display: flex; gap: 1.25rem; align-items: flex-start;
  padding: 1.25rem;
  background: var(--white);
  border: 1px solid var(--offwhite);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  counter-increment: step-counter;
}
.step::before {
  content: counter(step-counter);
  min-width: 36px; height: 36px;
  background: var(--red);
  color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 1rem;
  flex-shrink: 0;
}
.step-content h4 { color: var(--navy); margin-bottom: 0.35rem; }
.step-content p { font-size: 0.92rem; margin: 0; }

/* ── Tool / Calculator Styles ──────────────────────────────── */
.tool-shell {
  background: var(--white);
  border: 2px solid var(--offwhite);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.tool-header {
  background: var(--navy);
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.tool-header h3 { color: var(--white); margin: 0; font-size: 1.1rem; }
.tool-header .tool-badge {
  background: var(--red);
  color: var(--white);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
}
.tool-body { padding: 1.5rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.4rem;
}
.form-group select,
.form-group input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--slate-light);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.93rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
}
.form-group select:focus,
.form-group input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(15,27,45,0.1); }
.form-group select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238A99A8' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.9rem center; padding-right: 2.5rem; }

.result-box {
  background: var(--offwhite);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
  border-left: 4px solid var(--red);
  display: none;
}
.result-box.visible { display: block; }
.result-box h4 { color: var(--navy); margin-bottom: 0.75rem; font-size: 1rem; }
.result-row { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--slate-light); font-size: 0.92rem; }
.result-row:last-child { border-bottom: none; font-weight: 700; color: var(--navy); }
.result-row span:first-child { color: var(--text-muted); }
.result-total { font-size: 1.3rem; color: var(--red); font-family: var(--font-serif); }

/* ── Checklist ─────────────────────────────────────────────── */
.checklist { list-style: none; padding: 0; }
.checklist li {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--offwhite);
  font-size: 0.95rem;
  color: var(--text-muted);
}
.checklist li::before {
  content: '☐';
  color: var(--slate);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
}
.checklist li.checked { color: var(--text-muted); text-decoration: line-through; }
.checklist li.checked::before { content: '☑'; color: var(--green); }

/* ── State Grid ────────────────────────────────────────────── */
.state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.state-card {
  background: var(--white);
  border: 1px solid var(--offwhite);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  text-align: center;
  transition: all var(--transition);
  display: block;
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 500;
}
.state-card:hover { background: var(--navy); color: var(--white); border-color: var(--navy); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* ── City Grid ─────────────────────────────────────────────── */
.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.city-card {
  background: var(--white);
  border: 1px solid var(--offwhite);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  display: block;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.city-card:hover { border-left-color: var(--red); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.city-card-name { font-weight: 600; color: var(--navy); font-size: 0.95rem; display: block; }
.city-card-meta { font-size: 0.78rem; color: var(--slate); margin-top: 0.2rem; display: block; }

/* ── Download Box ──────────────────────────────────────────── */
.download-box {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  flex-wrap: wrap;
}
.download-box-text h3 { color: var(--white); font-size: 1.15rem; margin-bottom: 0.35rem; }
.download-box-text p { color: var(--slate-light); font-size: 0.9rem; margin: 0; }
.download-icon { font-size: 2.5rem; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: var(--slate-light);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; padding-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.footer-brand { font-family: var(--font-serif); color: var(--white); font-size: 1.2rem; display: block; margin-bottom: 0.75rem; }
.footer-desc { font-size: 0.85rem; line-height: 1.6; }
.footer-col h5 { color: var(--white); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-mono); margin-bottom: 1rem; }
.footer-col a { display: block; color: var(--slate-light); font-size: 0.85rem; padding: 0.2rem 0; transition: color var(--transition); }
.footer-col a:hover { color: var(--white); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 1.5rem; flex-wrap: wrap; gap: 1rem; font-size: 0.8rem; }
.footer-bottom .disclaimer { font-size: 0.75rem; color: var(--slate); max-width: 600px; }

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .download-box { flex-direction: column; text-align: center; }
}

/* ── Utility ───────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-red { color: var(--red); }
.text-navy { color: var(--navy); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.hidden { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .sidebar, .hero__actions, .btn { display: none !important; }
  body { font-size: 12pt; color: #000; }
  h1, h2, h3 { color: #000; }
  a { color: #000; text-decoration: underline; }
}
