/* Pathium site: shared styles (tokens, theme, switch, footer, article pages). */

/* Registered so the browser can animate them smoothly. */
@property --l { syntax: "<number>"; inherits: true; initial-value: 0.70; }
@property --c { syntax: "<number>"; inherits: true; initial-value: 0.20; }
@property --h { syntax: "<number>"; inherits: true; initial-value: 405; }

:root {
  /* Same palette as the app's five tab accents: Train, Move, Recover, Timers, Track. */
  --blue:   #2190f5;
  --green:  #33d973;
  --teal:   #6bc7d1;
  --red:    #f03038;
  --orange: #ff6b1f;

  --bg: #000;
  --text: #fff;
  --muted: rgba(255, 255, 255, 0.62);
  --card: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.12);

  --accent: var(--orange);
  --glow-lo: 0.12;
  --glow-hi: 0.30;
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f5;
  --text: #141414;
  --muted: rgba(0, 0, 0, 0.55);
  --card: rgba(0, 0, 0, 0.05);
  --line: rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Morphing accent: drifts through the app's five tab colors.
   Animated by hue (not by blending two colors) so every in-between
   shade stays vivid instead of passing through gray. */
@supports (color: oklch(0.6 0.2 30)) {
  .stage {
    --accent: oklch(var(--l) var(--c) var(--h));
    animation: morph 36s linear infinite;
  }
}
@keyframes morph {
  0%   { --l: 0.66; --c: 0.19; --h: 250; } /* blue   (Train)   */
  22%  { --l: 0.62; --c: 0.23; --h: 384; } /* red    (Timers)  */
  30%  { --l: 0.70; --c: 0.20; --h: 405; } /* orange (Track)   */
  56%  { --l: 0.77; --c: 0.20; --h: 513; } /* green  (Move)    */
  76%  { --l: 0.79; --c: 0.11; --h: 565; } /* teal   (Recover) */
  100% { --l: 0.66; --c: 0.19; --h: 610; } /* back to blue     */
}
@media (prefers-reduced-motion: reduce) {
  .stage { animation: none; }
}

/* Dark / light switch */
.theme-switch {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  z-index: 10;
  width: 64px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px;
  -webkit-tap-highlight-color: transparent;
}
.theme-switch svg { width: 16px; height: 16px; position: relative; z-index: 1; transition: color 0.25s ease; }
.theme-switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.9;
  transition: transform 0.3s cubic-bezier(.4, 0, .2, 1);
}
/* Knob sits under the icon for the active mode: sun = light, moon = dark. */
:root[data-theme="light"] .theme-switch .knob { transform: translateX(0); }
:root[data-theme="dark"]  .theme-switch .knob { transform: translateX(30px); }
:root[data-theme="light"] .theme-switch .sun,
:root[data-theme="dark"]  .theme-switch .moon { color: #fff; }
.theme-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Footer */
footer {
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.8;
}
footer a { color: inherit; text-underline-offset: 3px; }
footer a:hover { color: var(--text); }
.foot-links a { text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.foot-links .sep { margin: 0 8px; opacity: 0.6; }

/* Article pages (Privacy, Terms, and later Support / Manual) */
.site-header {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 20px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 0.95rem;
}
.brand img { width: 30px; height: 30px; border-radius: 7px; box-shadow: 0 0 0 1px var(--line); }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }

.article {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  flex: 1;
  padding: 36px 20px 24px;
  line-height: 1.65;
  font-size: 1.02rem;
}
.article h1 {
  margin: 0 0 18px;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(2rem, 7vw, 2.6rem);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.article .meta {
  margin: 0 0 32px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--muted);
}
.article .meta strong { color: var(--text); font-weight: 600; }
.article h2 {
  margin: 38px 0 10px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.article h2:first-of-type { border-top: 0; padding-top: 0; }
.article p { margin: 0 0 14px; color: var(--muted); }
.article p strong, .article li strong { color: var(--text); font-weight: 600; }
.article ul { margin: 0 0 16px; padding-left: 1.2em; color: var(--muted); }
.article li { margin: 0 0 8px; padding-left: 4px; }
.article li::marker { color: var(--accent); }
.article a { color: var(--accent); text-underline-offset: 3px; }
.article a:hover { filter: brightness(1.15); }
.article :target { scroll-margin-top: 20px; }

@media print {
  .theme-switch, footer { display: none; }
  body { background: #fff; color: #000; }
  .article p, .article ul, .article .meta { color: #222; }
}
