/*
 * 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);
  font-size: 1.05rem;
  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;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
}

.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;
  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-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); }

.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);
}

/* 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; }

.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);
  margin-bottom: 20px;
}

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

.chart-blur-overlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: color-mix(in srgb, var(--color-bg) 35%, 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;
}

.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;
  gap: 20px;
  margin-top: 8px;
}

.hero {
  max-width: 640px;
  margin-bottom: 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;
}

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

.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;
}

/* 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;
}
