/* ──────────────────────────────────────────────────────────
   eBil — Legal pages stylesheet
   Shared between privacy.html, terms.html, pdpa.html
   ────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --primary: #2d8a4e;
  --primary-dark: #1f6638;
  --primary-soft: #d4e8d9;
  --page-bg: #f6faf7;
  --card-bg: #ffffff;
  --border: #d4e8d9;
  --text-primary: #1a2e22;
  --text-secondary: #44544a;
  --text-muted: #6b7d72;
  --accent-bg: #ecf5ee;
  --shadow-sm: 0 1px 2px rgba(45, 138, 78, 0.04);
  --shadow-md: 0 4px 16px rgba(45, 138, 78, 0.06);

  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

/* ── Top bar ── */
.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.92);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.back-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.back-link:hover {
  background: var(--accent-bg);
  color: var(--primary);
}

/* ── Main layout ── */
.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 24px 96px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
}

@media (min-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 240px;
  }
}

/* ── Page header ── */
.doc-header {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--accent-bg);
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 20px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-variation-settings: "opsz" 144;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 12px;
}

.meta span strong {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Content ── */
.content {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 720px;
}

.content h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 48px 0 16px;
  scroll-margin-top: 96px;
  font-variation-settings: "opsz" 36;
}

.content h2:first-child { margin-top: 0; }

.content h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 17px;
  color: var(--text-primary);
  margin: 28px 0 10px;
}

.content p {
  margin-bottom: 16px;
}

.content ul, .content ol {
  margin: 12px 0 20px 22px;
}

.content li {
  margin-bottom: 8px;
  padding-left: 4px;
}

.content li::marker {
  color: var(--primary);
}

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

.content a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

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

/* Definition / callout block */
.callout {
  background: var(--accent-bg);
  border-left: 3px solid var(--primary);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin: 24px 0;
  font-size: 15px;
}

.callout strong { color: var(--primary-dark); }

/* Data table */
.data-table {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-bg);
}

.data-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--accent-bg);
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-secondary);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table td:first-child {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ── Sidebar TOC ── */
aside.toc {
  display: none;
}

@media (min-width: 960px) {
  aside.toc {
    display: block;
    position: sticky;
    top: 100px;
    align-self: start;
    font-size: 13px;
  }

  .toc-title {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }

  .toc ol {
    list-style: none;
    padding: 0;
  }

  .toc li { margin: 0; }

  .toc a {
    display: block;
    padding: 7px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    line-height: 1.4;
    transition: all 0.15s ease;
  }

  .toc a:hover {
    color: var(--primary);
    background: var(--accent-bg);
  }
}

/* ── Footer ── */
.legal-footer {
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 14px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}

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

.entity-line {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 480px;
}

/* ── Print styles ── */
@media print {
  .topbar, aside.toc, .legal-footer { display: none; }
  .layout { display: block; padding: 0; }
  body { background: white; font-size: 11pt; }
  h1 { font-size: 24pt; }
  .content h2 { font-size: 14pt; page-break-after: avoid; }
  a { color: black; text-decoration: none; }
}
