/* ============================================================
   Equity Dilution Calculator — styles.css
   Mobile-first. No fonts loaded, uses system-ui.
   ============================================================ */

:root {
  --accent: #2D6CDF;
  --accent-soft: #EAF1FD;
  --accent-dark: #1E4FA8;
  --ink: #0F172A;
  --ink-2: #334155;
  --ink-3: #64748B;
  --line: #E2E8F0;
  --line-2: #CBD5E1;
  --bg: #FFFFFF;
  --bg-soft: #F8FAFC;
  --bg-card: #FFFFFF;
  --ok: #10B981;
  --warn: #F59E0B;
  --bad: #EF4444;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 4px 14px rgba(15, 23, 42, 0.07), 0 12px 32px rgba(15, 23, 42, 0.08);
  --focus: 0 0 0 3px rgba(45, 108, 223, 0.3);
  --max-w: 1200px;
  --content-w: 760px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  color: var(--ink);
  line-height: 1.25;
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.7rem, 4vw, 2.25rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.65rem); margin-top: 2em; }
h3 { font-size: 1.08rem; margin-top: 1.5em; }

p { margin: 0 0 1em; color: var(--ink-2); }

/* ------------------- layout ------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(8px);
  background: rgba(255, 255, 255, 0.9);
}
.site-header .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-dot {
  display: inline-block;
  width: 20px; height: 20px;
  border-radius: 5px;
  background: var(--accent);
  position: relative;
}
.brand-dot::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 2px;
  background: #fff;
  transform: scale(0.55);
}
.meta-updated {
  font-size: 0.82rem;
  color: var(--ink-3);
}

main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px;
}

.hero {
  padding: 6px 0 18px;
  max-width: 780px;
}
.hero h1 { margin-bottom: 10px; }
.hero-sub {
  font-size: 1.05rem;
  color: var(--ink-2);
  max-width: 640px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 1024px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 32px;
    align-items: flex-start;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 70px;
}
@media (max-width: 1023px) { .sidebar { position: static; } }

.ad-slot {
  border: 1px dashed var(--line-2);
  background: var(--bg-soft);
  color: var(--ink-3);
  font-size: 0.78rem;
  text-align: center;
  padding: 16px;
  min-height: 250px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.ad-slot.ad-inline { min-height: 90px; margin: 28px 0; }

/* ------------------- calculator card ------------------- */

.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 22px;
}
@media (min-width: 640px) { .calc-card { padding: 28px; } }

.calc-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: -6px -6px 20px;
  padding: 0 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.calc-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
}
.calc-tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.calc-tab:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.tab-panel { display: none; }
.tab-panel[data-active="true"] { display: block; }

.perspective-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  padding: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.perspective-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-3);
  padding: 0 10px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.perspective-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-2);
  border-radius: 6px;
  cursor: pointer;
  min-height: 36px;
  transition: background 100ms, color 100ms, border-color 100ms, box-shadow 100ms;
}
.perspective-btn:hover { background: #fff; }
.perspective-btn[aria-checked="true"] {
  background: #fff;
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.perspective-btn:focus-visible { outline: none; box-shadow: var(--focus); }
@media (max-width: 520px) {
  .perspective-label { width: 100%; padding: 4px 4px 0; }
  .perspective-btn { flex: 1; padding: 8px 6px; font-size: 0.82rem; }
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}
@media (min-width: 768px) {
  .quick-grid { grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
}

.field {
  display: block;
  margin-bottom: 14px;
}
[hidden] { display: none !important; }
.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  margin-bottom: 6px;
}
.tip {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 11px; font-weight: 700;
  cursor: help;
  position: relative;
}
.tip:focus { outline: none; box-shadow: var(--focus); }
.tip .tip-body {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-weight: 400;
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 8px 10px;
  border-radius: 6px;
  width: max-content;
  max-width: 240px;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 5;
  white-space: normal;
}
.tip:hover .tip-body,
.tip:focus .tip-body,
.tip:active .tip-body { opacity: 1; }

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-prefix {
  display: inline-flex;
  align-items: center;
  padding-left: 12px;
  color: var(--ink-3);
  font-weight: 600;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  height: 44px;
}
.input-suffix {
  display: inline-flex;
  align-items: center;
  padding-right: 12px;
  color: var(--ink-3);
  font-weight: 600;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  height: 44px;
}
.input-prefix + input, input.has-prefix { border-top-left-radius: 0; border-bottom-left-radius: 0; }
input.has-suffix { border-top-right-radius: 0; border-bottom-right-radius: 0; }

input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: var(--focus); }

input[type="range"] {
  width: 100%;
  height: 24px;
  background: transparent;
  -webkit-appearance: none; appearance: none;
}
input[type="range"]:focus { outline: none; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; background: var(--line); border-radius: 3px;
}
input[type="range"]::-moz-range-track {
  height: 5px; background: var(--line); border-radius: 3px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  margin-top: -8px;
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
}
input[type="range"]:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(45,108,223,0.25); }

.slider-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 4px;
}

.results {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.result-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.95rem;
  gap: 8px;
}
.result-row .label { color: var(--ink-3); }
.result-row .value { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.result-big {
  font-size: 1.05rem;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid rgba(45,108,223,0.25);
  color: var(--accent-dark);
  font-weight: 600;
}
.result-big .num {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: block;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.result-summary {
  font-size: 0.95rem;
  color: var(--ink-2);
  padding-top: 4px;
  border-top: 1px dashed var(--line);
  margin-top: 2px;
}

/* ------------------- chart ------------------- */

.chart-wrap {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 540px) {
  .chart-wrap { grid-template-columns: 1fr 1fr; gap: 18px; }
}
.donut {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.donut-title {
  font-size: 0.85rem;
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.donut svg { width: 100%; max-width: 180px; height: auto; }
.donut-legend {
  display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 0.82rem; color: var(--ink-2);
  justify-content: center;
}
.donut-legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ------------------- actions ------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  transition: background 120ms, border-color 120ms, transform 50ms;
}
.btn:hover { background: var(--bg-soft); border-color: var(--line-2); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 6px 0;
  text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

/* ------------------- advanced / cap table ------------------- */

.stakeholder-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.stakeholder-row input { min-height: 40px; }
.remove-btn {
  width: 40px; height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 18px;
}
.remove-btn:hover { color: var(--bad); border-color: var(--bad); }

.cap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 16px;
}
.cap-table th, .cap-table td {
  padding: 10px 8px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.cap-table th:first-child, .cap-table td:first-child { text-align: left; }
.cap-table th {
  font-size: 0.78rem;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  background: var(--bg-soft);
}
.cap-table tr:last-child td { border-bottom: none; }
.cap-table .dilution-pos { color: var(--bad); }
.cap-table .dilution-neg { color: var(--ok); }

.cap-table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }

.summary-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.summary-box {
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.summary-box .label { font-size: 0.78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.summary-box .value { font-size: 1.1rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 4px; }

/* ------------------- waterfall ------------------- */

.waterfall-rounds {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.round-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--bg-soft);
}
.round-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 600px) {
  .round-card-grid { grid-template-columns: repeat(4, 1fr); }
}
.round-card-grid label { font-size: 0.8rem; color: var(--ink-3); font-weight: 600; }
.round-card input { background: #fff; }

.waterfall-chart-wrap {
  margin-top: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.waterfall-svg { width: 100%; height: 260px; display: block; }

/* ------------------- content sections ------------------- */

.content {
  max-width: var(--content-w);
  margin: 48px 0 0;
}
.content p, .content li { color: var(--ink-2); }
.content ol, .content ul { padding-left: 1.2em; }
.content li { margin-bottom: 6px; }

.definition-block {
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--accent-soft);
  margin: 20px 0;
}
.definition-block p:last-child { margin-bottom: 0; }
.definition-block .formula {
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 0.92rem;
  color: var(--ink);
  display: inline-block;
  margin-top: 6px;
}

.example-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 14px 0 20px;
  background: #fff;
  box-shadow: var(--shadow);
}
.example-card h3 { margin-top: 0; }
.example-card table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.9rem;
}
.example-card th, .example-card td {
  padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left;
}
.example-card th { font-weight: 600; color: var(--ink-3); background: var(--bg-soft); }

dl.glossary dt { font-weight: 700; color: var(--ink); margin-top: 14px; }
dl.glossary dd { margin: 4px 0 0; color: var(--ink-2); }

.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 14px 0;
}
.benchmark-table th, .benchmark-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.benchmark-table th { background: var(--bg-soft); color: var(--ink-3); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }

.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: #fff;
}
.faq details[open] { background: var(--bg-soft); }
.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  font-size: 1rem;
  list-style: none;
  padding-right: 24px;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0; top: 0;
  font-weight: 300;
  font-size: 22px;
  color: var(--ink-3);
  line-height: 1;
}
.faq details[open] summary::after { content: "−"; }
.faq summary:focus { outline: none; }
.faq summary:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
.faq p { margin-top: 10px; }

/* ------------------- cookie banner ------------------- */

.cookie {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 50;
  font-size: 0.9rem;
  max-width: 540px;
  margin: 0 auto;
}
.cookie.show { display: flex; }
.cookie button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  flex-shrink: 0;
}
.cookie a { color: var(--accent-soft); }

/* ------------------- footer ------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 60px;
  padding: 26px 20px;
  color: var(--ink-3);
  font-size: 0.88rem;
  text-align: center;
}
.site-footer a { color: var(--ink-2); margin: 0 8px; }

/* ------------------- print ------------------- */

@media print {
  .site-header, .sidebar, .ad-slot, .actions, .cookie, .site-footer,
  .calc-tabs, .btn, .tip, .advanced-toggle, .waterfall-chart-wrap {
    display: none !important;
  }
  body { font-size: 11pt; color: #000; background: #fff; }
  .calc-card { box-shadow: none; border: 1px solid #888; }
  .results { background: #fff; border-color: #888; }
  .content { max-width: none; }
  .donut svg { max-width: 160px; }
  a { color: #000; text-decoration: none; }
  main { padding: 0; max-width: none; }
  h2 { page-break-after: avoid; }
  .cap-table th { background: #eee; color: #000; }
}

/* ------------------- noscript ------------------- */
.noscript-note {
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  color: #78350F;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
