/*
 * Fun Financials — Harvest Almanac theme tokens.
 *
 * Every color/font below is a custom property, and every rule in this file
 * (and every template) should read the property, never a literal hex/font
 * name. Re-theming later means editing this block, not hunting templates.
 *
 * Coexists with the Bootstrap CDN stylesheet loaded in base.html — this
 * file supplies the site's own chrome (header/nav/banner/footer/type),
 * Bootstrap still handles component classes (btn, form-control, pagination)
 * on pages that haven't been rebuilt yet.
 */

/*
 * Committing to the Harvest Almanac soil-brown ground as the site's actual
 * identity, not an adaptive light/dark default — this is the "deliberately
 * one visual world" case, so :root itself carries the brown palette. A
 * paler alternative stays reachable via [data-theme="light"] for a future
 * theme toggle, it just isn't picked automatically from OS preference.
 */
:root {
  --color-bg: #2A2216;
  --color-surface: #34362A;
  --color-text: #E7E1C9;
  --color-muted: #ABA187;
  --color-line: #4A4432;
  --color-accent: #E3B23C;
  --color-accent-2: #86996B;
  --color-error: #D9695C;

  --font-display: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-body: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-mono: "SF Mono", "Cascadia Mono", ui-monospace, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --color-bg: #2A2216;
  --color-surface: #34362A;
  --color-text: #E7E1C9;
  --color-muted: #ABA187;
  --color-line: #4A4432;
  --color-accent: #E3B23C;
  --color-accent-2: #86996B;
  --color-error: #D9695C;
}
:root[data-theme="light"] {
  --color-bg: #FBFAF5;
  --color-surface: #FFFFFF;
  --color-text: #2A2216;
  --color-muted: #6B6552;
  --color-line: #E4DFCB;
  --color-accent: #B98A24;
  --color-accent-2: #4F6B3C;
  --color-error: #B8362A;
}

* { box-sizing: border-box; }

html {
  font-size: 18px;
}

html, body {
  background: var(--color-bg);
  color: var(--color-text);
}

body {
  font-family: var(--font-body);
  /* Bumped 2026-08-30 from 1.05rem (~18.9px against this site's 18px
     root) - user feedback that body text reads small on both mobile and
     desktop. 1.2rem (~21.6px) lands in the same range Medium (~21px) and
     Substack (~20-21px) use for their own long-form reading text; the
     existing 1.6 line-height already matched theirs, so font-size alone
     was the gap. Deliberately only the body-text rule, not the html root
     font-size - nav/buttons/headings already have their own explicit rem
     sizes and shouldn't scale up just because reading text did. */
  font-size: 1.2rem;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  text-wrap: balance;
}

a {
  color: var(--color-accent-2);
}
a:hover { color: var(--color-accent); }

.site-header {
  border-bottom: 1px solid var(--color-line);
  background: var(--color-surface);
}

.site-header__row {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  /* Column, not row - changed 2026-08-30 (was row+justify-content:center,
     which centered the logo and nav as one horizontal group but still
     left them side by side). Real feedback from the live site: the logo
     should sit on its own line above the nav, not beside it. align-items
     is the one that centers horizontally now that this axis is
     vertical - .site-nav (its own nested flex row) still lays its links
     out side by side underneath, unaffected by this. The mobile hamburger
     collapse still works the same way (nav-toggle/.site-nav just become
     the 2nd/3rd stacked rows instead of wrapping onto a 2nd row). */
  flex-direction: column;
  align-items: center;
  gap: 12px 24px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text);
}

.site-logo:hover { color: var(--color-text); }

.site-logo__word {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  /* Added 2026-08-30 alongside .site-header__row switching to a stacked
     column layout - previously this row's own overflow was masked by
     the header row's flex-wrap letting the whole nav drop to its own
     line below the logo; now that it's already on its own line, this
     needs its own wrap so 7 links + gaps don't overflow/scroll at
     medium (above the 560px hamburger breakpoint, below full desktop)
     widths. */
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.site-nav a {
  font-family: var(--font-body);
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--color-muted);
}

.site-nav a:hover { color: var(--color-accent-2); }

/* Hidden above the mobile breakpoint - .site-nav is a plain inline row
   there, this button never shows. See the 560px block below for the
   collapsed/hamburger behavior itself. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

/* Simple X when open, rather than a separate icon/asset. */
.nav-toggle.is-open .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle.is-open .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.site-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  min-height: 50vh;
  /* Site-wide, requested 2026-08-30 - {% block content %} in base.html
     is wrapped by this one element on every page, so this is the single
     rule that centers text everywhere rather than a per-template change. */
  text-align: center;
}

.site-footer {
  border-top: 1px solid var(--color-line);
  background: var(--color-surface);
  color: var(--color-muted);
}

.site-footer__row {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px;
  font-size: 0.95rem;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.site-footer a { color: var(--color-muted); }
.site-footer a:hover { color: var(--color-accent-2); }

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

/* Statement switcher on the symbol/plot page — replaces stock Bootstrap
   btn-primary/btn-secondary buttons with a themed tab row. */
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: var(--color-muted);
}
.back-link:hover { color: var(--color-accent-2); }

/* SEO PRD §5.4 (2026-08-23) - Home > Browse > Exchange > Company >
   Statement trail on plot.html, replacing that page's old single
   .back-link (still used elsewhere - symbols.html, the legal pages). */
.breadcrumbs {
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--color-muted);
}
.breadcrumbs a { color: var(--color-muted); }
.breadcrumbs a:hover { color: var(--color-accent-2); }
.breadcrumbs__sep { color: var(--color-line); }

.statement-tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--color-line);
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.statement-tabs a {
  display: inline-block;
  padding: 6px 2px 12px;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.statement-tabs a:hover { color: var(--color-text); }

.statement-tabs a.is-active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* Share button + fallback menu (templates/plot.html) - transparent/
   secondary treatment like .nav-toggle, not the accent-colored
   button/input[type=submit] styling reserved for real form submissions.
   No dropdown/menu component existed anywhere in this codebase before
   this - built from the same surface/line/muted tokens as everything
   else rather than new colors. */
.share {
  position: relative;
  margin-bottom: 20px;
}

.share__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--color-line);
  color: var(--color-muted);
  padding: 7px 16px;
  font-size: 0.92rem;
}

.share__toggle:hover {
  background: transparent;
  border-color: var(--color-accent-2);
  color: var(--color-accent-2);
}

.share__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.share__menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  font-size: 0.92rem;
  color: var(--color-muted);
  background: transparent;
  border: none;
  text-decoration: none;
  cursor: pointer;
}

.share__menu-item:hover {
  background: var(--color-bg);
  color: var(--color-accent-2);
}

.share__menu-item + .share__menu-item {
  border-top: 1px solid var(--color-line);
}

/* Forms — used by the symbol search and the line-item/period picker. */
form p { margin: 0 0 14px; }
form label {
  display: block;
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 4px;
}

input[type="text"], input[type="email"], input[type="password"], select {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  padding: 8px 10px;
  min-width: 220px;
}

button, input[type="submit"] {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-bg);
  background: var(--color-accent-2);
  border: 1px solid var(--color-accent-2);
  padding: 9px 20px;
  cursor: pointer;
}
button:hover, input[type="submit"]:hover { background: var(--color-accent); border-color: var(--color-accent); }
button:focus-visible, input[type="submit"]:focus-visible,
input[type="text"]:focus-visible, input[type="email"]:focus-visible,
input[type="password"]:focus-visible, select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Record lists — exchanges, symbols. */
.record-list { list-style: none; margin: 0 0 24px; padding: 0; }

.record-list__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-line);
}

.record-list__main { display: flex; flex-direction: column; gap: 2px; }
.record-list__main a { font-size: 1.05rem; }

.record-list__meta {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.record-list__count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.record-list__links { display: flex; gap: 14px; }
.record-list__links a { font-size: 0.92rem; white-space: nowrap; }

/* Customer Journey PRD R6 (2026-08-22) - marks the 10
   FREE_TIER_FULL_ACCESS_SYMBOLS tickers directly in the symbol list itself,
   not just in the callout box's prose above it. Fern-green (--color-accent-2),
   matching this palette's existing use of that token for positive/active
   states elsewhere, not the harvest-yellow --color-accent used for
   attention/warning-adjacent things (the blurred-chart highlight, nav hover). */
.tier-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}

.tier-badge--free {
  color: var(--color-accent-2);
  border: 1px solid var(--color-accent-2);
}

.pagination-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.92rem;
}

.pagination-nav__current { color: var(--color-muted); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
  margin: 28px 0 0;
}

.stat-grid__item {
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  padding: 16px 18px;
}

.stat-grid__item dt {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.stat-grid__item dd {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  color: var(--color-text);
  margin: 0;
}

.chart-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  /* Capped 2026-08-30 - previously stretched to .site-main's full
     1100px, which read as oversized once surrounding text became
     centered (shorter, narrower-looking lines by comparison). Still
     centered itself via the auto margins below, and sizeChartInner()'s
     JS reads *this* element's clientWidth, so a chart needing more room
     than 900px (many years of history) still grows past it and scrolls
     horizontally exactly as before - this only shrinks the common case
     of a chart that already fit. */
  max-width: 900px;
  margin: 0 auto 20px;
}

.chart-scroll__inner {
  position: relative;
  min-width: 100%;
  height: 560px;
  padding: 16px;
}

.chart-unit-label {
  position: absolute;
  top: 4px;
  left: 20px;
  font-size: 0.75rem;
  color: var(--color-muted);
  pointer-events: none;
  /* Empty (ratio chart, or before the JS above sets it) collapses to
     nothing rather than reserving blank space. */
}

.chart-blur-overlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  pointer-events: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  /* Was 35% - 6px blur alone still let bar shapes/edges show through on
     high-contrast bars; bumped both the blur radius and this opacity
     together so gated bars are genuinely unreadable, not just softened. */
  background: color-mix(in srgb, var(--color-bg) 60%, transparent);
  -webkit-mask-image: linear-gradient(to right, black 82%, transparent 100%);
  mask-image: linear-gradient(to right, black 82%, transparent 100%);
}

@media (max-width: 560px) {
  .chart-scroll__inner { height: 380px; }
}

@media (max-width: 560px) {
  .site-header__row,
  .site-main,
  .site-footer__row {
    padding-left: 16px;
    padding-right: 16px;
  }
  .site-main { padding-top: 28px; padding-bottom: 44px; }
  .site-logo__word { font-size: 1rem; letter-spacing: 0.08em; }
  .site-footer__row { flex-direction: column; gap: 6px; }

  /* Collapse .site-nav behind the hamburger button - .site-header__row is
     already flex-wrap (see its own rule above), so the hidden/shown nav
     just wraps onto its own full-width row underneath the logo+toggle row
     when opened, no extra positioning/overlay needed. */
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    order: 3;
  }
  .site-nav.is-open { display: flex; }
}

/* Auth forms (register/login) and Django's messages framework. */
.auth-form {
  max-width: 400px;
  /* margin:0 auto added 2026-08-30 - same fix as .hero: a max-width
     block doesn't center itself just because an ancestor has
     text-align:center, so this sat flush-left on every page that uses
     it (login, register, password reset, email preferences). */
  margin: 0 auto;
}

.auth-form .errorlist {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  color: var(--color-error);
  font-size: 0.85rem;
}

.form-error {
  color: var(--color-error);
  font-size: 0.9rem;
  margin: 0 0 16px;
}

.auth-form-footer {
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.messages {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.messages li {
  padding: 10px 14px;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.messages li.success { border-color: var(--color-accent-2); }
.messages li.error { border-color: var(--color-error); color: var(--color-error); }

.cta-row {
  display: flex;
  align-items: center;
  /* Added 2026-08-30 - text-align:center on an ancestor doesn't affect
     how a flex container distributes its own children (that's
     justify-content's job, not text-align's) - this stayed flush-left
     even once .hero below became a centered block. */
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
}

.hero {
  max-width: 640px;
  /* margin:0 auto added 2026-08-30 - this is a block element narrower
     than .site-main, so text-align:center on its text content alone
     doesn't center the *block itself*: without this, .hero (and
     everything in it) sat flush-left against .site-main's left edge,
     so the "centered" heading/paragraph text was actually centered
     around the wrong axis - visibly left of the page's true center on
     any wide viewport. */
  margin: 0 auto 36px;
}

.hero__eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: 600;
  margin: 0 0 14px;
}

.hero__headline {
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  line-height: 1.25;
  margin: 0 0 16px;
}

.hero__body {
  color: var(--color-muted);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0;
}

/* Compact inline search bar for the hero section (and reused as-is on the
   search results page) - the generic `form p { margin: 0 0 14px }` stacked
   layout used everywhere else reads wrong for a single-line hero search,
   so this is a small flex row instead, using the same input/button color
   tokens as the rest of the form styling above rather than new colors. */
.hero-search {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  max-width: 420px;
  /* Narrower than .hero, so needs its own centering for the same reason
     .hero itself did above - a max-width block doesn't center on its
     own text-align. */
  margin-left: auto;
  margin-right: auto;
}
.hero-search input[type="text"] {
  flex: 1;
  min-width: 0;
}

.hero__caption {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 10px;
}

.hero__tier-summary {
  color: var(--color-muted);
  font-size: 0.92rem;
  margin: 12px 0 0;
}

/* SEO PRD §5.3 "Should" (2026-08-23) - plain-language statement-type
   definition on plot.html, for a visitor arriving without financial
   background. Same muted/small treatment as .hero__tier-summary above -
   supporting context, not the page's main content. */
.statement-definition {
  color: var(--color-muted);
  font-size: 0.92rem;
  margin: 0 0 20px;
}

.preview-banner {
  border: 1px solid var(--color-accent);
  background: var(--color-surface);
  padding: 12px 16px;
  font-size: 0.92rem;
  color: var(--color-muted);
  margin: 0 0 20px;
}

.preview-banner a { color: var(--color-accent); }

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-line);
  padding: 16px 24px;
}

.cookie-banner__text {
  margin: 0;
  flex: 1 1 320px;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.cookie-banner__actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.cookie-banner__btn--secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-line);
}
.cookie-banner__btn--secondary:hover {
  background: var(--color-bg);
  border-color: var(--color-muted);
  color: var(--color-text);
}

@media (max-width: 560px) {
  .cookie-banner { flex-direction: column; align-items: stretch; }
  .cookie-banner__actions { justify-content: flex-end; }
}

.free-tier-symbol-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 10px 0 0;
  padding: 0;
}

/* SEO PRD §5.4 (2026-08-23) - "Compare with" peer-company links on
   plot.html (financials/readers/peer_symbols.py). Same flex-wrap list
   shape as .free-tier-symbol-list above, reused rather than a second
   near-identical rule. */
.peer-symbols {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--color-line);
}

/* documentation/prds/09-market-cap-pe-fcf-yield-prd.md Phase 1 - same
   top-border-separator shape as .peer-symbols above it on plot.html, its
   own .stat-grid content reuses dashboard.html's existing component
   as-is (no new grid/card rules needed here). */
.valuation-stats {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--color-line);
}
.valuation-stats__as-of {
  margin: 14px 0 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}
.peer-symbols__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 10px 0 0;
  padding: 0;
}

/* Simple label:value rows for things like a business address or email -
   deliberately not .stat-grid (that one's sized for short numeric stats,
   1.5rem tabular-nums monospace text - looks broken/oversized for a real
   address or CRO number, which is what it was wrongly reused for here). */
.contact-details {
  margin: 20px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-details__row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  border-bottom: 1px solid var(--color-line);
  padding-bottom: 10px;
}
.contact-details__row dt {
  flex: 0 0 160px;
  color: var(--color-muted);
  font-size: 0.9rem;
}
.contact-details__row dd {
  margin: 0;
  flex: 1 1 240px;
}

/* 404.html / 500.html - centered, minimal, deliberately not much more than
   a heading/message/link. 500.html in particular renders standalone (no
   base.html nav/footer, see that template's own comment on why), so this
   needs to look complete and on-brand on its own, not rely on surrounding
   page chrome for visual weight. */
.error-page {
  max-width: 480px;
  margin: 15vh auto;
  padding: 0 20px;
  text-align: center;
}
.error-page h1 {
  margin-bottom: 16px;
}
.error-page .lead {
  color: var(--color-muted);
  margin-bottom: 24px;
}
.error-page a {
  color: var(--color-accent-2);
}
.error-page a:hover {
  color: var(--color-accent);
}
