/* ==========================================================================
   DealsDrift — Design tokens
   Concept: deals arrive like a tide — currents of savings drifting in daily.
   Palette avoids the generic cream/terracotta + dark/neon defaults.
   ========================================================================== */

:root {
  /* Color */
  --ink: #14232B;           /* near-navy text */
  --ink-soft: #4C6169;      /* muted teal-gray secondary text */
  --paper: #F2F6F4;         /* pale seafoam-white background */
  --paper-raised: #FFFFFF;  /* card surfaces */
  --tide: #1F6F6B;          /* deep teal — primary brand */
  --tide-deep: #123F3D;     /* darker teal for hover/emphasis */
  --gold: #D9A441;          /* sandy gold — accent / CTA */
  --gold-deep: #B8842E;     /* gold hover */
  --line: rgba(20, 35, 43, 0.12);

  /* Type */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Scale */
  --radius: 10px;
  --max-width: 1180px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 0.5em 0;
}

a {
  color: var(--tide);
  text-decoration: none;
}

img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tide);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(242, 246, 244, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.logo .drift {
  color: var(--tide);
  font-style: italic;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 4px;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--gold);
  transition: width 0.25s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--ink);
}

@media (max-width: 780px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .nav-links.open { max-height: 320px; }
  .nav-links li { border-top: 1px solid var(--line); }
  .nav-links a { display: block; padding: 14px 24px; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 96px 0 64px;
  overflow: hidden;
}

.hero .container {
  position: relative;
  z-index: 2;
  max-width: 760px;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  letter-spacing: -0.01em;
}

.hero h1 em {
  font-style: italic;
  color: var(--tide);
}

.hero p.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 540px;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.wave-bg {
  position: absolute;
  bottom: -20px;
  left: 0;
  width: 100%;
  height: 180px;
  z-index: 1;
  opacity: 0.5;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

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

.btn-primary {
  background: var(--tide);
  color: #fff;
}
.btn-primary:hover { background: var(--tide-deep); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--ink); }

/* ---------- Ticker (Today's Drift) ---------- */

.ticker-section {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper-raised);
  padding: 14px 0;
  overflow: hidden;
}

.ticker-track {
  display: flex;
  gap: 40px;
  white-space: nowrap;
  animation: drift 32s linear infinite;
  width: max-content;
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-item {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticker-move {
  font-family: var(--font-mono);
  font-weight: 700;
}

.ticker-move.up { color: #16745B; }
.ticker-move.down { color: #B3392F; }

.ticker-item .price {
  color: var(--gold-deep);
  font-weight: 700;
}

/* ---------- Section basics ---------- */

section { padding: 72px 0; }

.section-head {
  max-width: 620px;
  margin-bottom: 40px;
}

.section-head h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.section-head p { color: var(--ink-soft); }

/* ---------- Category cards ---------- */

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 900px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .category-grid { grid-template-columns: 1fr; }
}

.category-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.category-card:hover {
  border-color: var(--tide);
  transform: translateY(-3px);
}

.category-card .tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.category-card h3 {
  font-size: 1.25rem;
  margin: 10px 0 8px;
}

.category-card p {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0 0 16px;
}

.category-card a {
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- Deal list (used on category pages) ---------- */

.deal-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.deal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  flex-wrap: wrap;
}

.deal-row .deal-info h4 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.deal-row .deal-info p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.deal-row .deal-price {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--tide-deep);
  font-weight: 700;
  white-space: nowrap;
}

.deal-row .deal-price .was {
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-decoration: line-through;
  font-weight: 400;
  margin-right: 8px;
}

/* A deal with product images keeps the gallery on the left and lets the copy
   take the remaining width, so rows with and without images still line up. */
.deal-row.has-media .deal-info { flex: 1 1 260px; }

.deal-media {
  flex: 0 0 132px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deal-media-main {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(20, 35, 43, 0.05);
  border: 1px solid var(--line);
}

.deal-media-main img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.3s ease;
}

a.deal-media-main:hover img { transform: scale(1.04); }

.deal-thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.deal-thumb {
  padding: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper-raised);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.deal-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.deal-thumb:hover { border-color: var(--tide); }

.deal-thumb.is-active {
  border-color: var(--tide);
  box-shadow: 0 0 0 2px rgba(31, 111, 107, 0.22);
}

@media (max-width: 560px) {
  .deal-media { flex: 0 0 100%; }
}

.updated-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

/* ---------- Stock list (Trading page) ---------- */

.stock-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 24px;
  flex-wrap: wrap;
}

.stock-row .stock-info h4 {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.04em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stock-row .stock-info .stock-exchange {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(31, 111, 107, 0.08);
  border-radius: 999px;
  padding: 3px 8px;
}

.stock-row .stock-info p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.stock-row .stock-quote {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
}

.stock-row .stock-price {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--tide-deep);
}

.stock-change {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.stock-change.up { color: #16745B; }
.stock-change.down { color: #B3392F; }

/* The trading day a quote is from. Deliberately quiet — it is a caveat on the
   price above it, not a number in its own right. */
.stock-asof {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  opacity: 0.85;
}

/* The homepage watchlist teaser reuses the feature panel, so the rows sit flush
   inside it rather than as separate cards. */
.feature-guide .visual .stock-row {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 0;
}

/* The homepage panel is a four-row teaser, not the watchlist itself. The
   trading-day caveat belongs with the full list on the Trading page, where
   there is room for it to read as a caveat rather than as clutter. */
.feature-guide .visual .stock-asof { display: none; }

.feature-guide .visual .stock-row:last-child { border-bottom: none; }
.feature-guide .visual .stock-price { font-size: 1.05rem; }

/* ---------- Wave divider ---------- */

.wave-divider {
  display: block;
  width: 100%;
  height: 60px;
}

/* ---------- Newsletter ---------- */

.newsletter {
  background: var(--tide);
  color: #fff;
  border-radius: var(--radius);
  padding: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.newsletter h3 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.newsletter p {
  color: rgba(255,255,255,0.8);
  margin: 0;
}

.newsletter form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.newsletter input[type="email"] {
  padding: 12px 16px;
  border-radius: 999px;
  border: none;
  min-width: 220px;
  font-family: var(--font-body);
}

.newsletter .btn-primary {
  background: var(--gold);
  color: var(--ink);
}
.newsletter .btn-primary:hover { background: var(--gold-deep); color: #fff; }

/* ---------- Guide / cornerstone feature ---------- */

.feature-guide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

@media (max-width: 780px) {
  .feature-guide { grid-template-columns: 1fr; }
}

.feature-guide .visual {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  font-family: var(--font-mono);
}

.feature-guide .visual .row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.85rem;
}
.feature-guide .visual .row:last-child { border-bottom: none; }
.feature-guide .visual .row .val { color: var(--tide-deep); font-weight: 700; }

/* ---------- Simple content pages (about, policy, contact) ---------- */

.content-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}

.content-page h1 { margin-bottom: 8px; }
.content-page .updated-note { display: block; margin-bottom: 32px; }
.content-page h2 { margin-top: 40px; font-size: 1.4rem; }
.content-page p, .content-page li { color: var(--ink-soft); }

.disclosure-box {
  background: var(--paper-raised);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 20px 24px;
  margin: 24px 0;
}
.disclosure-box p { color: var(--ink); margin: 0; }

/* ---------- Contact form ---------- */

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 32px;
}

.contact-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  display: block;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--paper-raised);
}

.contact-form textarea { min-height: 140px; resize: vertical; }

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

.site-footer {
  border-top: 1px solid var(--line);
  padding: 48px 0 32px;
  margin-top: 40px;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.footer-col h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col a { color: var(--ink); font-size: 0.92rem; }

.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* ---------- Page hero (category / simple pages) ---------- */

.page-hero {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--line);
}

.page-hero .eyebrow { margin-bottom: 10px; display: block; }
.page-hero p { color: var(--ink-soft); max-width: 560px; }

/* ==========================================================================
   Admin (admin.html) — Netlify Identity gated console
   ========================================================================== */

.admin-shell {
  min-height: calc(100vh - 210px);
  padding: 56px 0 88px;
}

/* ---------- Boot / loading state ---------- */

.admin-boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 80px 0;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-boot .spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--line);
  border-top-color: var(--tide);
  border-radius: 50%;
  animation: admin-spin 0.7s linear infinite;
}

@keyframes admin-spin { to { transform: rotate(360deg); } }

[hidden] { display: none !important; }

/* ---------- Sign-in card ---------- */

.auth-card {
  max-width: 440px;
  margin: 0 auto;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 36px;
  box-shadow: 0 18px 40px -28px rgba(20, 35, 43, 0.4);
}

.auth-card .eyebrow { display: block; margin-bottom: 10px; }
.auth-card h1 { font-size: 1.7rem; margin-bottom: 8px; }
.auth-card > p.sub {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0 0 28px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.auth-tabs button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 2px;
  margin-right: 20px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.auth-tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--tide);
  box-shadow: 0 0 0 3px rgba(31, 111, 107, 0.14);
}

.field .hint {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.btn-block { width: 100%; justify-content: center; }

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Status messages ---------- */

.msg {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.87rem;
  margin: 0 0 20px;
  border-left: 3px solid;
  line-height: 1.5;
}

.msg-error {
  background: rgba(178, 58, 47, 0.07);
  border-color: #B23A2F;
  color: #7E2A22;
}

.msg-success {
  background: rgba(31, 111, 107, 0.08);
  border-color: var(--tide);
  color: var(--tide-deep);
}

.msg-info {
  background: rgba(217, 164, 65, 0.1);
  border-color: var(--gold);
  color: #7A5715;
}

/* ---------- OAuth providers ---------- */

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 18px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.oauth-divider::before,
.oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.oauth-buttons {
  display: grid;
  gap: 10px;
}

.oauth-buttons .btn { text-transform: capitalize; }

/* ---------- Console header ---------- */

.admin-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px;
}

.admin-topbar h1 { font-size: clamp(1.8rem, 3vw, 2.3rem); margin-bottom: 6px; }
.admin-topbar .who { color: var(--ink-soft); font-size: 0.92rem; margin: 0; }

.role-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(31, 111, 107, 0.1);
  color: var(--tide-deep);
  border: 1px solid rgba(31, 111, 107, 0.22);
}

.pill.muted {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}

/* ---------- Console panels ---------- */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .admin-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.panel > h2 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.panel > p.panel-sub {
  color: var(--ink-soft);
  font-size: 0.86rem;
  margin: 0 0 20px;
}

.panel .btn { font-size: 0.88rem; padding: 11px 22px; }

.data-rows { font-family: var(--font-mono); font-size: 0.82rem; }

.data-rows .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.data-rows .row:last-child { border-bottom: none; }
.data-rows .row .k { color: var(--ink-soft); white-space: nowrap; }
.data-rows .row .v {
  color: var(--tide-deep);
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.panel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.admin-form { margin-top: 4px; }
.admin-form .field:last-of-type { margin-bottom: 22px; }

/* ---------- Public: deal badges, empty states, unpublished pages ---------- */

.deal-row .deal-info h4 a { color: inherit; }
.deal-row .deal-info h4 a:hover { color: var(--tide-deep); }

.deal-badge {
  display: inline-block;
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 2px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(217, 164, 65, 0.16);
  color: #7A5715;
  border: 1px solid rgba(217, 164, 65, 0.35);
}

.deal-empty {
  margin: 0;
  padding: 26px 24px;
  background: var(--paper-raised);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.retired-notice {
  padding: 110px 0 120px;
  text-align: center;
}

.retired-notice h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 12px; }
.retired-notice p { color: var(--ink-soft); margin: 0 0 18px; }

.page-body {
  max-width: 720px;
  font-size: 1rem;
  line-height: 1.75;
}

.page-body p { margin: 0 0 18px; color: var(--ink-soft); }
.page-body p:last-child { margin-bottom: 0; }
.page-body a { color: var(--tide-deep); text-decoration: underline; overflow-wrap: anywhere; }

/* ---------- Console: tabs ---------- */

.admin-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.admin-tabs button {
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.admin-tabs button:hover { color: var(--ink); }

.admin-tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

.panel-wide { padding: 32px; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.panel-head h2 { font-size: 1.15rem; margin-bottom: 4px; }

.panel-sub {
  color: var(--ink-soft);
  font-size: 0.86rem;
  margin: 0 0 20px;
  max-width: 68ch;
}

/* Selects and textareas were only styled for inputs before the editor arrived. */
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea { resize: vertical; line-height: 1.6; }

.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--tide);
  box-shadow: 0 0 0 3px rgba(31, 111, 107, 0.14);
}

.field .req {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
  margin-left: 6px;
}

.editor-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.editor-toolbar .field { margin-bottom: 0; min-width: 260px; }

/* ---------- Console: content editor fields ---------- */

.cms-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cms-field {
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
}

.cms-field:last-child { border-bottom: none; }

.cms-field-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.cms-field-head label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
}

.cms-field-head .btn-link { margin-left: auto; }

.cms-field input,
.cms-field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
  resize: vertical;
}

.cms-field input:focus,
.cms-field textarea:focus {
  outline: none;
  border-color: var(--tide);
  box-shadow: 0 0 0 3px rgba(31, 111, 107, 0.14);
}

.cms-field .hint {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
}

/* ---------- Console: tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 4px 0 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th {
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px dashed var(--line);
  vertical-align: top;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table td:first-child { min-width: 200px; }

.admin-table .cell-sub {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.admin-table .cell-empty {
  color: var(--ink-soft);
  font-style: italic;
}

.row-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  white-space: nowrap;
}

.btn-link {
  border: none;
  background: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--tide-deep);
  cursor: pointer;
  text-decoration: underline;
}

.btn-link:hover { color: var(--ink); }
.btn-link.danger { color: #B23A2F; }

.btn-danger {
  background: rgba(178, 58, 47, 0.08);
  color: #7E2A22;
  border: 1px solid rgba(178, 58, 47, 0.3);
}

.btn-danger:hover { background: rgba(178, 58, 47, 0.14); }

/* ---------- Console: page & deal editors ---------- */

.editor-card {
  margin-top: 26px;
  padding: 26px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.editor-card h3 { font-size: 1.02rem; margin-bottom: 6px; }

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

.form-grid .field-full { grid-column: 1 / -1; }

.form-grid .field-check {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 18px;
}

.field-check label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  font-weight: 500;
  margin: 0;
}

.field-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--tide);
}

.editor-card .field input[type="text"],
.editor-card .field input[type="url"],
.editor-card .field input[type="number"],
.editor-card .field input[type="search"],
.editor-card .field select,
.editor-card .field textarea {
  background: var(--paper-raised);
}

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .panel-wide { padding: 24px 20px; }
  .row-actions { justify-content: flex-start; }
}

/* ==========================================================================
   Blog — index cards and post pages
   ========================================================================== */

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 900px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .post-grid { grid-template-columns: 1fr; } }

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.post-card:hover {
  border-color: var(--tide);
  transform: translateY(-3px);
}

/* The newest post leads the index across the full width of the grid. */
.post-card-featured {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: stretch;
}

.post-card-featured .post-card-media {
  flex: 1 1 52%;
  min-width: 0;
}

.post-card-featured .post-card-media img { height: 100%; }

.post-card-featured .post-card-body {
  flex: 1 1 48%;
  justify-content: center;
  padding: 36px 34px;
}

.post-card-featured h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  margin: 12px 0 10px;
}

.post-card-featured .post-card-body p { font-size: 1rem; }

@media (max-width: 780px) {
  .post-card-featured { flex-direction: column; }
  .post-card-featured .post-card-body { padding: 28px 24px; }
}

.post-card-media {
  display: block;
  background: rgba(20, 35, 43, 0.06);
  overflow: hidden;
}

.post-card-media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .post-card-media img { transform: scale(1.03); }

.post-card-body {
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.post-card-body .tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.post-card-body h3 {
  font-size: 1.2rem;
  margin: 10px 0 8px;
}

.post-card-body h2 a,
.post-card-body h3 a { color: inherit; }
.post-card-body h2 a:hover,
.post-card-body h3 a:hover { color: var(--tide-deep); }

.post-card-body p {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0 0 16px;
}

/* A link mentioned in the summary, so it reads as one against the muted text. */
.post-card-body p a {
  color: var(--tide-deep);
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.post-card-meta,
.post-card-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.post-card-more {
  margin-top: auto;
  font-weight: 600;
  font-size: 0.9rem;
}

.post-empty {
  grid-column: 1 / -1;
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--paper-raised);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  margin: 0;
}

/* ---------- A single post ---------- */

.post { padding: 56px 0 24px; }

.post-container { max-width: 760px; }

.post-back {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.post-back:hover { color: var(--tide-deep); }

.post h1 {
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.12;
  margin: 18px 0 14px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.post-meta .tag {
  text-transform: uppercase;
  color: var(--gold-deep);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.post-lede {
  font-size: 1.12rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 24px 0 0;
}

.post-cover {
  margin: 32px 0 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(20, 35, 43, 0.06);
}

.post-cover img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.post-body {
  margin-top: 32px;
  padding: 0;
  background: none;
  border: none;
}

.post-body p {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 22px;
}

.post-more { padding-top: 40px; }
.post-more .section-head { margin-bottom: 28px; }
.post-more .post-grid { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 780px) {
  .post-more .post-grid { grid-template-columns: 1fr; }
}

/* ---------- Admin: cover image upload ---------- */

.upload-field {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 16px;
  background: var(--paper-raised);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.upload-preview {
  flex: 0 0 148px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(20, 35, 43, 0.06);
}

.upload-preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.upload-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.upload-buttons {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.upload-controls .hint { margin: 0; }

.field-group {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-bottom: 2px;
}

.field-group h4 {
  font-size: 0.95rem;
  margin: 0 0 4px;
}

.field-group .panel-sub { margin: 0; }

.admin-table .cell-thumb {
  width: 76px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.admin-table .cell-thumb-square {
  width: 56px;
  aspect-ratio: 1 / 1;
}

/* ---------- Admin: deal product-image gallery ---------- */

.upload-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.upload-gallery .hint { margin: 0; }

.gallery-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.gallery-item.is-lead { border-color: var(--tide); }

.gallery-item > img {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.gallery-item-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gallery-item-role {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.gallery-item.is-lead .gallery-item-role { color: var(--tide); }

.gallery-item-body input { width: 100%; }

.gallery-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 0 0 auto;
}

.gallery-item-actions .btn-link[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 560px) {
  .gallery-item { flex-wrap: wrap; }
  .gallery-item-actions { flex-direction: row; flex-wrap: wrap; }
}

.editor-card .field input[type="date"],
.editor-card .field input[type="file"] { background: var(--paper-raised); }

@media (max-width: 560px) {
  .upload-field { flex-direction: column; }
  .upload-preview { flex: 0 0 auto; width: 100%; }
}

/* ---------- Admin: stock quote budget and ticker search ---------- */

/* The remaining API request count sits above the table, next to the manual
   refresh, because the two only make sense read together. */
.quota-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px 16px;
  background: rgba(31, 111, 107, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.quota-bar.warn {
  background: rgba(217, 164, 65, 0.12);
  border-color: rgba(184, 132, 46, 0.4);
}

.quota-text {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.78rem;
  flex: 0 0 auto;
}

.ticker-search {
  padding-bottom: 18px;
  margin-bottom: 4px;
  border-bottom: 1px dashed var(--line);
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.input-row input { flex: 1 1 auto; }
.input-row .btn { flex: 0 0 auto; }

.ticker-results {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-raised);
  /* The symbol search returns up to a few dozen matches; the list scrolls rather
     than pushing the rest of the form off the screen. */
  max-height: 280px;
  overflow-y: auto;
}

.ticker-results li + li { border-top: 1px solid var(--line); }

.ticker-result {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}

.ticker-result:hover,
.ticker-result:focus-visible { background: rgba(31, 111, 107, 0.08); }

.ticker-result strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.ticker-result span {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.ticker-result .cell-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  margin-top: 2px;
}

/* What the row shows on the site right now, so it is clear the price is not a
   field that was left blank. */
.quote-readout {
  margin: 0 0 18px;
  padding: 12px 16px;
  background: rgba(31, 111, 107, 0.06);
  border-left: 3px solid var(--tide);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* A failed refresh, shown against the ticker it happened to. */
.admin-table .cell-sub.warn { color: #B3392F; }

@media (max-width: 560px) {
  .input-row { flex-direction: column; }
  .quota-bar { flex-direction: column; align-items: flex-start; }
}
