/* cellTrainer website — mirrors the App's About-page look:
   system font, rounded cards, accent colors per section.

   Theme is controlled by html[data-theme] (set by inline script in _layout.html
   based on localStorage 'theme' = auto|light|dark). The user toggles via the
   theme button in the header. Default = dark when JS off; @media fallback at
   the bottom flips to light if the system prefers light AND no data-theme is set. */

:root {
  --accent-mint:    #34c79a;
  --accent-pink:    #ea4d80;
  --accent-orange:  #f08a3a;
  --accent-blue:    #0a84ff;
  --accent-indigo:  #7d7bf0;
  --accent-purple:  #b07ccc;
  --accent-gray:    #98989e;
  --accent-accent:  var(--accent-blue);

  --radius:    16px;
  --radius-sm: 12px;
  --max-w:     1100px;
}

/* Dark (default) */
:root,
:root[data-theme="dark"] {
  --bg:        #0a0a0c;
  --bg-grad:   radial-gradient(at 20% 0%, rgba(10, 132, 255, 0.10), transparent 50%),
               radial-gradient(at 80% 0%, rgba(94, 92, 230, 0.08), transparent 50%);
  --surface:   rgba(28, 28, 32, 0.78);
  --surface-2: rgba(44, 44, 50, 0.55);
  --border:    rgba(255, 255, 255, 0.10);
  --text:      #f2f2f7;
  --text-2:    #b0b0b8;
  --text-3:    #76767c;
  --link:      #4dabf7;
  --shadow:    0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Light (explicit user choice) */
:root[data-theme="light"] {
  --bg:        #f5f5f7;
  --bg-grad:   radial-gradient(at 20% 0%, rgba(10, 132, 255, 0.08), transparent 50%),
               radial-gradient(at 80% 0%, rgba(94, 92, 230, 0.06), transparent 50%);
  --surface:   rgba(255, 255, 255, 0.78);
  --surface-2: rgba(255, 255, 255, 0.50);
  --border:    rgba(0, 0, 0, 0.10);
  --text:      #1d1d1f;
  --text-2:    #5b5b62;
  --text-3:    #86868b;
  --link:      #0066cc;
  --shadow:    0 4px 12px rgba(0, 0, 0, 0.06);
}

/* No-JS fallback: honor system preference if data-theme never got set */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:        #f5f5f7;
    --bg-grad:   radial-gradient(at 20% 0%, rgba(10, 132, 255, 0.08), transparent 50%),
                 radial-gradient(at 80% 0%, rgba(94, 92, 230, 0.06), transparent 50%);
    --surface:   rgba(255, 255, 255, 0.78);
    --surface-2: rgba(255, 255, 255, 0.50);
    --border:    rgba(0, 0, 0, 0.10);
    --text:      #1d1d1f;
    --text-2:    #5b5b62;
    --text-3:    #86868b;
    --link:      #0066cc;
    --shadow:    0 4px 12px rgba(0, 0, 0, 0.06);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Header ─────────────────────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 32px; height: 32px;
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.brand-name { font-size: 17px; }

.site-nav {
  display: flex;
  gap: 18px;
  margin-left: auto;
  font-size: 15px;
}
.site-nav a {
  color: var(--text-2);
  padding: 4px 0;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }

.lang-toggle-slot { min-width: 0; }
.lang-toggle {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface-2);
}
.lang-toggle:hover { color: var(--text); text-decoration: none; }

/* Theme toggle — three-state cycle (auto / light / dark).
   Only the icon for the current data-theme-pref is shown. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.theme-toggle:hover {
  color: var(--text);
  background: var(--surface);
}
.theme-icon { display: none; }
[data-theme-pref="auto"]  .theme-toggle .theme-icon[data-icon="auto"],
[data-theme-pref="light"] .theme-toggle .theme-icon[data-icon="light"],
[data-theme-pref="dark"]  .theme-toggle .theme-icon[data-icon="dark"] {
  display: inline;
}

/* ── Main / sections ────────────────────────────────── */

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 8px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-icon {
  font-size: 22px;
  line-height: 1;
}

/* per-accent title color */
.accent-mint   .section-icon { color: var(--accent-mint); }
.accent-pink   .section-icon { color: var(--accent-pink); }
.accent-orange .section-icon { color: var(--accent-orange); }
.accent-blue   .section-icon { color: var(--accent-blue); }
.accent-indigo .section-icon { color: var(--accent-indigo); }
.accent-purple .section-icon { color: var(--accent-purple); }
.accent-gray   .section-icon { color: var(--accent-gray); }
.accent-accent .section-icon { color: var(--accent-accent); }

/* ── Hero ───────────────────────────────────────────── */

.hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 24px;
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--accent-blue) 14%, transparent),
              transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.hero-logo {
  width: 76px; height: 76px;
  border-radius: 18%;
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
  flex-shrink: 0;
}
.hero h1 {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, sans-serif;
}
.hero-tagline {
  margin: 0;
  color: var(--text-2);
  font-size: 16px;
}

/* ── Grids ──────────────────────────────────────────── */

.grid {
  display: grid;
  gap: 14px;
}
.grid-features {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.grid-devices {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ── Feature cards (left accent stripe) ─────────────── */

.feature {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 14px 14px 18px;
}
.feature::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--accent-blue);
}
.feature-mint::before   { background: var(--accent-mint); }
.feature-pink::before   { background: var(--accent-pink); }
.feature-orange::before { background: var(--accent-orange); }
.feature-blue::before   { background: var(--accent-blue); }
.feature-indigo::before { background: var(--accent-indigo); }

.feature h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
}
.feature p {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

/* ── Device cards ───────────────────────────────────── */

.device {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.device header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.device h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.device p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}
.badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-standard {
  color: #1c8a4a;
  background: rgba(48, 181, 138, 0.18);
}
.badge-vendor {
  color: #b85d00;
  background: rgba(232, 115, 12, 0.18);
}

.caveat {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

/* ── Credits ────────────────────────────────────────── */

.credits {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.credits li {
  font-size: 14px;
  padding-left: 22px;
  position: relative;
}
.credits li::before {
  content: "♦";
  position: absolute;
  left: 0; top: 0;
  color: var(--accent-purple);
}
.credit-body { color: var(--text-2); font-size: 13px; }

/* ── Privacy CTA ────────────────────────────────────── */

.cta {
  display: inline-block;
  margin-top: 6px;
  font-weight: 600;
}

/* ── Imprint ────────────────────────────────────────── */

.imprint {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  align-items: baseline;
}
.imprint dt {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
.imprint dd {
  margin: 0;
  font-size: 15px;
}
.imprint-note {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

/* ── Prose (rendered Markdown for /privacy) ─────────── */

.prose {
  font-size: 15px;
  line-height: 1.65;
}
.prose h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.prose h2 {
  font-size: 21px;
  font-weight: 700;
  margin: 32px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.prose h2:first-of-type { border-top: none; padding-top: 0; }
.prose h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 22px 0 6px;
}
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin: 4px 0; }
.prose code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.prose pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
}
.prose pre code { border: none; padding: 0; background: none; }
.prose blockquote {
  border-left: 3px solid var(--border);
  margin: 12px 0;
  padding: 4px 16px;
  color: var(--text-2);
}
.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.prose table {
  border-collapse: collapse;
  font-size: 14px;
  margin: 12px 0;
}
.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 6px 12px;
  text-align: left;
}
.prose th {
  background: var(--surface-2);
  font-weight: 600;
}

/* ── Footer ─────────────────────────────────────────── */

.site-footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--text-2); }

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 600px) {
  .site-header { flex-wrap: wrap; gap: 12px; }
  .site-nav { margin-left: 0; }
  .hero { flex-direction: column; text-align: center; }
  .hero-logo { width: 64px; height: 64px; }
  .imprint { grid-template-columns: 1fr; gap: 4px; }
  .imprint dd { margin-bottom: 12px; }
}
