/* Shared styles for every page: theme tokens, fonts, left nav, search bar + dropdown. */
:root {
  --bg: #131722;
  --panel: #1e222d;
  --line: #2a2e39;
  --text: #d1d4dc;
  --muted: #9aa0ad;
  --accent: #2962ff;
  --accent-hover: #1e4fd8;
  --danger: #ef5350;
  --up: #26a69a;
  --down: #ef5350;
  --gold: #f2b84b;
  --cyan: #4dd0e1;
  --hover: #262b38;
  --nav-w: 272px;
  --radius: 10px;
  --font-text: "myriad-variable", sans-serif;
  --font-head: "TASA Explorer", var(--font-text);
  --font-chart: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  font-family: var(--font-text);
}
* { box-sizing: border-box; }
h1, h2, h3 { font-family: var(--font-head); font-variation-settings: normal; }
html, body { min-height: 100%; margin: 0; }
body {
  font-family: var(--font-text);
  /* Myriad at 96% width. Weight 400 is set with font-weight (the browser maps it to the "wght" axis), so
     elements that ask for 600/700 still get bold; "wght" here would force every element to 400. */
  font-weight: 400;
  font-variation-settings: "wdth" 96;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
}
button, input { font-family: inherit; font-variation-settings: inherit; }

/* ---------- left navigation ---------- */
.nav {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 20px 16px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
/* the logo is white + blue with a transparent background, so it sits directly on the nav */
.brand {
  display: flex; align-items: center;
  padding: 6px 4px;
  text-decoration: none; color: var(--text);
  font-weight: 800; font-size: 20px; letter-spacing: -0.01em;
}
.brand img { display: block; width: 168px; max-width: 100%; height: auto; }

/* About / Trends */
.menu { display: flex; flex-direction: column; gap: 2px; margin-top: -8px; }
.menu a {
  display: flex; align-items: center;
  min-height: 40px; padding: 0 12px;
  border-radius: 8px; color: var(--muted);
  text-decoration: none; font-size: 15px; font-weight: 500;
  transition: background .15s, color .15s;
}
.menu a:hover { background: var(--hover); color: var(--text); }
.menu a[aria-current="page"] { color: var(--text); background: var(--hover); }

/* Log in / Sign up / Log out */
.links { display: flex; flex-direction: column; gap: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.links a {
  display: flex; align-items: center; justify-content: flex-start;
  min-height: 40px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-size: 15px; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.links a:hover { background: var(--hover); border-color: #3a3f4d; }
.links a.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.links a.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
a:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* show Log in / Sign up when logged out, Log out when logged in */
/* nav items (About, Trends, Log in, Sign up, Log out) use the heading font */
.menu a, .links a { font-family: var(--font-head); font-variation-settings: normal; }

body[data-auth="out"] [data-show="in"],
body[data-auth="in"]  [data-show="out"] { display: none; }

/* ---------- main + search ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.search {
  position: relative; width: min(720px, 100%);
}
.search svg {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--muted); pointer-events: none;
}
.search input {
  width: 100%; height: 48px;
  padding: 0 56px 0 46px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 5px;
  font: inherit; font-size: 16px; letter-spacing: 0.02em;
}
.search input::placeholder { color: var(--muted); letter-spacing: 0; }
.search input:hover { border-color: #3a3f4d; }
.search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(41,98,255,.25); }
.search input[aria-invalid="true"] { border-color: var(--danger); }
.search kbd {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  min-width: 24px; height: 24px; padding: 0 7px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font: 12px ui-monospace, Menlo, Consolas, monospace;
}
.msg { min-height: 18px; margin-top: 6px; font-size: 13px; color: var(--danger); }
.msg:empty { min-height: 0; margin: 0; }

/* company name shown after the ticker, and the suggestions dropdown (js/search.js) */
.search-name {
  position: absolute; top: 50%; transform: translateY(-50%); right: 56px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  color: var(--muted); font-size: 15px; pointer-events: none;
}
.search-name:empty { display: none; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  margin: 0; padding: 4px; list-style: none; max-height: 360px; overflow-y: auto;
  background: var(--panel); border: 1px solid #3a3f4d; border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
}
.suggest li {
  display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 10px; border-radius: 4px; cursor: pointer;
}
.suggest li:hover, .suggest li[aria-selected="true"] { background: var(--hover); }
.sg-symbol { font-weight: 700; color: var(--text); }
.sg-name { color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sg-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }

#content { flex: 1; padding: 24px; }

/* ---------- narrow screens: nav becomes a top strip ---------- */
@media (max-width: 720px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .nav {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: 8px 12px; padding: 10px 14px;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; }
  .brand img { width: 124px; }
  .links { flex-direction: row; order: 2; padding-top: 0; border-top: 0; }
  .links a { min-height: 38px; padding: 0 12px; font-size: 14px; }
  .menu { order: 3; width: 100%; flex-direction: row; gap: 4px; margin-top: 0; }
  .menu a { min-height: 36px; font-size: 14px; }
  .top { padding: 14px 14px 10px; }
  .suggest li { grid-template-columns: 64px 1fr; }
  .sg-meta { display: none; }
}
