:root {
  --bg-0: #f4f7f5;
  --bg-1: #e8efeb;
  --ink: #16221d;
  --muted: #4a5b54;
  --panel: #fefefe;
  --line: #c8d5cd;
  --line-strong: #adc1b6;
  --accent: #0b6b57;
  --accent-strong: #095141;
  --accent-soft: #d9efe6;
  --focus: #f3a93a;
  --warn: #8f2e22;
  --ok: #0a7f53;
  --bad: #9a3b2a;
  --shadow-lg: 0 18px 42px rgba(12, 32, 25, 0.1);
  --shadow-sm: 0 8px 20px rgba(12, 32, 25, 0.07);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, #f8dcb3 0, transparent 34%),
    radial-gradient(circle at 88% 6%, #c0e5d8 0, transparent 32%),
    linear-gradient(156deg, var(--bg-0), var(--bg-1));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(11, 107, 87, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(11, 107, 87, 0.04) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 90%);
  z-index: -1;
}

a {
  color: var(--accent-strong);
}

.shell {
  width: min(1160px, 94vw);
  margin: 30px auto 44px;
  display: grid;
  gap: 18px;
}

.panel {
  background: rgba(254, 254, 254, 0.92);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(2px);
  animation: rise-in 560ms ease-out both;
}

.panel:nth-of-type(2) {
  animation-delay: 120ms;
}

.panel:nth-of-type(3) {
  animation-delay: 200ms;
}

.panel--hero {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  align-items: start;
}

.panel--hero::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -44px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(11, 107, 87, 0.15), rgba(11, 107, 87, 0));
  z-index: 0;
}

.panel--hero > * {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 700px;
}

.eyebrow {
  margin: 0;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-weight: 700;
  color: var(--accent-strong);
}

h1,
h2 {
  font-family: "Sora", sans-serif;
  letter-spacing: -0.02em;
}

h1 {
  margin: 8px 0 10px;
  font-size: clamp(2rem, 2.6vw + 1rem, 3rem);
  line-height: 1.08;
}

h2 {
  margin: 0;
  font-size: clamp(1.2rem, 1vw + 0.95rem, 1.55rem);
}

.subtext {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
}

.hero-chips {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-chips span {
  border: 1px solid #c6dbd1;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--accent-strong);
  background: #eef7f3;
}

.search-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #c3d4cb;
  background: linear-gradient(180deg, #f7fbf9, #f0f7f3);
}

.form-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #22332d;
}

input {
  width: 100%;
  min-height: 46px;
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus-visible,
button:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

input:focus-visible {
  border-color: #6fa28d;
  box-shadow: 0 0 0 3px rgba(11, 107, 87, 0.13);
}

button {
  width: 100%;
  min-height: 48px;
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #0f8b70, var(--accent));
  color: #fff;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: saturate(1.08);
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.form-actions {
  display: grid;
  gap: 8px;
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.panel--summary {
  display: grid;
  gap: 14px;
}

.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fdfefd;
}

.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.metric {
  margin: 8px 0 0;
  font-size: clamp(1.4rem, 1.2vw + 1rem, 1.9rem);
  font-weight: 800;
}

.submetric {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.sources {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.warnings {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--warn);
  display: grid;
  gap: 4px;
}

.panel--results {
  display: grid;
  gap: 12px;
}

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.results-note {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #51665d;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  background: #f4f8f6;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody td {
  text-align: left;
  border-bottom: 1px solid #e1e9e5;
  padding: 11px 8px;
  vertical-align: top;
}

.result-row:hover td {
  background: #f8fcfa;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #bfd1c8;
  padding: 3px 9px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #2f463d;
  background: #edf5f1;
}

.source-facebook {
  border-color: #b9c8ec;
  background: #eef2ff;
  color: #35408f;
}

.source-kijiji {
  border-color: #d3c5eb;
  background: #f4efff;
  color: #5f3b8a;
}

.source-karrot {
  border-color: #ecc9b2;
  background: #fff3ec;
  color: #8a4e2a;
}

.score {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 700;
  font-size: 0.8rem;
  background: #eef4f1;
  color: #2e443b;
}

.score--high {
  background: #dbf6ea;
  color: #11633d;
}

.score--mid {
  background: #fff2d9;
  color: #86520f;
}

.score--low {
  background: #fbe0da;
  color: #8c3225;
}

.savings {
  font-weight: 700;
}

.savings--good {
  color: var(--ok);
}

.savings--bad {
  color: var(--bad);
}

.reason-row td {
  padding-top: 8px;
  padding-bottom: 12px;
  background: #fbfdfc;
}

.reason-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fcfefd;
}

.reason-card summary {
  font-weight: 700;
  cursor: pointer;
  color: #32483f;
}

.reason-list {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.empty-row td {
  text-align: center;
  color: #485d54;
  padding: 16px;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .panel--hero {
    grid-template-columns: 1fr;
  }

  .search-form {
    max-width: 680px;
  }

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

@media (max-width: 860px) {
  .shell {
    width: min(96vw, 720px);
    margin-top: 18px;
  }

  .panel {
    padding: 16px;
    border-radius: 14px;
  }

  .hero-chips span {
    font-size: 0.78rem;
  }

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

  .results-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table,
  tbody {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  .result-row,
  .reason-row,
  .empty-row {
    display: block;
  }

  .result-row {
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    padding: 10px 12px;
    background: #fff;
    box-shadow: 0 6px 14px rgba(16, 31, 24, 0.07);
  }

  .result-row td {
    display: grid;
    grid-template-columns: minmax(68px, 84px) minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px solid #e4ebe7;
    padding: 8px 0;
  }

  .result-row td::before {
    content: attr(data-label);
    font-size: 0.71rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #587166;
  }

  .result-row td:last-child {
    border-bottom: 0;
  }

  .reason-row td {
    display: block;
    border: 0;
    padding: 0;
    background: transparent;
  }

  .reason-card {
    margin: -4px 4px 0;
  }

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

  .empty-row td {
    display: block;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: #fff;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
