/* Site header and footer ("chrome"). Loaded last: it replaces the header/footer
   layout rules spread over styles.css, calm.css, brand.css and theme-responsive.css. */

/* ===== Header =============================================================== */
.site-header {
  display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important;
  gap: 1rem !important; min-height: 64px; padding: .6rem clamp(1rem, 3vw, 2.5rem) !important;
}
/* Older stylesheets reorder header items below 1280px; keep logo, links, tools in this order. */
.site-header > .brand, .site-header > .top-nav, .site-header > .header-tools { order: 0 !important; }
.site-header .brand { flex: 0 0 auto; display: flex; align-items: center; gap: .5rem; text-decoration: none; }
.site-header .brand-copy { display: flex !important; flex-direction: column; line-height: 1.05; }
.site-header .brand-copy small { display: block; white-space: nowrap; font-size: .58rem !important; letter-spacing: .12em; }

.site-header .top-nav {
  display: flex !important; flex-direction: row !important; align-items: center; gap: .1rem;
  flex: 0 0 auto; min-width: 0; position: static; width: auto; margin: 0; padding: 0; border: 0; background: none !important;
}
.site-header .top-nav a, .site-header .nav-more-btn {
  padding: .5rem .65rem !important; border: 0; border-radius: 8px; background: none;
  color: var(--muted) !important; font: inherit; font-size: .9rem; font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer;
}
.site-header .top-nav a:hover, .site-header .nav-more-btn:hover, .site-header .nav-more.open .nav-more-btn {
  color: var(--text) !important; background: color-mix(in srgb, var(--text) 7%, transparent) !important;
}
.site-header .top-nav a[aria-current="page"] { color: var(--text) !important; }

.nav-more { position: relative; }
.nav-more-btn { display: inline-flex; align-items: center; gap: .4rem; }
.nav-more-btn::after {
  content: ""; width: .38rem; height: .38rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .15s ease;
}
.nav-more.open .nav-more-btn::after { transform: translateY(1px) rotate(-135deg); }
.nav-more-menu {
  position: absolute; top: calc(100% + .45rem); left: 0; z-index: 40; display: none; min-width: 12rem; padding: .4rem;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); box-shadow: 0 16px 36px rgba(0, 0, 0, .22);
}
.nav-more.open .nav-more-menu { display: grid; }
.site-header .nav-more-menu a { display: block; padding: .55rem .7rem !important; }

/* The links never shrink; the search box gives way instead (16rem down to 8rem). */
.header-tools { display: flex; align-items: center; justify-content: flex-end; gap: .45rem; flex: 1 1 auto; min-width: 0; margin-left: auto; }
.site-header .search {
  order: 0 !important; flex: 0 1 16rem !important; width: auto !important; min-width: 8rem;
  height: 2.4rem; padding: 0 .4rem 0 .75rem; border-radius: 999px !important;
}
.site-header .search input { min-width: 0; font-size: .88rem; }
.site-header .search button { display: none !important; }   /* Enter searches; the suggestions list opens as you type */
.site-header .theme-toggle {
  order: 0 !important; width: 2.4rem; min-width: 2.4rem !important; height: 2.4rem; padding: 0 !important; border-radius: 999px !important;
}
.site-header .theme-toggle b { display: none !important; }

.header-account { display: flex; align-items: center; gap: .35rem; }
.header-account a {
  padding: .5rem .85rem; border-radius: 999px; font-size: .88rem; font-weight: 700; white-space: nowrap; text-decoration: none;
  color: var(--text) !important;
}
.header-account a[hidden] { display: none !important; }
.header-account .nav-login:hover, .header-account .nav-mylist:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.header-account .nav-mylist { border: 1px solid var(--line-2); }
.header-account .nav-join { background: var(--bull); color: var(--on-accent) !important; }
.header-account .nav-join:hover { background: var(--bull-strong); }

.site-header .nav-toggle { display: none !important; order: 0 !important; }

/* Tablet: the links move into the menu button. */
@media (max-width: 1240px) {
  .site-header .nav-toggle { display: flex !important; }
  .site-header .top-nav {
    display: none !important; position: absolute; top: 100%; left: 1rem; right: 1rem; z-index: 30;
    flex-direction: column !important; align-items: stretch; gap: .1rem; margin-top: .35rem; padding: .5rem;
    border: 1px solid var(--line-2); border-radius: 14px; background: var(--card) !important; box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
  }
  .site-header .top-nav.open { display: flex !important; }
  .site-header .top-nav a { display: block; width: 100%; padding: .75rem .85rem !important; text-align: left !important; justify-content: flex-start !important; }
  .nav-more-btn { display: none !important; }
  .nav-more-menu { position: static; display: grid !important; min-width: 0; margin-top: .3rem; padding: .3rem 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; background: none; }
  .site-header .search { width: clamp(9rem, 26vw, 15rem) !important; }
}

/* Phone: logo + buttons on the first row, search on its own row. */
@media (max-width: 700px) {
  .site-header { flex-wrap: wrap !important; gap: .5rem !important; padding: .55rem 1rem .65rem !important; }
  .header-tools { display: contents; }
  .site-header .brand { order: 1; }
  .site-header .brand-copy small { display: none !important; }
  .site-header .theme-toggle { order: 2 !important; margin-left: auto; width: 2.2rem; min-width: 2.2rem !important; height: 2.2rem; }
  .header-account { order: 3; }
  .header-account a { padding: .45rem .7rem; font-size: .82rem; }
  .site-header .nav-toggle { order: 4 !important; }
  .site-header .search { order: 5 !important; flex: 1 1 100% !important; width: 100% !important; }
}
@media (max-width: 420px) {
  .site-header .brand-copy { display: none !important; }      /* the logo mark is enough on small phones */
  .header-account .nav-mylist { display: none !important; }   /* reachable from Account */
  .header-account a { padding: .42rem .6rem; }
}

/* ===== Footer =============================================================== */
.footer.site-footer {
  display: block !important; margin-top: 3rem; padding: 2.75rem clamp(1rem, 4vw, 3rem) 1.5rem !important;
  border-top: 1px solid var(--line) !important; background: color-mix(in srgb, var(--card) 45%, var(--bg)) !important; color: var(--muted);
}
.footer-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 2.5rem 3.5rem; max-width: 1200px; margin: 0 auto; }
.footer-logo { display: inline-flex; align-items: baseline; gap: .55rem; text-decoration: none; }
.footer-logo .wordmark { font-size: 1.45rem; color: var(--text); }
.footer-logo span { font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.footer-about > p { max-width: 23rem; margin: .55rem 0 1.25rem; font-size: .9rem; line-height: 1.5; color: var(--muted); }

.site-footer .footer-cols { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; justify-content: initial !important; }
.footer-cols > div { display: grid; align-content: start; gap: .55rem; }
.footer-cols h2 { margin: 0 0 .2rem; font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--text); }
.site-footer .footer-cols a, .site-footer .footer-cols button {
  justify-self: start; padding: 0; border: 0; background: none; font: inherit; font-size: .9rem !important; text-align: left;
  color: var(--muted) !important; text-decoration: none; cursor: pointer;
}
.site-footer .footer-cols a:hover, .site-footer .footer-cols button:hover { color: var(--text) !important; }
.site-footer .footer-cols button[hidden] { display: none; }

.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; max-width: 1200px; margin: 2.25rem auto 0;
  padding-top: 1.1rem; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted-2);
}
.site-footer .footer-bottom .footer-note, .site-footer .footer-bottom .footer-copy { padding: 0 !important; border: 0 !important; grid-column: auto; color: var(--muted-2); }
.site-footer .footer-copy a { color: var(--muted); }

/* Weekly sign-up inside the left column */
.site-footer .footer-nl { display: block; max-width: 24rem; margin: 0; padding: 0; border: 0; background: none; }
.site-footer .footer-nl-copy { display: block; margin: 0 0 .45rem; font-size: .85rem; color: var(--muted); }
.site-footer .footer-nl-copy b { margin-right: .35rem; color: var(--text); }
.site-footer .footer-nl-form { flex: none; }

@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr; gap: 2rem; }
  .site-footer .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem 1rem; }
}

/* ===== Glossary ============================================================ */
.gl-jump { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.5rem; }
.gl-jump a { padding: .4rem .85rem; border: 1px solid var(--line-2); border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.gl-jump a:hover { color: var(--text); border-color: var(--bull); }
.gl-group { margin: 0 0 2rem; scroll-margin-top: 6rem; }
.gl-group h2 { margin: 0 0 .8rem; font-size: 1.15rem; }
.gl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .7rem; margin: 0; padding: 0; list-style: none; }
.gl-list a { display: grid; gap: .3rem; height: 100%; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px;
  background: color-mix(in srgb, var(--card) 92%, transparent); color: var(--text); text-decoration: none; }
.gl-list a:hover { border-color: color-mix(in srgb, var(--bull) 50%, transparent); transform: translateY(-1px); }
.gl-list b { font-size: 1rem; }
.gl-list span { font-size: .86rem; line-height: 1.45; color: var(--muted); }
.gl-more { margin: 1.5rem 0; color: var(--muted); }
.gl-more a, .gl-box a { color: var(--bull); font-weight: 600; }
.gl-short { font-size: 1.1rem; }
.gl-box { margin: 1.4rem 0; padding: 1rem 1.2rem; border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--card) 92%, transparent); }
.gl-box h2 { margin: 0 0 .4rem !important; font-size: .78rem !important; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.gl-box p { margin: 0; }
.gl-box ul { margin: .6rem 0 0; padding-left: 1.1rem; }
.gl-example { border-left: 3px solid var(--bear); }
.gl-on2bb { border-left: 3px solid var(--bull); }

/* ===== TradingView boxes follow the light/dark theme ========================== */
.tradingview-chart-box {
  background: var(--card) !important; border: 1px solid var(--line) !important; border-radius: 14px !important;
}
.tradingview-chart-box iframe { border-radius: 12px !important; }
.tv-credit { margin: .4rem .2rem 0; font-size: .72rem; color: var(--muted-2); text-align: right; }
.tv-credit a { color: var(--muted); text-decoration: underline; }

/* ===== Cookie banner ======================================================== */
.cc-banner {
  position: fixed; left: 50%; bottom: 1rem; z-index: 2000; transform: translateX(-50%);
  width: min(46rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto;
  display: grid; gap: .9rem; padding: 1.1rem 1.25rem; border: 1px solid var(--line-2); border-radius: 16px;
  background: var(--card); color: var(--text); box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.cc-banner h2 { margin: 0 0 .35rem; font-size: 1.05rem; }
.cc-banner p { margin: 0; font-size: .88rem; line-height: 1.5; color: var(--muted); }
.cc-banner p b { color: var(--text); }
.cc-banner a { color: var(--bull); }
.cc-details { display: grid; gap: .5rem; }
.cc-details[hidden] { display: none; }
.cc-row { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; font-size: .86rem; color: var(--muted); }
.cc-row b { display: block; color: var(--text); }
.cc-row input { margin-top: .2rem; width: 1rem; height: 1rem; accent-color: var(--bull); flex: 0 0 auto; }
.cc-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.cc-actions button { padding: .6rem 1.1rem; border-radius: 10px; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; }
@media (max-width: 520px) { .cc-actions button { flex: 1 1 auto; } }
