/* Log Dyno web theme: the app's look (colors, fonts, white rounded buttons with soft shadows), light and dark.
   Light = the app's own palette. Dark = the same accents on dark surfaces.
   Theme: <html data-theme="light|dark"> set by /assets/theme.js; without it the device setting decides. */

@font-face { font-family: "Titillium Web"; src: url("fonts/TitilliumWeb-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Exo 2"; src: url("fonts/Exo2-Medium.otf") format("opentype"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #ecf0f1;            /* app background */
  --surface: #ffffff;       /* app cards / buttons */
  --text: #4e4e4e;          /* app text grey */
  --strong: #111111;
  --muted: #7b8285;
  --line: #dce2e4;
  --accent: #5aadff;        /* app's selected / active blue */
  --run: #e32b2b;           /* app's first run color: power solid, torque at 59% */
  --run-torque: rgba(227, 43, 43, 0.59);
  --run-2: #2b80e3;
  --run-3: #16bc19;
  --chart-bg: #ffffff;
  --chart-grid: #cfcfcf;
  --chart-label: #000000;
  --tip-bg: rgba(0, 0, 0, 0.75);
  --tip-text: #ffffff;
  --watermark: rgba(227, 43, 43, 0.10);
  --shadow: 2px 3px 6px rgba(0, 0, 0, 0.16);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.10);
  --radius: 10px;
  --font-body: "Titillium Web", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ui: "Exo 2", "Titillium Web", system-ui, sans-serif;
  --font-result: "Montserrat", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121618;
  --surface: #1d2327;
  --text: #c9d1d5;
  --strong: #ffffff;
  --muted: #8e999f;
  --line: #2e373d;
  --run: #f03c3c;
  --run-torque: rgba(240, 60, 60, 0.59);
  --chart-bg: #1d2327;
  --chart-grid: #3a444a;
  --chart-label: #dde3e6;
  --tip-bg: rgba(0, 0, 0, 0.85);
  --watermark: rgba(240, 60, 60, 0.09);
  --shadow: 2px 3px 8px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.45);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121618;
    --surface: #1d2327;
    --text: #c9d1d5;
    --strong: #ffffff;
    --muted: #8e999f;
    --line: #2e373d;
    --run: #f03c3c;
    --run-torque: rgba(240, 60, 60, 0.59);
    --chart-bg: #1d2327;
    --chart-grid: #3a444a;
    --chart-label: #dde3e6;
    --tip-bg: rgba(0, 0, 0, 0.85);
    --watermark: rgba(240, 60, 60, 0.09);
    --shadow: 2px 3px 8px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 var(--font-body); }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-ui); font-weight: 500; color: var(--strong); line-height: 1.2; margin: 0 0 .6em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* App-style button: white rounded slot with a soft drop shadow, grey text. */
.app-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 .95rem var(--font-ui); color: var(--text); text-decoration: none; white-space: nowrap;
  background: var(--surface); border: 0; border-radius: 8px; padding: .55rem 1.1rem;
  box-shadow: var(--shadow); cursor: pointer;
}
.app-btn:hover { color: var(--strong); }
.app-btn:active { transform: translateY(1px); box-shadow: 1px 1px 3px rgba(0, 0, 0, .2); }
.app-btn:disabled { opacity: .5; cursor: default; }
.app-btn.primary { color: var(--accent); }

/* Header (shared) */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 62px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--strong); text-decoration: none; font: 500 1.15rem var(--font-ui); }
.brand img { border-radius: 8px; }
.brand .wordmark { border-radius: 0; height: 30px; width: auto; }
.footer .brand .wordmark { height: 24px; }
.topbar-links { display: flex; gap: 20px; margin-left: auto; }
.topbar-links a { color: var(--text); text-decoration: none; font-size: .95rem; }
.topbar-links a:hover { color: var(--accent); }
.topbar-end { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-links + .topbar-end { margin-left: 0; }

.theme-toggle {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: var(--bg); color: var(--text); cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: inline; }
}

/* Footer (shared) */
.footer { padding: 32px 0 40px; }
.footer-inner { max-width: 1120px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.footer .brand { font-size: 1rem; }
.footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.footer nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.footer nav a:hover { color: var(--accent); }
.footer .copy { margin: 0 0 0 auto; color: var(--muted); font-size: .88rem; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .topbar-inner { padding: 0 16px; gap: 10px; }
  .topbar-links { display: none; }
  .footer-inner { padding: 0 16px; }
  .footer .copy { margin-left: 0; width: 100%; }
}
