/*
 * directory.css — Shared styles for all directory / locator pages
 * Extracted from inline <style> blocks duplicated across the 4 directory pages:
 *   - irs-office-locator.html
 *   - federal-reserve-directory.html
 *   - government-finance-directory.html
 *   - state-finance-offices.html
 *
 * Directory pages use a DIFFERENT design system from blog/calculator pages:
 *   - Sticky gradient header (not the inline brand header from common.css)
 *   - Full-width page hero with blue gradient
 *   - Dark footer variant
 *
 * Works alongside common.css which provides :root variables, box-sizing,
 * accessibility focus outlines, and img content-visibility.
 * Page-specific overrides remain in inline <style> blocks.
 *
 * Improves content-to-code ratio for Google AdSense compliance
 * and enables browser caching of directory-specific CSS.
 */

/* ===== Reset & Base (directory variant) ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.7;
  color: #2d3748;
  background: #f7fafc;
}

/* ===== Skip Navigation ===== */
.skip-nav {
  position: absolute;
  top: -100%;
  left: 0;
  background: #1a202c;
  color: #fff;
  padding: 12px 24px;
  z-index: 10000;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}

.skip-nav:focus {
  top: 0;
}

/* ===== Sticky Gradient Header ===== */
.site-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #fda085 100%);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(102, 126, 234, 0.3);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.site-logo {
  font-size: 1.6rem;
  font-weight: 800;
  text-decoration: none;
  color: #fff;
  letter-spacing: -0.5px;
}

.site-logo span {
  opacity: 0.85;
  font-weight: 400;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.main-nav a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 0;
  font-size: 0.9rem;
}

.breadcrumb a {
  color: #667eea;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  color: #718096;
}

/* ===== Page Hero ===== */
.page-hero {
  background: linear-gradient(135deg, #1a365d 0%, #2a4365 30%, #2b6cb0 60%, #3182ce 100%);
  color: #fff;
  padding: 60px 24px;
  text-align: center;
}

.page-hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.page-hero p {
  font-size: 1.15rem;
  max-width: 750px;
  margin: 0 auto;
  opacity: 0.92;
}

/* ===== Main Content Container ===== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

/* ===== Search / Filter Box ===== */
.search-box {
  margin-bottom: 24px;
}

.search-box input {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1rem;
  color: #2d3748;
  transition: border-color 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: #2b6cb0;
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

.search-results-count {
  text-align: center;
  color: #718096;
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: none;
}

/* ===== Table of Contents ===== */
.toc {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 40px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.toc h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #1a202c;
}

.toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.toc a {
  display: block;
  padding: 10px 16px;
  border-radius: 8px;
  color: #2b6cb0;
  text-decoration: none;
  font-weight: 500;
  background: #ebf8ff;
  transition: background 0.2s, transform 0.1s;
  font-size: 0.95rem;
}

.toc a:hover {
  background: #bee3f8;
  transform: translateX(4px);
}

/* ===== Section Headers ===== */
.section-header {
  background: linear-gradient(135deg, #1a365d, #2b6cb0);
  color: #fff;
  padding: 24px 32px;
  border-radius: 16px 16px 0 0;
  margin-top: 48px;
}

.section-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.section-header p {
  opacity: 0.9;
  font-size: 0.95rem;
}

/* ===== Agency Cards ===== */
.agency-card {
  background: #fff;
  border-radius: 0 0 16px 16px;
  padding: 0;
  margin-bottom: 32px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.agency-card:not(:first-of-type) {
  border-radius: 16px;
  margin-top: 24px;
}

.agency-entry {
  padding: 28px 32px;
  border-bottom: 1px solid #e2e8f0;
}

.agency-entry:last-child {
  border-bottom: none;
}

.agency-entry h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a365d;
  margin-bottom: 8px;
}

.agency-entry .agency-desc {
  color: #4a5568;
  font-size: 0.95rem;
  margin-bottom: 16px;
  line-height: 1.6;
}

.agency-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

/* ===== Detail Items (shared by agency-card and state-card) ===== */
.detail-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: #2d3748;
}

.detail-item .label {
  font-weight: 700;
  color: #1a365d;
  min-width: 70px;
  flex-shrink: 0;
}

.detail-item a {
  color: #2b6cb0;
  text-decoration: none;
}

.detail-item a:hover {
  text-decoration: underline;
}

/* ===== Sub-offices ===== */
.sub-offices {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed #cbd5e0;
}

.sub-offices h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 16px;
}

.sub-office-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.sub-office {
  background: #f7fafc;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  font-size: 0.88rem;
}

.sub-office strong {
  color: #1a365d;
  display: block;
  margin-bottom: 6px;
}

.sub-office .so-detail {
  color: #4a5568;
  margin-bottom: 3px;
}

/* ===== Phone Grid (IRS phone numbers) ===== */
.phone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.phone-card {
  background: #f7fafc;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  font-size: 0.92rem;
}

.phone-card strong {
  color: #1a365d;
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
}

.phone-card .phone-number {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2b6cb0;
  margin-bottom: 4px;
}

.phone-card .phone-desc {
  color: #4a5568;
  font-size: 0.88rem;
}

/* ===== Resource Grid (online resources) ===== */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.resource-card {
  background: #f7fafc;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.resource-card:hover {
  border-color: #2b6cb0;
  box-shadow: 0 4px 16px rgba(43, 108, 176, 0.1);
}

.resource-card strong {
  color: #1a365d;
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
}

.resource-card p {
  color: #4a5568;
  font-size: 0.88rem;
  margin-bottom: 10px;
}

.resource-card a {
  color: #2b6cb0;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.resource-card a:hover {
  text-decoration: underline;
}

/* ===== Tables (TAC table, state-directory table) ===== */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.tac-table,
.state-directory {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 16px;
}

.tac-table thead th,
.state-directory thead th {
  background: #1a365d;
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.tac-table tbody td,
.state-directory tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.tac-table tbody tr:nth-child(even),
.state-directory tbody tr:nth-child(even) {
  background: #f7fafc;
}

.tac-table tbody tr:hover,
.state-directory tbody tr:hover {
  background: #ebf8ff;
}

.state-directory a {
  color: #2b6cb0;
  text-decoration: none;
}

.state-directory a:hover {
  text-decoration: underline;
}

/* ===== TAC State Cards (IRS Office Locator) ===== */
.tac-state-card {
  border-radius: 12px;
  margin-top: 16px;
  overflow: hidden;
}

.tac-state-card .table-container {
  border-radius: 0;
  box-shadow: none;
}

.tac-state-card .tac-table {
  margin-top: 0;
}

/* ===== Educational Content Sections ===== */
.edu-content {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  margin-top: 48px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.edu-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a365d;
  margin-bottom: 20px;
}

.edu-content p {
  color: #4a5568;
  font-size: 0.95rem;
  margin-bottom: 16px;
  line-height: 1.7;
}

.edu-content ul {
  margin: 12px 0 16px 24px;
  color: #4a5568;
  font-size: 0.95rem;
}

.edu-content ul li {
  margin-bottom: 8px;
}

.edu-section {
  background: #fff;
  border-radius: 16px;
  padding: 36px;
  margin-top: 48px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.edu-section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a365d;
  margin-bottom: 20px;
}

.edu-section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2a4365;
  margin: 20px 0 10px;
}

.edu-section p {
  color: #4a5568;
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 12px;
}

.edu-section ul {
  list-style: disc;
  padding-left: 24px;
  margin-bottom: 12px;
}

.edu-section ul li {
  color: #4a5568;
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 6px;
}

/* ===== District Badge (Federal Reserve) ===== */
.district-badge {
  display: inline-block;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 20px;
  margin-right: 8px;
  vertical-align: middle;
}

/* ===== States Served (Federal Reserve) ===== */
.states-served {
  margin-top: 12px;
  padding: 12px 16px;
  background: #ebf8ff;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #2a4365;
}

.states-served strong {
  color: #1a365d;
}

/* ===== Alphabet Navigation (State Finance) ===== */
.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 32px;
  padding: 20px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.alpha-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #ebf8ff;
  color: #2b6cb0;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.1s;
}

.alpha-nav a:hover {
  background: #bee3f8;
  transform: scale(1.1);
}

/* ===== State Cards (State Finance) ===== */
.state-card {
  background: #fff;
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.state-card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.state-card-header {
  background: linear-gradient(135deg, #1a365d, #2b6cb0);
  color: #fff;
  padding: 20px 28px;
}

.state-card-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}

.state-card-body {
  padding: 24px 28px;
}

.state-card-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a365d;
  margin-bottom: 8px;
}

.state-card-body .office-desc {
  color: #4a5568;
  font-size: 0.95rem;
  margin-bottom: 16px;
  line-height: 1.6;
}

.office-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

/* ===== Directory Disclaimer ===== */
.directory-disclaimer {
  background: #fffbeb;
  border: 1px solid #fbbf24;
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 40px;
  font-size: 0.9rem;
  color: #92400e;
}

.directory-disclaimer strong {
  color: #78350f;
}

/* ===== Newsletter Section ===== */
.newsletter-section {
  border-radius: 14px;
  padding: 28px;
  margin: 32px 0;
  text-align: center;
}

/* ===== Dark Footer (directory variant) ===== */
.site-footer {
  background: #1a202c;
  color: #a0aec0;
  padding: 48px 24px 24px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}

.footer-col h4 {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col ul li a {
  color: #a0aec0;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-col ul li a:hover {
  color: #fff;
}

.footer-bottom {
  max-width: 1200px;
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid #2d3748;
  text-align: center;
  font-size: 0.85rem;
  color: #718096;
}

/* ===== Cookie Consent (directory variant) ===== */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1a202c;
  color: #e2e8f0;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 9999;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  font-size: 0.9rem;
}

.cookie-consent.hidden {
  display: none;
}

.cookie-consent a {
  color: #90cdf4;
}

.cookie-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.cookie-btn:hover {
  opacity: 0.9;
}

/* ===== Print Styles ===== */
@media print {
  .site-header,
  .site-footer,
  .cookie-consent,
  .skip-nav,
  .toc,
  .search-box,
  .alpha-nav {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .section-header,
  .state-card-header {
    background: #333;
    -webkit-print-color-adjust: exact;
  }

  .agency-card,
  .state-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  a {
    color: #000;
  }

  a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }
}

/* ===== Responsive: Tablet & Mobile ===== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: 12px;
  }

  .main-nav ul {
    justify-content: center;
  }

  .page-hero h1 {
    font-size: 1.8rem;
  }

  .section-header {
    padding: 20px;
  }

  .agency-entry {
    padding: 20px;
  }

  .agency-details,
  .office-details {
    grid-template-columns: 1fr;
  }

  .sub-office-grid {
    grid-template-columns: 1fr;
  }

  .toc-grid {
    grid-template-columns: 1fr;
  }

  .phone-grid,
  .resource-grid {
    grid-template-columns: 1fr;
  }

  .cookie-consent {
    flex-direction: column;
    text-align: center;
  }

  .edu-section {
    padding: 24px;
  }

  .state-card-header {
    padding: 16px 20px;
  }

  .state-card-body {
    padding: 20px;
  }

  .alpha-nav a {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .tac-table,
  .state-directory {
    font-size: 0.8rem;
  }

  .tac-table thead th,
  .tac-table tbody td,
  .state-directory thead th,
  .state-directory tbody td {
    padding: 8px 10px;
  }
}
