/* ==========================================================================
   PERMIT LAYOUT
   Hub page (/permits/) + per-city page (/permits/<slug>/).
   Uses design tokens from design-system.css.
   ========================================================================== */

/* --- Shared wrappers --- */
.permit-hub,
.permit-city {
  padding: 0 0 64px;
  background: var(--bg-subtle, #f8fafc);
}

/* Matches the site header's .container for horizontal alignment. */
.permit-wrapper {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* Narrower centered column for hero + primary cards on the hub. */
.permit-col {
  max-width: 720px;
  margin: 0 auto;
}

/* --- Breadcrumbs --- */
.permit-breadcrumbs {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 20px 0 8px;
}

/* Hub breadcrumbs sit with the centered hero. */
.permit-hub .permit-breadcrumbs {
  text-align: center;
}

.permit-breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.permit-breadcrumbs a:hover {
  color: var(--accent-primary);
}

.permit-breadcrumbs .sep {
  margin: 0 8px;
  color: var(--text-light, #94a3b8);
}

.permit-breadcrumbs .current {
  color: var(--text-main);
  font-weight: 500;
}

/* --- Hero (centered for hub, left for city) --- */
.permit-hero {
  text-align: center;
  padding: 48px 0 32px;
}

.permit-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin: 0 auto 16px;
  max-width: 780px;
}

.permit-hero p {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 auto;
  max-width: 640px;
}

.permit-city .permit-hero {
  text-align: left;
  padding: 56px 0 32px;
}

.permit-city .permit-hero h1,
.permit-city .permit-hero p {
  margin-left: 0;
  margin-right: 0;
}

/* Methodology link - sits on its own line below the hero description,
   plain underlined dark link with arrow (not a pill). */
.permit-hero__meta {
  margin: 20px auto 0;
  max-width: 640px;
  font-size: 0.9375rem;
}

.permit-city .permit-hero__meta {
  margin-left: 0;
  margin-right: 0;
}

.permit-hero__methodology,
#permit-national-result p.muted a,
.permit-result-card p.muted a {
  color: var(--text-main);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.permit-hero__methodology:hover,
#permit-national-result p.muted a:hover,
.permit-result-card p.muted a:hover {
  color: var(--accent-primary);
}

/* --- Card primitive --- */
.permit-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.permit-card + .permit-card {
  margin-top: 24px;
}

@media (max-width: 640px) {
  .permit-card {
    padding: 24px 20px;
    border-radius: 12px;
  }
}

/* --- Hub search card --- */
.permit-search-card {
  margin: 8px 0 32px;
}

.permit-search__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.permit-search__input {
  position: relative;
}

.permit-search__input input {
  width: 100%;
  padding: 18px 20px;
  font-size: 1.125rem;
  font-family: inherit;
  color: var(--text-main);
  background: #fff;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  box-sizing: border-box;
}

.permit-search__input input::placeholder {
  color: var(--text-light, #94a3b8);
}

.permit-search__input input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(224, 93, 54, 0.12);
}

.permit-search__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 16px 40px -8px rgba(15, 23, 42, 0.18);
  max-height: 360px;
  overflow-y: auto;
  z-index: 20;
  padding: 8px;
}

.permit-search__dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text-main);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.permit-search__dropdown button:hover {
  background: var(--bg-subtle, #f8fafc);
  color: var(--accent-primary);
}

.permit-search__dropdown .city-search-miss {
  color: var(--text-muted);
  font-style: italic;
}

.permit-search__dropdown .city-search-miss span {
  color: var(--accent-primary);
  font-style: normal;
  font-weight: 600;
}

/* --- Section divider ("or" between search and national) --- */
.permit-divider {
  display: flex;
  align-items: center;
  margin: 32px 0;
  color: var(--text-light, #94a3b8);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.permit-divider::before,
.permit-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.permit-divider::before {
  margin-right: 16px;
}
.permit-divider::after {
  margin-left: 16px;
}

/* --- Calc form (national + city share this) --- */
.permit-form .field {
  margin-bottom: 20px;
}

.permit-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.permit-form input[type='number'],
.permit-form select {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-main);
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-sizing: border-box;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.permit-form input[type='number']:focus,
.permit-form select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(224, 93, 54, 0.12);
}

.permit-form input[type='number']::-webkit-inner-spin-button,
.permit-form input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.permit-form input[type='number'] {
  -moz-appearance: textfield;
}

.permit-form .btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  margin-top: 4px;
}

/* --- Result card --- */
#permit-national-result,
#calc-result {
  margin-top: 24px;
}

.permit-result-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
}

.permit-result-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 6px;
  letter-spacing: -0.015em;
}

.permit-result-total {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.5rem);
  font-weight: 800;
  color: var(--accent-primary);
  margin: 0 0 16px;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#permit-national-result h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 6px;
}

#permit-national-result p.muted {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* --- Estimate banner (state-level, unverified) --- */
.permit-estimate-banner {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-left: 4px solid #d97706;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 20px;
  color: #78350f;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.permit-estimate-banner strong {
  color: #78350f;
  font-weight: 700;
}

.permit-estimate-banner a {
  color: #b45309;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.permit-estimate-banner a:hover {
  text-decoration: underline;
}

/* --- Fee breakdown table --- */
.permit-fee-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 0.9375rem;
}

.permit-fee-table th,
.permit-fee-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.permit-fee-table thead th {
  background: transparent;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding-top: 0;
}

.permit-fee-table tbody tr:last-child td {
  border-bottom: none;
}

.permit-fee-table tbody td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.permit-provenance {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  font-size: 0.8125rem;
  color: var(--text-light, #94a3b8);
}

.permit-provenance a {
  color: var(--accent-primary);
  text-decoration: none;
}

.permit-provenance a:hover {
  text-decoration: underline;
}

/* --- Sections (hub) --- */
.permit-section {
  margin: 48px 0;
}

.permit-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.permit-section h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.02em;
}

.permit-section-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* --- Featured cities grid --- */
.permit-featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.permit-featured-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: all 0.15s ease;
}

.permit-featured-tile::after {
  content: '→';
  color: var(--text-light, #94a3b8);
  font-weight: 400;
  transition:
    color 0.15s ease,
    transform 0.15s ease;
}

.permit-featured-tile:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(15, 23, 42, 0.08);
}

.permit-featured-tile:hover::after {
  color: var(--accent-primary);
  transform: translateX(3px);
}

/* --- Browse by state --- */
.permit-state-group {
  margin-bottom: 28px;
}

.permit-state-group h3 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.permit-state-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px 16px;
}

.permit-state-group li {
  margin: 0;
}

.permit-state-group a {
  display: inline-block;
  padding: 6px 0;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: color 0.15s ease;
}

.permit-state-group a:hover {
  color: var(--accent-primary);
}

/* --- Related pills (both hub + city) --- */
.permit-related {
  margin: 48px 0 0;
  padding-top: 32px;
  border-top: 1px solid var(--border-light);
}

.permit-related h2 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.permit-related ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permit-related li {
  margin: 0;
}

.permit-related a {
  display: inline-block;
  padding: 8px 14px;
  background: #fff;
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.15s ease;
}

.permit-related a:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* ==========================================================================
   CITY PAGE SPECIFIC
   ========================================================================== */

.permit-city-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

@media (min-width: 960px) {
  .permit-city-grid {
    grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
    gap: 48px;
    align-items: start;
  }

  /* Calc card follows the reader as they scroll through the content column. */
  .permit-city-grid > .permit-card {
    position: sticky;
    top: 88px; /* clear of the site header */
    align-self: start;
  }
}

.permit-city-content h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 40px 0 16px;
  letter-spacing: -0.02em;
}

.permit-city-content h2:first-child {
  margin-top: 0;
}

.permit-city-content h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 24px 0 10px;
  letter-spacing: -0.01em;
}

.permit-city-content p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.permit-city-content a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.permit-city-content a:hover {
  text-decoration-thickness: 2px;
}

/* Nearby / state peer lists in aside */
.permit-peer-list {
  margin-top: 24px;
}

.permit-peer-list h2,
.permit-peer-list h3 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 24px 0 8px;
}

.permit-peer-list > h2:first-child,
.permit-peer-list > h3:first-child {
  margin-top: 0;
}

.permit-peer-list ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.permit-peer-list li {
  margin: 0;
}

.permit-peer-list a {
  display: block;
  padding: 6px 0;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: color 0.15s ease;
}

.permit-peer-list a:hover {
  color: var(--accent-primary);
}

/* --- Permit hub: per-type calculator cards --- */
.permit-hub-calculators {
  margin-top: 32px;
  margin-bottom: 32px;
}
.permit-hub-calculators > h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 600;
}
.permit-hub-calculators > p.muted {
  color: var(--text-muted);
  margin: 0 0 16px;
}
.permit-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.permit-calc-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md, 8px);
  background: var(--bg-base);
  text-decoration: none;
  color: var(--text-main);
  transition:
    border-color 0.15s ease,
    transform 0.15s ease;
}
.permit-calc-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}
.permit-calc-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
}
.permit-calc-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.permit-calc-card--hub {
  background: var(--bg-subtle);
  border-color: var(--accent-primary);
}
.permit-calc-card--info {
  border-style: dashed;
}
