html {
  overflow-x: hidden;
}

.fence-cost-page {
  --cost-slate: #334155;
  --cost-slate-dark: #0f172a;
  --cost-green: #15803d;
  --cost-amber: #d97706;
  --cost-blue: #2563eb;
  --cost-red: #dc2626;
  --cost-line: rgba(51, 65, 85, 0.18);
  --cost-line-strong: rgba(21, 128, 61, 0.38);
  --cost-soft: rgba(148, 163, 184, 0.15);
  --cost-panel: rgba(255, 255, 255, 0.86);
  --cost-ink: #102018;
  --cost-muted: #526173;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(248, 250, 252, 0.98), rgba(236, 253, 245, 0.82) 48%, rgba(255, 255, 255, 0.96)),
    #f8fafc;
}

:root[data-theme="dark"] .fence-cost-page {
  --cost-slate: #cbd5e1;
  --cost-slate-dark: #f8fafc;
  --cost-green: #86efac;
  --cost-amber: #fbbf24;
  --cost-blue: #93c5fd;
  --cost-red: #fca5a5;
  --cost-line: rgba(203, 213, 225, 0.17);
  --cost-line-strong: rgba(134, 239, 172, 0.36);
  --cost-soft: rgba(148, 163, 184, 0.12);
  --cost-panel: rgba(15, 23, 42, 0.86);
  --cost-ink: #f8fafc;
  --cost-muted: #cbd5e1;
  background:
    linear-gradient(135deg, #020617, #0f172a 58%, #052e16),
    #020617;
}

.fence-cost-page .container {
  width: min(calc(100vw - 2rem), var(--content));
}

.fence-cost-page .site-header {
  background: rgba(248, 250, 252, 0.9);
  border-bottom-color: var(--cost-line);
}

:root[data-theme="dark"] .fence-cost-page .site-header {
  background: rgba(2, 6, 23, 0.86);
}

.fence-cost-page h1,
.fence-cost-page h2,
.fence-cost-page h3,
.fence-cost-page h4,
.fence-cost-page .logo {
  letter-spacing: 0;
}

.fence-cost-page [hidden] {
  display: none !important;
}

.fence-cost-page .reveal {
  opacity: 1;
  transform: none;
}

.cost-hero {
  padding: 3.15rem 0 1.8rem;
}

.cost-hero-grid,
.cost-calculator-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 0.92fr);
  align-items: start;
}

.cost-hero-grid > *,
.cost-calculator-grid > *,
.cost-related-grid > *,
.cost-info-grid > * {
  min-width: 0;
}

.cost-eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--cost-line);
  border-radius: 999px;
  background: var(--cost-soft);
  color: var(--cost-slate-dark);
  font-weight: 900;
}

.cost-eyebrow {
  padding: 0.42rem 0.78rem;
}

.section-kicker {
  padding: 0.28rem 0.72rem;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.cost-hero h1 {
  margin: 0.62rem 0 0.35rem;
  text-wrap: balance;
}

.cost-subtitle,
.cost-muted,
.cost-tip,
.cost-warning,
.field-help,
.quick-head p,
.cost-card p,
.cost-related-card p,
.result-summary dd {
  color: var(--cost-muted);
}

.cost-subtitle {
  max-width: 900px;
  margin: 0;
  font-size: 1.08rem;
}

.cost-visual-card,
.quick-card,
.cost-tool-panel,
.cost-results-panel,
.cost-card,
.cost-related-card {
  border: 1px solid var(--cost-line);
  border-radius: 20px;
  background: var(--cost-panel);
  box-shadow: var(--shadow-soft);
}

.cost-visual-card {
  padding: 1rem;
  color: var(--cost-slate-dark);
}

.cost-visual-card svg,
.cost-result-visual svg {
  display: block;
  width: 100%;
  height: auto;
}

.section {
  padding: 2rem 0 3rem;
}

.section-heading {
  max-width: 960px;
}

.section-heading h2 {
  margin: 0.35rem 0 0.55rem;
  font-family: var(--font-heading);
  font-size: 2.25rem;
  line-height: 1.08;
}

.quick-card,
.cost-tool-panel,
.cost-results-panel {
  padding: 1rem;
}

.quick-card {
  background:
    linear-gradient(135deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.92)),
    #f8fafc;
}

:root[data-theme="dark"] .quick-card {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.86)),
    #0f172a;
}

.quick-head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.quick-head h2,
.cost-tool-head h2,
.cost-results-panel h3,
.cost-card h3,
.cost-related-card h3 {
  margin: 0;
  font-family: var(--font-heading);
}

.quick-head h2 {
  font-size: 1.18rem;
  text-transform: uppercase;
}

.cost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.76rem 1rem;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-weight: 850;
  text-align: center;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.16);
}

.cost-button.wide {
  width: 100%;
}

.cost-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--cost-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  -webkit-overflow-scrolling: touch;
}

:root[data-theme="dark"] .cost-table-wrap {
  background: rgba(255, 255, 255, 0.04);
}

.cost-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.cost-table th,
.cost-table td {
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--cost-line);
  vertical-align: top;
}

.cost-table th {
  background: rgba(100, 116, 139, 0.08);
  color: var(--cost-slate-dark);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.cost-table tr:last-child td {
  border-bottom: 0;
}

.cost-table td:first-child {
  font-weight: 800;
}

.cost-quick-metrics {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cost-quick-metrics div {
  padding: 0.85rem;
  border: 1px solid var(--cost-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
}

.cost-quick-metrics strong {
  display: block;
  font-size: 1.08rem;
}

.cost-calculator-grid {
  grid-template-columns: minmax(0, 1fr) minmax(410px, 0.95fr);
}

.cost-tool-head,
.cost-result-head,
.cost-result-total,
.cost-result-actions,
.cost-compare-actions {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.cost-tool-head {
  margin-bottom: 1rem;
}

.cost-tool-head p,
.cost-result-head span {
  color: var(--cost-muted);
  font-weight: 700;
}

.cost-mode-switch,
.cost-segmented,
.cost-step-nav,
.cost-result-actions,
.cost-compare-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.cost-mode-switch button,
.cost-segmented button,
.cost-step-nav button,
.cost-result-actions button,
.cost-compare-actions button {
  min-height: 42px;
  border: 1px solid var(--cost-line);
  border-radius: 999px;
  padding: 0.62rem 0.9rem;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  font-weight: 800;
}

:root[data-theme="dark"] .cost-mode-switch button,
:root[data-theme="dark"] .cost-segmented button,
:root[data-theme="dark"] .cost-step-nav button,
:root[data-theme="dark"] .cost-result-actions button,
:root[data-theme="dark"] .cost-compare-actions button {
  background: rgba(255, 255, 255, 0.05);
}

.cost-mode-switch button[aria-pressed="true"],
.cost-segmented button.is-active,
.cost-option-grid button.is-active,
.cost-material-choice button.is-active,
.cost-style-options button.is-active,
.cost-height-options button.is-active {
  border-color: var(--cost-line-strong);
  background: linear-gradient(135deg, rgba(21, 128, 61, 0.13), rgba(148, 163, 184, 0.12));
  color: var(--cost-slate-dark);
}

.cost-progress {
  height: 10px;
  overflow: hidden;
  margin: 0 0 1rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.12);
}

.cost-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f172a, #22c55e);
  transition: width 180ms ease;
}

.wizard-panel,
.expert-panel,
.cost-step {
  display: grid;
  gap: 1rem;
}

.cost-step {
  padding: 0.95rem;
  border: 1px solid var(--cost-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.28);
}

:root[data-theme="dark"] .cost-step {
  background: rgba(255, 255, 255, 0.04);
}

.cost-step h3,
.cost-step h4 {
  margin: 0;
  font-family: var(--font-heading);
}

.cost-option-grid,
.cost-material-choice,
.cost-style-options,
.cost-check-grid,
.cost-related-grid,
.cost-info-grid {
  display: grid;
  gap: 0.75rem;
}

.cost-option-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cost-option-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cost-material-choice {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cost-style-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cost-option-grid button,
.cost-material-choice button,
.cost-style-options button {
  display: grid;
  gap: 0.25rem;
  min-height: 112px;
  padding: 0.85rem;
  border: 1px solid var(--cost-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--text);
  text-align: left;
}

.cost-option-grid button span,
.cost-material-choice button span,
.cost-style-options button span {
  color: var(--cost-muted);
  font-weight: 650;
}

.cost-field-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cost-field-grid label,
.wide-label {
  display: grid;
  gap: 0.4rem;
  color: var(--text);
  font-weight: 800;
}

.cost-field-grid input,
.cost-field-grid select,
.wide-label select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--cost-line);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  background: var(--bg-elevated);
  color: var(--text);
}

.cost-field-grid label[data-entry="total"],
.cost-field-grid label[data-entry="dimensions"],
.cost-field-grid label[data-entry="lot"] {
  display: none;
}

.cost-field-grid.is-total label[data-entry="total"],
.cost-field-grid.is-dimensions label[data-entry="dimensions"],
.cost-field-grid.is-lot label[data-entry="lot"] {
  display: grid;
}

.cost-check-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cost-check-grid label {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.8rem;
  border: 1px solid var(--cost-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  font-weight: 700;
}

.cost-warning,
.cost-note,
.cost-tip {
  margin: 0;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--cost-amber);
  border-radius: 0 14px 14px 0;
  background: rgba(217, 119, 6, 0.1);
  font-weight: 650;
}

.cost-warning {
  border-left-color: var(--cost-red);
  background: rgba(220, 38, 38, 0.08);
  color: var(--text);
}

.cost-results-panel {
  display: grid;
  gap: 0.9rem;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(21, 128, 61, 0.82)),
    #0f172a;
  color: #f8fafc;
}

.cost-result-head span {
  color: rgba(248, 250, 252, 0.78);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.cost-result-visual {
  min-height: 178px;
  border-radius: 16px;
  border: 1px solid rgba(248, 250, 252, 0.11);
  background: rgba(255, 255, 255, 0.05);
}

.result-summary {
  display: grid;
  gap: 0.5rem;
  margin: 0;
}

.result-summary div {
  display: grid;
  gap: 0.1rem;
}

.result-summary dt {
  color: rgba(248, 250, 252, 0.68);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.cost-results-panel .result-summary dd,
.cost-results-panel .cost-muted {
  color: rgba(248, 250, 252, 0.78);
}

.result-summary dd {
  margin: 0;
  font-weight: 700;
}

.cost-result-block {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cost-result-block h4 {
  margin: 0;
  font-family: var(--font-heading);
}

.cost-result-line,
.cost-result-total div {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: baseline;
}

.cost-result-line small {
  display: block;
  color: rgba(248, 250, 252, 0.68);
  font-weight: 650;
}

.cost-result-total {
  padding: 0.85rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cost-result-total span {
  display: block;
  color: rgba(248, 250, 252, 0.68);
  font-size: 0.88rem;
  font-weight: 700;
}

.cost-result-total strong {
  font-size: 1.35rem;
}

.cost-result-actions,
.cost-compare-actions {
  flex-wrap: wrap;
}

.cost-result-actions button,
.cost-compare-actions button {
  flex: 1 1 140px;
  color: inherit;
}

.cost-list,
.cost-savings-list,
.cost-warning-list {
  margin: 0;
  padding-left: 1.1rem;
}

.share-output {
  margin: 0;
  min-height: 1.5em;
  color: rgba(248, 250, 252, 0.72);
  font-size: 0.92rem;
  word-break: break-word;
}

.cost-info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.cost-card,
.cost-related-card {
  padding: 1rem;
}

.cost-card ul,
.cost-card ol {
  margin: 0.55rem 0 0;
  padding-left: 1.1rem;
}

.cost-related-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cost-related-card span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--cost-slate-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.cost-related-card a {
  display: inline-flex;
  margin-top: 0.8rem;
  color: var(--cost-green);
  font-weight: 850;
}

.cost-faq {
  display: grid;
  gap: 0.85rem;
}

.cost-faq details {
  overflow: hidden;
  border: 1px solid var(--cost-line);
  border-radius: 18px;
  background: var(--cost-panel);
  box-shadow: var(--shadow-soft);
}

.cost-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 850;
  list-style: none;
}

.cost-faq summary::-webkit-details-marker {
  display: none;
}

.cost-faq summary::after {
  content: "+";
  color: var(--cost-green);
  font-size: 1.35rem;
  line-height: 1;
}

.cost-faq details[open] summary::after {
  content: "-";
}

.cost-faq details > div {
  padding: 0 1.1rem 1.1rem;
}

.cost-faq p {
  margin: 0;
  color: var(--cost-muted);
}

@media (max-width: 1080px) {
  .cost-hero-grid,
  .cost-calculator-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .cost-option-grid,
  .cost-option-grid.compact,
  .cost-style-options,
  .cost-check-grid,
  .cost-related-grid,
  .cost-info-grid,
  .cost-quick-metrics {
    grid-template-columns: 1fr;
  }

  .cost-material-choice {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-head,
  .cost-tool-head,
  .cost-result-head,
  .cost-result-total {
    flex-direction: column;
    align-items: flex-start;
  }

  .cost-field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .cost-hero {
    padding-top: 2.6rem;
  }

  .cost-hero h1 {
    font-size: clamp(2.2rem, 10vw, 3.2rem);
  }

  .section-heading h2 {
    font-size: 2rem;
  }

  .cost-table {
    min-width: 700px;
  }

  .cost-button,
  .cost-result-actions button,
  .cost-compare-actions button {
    width: 100%;
  }

  .cost-results-panel {
    padding: 0.9rem;
  }
}

@media (max-width: 520px) {
  .fence-cost-page .container {
    width: min(calc(100vw - 2rem), 360px);
    margin-inline: 1rem;
  }

  .cost-hero h1,
  .section-heading h2 {
    overflow-wrap: anywhere;
  }
}
