@import url("https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

:root {
  --page: #f6f7f4;
  --paper: rgba(255, 255, 255, 0.92);
  --paper-solid: #ffffff;
  --ink: #17314c;
  --ink-soft: #526579;
  --ink-faint: #758496;
  --line: rgba(23, 49, 76, 0.12);
  --line-strong: rgba(23, 49, 76, 0.2);
  --blue: #204a86;
  --blue-bright: #2f6fd6;
  --blue-soft: rgba(47, 111, 214, 0.12);
  --green: #3e8876;
  --green-soft: rgba(62, 136, 118, 0.14);
  --amber: #b87543;
  --amber-soft: rgba(184, 117, 67, 0.14);
  --red: #b24444;
  --red-soft: rgba(178, 68, 68, 0.12);
  --shadow-lg: 0 28px 70px rgba(26, 49, 74, 0.14);
  --shadow-md: 0 18px 42px rgba(26, 49, 74, 0.1);
  --shadow-sm: 0 10px 24px rgba(26, 49, 74, 0.07);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --max-width: 1240px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(184, 117, 67, 0.08), transparent 30%),
    radial-gradient(circle at top right, rgba(47, 111, 214, 0.12), transparent 34%),
    linear-gradient(180deg, #fbfbf7 0%, var(--page) 50%, #fbfbf8 100%);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

select,
input[type="number"] {
  width: 100%;
  min-height: 3.15rem;
  padding: 0.82rem 2.65rem 0.82rem 0.95rem;
  border: 1px solid rgba(23, 49, 76, 0.14);
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.96);
  color: var(--ink);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) calc(50% - 3px),
    calc(100% - 16px) calc(50% - 3px);
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
}

select:focus,
input:focus,
button:focus-visible,
a:focus-visible,
.table-scroll:focus {
  outline: 3px solid rgba(47, 111, 214, 0.18);
  outline-offset: 2px;
}

.page-aura {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(23, 49, 76, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 49, 76, 0.018) 1px, transparent 1px);
  background-size: 100% 100%, 30px 30px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
  opacity: 0.55;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 100;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
}

.section {
  padding: clamp(3rem, 6vw, 4.8rem) 0;
}

.section--compact {
  padding-top: 0;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0.9rem 0;
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(251, 251, 247, 0.94), rgba(251, 251, 247, 0.78));
  border-bottom: 1px solid rgba(23, 49, 76, 0.08);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  width: 2.85rem;
  height: 2.85rem;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.24), transparent 42%),
    linear-gradient(145deg, var(--blue), var(--blue-bright));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 14px 28px rgba(32, 74, 134, 0.2);
}

.brand-copy {
  display: grid;
  gap: 0.05rem;
  font-size: 0.86rem;
}

.brand-copy strong {
  font-size: 0.98rem;
}

.brand-copy span:last-child {
  color: var(--ink-faint);
}

.site-nav {
  justify-self: end;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0.62rem 0.9rem;
  border: 1px solid rgba(23, 49, 76, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-sm);
}

.site-nav a {
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 700;
}

.tool-hero {
  padding: clamp(2rem, 5vw, 3.2rem) 0 clamp(1.5rem, 4vw, 2.4rem);
}

.tool-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
  gap: 1.2rem;
  align-items: end;
}

.tool-hero h1,
.panel-header h2,
.table-heading h2 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  line-height: 1;
  letter-spacing: -0.035em;
}

.tool-hero h1 {
  max-width: 760px;
  font-size: clamp(2.35rem, 5vw, 4.25rem);
}

.tool-hero p:last-child {
  margin: 0;
  color: var(--ink-soft);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  gap: 1.15rem;
  align-items: start;
}

.panel,
.table-section {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--paper);
  box-shadow: var(--shadow-md);
}

.input-panel {
  padding: clamp(1.15rem, 3vw, 1.6rem);
}

.panel-header,
.table-heading,
.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.panel-header {
  margin-bottom: 1rem;
}

.panel-header h2,
.table-heading h2 {
  font-size: clamp(1.65rem, 3vw, 2.25rem);
}

.ghost-button {
  min-height: 2.55rem;
  padding: 0.65rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-weight: 800;
}

.form-section {
  padding: 1rem;
  border: 1px solid rgba(23, 49, 76, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.58);
}

.form-section:nth-of-type(1) {
  background: linear-gradient(135deg, rgba(47, 111, 214, 0.08), rgba(255, 255, 255, 0.72));
}

.form-section:nth-of-type(2) {
  background: linear-gradient(135deg, rgba(184, 117, 67, 0.1), rgba(255, 255, 255, 0.72));
}

.form-section:nth-of-type(3) {
  background: linear-gradient(135deg, rgba(62, 136, 118, 0.1), rgba(255, 255, 255, 0.72));
}

.form-section + .form-section {
  margin-top: 0.9rem;
}

.form-section h3 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
}

.field-grid {
  display: grid;
  gap: 0.85rem;
}

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

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

.field-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.field span,
.parallel-card span {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
}

.segmented-control label {
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: block;
  min-width: 120px;
  padding: 0.62rem 0.9rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
}

.segmented-control input:checked + span {
  background: var(--blue);
  color: #fff;
}

.load-mode-panel {
  margin-top: 0.85rem;
}

.load-system-grid {
  margin-top: 0.85rem;
}

.is-hidden {
  display: none !important;
}

.input-with-unit {
  position: relative;
}

.input-with-unit small {
  position: absolute;
  top: 50%;
  right: 0.9rem;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 0.8rem;
  font-weight: 800;
}

.input-with-unit input {
  padding-right: 4.25rem;
}

.pf-field {
  grid-column: span 1;
}

.parallel-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  margin-top: 0.9rem;
  padding: 0.9rem;
  border: 1px solid rgba(23, 49, 76, 0.1);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.68);
}

.parallel-card strong {
  display: block;
  margin-top: 0.1rem;
  font-family: "Newsreader", Georgia, serif;
  font-size: 2rem;
  line-height: 1;
}

.stepper {
  display: grid;
  grid-template-columns: 3rem 5rem 3rem;
  overflow: hidden;
  border: 1px solid rgba(23, 49, 76, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.stepper button,
.stepper input {
  min-height: 3rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
}

.stepper input {
  border-left: 1px solid rgba(23, 49, 76, 0.1);
  border-right: 1px solid rgba(23, 49, 76, 0.1);
  font-weight: 800;
  padding: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  padding: 0.9rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  transition:
    transform 200ms ease,
    box-shadow 200ms ease;
}

.button-primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 16px 30px rgba(23, 49, 76, 0.18);
}

.button:hover,
.button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible {
  transform: translateY(-1px);
}

.calculate-button {
  width: 100%;
  margin-top: 1rem;
}

.results-panel {
  position: sticky;
  top: 6.1rem;
  background:
    radial-gradient(circle at top right, rgba(62, 136, 118, 0.15), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 250, 248, 0.9));
  box-shadow: var(--shadow-lg);
}

.result-hero {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--line);
}

.result-hero span,
.result-grid span,
.factor-strip span,
.recommendation-row span {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-hero strong {
  display: block;
  margin-top: 0.25rem;
  padding-bottom: 0.12rem;
  color: var(--blue);
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(1.75rem, 3.75vw, 2.85rem);
  line-height: 1.08;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-hero p {
  margin: 0.65rem 0 0;
  color: var(--ink-soft);
  font-weight: 700;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 1rem 1.25rem;
}

.result-grid article {
  padding: 0.95rem;
  border: 1px solid rgba(23, 49, 76, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
}

.result-grid strong {
  display: block;
  margin-top: 0.35rem;
  color: var(--ink);
  font-size: 1.2rem;
}

.factor-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0 1.25rem 1rem;
}

.factor-strip span {
  padding: 0.55rem 0.7rem;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
}

.recommendation-list {
  display: grid;
  gap: 0.6rem;
  padding: 0 1.25rem 1rem;
}

.recommendation-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(23, 49, 76, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
}

.recommendation-row.is-selected {
  border-color: rgba(47, 111, 214, 0.28);
  background: linear-gradient(135deg, var(--blue-soft), rgba(255, 255, 255, 0.85));
}

.recommendation-row strong {
  display: block;
}

.recommendation-row em {
  color: var(--ink-soft);
  font-style: normal;
  font-size: 0.88rem;
}

.recommendation-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.recommendation-details small {
  padding: 0.28rem 0.45rem;
  border-radius: 999px;
  background: rgba(23, 49, 76, 0.055);
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.message-card {
  margin: 0 1.25rem 1.25rem;
  padding: 0.95rem;
  border: 1px solid rgba(62, 136, 118, 0.22);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--green-soft), rgba(255, 255, 255, 0.8));
  color: var(--ink);
  font-weight: 700;
}

.message-card.is-warning {
  border-color: rgba(184, 117, 67, 0.26);
  background: linear-gradient(135deg, var(--amber-soft), rgba(255, 255, 255, 0.84));
}

.message-card.is-error {
  border-color: rgba(178, 68, 68, 0.24);
  background: linear-gradient(135deg, var(--red-soft), rgba(255, 255, 255, 0.84));
}

.table-section {
  padding: clamp(1rem, 3vw, 1.45rem);
}

.table-heading {
  margin-bottom: 1rem;
}

.table-filter {
  width: min(100%, 300px);
}

.table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.ampacity-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.ampacity-table th,
.ampacity-table td {
  padding: 0.68rem 0.75rem;
  border-bottom: 1px solid rgba(23, 49, 76, 0.08);
  border-right: 1px solid rgba(23, 49, 76, 0.06);
  text-align: center;
}

.ampacity-table th:first-child,
.ampacity-table td:first-child {
  position: sticky;
  left: 0;
  text-align: left;
}

.ampacity-table th {
  background: var(--blue);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ampacity-table thead tr:first-child th:nth-child(2),
.ampacity-table thead tr:nth-child(2) th:nth-child(-n + 3) {
  background: #8e5d35;
}

.ampacity-table thead tr:first-child th:nth-child(3),
.ampacity-table thead tr:nth-child(2) th:nth-child(n + 4) {
  background: #536d83;
}

.ampacity-table tbody td:first-child {
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.ampacity-table tbody tr:nth-child(even) td {
  background-color: rgba(47, 111, 214, 0.035);
}

.ampacity-table tbody td.col-copper {
  background: rgba(184, 117, 67, 0.1);
}

.ampacity-table tbody td.col-aluminum {
  background: rgba(83, 109, 131, 0.11);
}

.ampacity-table tbody tr:nth-child(even) td.col-copper {
  background: rgba(184, 117, 67, 0.16);
}

.ampacity-table tbody tr:nth-child(even) td.col-aluminum {
  background: rgba(83, 109, 131, 0.16);
}

.ampacity-table tbody tr.is-selected td {
  background-color: rgba(184, 117, 67, 0.14);
  color: var(--ink);
  font-weight: 800;
}

.grounding-section {
  background:
    radial-gradient(circle at top right, rgba(184, 117, 67, 0.12), transparent 34%),
    rgba(255, 255, 255, 0.92);
}

.grounding-table {
  min-width: 680px;
}

.grounding-table th,
.grounding-table thead tr:first-child th,
.grounding-table thead tr:first-child th:nth-child(2),
.grounding-table thead tr:first-child th:nth-child(3) {
  background: var(--green);
}

.grounding-table th:first-child,
.grounding-table td:first-child {
  width: 32%;
}

.grounding-table tbody td.col-copper {
  background: rgba(184, 117, 67, 0.1);
}

.grounding-table tbody td.col-aluminum {
  background: rgba(83, 109, 131, 0.11);
}

.site-footer {
  padding: 1.4rem 0 2.2rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.92rem;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 520ms ease,
    transform 520ms ease;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1180px) {
  .header-inner,
  .tool-hero__inner,
  .app-grid {
    grid-template-columns: 1fr;
  }

  .site-nav {
    justify-self: start;
  }

  .results-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  .field-grid--three,
  .field-grid--two,
  .field-grid--four,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .table-heading,
  .section-title-row,
  .parallel-card {
    display: grid;
  }

  .segmented-control {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(calc(100% - 1.2rem), var(--max-width));
  }

  .brand {
    align-items: flex-start;
  }

  .brand-copy span:last-child {
    font-size: 0.82rem;
  }

  .site-nav {
    width: 100%;
  }

  .site-nav a {
    font-size: 0.86rem;
  }

  .recommendation-row {
    grid-template-columns: 1fr;
  }
}
