:root {
  --porcelain: #f7faf9;
  --paper: #ffffff;
  --ink: #13201d;
  --spruce: #12362f;
  --spruce-dark: #0b2a25;
  --verdigris: #2c7a6a;
  --mint: #e5efea;
  --gold: #b08d4f;
  --oxblood: #7b302f;
  --slate: #4d5d59;
  --line: #cedbd7;
  --soft-line: #e3ebe8;
  --shadow: 0 10px 28px rgba(19, 32, 29, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--porcelain);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--porcelain);
}

button,
input,
select { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

.masthead {
  color: #fff;
  background: var(--spruce-dark);
  border-bottom: 4px solid var(--gold);
}

.masthead-inner,
.control-inner,
.source-inner,
.results-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
}

.masthead-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
  align-items: end;
  padding: 38px 0 34px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.brand-lockup svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.25;
}

.brand-lockup circle {
  fill: var(--gold);
  stroke: var(--gold);
}

.eyebrow,
.company-platform,
.source-kicker {
  margin: 0 0 8px;
  color: #b8d8cf;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 880px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.15rem, 4.2vw, 4.25rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
}

.dek {
  max-width: 800px;
  margin: 16px 0 0;
  color: #d9e7e3;
  font-size: 1rem;
  line-height: 1.55;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 105px);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.summary div {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
}

.summary div:last-child { border-right: 0; }

.summary strong {
  font-family: Georgia, "Times New Roman", serif;
  color: #fff;
  font-size: 2rem;
  font-weight: 500;
}

.summary span {
  color: #bdd4ce;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.control-band {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 249, 248, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.control-inner {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(190px, 260px);
  gap: 18px;
  align-items: end;
  padding: 16px 0;
}

.search-field,
.select-field,
.segmented {
  min-width: 0;
}

.search-field span,
.select-field span,
.segmented legend {
  display: block;
  margin: 0 0 6px;
  padding: 0;
  color: var(--slate);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.search-field input,
.select-field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
}

.search-field input:focus,
.select-field select:focus {
  border-color: var(--spruce);
  box-shadow: 0 0 0 3px rgba(22, 68, 60, 0.12);
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, auto);
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented legend { grid-column: 1 / -1; }

.segmented button {
  height: 42px;
  padding: 0 12px;
  color: var(--slate);
  background: var(--paper);
  border: 1px solid var(--line);
  border-right-width: 0;
  cursor: pointer;
}

.segmented button:first-of-type { border-radius: 4px 0 0 4px; }
.segmented button:last-of-type {
  border-right-width: 1px;
  border-radius: 0 4px 4px 0;
}

.segmented button.is-active {
  color: #fff;
  background: var(--spruce);
  border-color: var(--spruce);
}

.source-band {
  background: #edf3f1;
  border-bottom: 1px solid var(--line);
}

.source-inner {
  display: grid;
  grid-template-columns: 1.25fr 1fr auto;
  gap: 34px;
  align-items: center;
  padding: 20px 0;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.source-inner p {
  margin: 0;
  color: var(--slate);
  font-size: 0.84rem;
  line-height: 1.45;
}

.source-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--spruce);
}

.data-link,
.quiet-button,
.card-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.data-link {
  color: #fff;
  background: var(--oxblood);
}

.data-link.secondary {
  color: var(--spruce);
  background: #fff;
  border: 1px solid var(--line);
}

.results-shell { padding: 28px 0 70px; }

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  margin-bottom: 24px;
}

.results-head p {
  margin: 0;
  color: var(--slate);
  font-size: 0.88rem;
}

.quiet-button {
  color: var(--spruce);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
}

.company-section { margin: 0 0 48px; }

.company-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--spruce);
}

.company-platform {
  margin-bottom: 3px;
  color: var(--oxblood);
}

.company-head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  font-weight: 500;
  letter-spacing: 0;
}

.company-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--slate);
  font-size: 0.78rem;
}

.company-meta a {
  color: var(--spruce);
  font-weight: 800;
}

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

.ad-card {
  min-width: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.card-media {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #e6ecea;
  border-bottom: 1px solid var(--soft-line);
}

.media-pair {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.media-pair figure {
  min-width: 0;
  margin: 0;
  background: #edf3f1;
}

.media-pair figcaption {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--spruce);
  background: #edf3f1;
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.media-pair img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  background: #e6ecea;
}

.preview-button {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: zoom-in;
}

.rank-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  min-width: 38px;
  padding: 6px 8px;
  color: #fff;
  background: rgba(12, 48, 42, 0.92);
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.copy-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--soft-line);
}

.copy-panel {
  min-width: 0;
}

.copy-panel > span {
  display: block;
  margin-bottom: 7px;
  color: var(--oxblood);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.copy-panel strong {
  display: block;
  color: var(--spruce-dark);
  font-size: 0.86rem;
  line-height: 1.35;
}

.copy-panel p {
  margin: 7px 0 0;
  color: var(--slate);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-line;
}

.card-body { padding: 16px; }

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 11px;
}

.product-chip,
.format-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.product-chip {
  color: var(--spruce-dark);
  background: var(--mint);
}

.format-chip {
  color: #6a4b16;
  background: #f3e8cf;
}

.card-body h3 {
  margin: 0;
  min-height: 2.5em;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.description {
  min-height: 2.9em;
  margin: 8px 0 14px;
  color: var(--slate);
  font-size: 0.79rem;
  line-height: 1.45;
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  margin: 0 0 14px;
  padding: 11px 0;
  border-top: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
  font-size: 0.72rem;
}

.facts dt { color: var(--slate); }
.facts dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.card-actions a {
  min-width: 0;
  padding: 0 8px;
  color: var(--spruce);
  background: #fff;
  border: 1px solid var(--line);
}

.card-actions a.primary {
  color: #fff;
  background: var(--spruce);
  border-color: var(--spruce);
}

.card-actions a[aria-disabled="true"] {
  color: #84908d;
  pointer-events: none;
}

.empty-state {
  padding: 72px 20px;
  text-align: center;
  border-top: 2px solid var(--line);
}

.empty-state strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
  font-weight: 500;
}

.empty-state p { color: var(--slate); }

.lightbox {
  width: min(1100px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 6px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

.lightbox::backdrop { background: rgba(6, 22, 19, 0.78); }

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #fff;
  background: rgba(12, 48, 42, 0.9);
  border: 0;
  border-radius: 50%;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-media {
  display: grid;
  place-items: center;
  min-height: 55vh;
  max-height: 75vh;
  padding: 24px;
  background: #e6ecea;
}

.lightbox-media img,
.lightbox-media video {
  max-width: 100%;
  max-height: calc(75vh - 48px);
  object-fit: contain;
}

.lightbox-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 20px;
  color: var(--slate);
  font-size: 0.82rem;
}

.lightbox-caption strong { color: var(--ink); }

@media (max-width: 1180px) {
  .control-inner { grid-template-columns: 1fr 1fr; }
  .ad-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .masthead-inner { grid-template-columns: 1fr; }
  .summary { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .control-band { position: static; }
  .source-inner { grid-template-columns: 1fr; gap: 14px; }
  .source-actions { justify-content: flex-start; }
  .ad-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .masthead-inner,
  .control-inner,
  .source-inner,
  .results-shell { width: min(100% - 24px, 1480px); }
  .masthead-inner { padding: 28px 0 26px; gap: 26px; }
  h1 { font-size: 2.35rem; }
  .summary div { min-height: 76px; padding: 10px; }
  .summary strong { font-size: 1.55rem; }
  .control-inner { grid-template-columns: 1fr; }
  .segmented { grid-auto-columns: minmax(0, 1fr); width: 100%; }
  .segmented button { padding: 0 7px; font-size: 0.74rem; }
  .company-head { align-items: start; flex-direction: column; }
  .ad-grid { grid-template-columns: 1fr; }
  .copy-comparison { grid-template-columns: 1fr; }
  .card-body h3,
  .description { min-height: 0; }
  .lightbox-media { min-height: 45vh; padding: 12px; }
  .lightbox-caption { align-items: flex-start; flex-direction: column; }
}

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