/* ============================================
   US Area Code Lookup — Design System
   ============================================ */

:root {
  --c-primary: #0f2942;
  --c-accent: #0077cc;
  --c-accent-light: #e8f4fd;
  --c-accent-dark: #005fa3;
  --c-success: #1a7f4b;
  --c-bg: #ffffff;
  --c-bg-soft: #f5f7fa;
  --c-text: #1a1a1a;
  --c-text-muted: #5f6b7a;
  --c-border: #dde3ea;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --max-w: 860px;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); color: var(--c-text); background: var(--c-bg); line-height: 1.6; font-size: 16px; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

/* Skip link */
.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(--c-accent); color: #fff; padding: .5rem 1rem;
  border-radius: var(--radius); z-index: 9999; font-weight: 600;
}

/* Layout */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1rem; }
main { min-height: 70vh; }

/* ---- HEADER ---- */
.site-header {
  background: var(--c-primary);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 1rem;
  display: flex; align-items: center; justify-content: space-between; height: 58px;
}
.site-logo {
  font-size: 1.25rem; font-weight: 700; color: #fff; text-decoration: none;
  display: flex; align-items: center; gap: .4rem; white-space: nowrap;
}
.site-logo:hover { text-decoration: none; opacity: .9; }
.logo-icon { font-size: 1.4rem; }
.site-nav { display: flex; gap: .25rem; }
.site-nav a {
  color: rgba(255,255,255,.85); font-size: .875rem; font-weight: 500;
  padding: .4rem .65rem; border-radius: 6px; transition: background .15s;
  white-space: nowrap;
}
.site-nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.site-nav a.active { background: rgba(255,255,255,.2); color: #fff; }
.hamburger { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; padding: .25rem; }

/* ---- BREADCRUMB ---- */
.breadcrumb {
  background: var(--c-bg-soft); border-bottom: 1px solid var(--c-border);
  padding: .5rem 0; font-size: .8rem; color: var(--c-text-muted);
}
.breadcrumb ol { max-width: var(--max-w); margin: 0 auto; padding: 0 1rem; display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.breadcrumb li + li::before { content: "›"; margin-right: .25rem; }
.breadcrumb a { color: var(--c-text-muted); }
.breadcrumb a:hover { color: var(--c-accent); }

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, var(--c-primary) 0%, #1a4a7a 100%);
  color: #fff; padding: 3rem 1rem 2.5rem; text-align: center;
}
.hero h1 { font-size: clamp(1.75rem, 5vw, 2.75rem); font-weight: 800; margin-bottom: .75rem; line-height: 1.2; }
.hero p { font-size: 1.05rem; opacity: .9; max-width: 560px; margin: 0 auto 1.5rem; }

/* ---- SEARCH BOX ---- */
.search-wrap { max-width: 480px; margin: 0 auto; }
.search-form { display: flex; gap: .5rem; }
.search-input {
  flex: 1; padding: .85rem 1.1rem; font-size: 1rem; border: none;
  border-radius: var(--radius); background: #fff; color: var(--c-text);
  outline: none; min-width: 0;
}
.search-input:focus { box-shadow: 0 0 0 3px rgba(0,119,204,.4); }
.search-btn {
  background: var(--c-accent); color: #fff; border: none; border-radius: var(--radius);
  padding: .85rem 1.25rem; font-size: 1rem; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: background .15s;
}
.search-btn:hover { background: var(--c-accent-dark); }

/* ---- INLINE SEARCH RESULT ---- */
#search-result {
  max-width: var(--max-w); margin: 1.25rem auto 0; padding: 0 1rem;
}
.result-card {
  background: #fff; border: 2px solid var(--c-accent); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; display: flex; flex-wrap: wrap; gap: .75rem 2rem;
  align-items: flex-start;
}
.result-card .result-code { font-size: 2.5rem; font-weight: 800; color: var(--c-accent); line-height: 1; }
.result-meta { flex: 1; min-width: 160px; }
.result-meta strong { display: block; font-size: 1.1rem; color: var(--c-text); }
.result-meta span { font-size: .9rem; color: var(--c-text-muted); }
.result-link { align-self: center; }

/* ---- AD SLOT ---- */
.ad-slot {
  min-height: 50px; background: var(--c-bg-soft);
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--c-border); border-radius: 8px;
  color: #bbb; font-size: .75rem; margin: 1.5rem 0;
}
.ad-slot--top { min-height: 50px; }
@media(min-width:768px){ .ad-slot--top { min-height: 90px; } }
.ad-slot--mid { min-height: 280px; }
.ad-slot--bot { min-height: 50px; }
@media(min-width:768px){ .ad-slot--bot { min-height: 90px; } }

/* ---- SECTION TITLES ---- */
.section { padding: 2rem 0; }
.section-title {
  font-size: 1.35rem; font-weight: 700; color: var(--c-primary);
  margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 2px solid var(--c-accent-light);
}

/* ---- AREA CODE CARD (info box) ---- */
.area-code-card {
  background: var(--c-accent-light); border: 2px solid var(--c-accent);
  border-radius: var(--radius); padding: 1.5rem; margin: 1.5rem 0;
}
.area-code-number {
  font-size: clamp(48px, 10vw, 80px); font-weight: 700; color: var(--c-accent);
  line-height: 1; margin-bottom: .5rem;
}
.area-code-region { font-size: 1.2rem; font-weight: 600; color: var(--c-primary); margin-bottom: 1rem; }
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem;
}
.info-item { display: flex; align-items: flex-start; gap: .5rem; font-size: .9rem; }
.info-icon { font-size: 1rem; flex-shrink: 0; margin-top: .1rem; }
.info-label { color: var(--c-text-muted); font-size: .78rem; display: block; }
.info-value { font-weight: 600; color: var(--c-text); }

/* ---- GRID CARDS ---- */
.code-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem;
  margin: 1rem 0;
}
.code-card {
  background: var(--c-bg-soft); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: .75rem 1rem; text-decoration: none; color: var(--c-text);
  transition: border-color .15s, box-shadow .15s; display: block;
}
.code-card:hover { border-color: var(--c-accent); box-shadow: var(--shadow); text-decoration: none; }
.code-card .code-num { font-size: 1.5rem; font-weight: 700; color: var(--c-accent); display: block; }
.code-card .code-state { font-size: .78rem; color: var(--c-text-muted); display: block; margin-top: .1rem; }
.code-card .code-city { font-size: .8rem; color: var(--c-text); display: block; }

/* Popular grid */
.popular-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: .75rem;
}

/* ---- STATE SECTION ---- */
.state-group { margin-bottom: 1.5rem; }
.state-group h3 { font-size: 1rem; font-weight: 700; color: var(--c-primary); margin-bottom: .5rem; }
.state-codes { display: flex; flex-wrap: wrap; gap: .4rem; }
.state-code-pill {
  background: var(--c-bg-soft); border: 1px solid var(--c-border); border-radius: 20px;
  padding: .25rem .65rem; font-size: .85rem; font-weight: 600; color: var(--c-accent);
  text-decoration: none; transition: background .15s;
}
.state-code-pill:hover { background: var(--c-accent-light); text-decoration: none; }

/* ---- FAQ / ACCORDION ---- */
.faq-list { margin: 1rem 0; }
details {
  border: 1px solid var(--c-border); border-radius: var(--radius);
  margin-bottom: .5rem; overflow: hidden;
}
details[open] { border-color: var(--c-accent); }
summary {
  padding: 1rem 1.25rem; font-weight: 600; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  list-style: none; user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.25rem; color: var(--c-accent); flex-shrink: 0; }
details[open] summary::after { content: "−"; }
summary:hover { background: var(--c-bg-soft); }
.faq-body { padding: .75rem 1.25rem 1rem; border-top: 1px solid var(--c-border); font-size: .95rem; }

/* ---- FULL LIST TABLE ---- */
.ac-table-wrap { overflow-x: auto; margin: 1rem 0; }
.ac-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ac-table th {
  background: var(--c-primary); color: #fff; text-align: left;
  padding: .6rem .75rem; white-space: nowrap;
}
.ac-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--c-border); }
.ac-table tr:hover td { background: var(--c-accent-light); }
.ac-table .code-link { font-weight: 700; color: var(--c-accent); }
.ac-table .badge {
  display: inline-block; font-size: .72rem; padding: .15rem .4rem;
  border-radius: 4px; font-weight: 600;
}
.badge-geo { background: #d1f0e0; color: #1a7f4b; }
.badge-tf  { background: #fde8d8; color: #b94a00; }

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
  margin-bottom: 1rem; padding: 1rem; background: var(--c-bg-soft);
  border: 1px solid var(--c-border); border-radius: var(--radius);
}
.filter-bar label { font-size: .875rem; font-weight: 600; color: var(--c-text-muted); }
.filter-bar select, .filter-bar input {
  border: 1px solid var(--c-border); border-radius: 6px; padding: .4rem .6rem;
  font-size: .875rem; color: var(--c-text); background: #fff;
}
.filter-bar select:focus, .filter-bar input:focus {
  outline: none; border-color: var(--c-accent);
}

/* ---- CONTENT PROSE ---- */
.prose h2 { font-size: 1.3rem; font-weight: 700; color: var(--c-primary); margin: 1.75rem 0 .75rem; }
.prose h3 { font-size: 1.1rem; font-weight: 700; color: var(--c-primary); margin: 1.25rem 0 .5rem; }
.prose p { margin-bottom: 1rem; }
.prose ul { margin: .75rem 0 1rem 1.25rem; }
.prose li { margin-bottom: .3rem; list-style: disc; }
.prose strong { color: var(--c-primary); }

/* ---- CITY LIST ---- */
.city-list { display: flex; flex-wrap: wrap; gap: .35rem; margin: .75rem 0; }
.city-tag {
  background: var(--c-bg-soft); border: 1px solid var(--c-border); border-radius: 20px;
  padding: .2rem .6rem; font-size: .82rem; color: var(--c-text-muted);
}

/* ---- NAV PREV/NEXT ---- */
.pseo-nav {
  display: flex; justify-content: space-between; gap: 1rem;
  margin: 2rem 0; padding: 1rem 0; border-top: 1px solid var(--c-border);
}
.pseo-nav a {
  background: var(--c-bg-soft); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: .6rem 1rem; font-size: .9rem; font-weight: 600; color: var(--c-accent);
  flex: 1; text-align: center; max-width: 200px; transition: border-color .15s;
}
.pseo-nav a:hover { border-color: var(--c-accent); text-decoration: none; background: var(--c-accent-light); }

/* ---- TOLL-FREE CARD ---- */
.tf-card {
  background: linear-gradient(135deg, #fff5ec, #fff);
  border: 2px solid #e07820; border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin-bottom: 1rem;
}
.tf-code { font-size: 2.5rem; font-weight: 800; color: #e07820; }
.tf-desc { font-size: .9rem; color: var(--c-text-muted); }

/* ---- ZIP / REVERSE TOOL ---- */
.tool-box {
  background: var(--c-accent-light); border: 2px solid var(--c-accent);
  border-radius: var(--radius); padding: 1.5rem; margin: 1.5rem 0;
  max-width: 480px;
}
.tool-box label { font-weight: 600; display: block; margin-bottom: .5rem; }
.tool-input-row { display: flex; gap: .5rem; }
.tool-input {
  flex: 1; padding: .7rem .9rem; border: 1px solid var(--c-border); border-radius: 8px;
  font-size: 1rem; min-width: 0;
}
.tool-input:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(0,119,204,.2); }
.tool-btn {
  background: var(--c-accent); color: #fff; border: none; border-radius: 8px;
  padding: .7rem 1.1rem; font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.tool-btn:hover { background: var(--c-accent-dark); }
.tool-output {
  margin-top: 1rem; padding: 1rem; background: #fff;
  border-radius: 8px; border: 1px solid var(--c-border); font-size: .95rem;
  display: none;
}
.tool-output.visible { display: block; }

/* ---- FOOTER ---- */
.site-footer {
  background: var(--c-primary); color: rgba(255,255,255,.75);
  padding: 2.5rem 1rem 1.5rem; margin-top: 3rem;
  font-size: .875rem;
}
.footer-inner { max-width: var(--max-w); margin: 0 auto; }
.footer-top {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem; margin-bottom: 2rem;
}
.footer-col h4 { color: #fff; font-size: .95rem; font-weight: 700; margin-bottom: .75rem; }
.footer-col a {
  display: block; color: rgba(255,255,255,.7); margin-bottom: .35rem;
  font-size: .85rem;
}
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15); padding-top: 1rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}
.footer-bottom a { color: rgba(255,255,255,.6); }
.footer-bottom a:hover { color: #fff; }

/* ---- MOBILE NAV (bottom bar) ---- */
@media (max-width: 767px) {
  .site-nav { display: none; }
  .hamburger { display: block; }
  .mobile-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    background: var(--c-primary); border-top: 2px solid rgba(255,255,255,.15);
    display: flex; justify-content: space-around; padding: .5rem 0 .75rem;
    box-shadow: 0 -4px 16px rgba(0,0,0,.2);
  }
  .mobile-nav a {
    color: rgba(255,255,255,.7); font-size: .7rem; font-weight: 600;
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    padding: .25rem .5rem; min-width: 44px; min-height: 44px; justify-content: center;
    text-decoration: none;
  }
  .mobile-nav a .nav-icon { font-size: 1.2rem; }
  .mobile-nav a:hover, .mobile-nav a.active { color: #fff; }
  body { padding-bottom: 72px; }
  .site-footer { padding-bottom: 5rem; }
}

@media (max-width: 540px) {
  .search-form { flex-direction: column; }
  .search-input, .search-btn { width: 100%; }
  .hero { padding: 2rem 1rem 1.75rem; }
  .info-grid { grid-template-columns: 1fr 1fr; }
}

/* Utility */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--c-text-muted); font-size: .9rem; }
.btn { display: inline-block; background: var(--c-accent); color: #fff; padding: .6rem 1.2rem; border-radius: 8px; font-weight: 600; font-size: .9rem; }
.btn:hover { background: var(--c-accent-dark); text-decoration: none; }
.divider { border: none; border-top: 1px solid var(--c-border); margin: 1.5rem 0; }
