/* ==========================================================
   Health Tracker — Legal Pages (Privacy & Terms)
   Shared styles matching the main page aesthetic
   ========================================================== */

/* --- Fonts (self-hosted) --- */
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("/assets/fonts/instrument-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/instrument-serif-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Variables --- */
:root {
  --primary: #0f7b5f;
  --primary-hover: #0c6650;
  --primary-soft: #edf8f4;
  --accent: #e8714a;

  --bg: #faf9f6;
  --bg-alt: #f3f2ee;
  --surface: #ffffff;
  --text: #1a1d23;
  --text-secondary: #505468;
  --text-muted: #8c90a4;
  --border: #e4e2dc;
  --border-light: #eeedea;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --font-serif: "Instrument Serif", "Noto Serif SC", "Songti SC", Georgia, serif;
  --font-sans: "Instrument Sans", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --container: 880px;
}

/* --- Dark Mode --- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111311;
    --bg-alt: #191b19;
    --surface: #1e211e;
    --text: #e4e2dc;
    --text-secondary: #a4a8b4;
    --text-muted: #686c80;
    --border: #2a2d2a;
    --border-light: #232623;
    --primary-soft: rgba(15, 123, 95, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.25);
  }
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- Base --- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  display: block;
}

/* --- Layout --- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================
   Navigation
   ========================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 249, 246, 0.82);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
}

@media (prefers-color-scheme: dark) {
  .nav {
    background: rgba(17, 19, 17, 0.82);
  }
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-sans);
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand:hover {
  color: var(--text);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 450;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link[aria-current="page"] {
  color: var(--text);
  font-weight: 580;
}

.lang-toggle {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--text-secondary);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 5px 16px;
  border-radius: 9999px;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.lang-toggle:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

/* ==========================================================
   Page Header
   ========================================================== */
.page-header {
  padding: clamp(48px, 8vw, 80px) 0 clamp(32px, 5vw, 48px);
  text-align: center;
}

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.page-subtitle {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 20px;
}

.version-badge {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  padding: 6px 18px;
  border-radius: 9999px;
}

/* ==========================================================
   Legal Content
   ========================================================== */
.legal-content {
  padding-bottom: clamp(48px, 8vw, 80px);
}

.legal-content article {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-xl);
  padding: clamp(28px, 5vw, 48px);
  box-shadow: var(--shadow-sm);
}

/* Overview paragraph */
.legal-content article > p:first-child {
  font-size: 1.02rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-light);
}

/* Section headings */
.legal-content h2 {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--text);
  margin: 36px 0 14px;
  padding: 0;
  border: none;
  position: relative;
  padding-left: 16px;
  letter-spacing: 0;
}

.legal-content h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 3px;
  border-radius: 2px;
  background: var(--primary);
}

.legal-content h2:first-of-type {
  margin-top: 0;
}

.legal-content h3 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 10px;
}

/* Paragraphs */
.legal-content p {
  margin: 14px 0;
  color: var(--text-secondary);
  line-height: 1.8;
  text-align: justify;
}

/* Lists */
.legal-content ul {
  list-style: none;
  padding: 0;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legal-content li {
  position: relative;
  padding-left: 20px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.legal-content li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.4;
}

.legal-content strong {
  color: var(--text);
  font-weight: 600;
}

/* ==========================================================
   Purchase Section (Terms page)
   ========================================================== */
.purchase-section {
  background: var(--primary-soft);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 24px;
  margin: 18px 0;
}

.purchase-section h3 {
  color: var(--primary);
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.purchase-option {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 18px;
  margin: 12px 0;
  transition: border-color 0.2s;
}

.purchase-option:hover {
  border-color: var(--border);
}

.purchase-option h4 {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
}

.purchase-option p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==========================================================
   Contact Section
   ========================================================== */
.contact-section {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 28px;
  margin-top: 36px;
}

.contact-section h2 {
  margin: 0 0 12px;
  padding-left: 0;
}

.contact-section h2::before {
  display: none;
}

.contact-section p {
  margin: 0;
}

.contact-email {
  color: var(--primary);
  font-weight: 550;
}

.contact-email:hover {
  text-decoration: underline;
}

/* ==========================================================
   Footer
   ========================================================== */
.footer {
  padding: 36px 0;
  text-align: center;
  border-top: 1px solid var(--border-light);
  margin-top: 0;
}

.footer-copy {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.footer p {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

/* ICP/MPS beian styles */
.footer-beian {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.footer-beian:empty {
  display: none;
}

.footer-beian a {
  color: var(--text-muted);
  transition: color 0.2s;
}

.footer-beian a:hover {
  color: var(--text-secondary);
}

.footer-beian img {
  display: inline-block;
  vertical-align: -2px;
}

.separator {
  display: inline-block;
  margin: 0 8px;
  color: var(--text-muted);
  font-weight: normal;
}

.separator::before {
  content: "|";
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 768px) {
  .container {
    padding: 0 18px;
  }

  .nav-inner {
    padding: 0 18px;
  }

  .nav-brand {
    display: none;
  }

  .nav-links {
    gap: 16px;
  }

  .nav-link {
    font-size: 0.84rem;
  }

  .nav-right {
    width: 100%;
    justify-content: space-between;
  }

  .page-header {
    padding: 36px 0 24px;
  }

  .legal-content article {
    padding: 24px 20px;
    border-radius: var(--r-lg);
  }

  .legal-content h2 {
    font-size: 1.08rem;
  }

  .purchase-section {
    padding: 18px;
  }

  .purchase-option {
    padding: 14px;
  }

  .contact-section {
    padding: 22px;
  }
}
