/* --- Font ------------------------------------------------------------- */
/* Only Ambra-Sans-Text-Medium.otf is available locally. We register it
   across the whole weight range so every Ambra usage still renders in the
   correct family; the browser synthesizes bold from the Medium master.   */
@font-face {
  font-family: "Ambra Sans Text";
  src: url("./Ambra-Sans-Text-Medium.otf") format("opentype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --- Design tokens (mapped 1:1 from Figma) --------------------------- */
:root {
  --thought-blue: #17599c;
  --freedom-blue: #2f7dc1;
  --brand-orange: #db5c05;
  --accessible-orange: #ed6b1f;
  --association-white: #ffffff;
  --greyscale-500: #666666;
  --greyscale-900: #e4e4e4;
  --greyscale-950: #f5f5f5;
  --frame-border: #cecece;
  --plan-banner-blue: #1a5a7a;

  --font-size-h6: 12px;
  --font-line-h6: 16px;
  --font-size-body-med: 14px;
  --font-line-body-med: 20px;
}

/* --- Reset ----------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  background: #eaeaea;
  font-family: "Ambra Sans Text", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  color: #111;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

/* --- Mobile frame (matches Figma iPhone 14/15 Pro Max) --------------- */
.mobile-frame {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--greyscale-950);
  border: 1px solid var(--frame-border);
  padding: 40px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Section header (title + hamburger) ------------------------------ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  margin: 0;
  font-weight: 700;
  font-size: 24px;
  line-height: 24px;
  color: var(--thought-blue);
}

/* --- Scenario menu (hamburger + dropdown) ---------------------------- */
.menu-wrap {
  position: relative;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: var(--thought-blue);
  transition: background-color 0.15s ease;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  background: rgba(23, 89, 156, 0.08);
  outline: none;
}

.menu-toggle[aria-expanded="true"] {
  background: rgba(23, 89, 156, 0.12);
}

.menu-toggle__icon {
  width: 22px;
  height: 22px;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  min-width: 220px;
  background: var(--association-white);
  border: 1px solid var(--greyscale-900);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu[hidden] {
  display: none;
}

.menu__heading {
  margin: 0;
  padding: 8px 14px 4px;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--greyscale-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.menu__item {
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.3;
  color: #111;
  transition: background-color 0.15s ease;
}

.menu__item:hover,
.menu__item:focus-visible {
  background: var(--greyscale-950);
  outline: none;
}

.menu__item[aria-current="true"] {
  background: var(--greyscale-950);
  color: var(--thought-blue);
  font-weight: 500;
}

/* --- Plan title banner (top of each card, edge-to-edge) -------------- */
.card__plan {
  /* Escape the card's 16px padding on top/left/right so the banner
     reaches the card's outer edge and its rounded corners align. */
  margin: -16px -16px 0;
  padding: 15px 24px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  background: var(--plan-banner-blue);
  color: var(--association-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card__plan-name {
  min-width: 0;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__plan-badge {
  /* Hidden by default; only the .card--active card shows it. */
  display: none;
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--association-white);
  color: var(--thought-blue);
  font-size: 11px;
  line-height: 1.4;
  font-weight: 500;
  white-space: nowrap;
}

.card--active .card__plan-badge {
  display: inline-flex;
  align-items: center;
}

/* --- Horizontal card scroller ---------------------------------------- */
.cards-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  /* Escape the parent's 16px horizontal padding so cards can scroll
     edge-to-edge, then re-add the same padding so first/last cards align
     with the rest of the content. */
  margin: 0 -16px;
  padding: 0 16px;
  scroll-padding-left: 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cards-scroll::-webkit-scrollbar {
  display: none;
}
.cards-scroll:focus {
  outline: none;
}

/* --- Card ------------------------------------------------------------ */
.card {
  flex: 0 0 361px;
  scroll-snap-align: start;
  background: var(--association-white);
  border: 1px solid var(--greyscale-900);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  /* Clip the plan banner's top corners to the card's rounded border. */
  overflow: hidden;
}

/* --- Card: usage header (used / total + %) --------------------------- */
.card__usage {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card__usage-row {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--thought-blue);
}

.card__usage-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 0; /* the two inline spans set their own size */
}

.card__usage-primary {
  font-size: 16px;
  line-height: 28px;
  font-weight: 500;
  color: var(--thought-blue);
}

.card__usage-secondary {
  font-size: 12px;
  line-height: 20px;
  font-weight: 500;
  color: var(--thought-blue);
}

.card__usage-percent {
  margin: 0;
  font-size: 16px;
  line-height: 28px;
  font-weight: 500;
  color: var(--thought-blue);
  white-space: nowrap;
}

/* --- Progress bar ---------------------------------------------------- */
.progress {
  width: 100%;
  min-height: 22px;
  background: var(--greyscale-950);
  border-radius: 20px;
  padding: 2px;
  display: flex;
  align-items: stretch;
}

.progress__fill {
  height: 18px;
  border-radius: 20px;
  background-image: linear-gradient(
    to right,
    var(--accessible-orange) 0%,
    var(--freedom-blue) 100%
  );
  border: 1px solid var(--greyscale-900);
}

.progress__fill[style*="width: 0%"] {
  border: 0;
  background: transparent;
}

/* --- Metrics (Talk / Text / Data) ------------------------------------ */
.metrics {
  display: flex;
  gap: 4px;
  width: 100%;
}

.metric {
  flex: 1 1 0;
  min-width: 0;
  height: 57px;
  background: var(--greyscale-950);
  border-radius: 10px;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric__value {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  color: var(--thought-blue);
  white-space: nowrap;
}

.metric__label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-h6);
  line-height: var(--font-line-h6);
  font-weight: 400;
  color: var(--greyscale-500);
}

.metric__icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  fill: currentColor;
}

/* --- Card footer ----------------------------------------------------- */
.card__footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card__reset {
  margin: 0;
  padding: 8px 4px 10px;
  font-size: var(--font-size-h6);
  line-height: var(--font-line-h6);
  font-weight: 400;
  color: var(--greyscale-500);
  white-space: nowrap;
}

.card__reset-date {
  display: inline-block;
  margin-top: 2px;
  font-weight: 500;
  color: var(--greyscale-500);
}

/* --- Shared CTA panel (below dots) ----------------------------------- */
.cta-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
  background: var(--association-white);
  border: 1px solid var(--greyscale-900);
  border-radius: 20px;
}

.cta-panel__text {
  margin: 0;
  font-size: var(--font-size-body-med);
  line-height: var(--font-line-body-med);
  font-weight: 500;
  color: var(--brand-orange);
  white-space: nowrap;
}

/* --- Primary button (matches Code Connect: Icons+Text / Filled / XS) - */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accessible-orange);
  color: var(--association-white);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--brand-orange);
}

.btn-primary__icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* --- Dot indicators -------------------------------------------------- */
.dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--frame-border);
  transition: background-color 0.2s ease;
}

.dot--active {
  background: var(--thought-blue);
}
