/* tefinance.xyz — Stock Position Calculator
   Visual identity: pure black + electric red + soft white,
   Bloomberg-terminal aesthetic, ticker bar, semantic gain/loss colors. */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
  font-size: 15px; line-height: 1.55;
  color: #d8d6cc; background: #080808;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: #e63946; text-decoration: none; border-bottom: 1px solid rgba(230, 57, 70, .3); }
a:hover { color: #ffffff; border-bottom-color: #ffffff; }

h1, h2, h3, h4 {
  font-family: -apple-system, "Inter", "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #f1f0e8; line-height: 1.2; margin: 0 0 .55em;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.65rem); margin-top: 1.6em; }
h3 { font-size: 1rem; font-family: "JetBrains Mono", Consolas, monospace; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: #e63946; }
p { margin: 0 0 1em; }

code, kbd, samp, .mono {
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  font-size: .92em; background: #1a1a1a; color: #e63946; padding: .12em .4em; border-radius: 0;
  border: 1px solid #2a2a2a;
}

:root {
  --bg: #080808;
  --bg-2: #1a1a1a;
  --bg-3: #232323;
  --line: #2a2a2a;
  --line-2: #3a3a3a;
  --red: #e63946;
  --red-dim: #b32d36;
  --green: #2ecc71;
  --green-dim: #1f9c54;
  --text: #d8d6cc;
  --muted: #8a8478;
  --hi: #f1f0e8;
}

.container { width: min(1180px, 94%); margin: 0 auto; }

/* ---- Ticker bar (signature element) ---- */
.ticker {
  background: #000;
  border-bottom: 1px solid var(--line);
  padding: .35rem 0;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .78rem;
  white-space: nowrap;
  overflow: hidden;
}
.ticker-inner {
  display: flex; gap: 2.5rem;
  animation: ticker-scroll 80s linear infinite;
}
.ticker .item { display: flex; gap: .5rem; }
.ticker .sym { color: var(--hi); font-weight: 700; }
.ticker .px { color: var(--muted); }
.ticker .ch.up { color: var(--green); }
.ticker .ch.dn { color: var(--red); }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---- Header ---- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 0;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; line-height: 1.05; }
.brand-mark {
  width: 36px; height: 36px;
  background: var(--bg); color: var(--red);
  border: 2px solid var(--red);
  display: grid; place-items: center;
  position: relative;
  flex-shrink: 0;
}
.brand-mark::before {
  content: "";
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 12px solid var(--red);
  margin-bottom: 2px;
}
.brand-text { display: inline-flex; flex-direction: column; gap: 1px; }
.brand-name {
  color: var(--hi); font-weight: 800;
  font-size: 1rem; letter-spacing: -.01em;
}
.brand-tagline {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .68rem; font-weight: 600; color: var(--red);
  text-transform: uppercase; letter-spacing: .15em;
}
@media (max-width: 720px) { .brand-tagline { display: none; } }

.nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; row-gap: .25rem; }
.nav a {
  font-family: "JetBrains Mono", Consolas, monospace; font-weight: 600;
  color: var(--text); font-size: .78rem;
  padding: .25rem 0; white-space: nowrap;
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: none;
}
.nav a:hover { color: var(--red); }
.nav-toggle {
  display: none; background: transparent; border: 0; padding: .4rem; cursor: pointer;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px; background: var(--red);
  margin: 5px 0;
}

/* ---- Hero ---- */
.hero {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--line);
}
.hero-inner { max-width: 820px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .72rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--red); font-weight: 700;
  padding: .25rem .7rem;
  border: 1px solid var(--red);
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: ""; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}
.lead { font-size: 1.05rem; color: var(--muted); }

/* ---- Tool ---- */
.tool {
  background: var(--bg-2);
  border: 1px solid var(--line);
  margin: 2rem 0;
}
.tool-head {
  background: var(--bg);
  padding: .8rem 1.4rem;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.tool-head h2 {
  margin: 0; font-size: 1rem; color: var(--hi);
  font-family: "JetBrains Mono", Consolas, monospace; text-transform: uppercase; letter-spacing: .12em;
}
.tool-head .stamp {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .72rem; color: var(--red); letter-spacing: .15em; text-transform: uppercase;
  font-weight: 700;
}
.tool-body {
  padding: 1.6rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
}
.field-group {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 1.2rem;
}
.field-group h3 { margin-top: 0; }
.field { display: grid; grid-template-columns: 1fr auto; gap: .7rem; align-items: baseline; padding: .5rem 0; border-bottom: 1px dotted var(--line); }
.field:last-child { border-bottom: none; }
.field label {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  font-size: .76rem;
}
.field input, .field select {
  font: inherit; font-family: "JetBrains Mono", Consolas, monospace;
  padding: .35rem .55rem;
  border: 1px solid var(--line-2); border-radius: 0;
  background: var(--bg-2); color: var(--hi);
  font-weight: 700; text-align: right; width: 130px;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--red);
  background: var(--bg-3);
}

.tool-output {
  border-top: 1px solid var(--line);
  padding: 1.4rem 1.6rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--line);
}
.tool-output .stat {
  background: var(--bg);
  padding: 1rem 1.2rem;
}
.tool-output .stat .k {
  display: block;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .68rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em; margin-bottom: .35rem;
}
.tool-output .stat .v {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 1.5rem; font-weight: 700; color: var(--hi);
  letter-spacing: -.01em; line-height: 1;
}
.tool-output .stat.gain .v { color: var(--green); }
.tool-output .stat.loss .v { color: var(--red); }
.tool-output .stat.headline .v { font-size: 2rem; }

.scenario-table { padding: 1.4rem 1.6rem; border-top: 1px solid var(--line); }
.scenario-table h3 { margin-top: 0; }

.privacy-note {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .8rem; color: var(--muted);
  border-left: 2px solid var(--red);
  padding: .55rem .9rem; margin: 0 1.6rem 1.6rem; background: var(--bg);
}

/* ---- Content ---- */
.content { padding: 1.5rem 0 3rem; }
.content section { margin-bottom: 2rem; }

.author-card {
  display: grid; grid-template-columns: 88px 1fr; gap: 1.4rem;
  align-items: center; padding: 1.4rem;
  background: var(--bg-2); border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  margin: 1.2rem 0;
}
.author-avatar {
  width: 88px; height: 88px;
  background: var(--bg); color: var(--red);
  border: 2px solid var(--red);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 1.7rem; font-weight: 800;
  display: grid; place-items: center;
  letter-spacing: 1px;
}
.author-card h3 { font-family: -apple-system, sans-serif; color: var(--hi); margin: 0 0 .2rem; font-size: 1.1rem; text-transform: none; letter-spacing: 0; }
.author-meta {
  font-family: "JetBrains Mono", Consolas, monospace;
  color: var(--red); font-size: .8rem; margin: 0 0 .5rem;
  text-transform: uppercase; letter-spacing: .08em;
}
.cred-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.cred-row span {
  display: inline-block; padding: .15rem .55rem;
  background: var(--bg); border: 1px solid var(--line-2);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .72rem; color: var(--text);
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}

/* Reference / data tables */
.ref-table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--bg-2); }
.ref-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 480px; font-family: "JetBrains Mono", Consolas, monospace; }
.ref-table th, .ref-table td {
  padding: .55rem .75rem; text-align: left;
  border-bottom: 1px solid var(--line);
}
.ref-table thead th {
  background: var(--bg); color: var(--red);
  font-weight: 700; text-transform: uppercase; font-size: .72rem; letter-spacing: .1em;
  border-bottom: 2px solid var(--red-dim);
}
.ref-table tbody tr:hover td { background: var(--bg-3); }
.ref-table td.num { text-align: right; }
.ref-table td.gain { color: var(--green); }
.ref-table td.loss { color: var(--red); }

.callout {
  border-left: 3px solid var(--red);
  background: var(--bg-2);
  padding: .9rem 1.1rem;
  margin: 1.2rem 0; font-size: .92rem;
}
.callout strong { color: var(--red); }

/* Forms */
.form-card {
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 1.6rem;
  margin: 1rem 0 2rem;
  border-top: 3px solid var(--red);
}
.form-card label { display: grid; gap: .35rem; margin-bottom: 1rem; font-family: "JetBrains Mono", Consolas, monospace; font-size: .76rem; color: var(--red); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.form-card input, .form-card textarea, .form-card select {
  font: inherit; font-family: -apple-system, sans-serif; padding: .65rem .85rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-2);
}
.form-card input:focus, .form-card textarea:focus, .form-card select:focus {
  outline: none; border-color: var(--red);
}
.btn {
  display: inline-block; padding: .65rem 1.4rem;
  font-family: "JetBrains Mono", Consolas, monospace; font-weight: 700; font-size: .85rem;
  cursor: pointer; text-transform: uppercase; letter-spacing: .12em;
  border: 1px solid var(--red); background: var(--red); color: var(--bg);
}
.btn:hover { background: var(--bg); color: var(--red); }

/* Footer */
.site-footer {
  background: #000; color: var(--muted);
  padding: 2.4rem 0 1.4rem;
  border-top: 2px solid var(--red);
}
.site-footer a { color: var(--red); }
.site-footer a:hover { color: var(--hi); }
.site-footer .brand-name { color: var(--hi); }
.site-footer .brand-tagline { color: var(--red); }
.footer-grid {
  display: grid; gap: 1.6rem;
  grid-template-columns: 2fr 1fr 1fr;
  margin-bottom: 1.4rem;
}
.site-footer h4 {
  color: var(--red); font-family: "JetBrains Mono", Consolas, monospace; font-size: .76rem;
  margin-bottom: .8rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 700;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: .35rem 0; font-size: .9rem; }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .8rem;
  padding-top: 1.2rem; border-top: 1px solid var(--line);
  font-family: "JetBrains Mono", Consolas, monospace; font-size: .76rem;
}

/* Responsive */
@media (max-width: 880px) {
  .tool-body { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .author-card { grid-template-columns: 1fr; }
  .ticker .item { gap: .35rem; }

  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 100%; right: 4%; left: 4%;
    background: var(--bg); border: 1px solid var(--red);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: .5rem; display: none; z-index: 50;
  }
  .nav.open { display: flex; }
  .nav a { padding: .65rem .85rem; }
  .nav a:hover { background: var(--bg-2); }
}
