/* PerkCalc shared styles: color tokens, base type, the top nav and common building blocks.
   Each page adds its own layout on top. Verizon palette: red, black, white, neutral greys;
   green is reserved for money saved. */
:root {
  --bg: #F5F5F5;
  --surface: #FFFFFF;
  --ink: #000000;
  --muted: #5C5C5C;
  --faint: #666666;
  --line: #E2E2E2;
  --hover: #F8F8F8;
  --accent: #D80000;
  --accent-soft: #FDE7E7;
  --neutral-soft: #EFEFEF;
  --mark-ring: transparent;
  --save: #07804D;
  --save-soft: #E1F4EA;
  --warn: #A3470A;
  --warn-soft: #FCEDE0;
  --bar: #000000;
  --bar-fg: #FFFFFF;
  --bar-muted: #A3A3A3;
  --bar-line: rgba(255, 255, 255, .13);
  --bar-track: rgba(255, 255, 255, .1);
  --bar-save: #4BE09D;
  --bar-save-soft: rgba(75, 224, 157, .16);
  --bar-warn: #F7B27A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 14px rgba(0, 0, 0, .05);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* Dark tokens: used when the device is in dark mode (unless the switch picked light), or when the
   switch picked dark. theme.js sets data-theme on <html>. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0A0A; --surface: #161616; --ink: #F2F2F2; --muted: #A3A3A3; --faint: #8F8F8F; --line: #2A2A2A;
    --hover: #1C1C1C; --neutral-soft: #242424; --mark-ring: rgba(255, 255, 255, .16);
    --accent: #FF4040; --accent-soft: #3A1515; --save: #46D394; --save-soft: #10301F;
    --warn: #F2A26C; --warn-soft: #382213;
    /* The savings bar stays dark in dark mode (raised, not inverted), so the number is the brightest thing on screen. */
    --bar: #1E1E1E; --bar-fg: #F2F2F2; --bar-muted: #A3A3A3; --bar-line: rgba(255, 255, 255, .12);
    --bar-track: rgba(255, 255, 255, .1); --bar-save: #4BE09D; --bar-save-soft: rgba(75, 224, 157, .14); --bar-warn: #F7B27A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0A0A; --surface: #161616; --ink: #F2F2F2; --muted: #A3A3A3; --faint: #8F8F8F; --line: #2A2A2A;
  --hover: #1C1C1C; --neutral-soft: #242424; --mark-ring: rgba(255, 255, 255, .16);
  --accent: #FF4040; --accent-soft: #3A1515; --save: #46D394; --save-soft: #10301F;
  --warn: #F2A26C; --warn-soft: #382213;
  /* The savings bar stays dark in dark mode (raised, not inverted), so the number is the brightest thing on screen. */
  --bar: #1E1E1E; --bar-fg: #F2F2F2; --bar-muted: #A3A3A3; --bar-line: rgba(255, 255, 255, .12);
  --bar-track: rgba(255, 255, 255, .1); --bar-save: #4BE09D; --bar-save-soft: rgba(75, 224, 157, .14); --bar-warn: #F7B27A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.num { font-variant-numeric: tabular-nums; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); text-underline-offset: 2px; }

/* Page wrapper for the content pages (the perk calculator has its own two-column layout). */
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 24px 64px;
  display: flex; flex-direction: column; gap: 28px;
}

/* Top nav: brand on the left, tool links on the right (below on phones). */
.topnav { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; color: inherit; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; display: block; }
.wordmark { font-weight: 800; font-size: 19px; letter-spacing: -0.03em; }
.wordmark span { color: var(--accent); }
.navlinks {
  display: flex; gap: 3px; padding: 3px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; max-width: 100%;
}
.navlinks::-webkit-scrollbar { display: none; }
.navlinks a {
  flex: none; font-size: 13.5px; font-weight: 700; color: var(--muted); text-decoration: none;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 14px; border-radius: 999px; white-space: nowrap;
}
.navlinks a:hover { color: var(--ink); }
.navlinks a[aria-current="page"] { background: var(--ink); color: var(--surface); }
/* Phones: full-width segmented control with four equal tabs, not four words pushed apart. */
@media (max-width: 520px) {
  .navlinks { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
  .navlinks a { padding: 0 4px; font-size: 13px; }
}

/* Moving between pages crossfades instead of flashing (browsers with cross-document view
   transitions; others just load normally). The logo and tab bar hold still. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
.topnav .brand { view-transition-name: brand; }
.tabbar { view-transition-name: tabbar; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* Phones: a bottom tab bar replaces the top links, so switching tools is a thumb tap. */
.tabbar { display: none; }
@media (max-width: 699px) {
  .navlinks { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 4px max(8px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: color-mix(in srgb, var(--surface) 92%, transparent); border-top: 1px solid var(--line);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
}
.tabbar a {
  min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11.5px; font-weight: 700; color: var(--faint); text-decoration: none;
}
.tabbar .ic { width: 56px; height: 30px; border-radius: 999px; display: grid; place-items: center; transition: background .16s ease, transform .09s ease-out; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] .ic { background: var(--neutral-soft); }
.tabbar a:active .ic { transform: scale(.94); }

/* Light/dark switch: a round button at the right of the top bar. */
.navlinks { margin-left: auto; }
.theme-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); transition: transform .09s ease-out;
}
.theme-btn:active { transform: scale(.94); }
.theme-btn .sun, .theme-btn[data-mode="dark"] .moon { display: none; }
.theme-btn[data-mode="dark"] .sun { display: block; }
@media (max-width: 699px) { .theme-btn { margin-left: auto; } }
/* Images with a light and a dark version follow the theme too. The :root prefix keeps these
   ahead of a page's own display rule for the image (e.g. .yt-logo { display: block }). */
:root .only-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-light { display: none; }
  :root:not([data-theme="light"]) .only-dark { display: block; }
}
:root[data-theme="dark"] .only-light { display: none; }
:root[data-theme="dark"] .only-dark { display: block; }

/* Page header */
header { display: flex; flex-direction: column; gap: 12px; }
.eyebrow { font-size: 12.5px; color: var(--faint); font-weight: 600; }
.asof { font-size: 12.5px; color: var(--faint); font-weight: 500; }
h1 {
  font-weight: 800;
  font-size: clamp(30px, 8vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin: 2px 0 0;
  text-wrap: balance;
}
/* Green is kept for money; headline emphasis is weight and color contrast only. */
h1 em { font-style: normal; color: var(--muted); }
h2 { text-wrap: balance; }
.lede { margin: 0; color: var(--muted); max-width: 58ch; font-size: 16px; }
.lede b { color: var(--ink); font-weight: 700; }

.label { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  overflow: hidden;
}
.tag {
  display: inline-block; font-size: 12.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--save-soft); color: var(--save); letter-spacing: -0.01em;
}
.tag.neutral { background: var(--neutral-soft); color: var(--ink); }
.tag.red { background: var(--accent-soft); color: var(--accent); }

/* Toggle switch row (shared by the calculator and home internet pages). */
.switch-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: none; border: 0; text-align: left; cursor: pointer; padding: 0;
}
.switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-text b { font-weight: 700; font-size: 15px; }
.switch-text span { font-size: 13px; color: var(--muted); }
.switch {
  flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative;
  transition: background .2s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s ease;
}
.switch-row[aria-checked="true"] .switch { background: var(--save); }
.switch-row[aria-checked="true"] .switch::after { transform: translateX(18px); }

.site-foot { display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--muted); }
.site-foot p { margin: 0; max-width: 72ch; }

@media (min-width: 960px) {
  .page { padding-block: 36px 72px; gap: 32px; }
  h1 { font-size: 48px; }
  .lede { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
