/* Morning Briefing — shared site styles.
 * Financial-publication feel: restrained, sharp, paper-and-ink.
 * No startup-neon. Mobile-first, responsive. */

:root {
  --ink: #101418;
  --navy: #0e2a47;
  --gold: #b8892e;
  --paper: #ffffff;
  --soft: #f4f6f8;
  --muted: #5b6570;
  --hairline: #e2e7ec;

  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 6px;
  --max-landing: 1080px;
  --max-app: 760px;
}

/* Dark theme — same token names, ink-navy surfaces, soft-paper text.
 * Selected via the data-theme attribute on <html> (see assets/js/app.js).
 * Restrained financial-publication feel is preserved; no pure black. */
[data-theme="dark"] {
  --ink: #e8edf4;
  --navy: #9fc0e8;
  --gold: #c99a3f;
  --paper: #0d1b2e;
  --soft: #152a44;
  --muted: #93a1b3;
  --hairline: #2b425f;
}

/* The hero and footer are tuned for dark-navy surfaces in both themes. */
[data-theme="dark"] .hero {
  background: #0e2a47;
  color: #e8edf4;
}
[data-theme="dark"] .hero h1 {
  color: #e8edf4;
}
[data-theme="dark"] .btn:hover {
  background: #b9d2ef;
  border-color: #b9d2ef;
}
[data-theme="dark"] .footer {
  background: #081426;
}
[data-theme="dark"] .footer .wordmark {
  color: #e8edf4;
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-left: 1.25em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.theme-toggle svg {
  display: block;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3 {
  font-family: var(--serif);
  line-height: 1.25;
  margin: 0 0 0.5em;
  font-weight: 700;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--navy);
}

/* ---------- Layout ---------- */

.wrap {
  max-width: var(--max-landing);
  margin: 0 auto;
  padding: 0 20px;
}

.wrap-narrow {
  max-width: var(--max-app);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Top bar ---------- */

.topbar {
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--navy);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.wordmark .wordmark-gold {
  color: var(--gold);
  font-weight: 400;
  margin-right: 0.35em;
}

.wordmark .wordmark-logo {
  width: 1.35em;
  height: 1.35em;
  vertical-align: -0.28em;
  margin-right: 0.35em;
  border-radius: 4px;
}

.topbar-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-left: 1.25em;
}

.topbar-nav a:hover {
  color: var(--ink);
}

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.8em 1.6em;
  border-radius: var(--radius);
  border: 1px solid var(--navy);
  background: var(--navy);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: #143a63;
  border-color: #143a63;
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--paper);
  color: var(--navy);
  border-color: var(--hairline);
}

.btn-secondary:hover {
  background: var(--soft);
  border-color: var(--muted);
}

.btn-small {
  font-size: 0.875rem;
  padding: 0.55em 1.1em;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35em;
}

.input {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.7em 0.85em;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.input:focus {
  outline: 2px solid var(--navy);
  outline-offset: 0;
  border-color: var(--navy);
}

.input[disabled] {
  background: var(--soft);
  color: var(--muted);
  cursor: not-allowed;
}

.form-error {
  display: none;
  font-size: 0.9rem;
  color: #8a1f1f;
  background: #fdf0f0;
  border: 1px solid #e8c4c4;
  border-radius: var(--radius);
  padding: 0.7em 0.9em;
  margin-bottom: 1rem;
}

.form-error.show {
  display: block;
}

.form-success {
  display: none;
  font-size: 0.95rem;
  color: var(--navy);
  background: var(--soft);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.9em 1em;
}

.form-success.show {
  display: block;
}

/* ---------- Alert banner (e.g. ?error=bad_link) ---------- */

.alert {
  border-radius: var(--radius);
  padding: 0.9em 1.1em;
  margin: 1.5em 0 0;
  font-size: 0.95rem;
}

.alert-error {
  color: #8a1f1f;
  background: #fdf0f0;
  border: 1px solid #e8c4c4;
}

/* ---------- Hero (landing) ---------- */

.hero {
  background: var(--navy);
  color: var(--paper);
  padding: 4rem 0 4.5rem;
}

.hero .eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1em;
}

.hero h1 {
  color: var(--paper);
  font-size: 2.1rem;
  max-width: 16em;
  margin-bottom: 0.6em;
}

.hero .lede {
  color: #c9d4e0;
  font-size: 1.1rem;
  max-width: 34em;
  margin-bottom: 2em;
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
}

.signup-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 26rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.signup-card h2 {
  font-size: 1.3rem;
  margin-bottom: 0.35em;
}

.signup-card .fine {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.9em 0 0;
}

.signup-note {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: #aeb9c4;
}

/* ---------- Sections (landing) ---------- */

.section {
  padding: 4rem 0;
}

.section-soft {
  background: var(--soft);
}

.section h2 {
  font-size: 1.7rem;
  color: var(--navy);
}

.section .section-lede {
  color: var(--muted);
  max-width: 42em;
}

.kicker {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.6em;
  font-weight: 600;
}

.steps {
  display: grid;
  gap: 1.25rem;
  margin-top: 2rem;
}

.step {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--navy);
  color: var(--paper);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.75em;
}

.step h3 {
  font-size: 1.15rem;
  margin-bottom: 0.4em;
}

.step p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

/* "What you get" — brief format preview */

.brief-preview {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-top: 4px solid var(--navy);
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: 2rem;
  max-width: 40rem;
}

.brief-preview-head {
  padding: 1.5rem 1.75rem 0.5rem;
}

.brief-preview-head .date {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brief-section {
  padding: 1.1rem 1.75rem;
  border-top: 1px solid var(--hairline);
}

.brief-section h3 {
  font-family: var(--sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--navy);
  margin-bottom: 0.6em;
  font-weight: 700;
}

.brief-section p,
.brief-section li {
  font-size: 0.95rem;
  color: var(--ink);
}

.brief-section ul {
  margin: 0;
  padding-left: 1.2em;
}

.brief-section .brief-note {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Freemium band */

.band {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
  text-align: center;
  padding: 2.5rem 20px;
}

.band p {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--navy);
  margin: 0 0 0.4em;
}

.band .band-sub {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}

/* ---------- Footer ---------- */

.footer {
  background: var(--ink);
  color: #9aa5b1;
  padding: 3rem 0;
  font-size: 0.88rem;
}

.footer .disclaimer {
  border-left: 2px solid var(--gold);
  padding-left: 1em;
  max-width: 46em;
  margin-bottom: 1.5em;
  color: #b9c2cc;
}

.footer .wordmark {
  color: var(--paper);
  font-size: 1rem;
}

.footer small {
  display: block;
  margin-top: 0.5em;
  color: #6e7884;
}

/* ---------- Profile page ---------- */

.profile-head {
  padding: 2.5rem 0 1.5rem;
}

.profile-head h1 {
  font-size: 1.9rem;
  color: var(--navy);
  margin-bottom: 0.25em;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.plan-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--navy);
  background: var(--soft);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.3em 0.9em;
}

.card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.2rem;
  color: var(--navy);
  margin-bottom: 0.75em;
}

.name-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.name-row .current-name {
  font-size: 1.1rem;
  font-weight: 600;
}

.name-edit {
  display: none;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.name-edit.show {
  display: flex;
}

.name-edit .input {
  width: auto;
  min-width: 12rem;
}

/* Ticker picker */

.picker-wrap {
  position: relative;
  margin-bottom: 1.25rem;
}

.picker-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(14, 42, 71, 0.14);
  z-index: 20;
  max-height: 19rem;
  overflow-y: auto;
}

.picker-results.show {
  display: block;
}

.picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  padding: 0.7em 0.9em;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
}

.picker-item:last-child {
  border-bottom: 0;
}

.picker-item:hover,
.picker-item:focus-visible {
  background: var(--soft);
}

.picker-item .ticker {
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
}

.picker-item .co-name {
  color: var(--muted);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-empty {
  padding: 0.9em;
  color: var(--muted);
  font-size: 0.9rem;
}

.limit-note {
  display: none;
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 0.7em 0.9em;
  margin-bottom: 1.25rem;
}

.limit-note.show {
  display: block;
}

/* Ticker chips */

.ticker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticker-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  background: var(--soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 0.5em 0.5em 0.5em 0.85em;
  font-size: 0.92rem;
}

.ticker-chip .ticker {
  font-weight: 700;
  color: var(--navy);
}

.ticker-chip .co-name {
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-remove {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25em 0.45em;
  border-radius: 4px;
}

.chip-remove:hover {
  color: #8a1f1f;
  background: #f3e4e4;
}

.empty-state {
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--navy);
  margin-bottom: 0.4em;
}

.loading {
  color: var(--muted);
  font-style: italic;
}

/* ---------- Toasts ---------- */

#toast-host {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(92vw, 26rem);
}

.toast {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 0.8em 1.1em;
  font-size: 0.92rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.toast-show {
  opacity: 1;
  transform: translateY(0);
}

.toast-error {
  background: #6e1b1b;
}

.toast-success {
  background: var(--navy);
}

/* ---------- Responsive ---------- */

@media (min-width: 760px) {
  .hero {
    padding: 5.5rem 0 6rem;
  }

  .hero h1 {
    font-size: 2.9rem;
  }

  .hero-grid {
    grid-template-columns: 1.2fr 1fr;
    align-items: start;
  }

  .steps {
    grid-template-columns: repeat(3, 1fr);
  }

  .profile-head h1 {
    font-size: 2.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Sample brief mock — a visual preview of the email readers receive. */
.sample-label {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.email-mock {
  max-width: 620px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(8, 20, 38, 0.12);
  text-align: left;
  color: #101418;
}
.email-mock-top {
  background: #0e2a47;
  color: #ffffff;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.email-mock-brand {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.email-mock-brand .wordmark-gold {
  color: var(--gold);
  margin-right: 0.4em;
}
.email-mock-date {
  font-size: 0.8rem;
  color: #c9d4e0;
}
.email-mock-greet {
  font-family: var(--serif);
  font-size: 1.15rem;
  padding: 1.25rem 1.5rem 0;
  margin: 0;
}
.email-mock-section {
  padding: 1rem 1.5rem;
  border-top: 1px solid #eef1f4;
}
.email-mock-section:first-of-type {
  border-top: none;
}
.email-mock-section h4 {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b8892e;
  margin: 0 0 0.7em;
}
.email-mock-headline {
  font-weight: 700;
  margin: 0 0 0.2em;
  font-size: 0.95rem;
}
.email-mock-summary {
  color: #5b6570;
  font-size: 0.88rem;
  margin: 0 0 1em;
}
.email-mock-summary:last-child {
  margin-bottom: 0;
}
.email-mock-data {
  display: flex;
  justify-content: space-between;
  margin: 0 0 0.35em;
  font-size: 0.92rem;
}
.email-mock-data .up { color: #1a7a3a; font-weight: 600; }
.email-mock-data .down { color: #b3261e; font-weight: 600; }
.email-mock-ticker {
  font-size: 0.92rem;
  margin: 0 0 0.6em;
}
.email-mock-ticker:last-child {
  margin-bottom: 0;
}
.email-mock-cal {
  font-size: 0.92rem;
  margin: 0 0 0.35em;
}
.email-mock-cal:last-child {
  margin-bottom: 0;
}
.sample-link {
  color: var(--gold);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mock-icon {
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.12em;
  margin-right: 0.45em;
}
.spark {
  width: 60px;
  height: 20px;
  vertical-align: middle;
  margin-right: 0.5em;
}
.mock-fig {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
