/* Chronos — Legal pages. Shared by index.html and delete-account.html.
   Visual system mirrors https://chronosintelligentalarm.com/ (chronos-web/docs/index.html)
   and the approved mockup chronos-web/design/Legal.dc.html. */

:root {
  --bg: #0b0912;
  --bg2: #150f24;
  --card: #191426;
  --card-hover: #201933;
  --border: #2b2340;
  --text: #f4f1fb;
  --muted: #a89ec3;
  --accent: #8b6cf0;
  --accent-light: #bcaaf6;           /* fallback for browsers without color-mix() */
  --accent-dim: rgba(139, 108, 240, .16);
  --accent-55: rgba(139, 108, 240, .55);
  --accent-45: rgba(139, 108, 240, .45);
  --warm: #ffb457;
  --cjk: "Hiragino Sans", "Noto Sans CJK SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei";
  --display: 'Outfit', 'Inter', -apple-system, "Segoe UI", Roboto, "Noto Sans", var(--cjk), sans-serif;
  --body: 'Inter', -apple-system, "Segoe UI", Roboto, "Noto Sans", var(--cjk), sans-serif;
  color-scheme: dark;
}
@supports (color: color-mix(in srgb, red 50%, blue)) {
  :root {
    --accent-light: color-mix(in srgb, var(--accent) 58%, #ffffff);
    --accent-dim: color-mix(in srgb, var(--accent) 16%, transparent);
    --accent-55: color-mix(in srgb, var(--accent) 55%, transparent);
    --accent-45: color-mix(in srgb, var(--accent) 45%, transparent);
  }
}

/* Language-specific font stacks so zh / ja / ko never fall back to a poor face. */
:lang(ja) { --cjk: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans CJK JP", "Noto Sans JP", "Yu Gothic", Meiryo; }
:lang(zh) { --cjk: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei", "Hiragino Sans"; }
:lang(ko) { --cjk: "Apple SD Gothic Neo", "Noto Sans CJK KR", "Noto Sans KR", "Malgun Gothic", "Hiragino Sans"; }

* { box-sizing: border-box; }
html { background: var(--bg); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-light); text-decoration: none; }
a:hover { color: #ffffff; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; margin: 0; }
:lang(ja) h1, :lang(ja) h2, :lang(zh) h1, :lang(zh) h2, :lang(ko) h1, :lang(ko) h2 { letter-spacing: 0; }
img { max-width: 100%; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 28px; position: relative; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; border-radius: 6px; }

/* UI strings: one <span data-l="xx"> per language. JS shows the active one; without JS, English. */
html.js [data-l] { display: none; }
html.js[data-lang="en"] [data-l="en"], html.js[data-lang="es"] [data-l="es"], html.js[data-lang="fr"] [data-l="fr"],
html.js[data-lang="de"] [data-l="de"], html.js[data-lang="pt"] [data-l="pt"], html.js[data-lang="it"] [data-l="it"],
html.js[data-lang="zh"] [data-l="zh"], html.js[data-lang="ja"] [data-l="ja"], html.js[data-lang="ko"] [data-l="ko"] { display: inline; }
html:not(.js) [data-l]:not([data-l="en"]) { display: none; }

/* ===== Header ===== */
.top { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  background: rgba(11, 9, 18, 0.66); border-bottom: 1px solid transparent; transition: border-color .3s ease, background .3s ease; }
.top.scrolled { border-bottom-color: var(--border); background: rgba(11, 9, 18, 0.86); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15em; color: var(--text); }
.brand:hover { color: var(--text); }
.brand img { width: 34px; height: 34px; border-radius: 50%; display: block; box-shadow: 0 0 0 1px rgba(139,108,240,.5), 0 0 18px rgba(139,108,240,.45); }
.brand .dot { color: var(--warm); }
.top-right { display: flex; align-items: center; gap: 18px; }
.back { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9em; font-weight: 500; transition: color .15s ease; }
.back:hover { color: var(--text); }
.back svg { width: 16px; height: 16px; flex: none; }
.lang-select { position: relative; display: inline-flex; align-items: center; }
html:not(.js) .lang-select { display: none; }
.lang-select select { appearance: none; -webkit-appearance: none; background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 7px 34px 7px 12px; font: 600 0.86em var(--body); cursor: pointer; transition: border-color .15s ease; }
.lang-select select:hover { border-color: var(--accent-55); }
.lang-select svg { position: absolute; right: 11px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }

/* ===== Hero ===== */
/* overflow: clip (not hidden): a hidden-overflow hero is a scroll container, and navigating to #en … #ko would then
   align the hero itself under the sticky header instead of leaving the page at the top. */
.hero { position: relative; overflow: hidden; overflow: clip; padding: 72px 0 40px; scroll-margin-top: 100vh; }
.glow { position: absolute; width: 760px; height: 520px; left: -220px; top: -220px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(139,108,240,.30), transparent 70%); filter: blur(10px); }
.glow-b { position: absolute; width: 520px; height: 520px; right: -200px; top: -260px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,180,87,.22), transparent 70%); filter: blur(10px); }
.hero-inner { display: flex; flex-direction: column; gap: 16px; }
.kicker { color: var(--accent-light); font-weight: 700; font-size: 0.82em; letter-spacing: .12em; text-transform: uppercase; }
.hero-slot { display: flex; flex-direction: column; gap: 16px; }
.hero-slot:empty { display: none; }
/* The <h1> and its <p class="muted"> are the document's own; JS moves them here. Without JS they stay in the article (see below).
   Navigating to #en … #ko lands on the <h1>: a large scroll margin keeps the whole hero in view instead of tucking the title under the sticky header. */
.hero-slot h1 { scroll-margin-top: 100vh; }
.hero-slot h1, html:not(.js) .doc h1 { font-size: 56px; line-height: 1.04; font-weight: 800;
  background: linear-gradient(135deg, #ffffff 30%, var(--accent-light)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-slot p.muted, html:not(.js) .doc > p.muted { color: var(--muted); font-size: 0.95em; line-height: 1.7; margin: 0; max-width: 720px; }
.hero-slot p.muted a, html:not(.js) .doc > p.muted a { text-decoration: underline; text-decoration-color: var(--accent-45); text-underline-offset: 3px; }
.langs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.langs a { padding: 7px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); color: var(--muted); font-size: 0.86em; font-weight: 600; transition: border-color .15s ease, color .15s ease; }
.langs a:hover { color: var(--text); border-color: var(--accent-55); }
.langs a.on { background: var(--accent-dim); color: var(--accent-light); border-color: var(--accent-55); }

/* ===== Layout: sticky table of contents + article ===== */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 64px; align-items: start; padding: 24px 0 120px; }
.side { position: sticky; top: 92px; }
.toc { display: flex; flex-direction: column; gap: 2px; }
.toc-label { font-size: 0.78em; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; padding: 0 12px; }
.toc-links { display: flex; flex-direction: column; gap: 2px; }
.toc a { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-size: 0.9em; line-height: 1.35; border-left: 2px solid transparent; transition: color .15s ease, background .15s ease; }
.toc a .num { font-family: var(--display); font-weight: 700; color: var(--accent-light); font-size: 0.85em; min-width: 18px; flex: none; }
.toc a:hover { color: var(--text); background: var(--card); }
.toc a.active { color: var(--text); background: var(--card); border-left-color: var(--accent); }
html:not(.js) .layout { grid-template-columns: minmax(0, 1fr); }
html:not(.js) .side { display: none; }
html:not(.js) .doc { margin: 0 auto; }

/* ===== Article ===== */
.doc { max-width: 760px; }
.doc .lang-nav { display: none; }                     /* legacy in-document language nav, replaced by the hero pills */
html.js .doc > :not(section.lang.active) { display: none; }   /* JS shows one language; before JS wraps, nothing flashes */
.doc p, .doc li { color: var(--muted); font-size: 1.02em; line-height: 1.72; }
:lang(ja) .doc p, :lang(ja) .doc li, :lang(zh) .doc p, :lang(zh) .doc li, :lang(ko) .doc p, :lang(ko) .doc li { line-height: 1.85; }
.doc p { margin: 0 0 16px; }
.doc strong { color: var(--text); font-weight: 600; }
/* Summary: the first paragraph of the policy, as a highlighted card */
.doc .lang > p:first-child:not(.muted), html:not(.js) .doc > p.muted + p { font-size: 1.12em; color: var(--text); background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px;
  background-image: radial-gradient(420px 200px at 0% 0%, var(--accent-dim), transparent 70%); }
.doc h2 { font-size: 26px; font-weight: 700; margin: 52px 0 16px; padding-top: 8px; display: flex; gap: 14px; align-items: baseline; scroll-margin-top: 90px; }
.doc h2 .num { color: var(--accent-light); font-size: 0.72em; font-weight: 800; flex: none; }
.doc .lang > h2:first-child { margin-top: 8px; }
.doc ul { margin: 0 0 18px; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.doc li { padding-left: 22px; position: relative; }
.doc li::before { content: ""; position: absolute; left: 4px; top: 0.75em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.doc a { color: var(--accent-light); text-decoration: underline; text-decoration-color: var(--accent-45); text-underline-offset: 3px; }
.doc a:hover { color: #ffffff; }
/* Tables as cards. JS wraps each table in .tablewrap (horizontal scroll on narrow screens); the table carries the card look on its own without JS. */
.doc table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.95em; margin: 6px 0 20px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--card); }
.tablewrap { overflow-x: auto; margin: 6px 0 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.tablewrap table { margin: 0; border: none; border-radius: 0; }
.doc th, .doc td { padding: 12px 16px; text-align: left; vertical-align: top; border-top: 1px solid var(--border); color: var(--muted); line-height: 1.55; }
.doc tr:first-child th, .doc tr:first-child td { border-top: none; }
.doc th { background: var(--bg2); color: var(--text); font-weight: 700; font-size: 0.86em; letter-spacing: .04em; text-transform: uppercase; }
.doc td:first-child { color: var(--text); font-weight: 600; white-space: nowrap; }
/* Without JS: every language stacked, separated as in the original document */
html:not(.js) .doc h1 { font-size: 44px; margin: 0 0 12px; scroll-margin-top: 96px; }
html:not(.js) .doc > p.muted { margin-bottom: 28px; }
html:not(.js) .doc hr.divider { border: none; border-top: 1px solid var(--border); margin: 72px 0 64px; }

/* ===== Footer ===== */
footer { border-top: 1px solid var(--border); padding: 32px 0 44px; color: var(--muted); font-size: 0.9em; }
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.foot-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05em; color: var(--text); }
.foot-brand img { width: 28px; height: 28px; border-radius: 50%; }
.foot-links { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }

@media (max-width: 900px) {
  .wrap { padding: 0 20px; }
  .top-row { gap: 12px; }
  .top-right { gap: 10px; }
  .hero { padding: 48px 0 28px; }
  .hero-slot h1, html:not(.js) .doc h1 { font-size: 36px; }
  .layout { grid-template-columns: 1fr; gap: 24px; padding-bottom: 80px; }
  .side { position: static; }
  .doc h2 { font-size: 22px; margin-top: 40px; }
  .doc td:first-child { white-space: normal; }
  .foot-row { flex-direction: column; text-align: center; gap: 14px; }
}
@media (max-width: 560px) {
  .back-text { display: none; }
  .brand { font-size: 1.05em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
