/* ============================================================
   WattCost.org - app.css
   Fonts: IBM Plex Sans + IBM Plex Mono (Google Fonts)
   Color: Teal (#085041 dark, #1d9e75 mid, #e1f5ee light)
   ADA: WCAG AA compliant - min font 14px, contrast >=4.5:1
   v2
   ============================================================ */

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

:root {
  --bg:             #f6f5f2;
  --surface:        #ffffff;
  --border:         #e2dfd8;
  --border-strong:  #c8c4bc;
  --text:           #1a1917;
  --text-muted:     #555250;   /* 6.5:1 on white - AA */
  --text-faint:     #766f6a;   /* 4.6:1 on white - AA */
  --teal-dark:      #085041;   /* 9.2:1 on white - AAA */
  --teal-mid:       #1d9e75;   /* 3.7:1 - decorative / large text only */
  --teal-light:     #e1f5ee;
  --mono:           'IBM Plex Mono', 'Courier New', monospace;
  --sans:           'IBM Plex Sans', system-ui, sans-serif;
  --radius:         6px;
  --radius-lg:      10px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* -- SKIP LINK (ADA) -- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--teal-dark);
  color: #fff;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  z-index: 9999;
  text-decoration: none;
  border-radius: var(--radius);
}
.skip-link:focus { top: 0.5rem; }

/* -- NAV -- */
nav {
  background: #10231d;
  border-bottom: 0.5px solid #2a3a3f;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
}
nav > * { flex-shrink: 0; }

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--teal-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-icon span {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--teal-dark);
  line-height: 1;
}
.nav-brand-name {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.2;
}
.nav-brand-name .dot-org { color: #5dcaa5; }
.nav-brand-sub {
  font-size: 13px;
  color: #8aa8af;
  line-height: 1.2;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}
.nav-links a {
  font-size: 15px;
  color: #8aa8af;
  text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a:focus { color: #ffffff; outline: 2px solid #5dcaa5; outline-offset: 3px; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
}

.card-body nav {
  background: transparent;
  border-bottom: 0;
  padding: 0;
  display: block;
  height: auto;
  position: static;
  overflow: visible;
}

/* -- HERO -- */
.hero {
  background: #10231d;
  border-bottom: 3px solid var(--teal-mid);
  padding: 0.9rem 1.5rem 1rem;
}
.hero-inner {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 0.1rem 1.2rem;
  flex-wrap: wrap;
}
.hero h1 {
  font-size: 1.3rem;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.25;
  white-space: nowrap;
  flex-shrink: 0;
}
.hero h1 .accent { color: #5dcaa5; }
.hero p {
  font-size: 14px;
  color: #8aa8af;
  line-height: 1.5;
  margin: 0;
}

/* -- AD SLOTS -- */
.ad-wrap {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  min-height: 106px;
}
.ad-placeholder {
  width: 728px;
  max-width: 100%;
  height: 90px;
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}
.ad-placeholder span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.adsbygoogle { display: block; }

/* -- MAIN LAYOUT -- */
.main-wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  align-items: start;
}

/* -- CARD BASE -- */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-head {
  padding: 0.75rem 1.1rem;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-head h2 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.card-body { padding: 1.1rem; }

/* -- FIELD LABEL -- */
.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

/* -- FORM ELEMENTS -- */
.input-field,
.select-field {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  appearance: none;
}
.input-field:focus,
.select-field:focus {
  outline: 2px solid var(--teal-dark);
  outline-offset: 1px;
  border-color: var(--teal-dark);
  background: var(--surface);
}
.input-with-unit { position: relative; }
.input-with-unit .input-field { padding-right: 3rem; }
.input-unit {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  pointer-events: none;
}

.select-wrap { position: relative; }
.select-wrap::after {
  content: '\25BE';
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-faint);
  font-size: 12px;
}

.mb-1 { margin-bottom: 0.75rem; }
.mb-15 { margin-bottom: 1.1rem; }

/* -- INPUT ROW -- */
.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* -- PRESETS -- */
.presets {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.preset-btn {
  font-family: var(--mono);
  font-size: 12px;
  padding: 0.3rem 0.7rem;
  background: transparent;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
}
.preset-btn:hover { border-color: var(--teal-dark); color: var(--teal-dark); }
.preset-btn.active {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #fff;
}
.preset-btn:focus {
  outline: 2px solid var(--teal-dark);
  outline-offset: 2px;
}

/* -- DIVIDER -- */
.divider {
  border: none;
  border-top: 0.5px solid var(--border);
  margin: 1rem 0;
}

/* -- RESULTS GRID -- */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.result-cell {
  background: var(--surface);
  padding: 0.85rem 0.6rem;
  text-align: center;
}
.result-cell.highlight { background: var(--teal-light); }
.result-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.3rem;
}
.result-value {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.result-cell.highlight .result-value {
  font-size: 1.5rem;
  color: var(--teal-dark);
}

/* -- USAGE TABLE -- */
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.usage-table th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
  padding: 0 0.5rem 0.5rem;
  border-bottom: 0.5px solid var(--border);
}
.usage-table th:not(:first-child) { text-align: right; }
.usage-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 13px;
}
.usage-table td:not(:first-child) { text-align: right; }
.usage-table tr.active-row td {
  color: var(--teal-dark);
  font-weight: 600;
  background: var(--teal-light);
}

/* -- SIDEBAR -- */
.sidebar { display: flex; flex-direction: column; gap: 1rem; }

/* -- RATE BADGE (in card-head) -- */
.rate-badge {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--teal-light);
  color: var(--teal-dark);
  padding: 0.2rem 0.6rem;
  border: 0.5px solid var(--teal-mid);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
.rate-badge:hover { background: #c8eddf; }
.rate-badge:focus { outline: 2px solid var(--teal-dark); outline-offset: 2px; }

/* -- RATE CARD -- */
.rate-display { margin-bottom: 0.75rem; }
.rate-big {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--teal-dark);
  line-height: 1;
}
.rate-big .rate-unit-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}
.rate-source {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}
.rate-auto-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  background: var(--teal-light);
  color: var(--teal-dark);
  border-radius: var(--radius);
  margin-top: 4px;
}
.rate-btn-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.65rem;
}
.btn-small {
  font-family: var(--sans);
  font-size: 13px;
  padding: 0.35rem 0.65rem;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
}
.btn-small:hover { border-color: var(--teal-dark); color: var(--teal-dark); }
.btn-small:focus { outline: 2px solid var(--teal-dark); outline-offset: 2px; }
.btn-small.primary {
  border-color: var(--teal-mid);
  color: var(--teal-dark);
}

/* -- RATE SELECTOR (expanded) -- */
.rate-selector { display: none; padding-top: 0.75rem; border-top: 0.5px solid var(--border); margin-top: 0.75rem; }
.rate-selector.open { display: block; }
.rate-note {
  font-size: 13px;
  color: var(--text-faint);
  line-height: 1.5;
  margin-top: 0.5rem;
}
.manual-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 0.5px solid var(--border);
}
.manual-row label { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.manual-input {
  width: 110px;
  padding: 0.4rem 2.2rem 0.4rem 0.6rem;
  border: 0.5px solid var(--border-strong);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  border-radius: var(--radius);
}
.manual-input:focus { outline: 2px solid var(--teal-dark); }

/* -- POPULAR GRID -- */
.popular-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.35rem;
}
.popular-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 0.45rem 0.6rem;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  display: block;
  transition: all 0.12s;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.popular-link:hover,
.popular-link:focus {
  border-color: var(--teal-dark);
  color: var(--teal-dark);
  background: var(--teal-light);
  outline: none;
}

/* -- AD SIDEBAR -- */
.ad-sidebar-placeholder {
  width: 100%;
  height: 250px;
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* -- REFERENCE TABLE -- */
.ref-section {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
}
.section-heading {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 0.5px solid var(--border);
}
.ref-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 14px;
}
.ref-table th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg);
}
.ref-table th:not(:first-child) { text-align: right; }
.ref-table td {
  padding: 0.65rem 1rem;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
}
.ref-table td:not(:first-child) {
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
}
.ref-table tbody tr { cursor: pointer; transition: background 0.1s; }
.ref-table tbody tr:hover td { background: var(--teal-light); color: var(--teal-dark); }
.ref-table td.app-name { color: var(--text); font-weight: 500; }

/* -- AD MID -- */
.ad-mid-wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 1.5rem 1.5rem;
  display: flex;
  justify-content: center;
}

/* -- APPLIANCE PAGE -- */
.appliance-hero {
  background: #0e231d;
  border-bottom: 3px solid var(--teal-mid);
  padding: 0.3rem 1.5rem 0.6rem;
}
.appliance-hero .breadcrumb {
  font-size: 13px;
  color: #6a8a90;
  margin-bottom: 0.5rem;
}
.appliance-hero .breadcrumb a {
  color: #8aa8af;
  text-decoration: none;
}
.appliance-hero .breadcrumb a:hover { color: #5dcaa5; }
.appliance-hero h1 { color: #ffffff; }
.appliance-intro {
  font-size: 15px;
  color: #8aa8af;
  line-height: 1.7;
  margin-top: 0.1rem;
}
.tips-card { background: var(--teal-light); border: 0.5px solid var(--teal-mid); border-radius: var(--radius-lg); padding: 1rem 1.1rem; margin-top: 1.1rem; }
.tips-card h3 { font-size: 13px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.07em; color: var(--teal-dark); margin-bottom: 0.5rem; }
.tips-card ul { padding-left: 1.2rem; }
.tips-card li { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 0.3rem; }

/* -- STATIC PAGES -- */
.static-wrap {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1.5rem 3rem;
}
.static-wrap h1 { font-size: 1.5rem; font-weight: 500; margin-bottom: 1.25rem; color: var(--text); }
.static-wrap h2 { font-size: 1.1rem; font-weight: 500; margin: 1.5rem 0 0.5rem; color: var(--text); }
.static-wrap p { font-size: 15px; color: var(--text-muted); line-height: 1.7; margin-bottom: 0.9rem; }
.static-wrap ul { padding-left: 1.4rem; margin-bottom: 0.9rem; }
.static-wrap li { font-size: 15px; color: var(--text-muted); line-height: 1.6; margin-bottom: 0.3rem; }
.static-wrap a { color: var(--teal-dark); }

/* -- FOOTER -- */
footer {
  background: var(--text);
  padding: 1.5rem;
  margin-top: 2rem;
}
.footer-inner {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-brand .name {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: #fff;
}
.footer-brand .name .dot-org { color: var(--teal-mid); }
.footer-brand .tagline { font-size: 13px; color: #9ca3af; margin-top: 3px; }
.footer-links { display: flex; gap: 1.5rem; list-style: none; flex-wrap: wrap; }
.footer-links a { font-family: var(--mono); font-size: 13px; color: #9ca3af; text-decoration: none; }
.footer-links a:hover { color: #fff; }
.footer-copy {
  max-width: 1060px;
  margin: 1.25rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid #374151;
  font-family: var(--mono);
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  line-height: 1.6;
}

/* -- RESPONSIVE -- */
@media (max-width: 768px) {
  .main-wrap { grid-template-columns: 1fr; padding: 1rem; }
  .input-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; gap: 0.75rem; z-index: 99; }
  .nav-toggle { display: block; }
  .ref-section { padding: 0 1rem 2rem; }
  .ad-mid-wrap { padding: 0 1rem 1.5rem; }
  .results-grid { grid-template-columns: repeat(3, 1fr); }
  .popular-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  footer { padding: 1.25rem 1rem; }
}

@media (max-width: 480px) {
  .results-grid { grid-template-columns: 1fr; }
  .result-cell.highlight { order: -1; }
  .presets { gap: 0.3rem; }
  .ref-table { font-size: 13px; }
  .ref-table th, .ref-table td { padding: 0.55rem 0.65rem; }
}

/* Focus visible for keyboard users */
:focus-visible { outline: 2px solid var(--teal-dark); outline-offset: 2px; }
