/* Embed (design: Embed): the builder page, and the widgets (body.embed-w, own document) */

/* ---- builder */
.embed-hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 840px;
}

.embed-hero h1 {
  font-size: clamp(32px, 6vw, 44px);
  line-height: 1.08;
}

.embed-hero p {
  font-size: 18px;
  color: var(--ink-2);
}

.embed-options {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
}

.embed-options__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.embed-options__group .toggle-group {
  gap: 6px;
}

.embed-options__label,
.embed-options__select {
  font-size: 14px;
  font-weight: 600;
  margin-right: 4px;
}

.embed-options__select {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.embed-options__select select {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 14px;
  font-weight: 400;
}

.embed-work {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
}

.embed-work__col {
  flex: 1 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.embed-work__col h2 {
  font-size: 16px;
}

.embed-stage {
  background: var(--stage);
  border-radius: var(--radius-card);
  padding: 28px;
  display: flex;
  justify-content: center;
}

.embed-stage iframe {
  display: block;
  border-radius: var(--radius-card);
}

.embed-code-block {
  margin: 0;
  background: var(--surface-dark);
  color: #e6e9ec;
  border-radius: var(--radius-card);
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.embed-copy {
  align-self: flex-start;
}

.embed-notes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink-2);
}

@media (max-width: 640px) {
  .embed-stage {
    padding: 16px;
  }
}

/* ---- widget document */
body.embed-w {
  --w-bg: var(--surface);
  --w-fg: var(--ink);
  --w-line: var(--line);
  --w-panel: var(--ground);
  --w-muted: var(--muted);
  --w-link: var(--accent);
  margin: 0;
  background: transparent;
  color: var(--w-fg);
  min-width: 0;
}

body.embed-w--dark {
  --w-bg: var(--surface-dark);
  --w-fg: var(--on-dark);
  --w-line: var(--line-dark);
  --w-panel: var(--surface-dark-2);
  --w-muted: #aeb4bb;
  --w-link: var(--on-dark-link);
  color-scheme: dark;
}

.embed-w__box {
  box-sizing: border-box;
  min-height: 100vh;
  background: var(--w-bg);
  border: 1px solid var(--w-line);
  border-radius: var(--radius-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.embed-w__stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.embed-w__eyebrow {
  font-size: 12px;
  color: var(--w-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.embed-w__name {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.embed-w__title {
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

.embed-w__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 10px;
}

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

.embed-w__stat {
  display: flex;
  flex-direction: column;
  background: var(--w-panel);
  border-radius: var(--radius-control);
  padding: 8px 10px;
  min-width: 0;
}

.embed-w__stat dt {
  font-size: 11px;
  color: var(--w-muted);
}

.embed-w__stat dd {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
}

.embed-w__na {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--w-muted);
}

.embed-w__note {
  font-size: 12px;
  color: var(--w-muted);
}

.embed-w__badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.embed-w__badge--town {
  background: var(--tone-town-bg);
  color: var(--tone-town-ink);
}

.embed-w__badge--modelled {
  background: var(--tone-modelled-bg);
  color: var(--tone-modelled-ink);
}

.embed-w__badge--regional {
  background: var(--tone-regional-bg);
  color: var(--tone-regional-ink);
}

/* climate: 12 single bars of the daily high */
.embed-w__bars {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 120px;
  border-bottom: 1px solid var(--w-line);
}

.embed-w__bar {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.embed-w__bar-value {
  font-family: var(--font-mono);
  font-size: 10px;
}

.embed-w__bar-fill {
  width: 100%;
  background: var(--chart-high);
  border-radius: 2px 2px 0 0;
}

.embed-w__months {
  display: flex;
  gap: 4px;
}

.embed-w__months span {
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: var(--w-muted);
}

/* ranking */
.embed-w__rank {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.embed-w__rank li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--w-panel);
  border-radius: var(--radius-small);
  padding: 6px 10px;
  font-size: 14px;
}

.embed-w__rank-n {
  font-family: var(--font-mono);
  color: var(--w-muted);
}

.embed-w__rank-v {
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}

.embed-w__credit {
  font-size: 11px;
  color: var(--w-muted);
  border-top: 1px solid var(--w-line);
  padding-top: 8px;
}

.embed-w__credit a {
  color: inherit;
}

.embed-options [hidden],
.embed-copy[hidden] {
  display: none;
}

/* ---- ranking badges with their code (/portugal/tavira/badges/) */
.badge-offer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.badge-offer img {
  max-width: 100%;
  height: auto;
}

.badge-offer .embed-code-block {
  width: 100%;
}

.badge-offer__item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
}

.badge-offer__item h3 {
  font-size: 15px;
}
