/*
 * Styling for the embeddable widgets only. Deliberately separate from
 * styles.css: an embed must not carry the site header, hero or footer rules,
 * and it has to look deliberate on someone else's page — including a dark one.
 *
 * Same design tokens as the main site so a widget still reads as ours.
 */
:root {
  --navy-900: #0b1f3a;
  --teal-500: #0d9488;
  --teal-600: #0b7c72;
  --teal-050: #e7f5f3;
  --red-500: #b3492f;
  --red-050: #fbeeea;
  --ink-900: #0f172a;
  --ink-600: #475569;
  --ink-400: #94a3b8;
  --line: #e2e8f0;
  --card: #ffffff;
  --surface: #f7f9fc;
}

/* Hosts run dark themes too. A widget that ignores that looks like an ad. */
@media (prefers-color-scheme: dark) {
  :root {
    --ink-900: #e8edf5;
    --ink-600: #a8b4c6;
    --ink-400: #7b8799;
    --line: #23324a;
    --card: #101c30;
    --surface: #0b1526;
    --teal-050: #0f2c2a;
    --red-050: #2c1712;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: transparent;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink-900);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.w {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  max-width: 100%;
}

.w-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.w-title { font-size: 1.02rem; font-weight: 800; margin: 0; }
.w-year {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--teal-600);
  background: var(--teal-050);
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

.w-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.w-field { flex: 1 1 140px; min-width: 0; }
.w-field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-400);
  margin-bottom: 4px;
}
.w-field[hidden] { display: none; }

.w select,
.w input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  appearance: none;
}
.w select:focus,
.w input:focus {
  outline: 2px solid var(--teal-500);
  outline-offset: 1px;
}

.w-prefix { display: flex; align-items: stretch; }
.w-prefix span {
  display: flex;
  align-items: center;
  padding: 0 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: var(--ink-400);
  font-size: 0.9rem;
}
.w-prefix input { border-radius: 0 8px 8px 0; }

.w-note {
  font-size: 0.74rem;
  color: var(--ink-600);
  margin: 8px 0 0;
  min-height: 1em;
}
.w-note.notice--ok { color: var(--teal-600); }
.w-note.notice--warn { color: var(--red-500); }

.w-result {
  margin-top: 14px;
  padding: 14px;
  background: var(--teal-050);
  border-radius: 10px;
}
.w-result-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--teal-600);
}
.w-result-value {
  display: block;
  font-size: clamp(1.5rem, 7vw, 1.9rem);
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.15;
  margin-top: 2px;
  overflow-wrap: break-word;
}
.w-result-sub { display: block; font-size: 0.8rem; color: var(--ink-600); margin-top: 2px; }

.w-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.w-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}
.w-tile span:first-child {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-400);
}
.w-tile span:last-child {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink-900);
  overflow-wrap: break-word;
}
.w-tile--cost { background: var(--red-050); border-color: rgba(179, 73, 47, 0.2); }
.w-tile--cost span:last-child { color: var(--red-500); }

.w-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.82rem; }
.w-table td { padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--ink-600); }
.w-table td:last-child { text-align: right; font-weight: 700; color: var(--ink-900); }
.w-table tr:last-child td { border-bottom: none; }

/* Attribution shown to humans inside the frame. The link that carries SEO
 * value is the one in the host page's own HTML, outside the iframe. */
.w-by {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--ink-400);
}
.w-by a { color: var(--teal-600); text-decoration: none; font-weight: 700; }
.w-by a:hover { text-decoration: underline; }

@media (max-width: 380px) {
  .w { padding: 14px; }
  .w-row { gap: 8px; }
}
