/* Shared styles for the standalone legal pages (tos.html, privacy.html) */

:root {
  --brand: #d6628f;
  --brand-strong: #b84a7a;
  --brand-strong-hover: #a03f69;
  --brand-soft: #fdf2f7;
  --ink: #101828;
  --text: #344054;
  --muted: #475467;
  --soft: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --surface: #ffffff;
  --bg: #f6f7f9;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 14px 36px rgba(16, 24, 40, 0.06);
  --radius: 18px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Top bar ---------------------------------------------------------------- */

.legal-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.legal-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1080px, calc(100% - 32px));
  height: 68px;
  margin: 0 auto;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}

.legal-brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(214, 98, 143, 0.18);
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.legal-brand-mark svg {
  width: 18px;
  height: 18px;
}

.legal-brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.legal-brand-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legal-brand-copy span {
  color: var(--soft);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.legal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legal-nav-link {
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.legal-nav-link:hover {
  background: #f2f4f7;
  color: var(--ink);
}

.legal-nav-link.is-active {
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 600;
}

.legal-dashboard-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  margin-left: 8px;
  padding: 0 14px;
  border-radius: 9px;
  background: var(--brand-strong);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.legal-dashboard-btn:hover {
  background: var(--brand-strong-hover);
}

.legal-dashboard-btn svg {
  width: 15px;
  height: 15px;
}

/* Article --------------------------------------------------------------- */

.legal-main {
  width: min(920px, calc(100% - 40px));
  margin: 28px auto 0;
  padding-bottom: 56px;
}

.legal-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 4px 14px;
  color: var(--soft);
  font-size: 12.5px;
}

.legal-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.legal-breadcrumb a:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

.legal-breadcrumb .sep {
  color: var(--line-strong);
}

.legal-card {
  padding: 44px 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.legal-head {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.legal-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid rgba(214, 98, 143, 0.16);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.legal-head h1 {
  margin: 16px 0 8px;
  color: var(--ink);
  font-family: var(--font-heading);
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.legal-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

.legal-updated {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 0;
  color: var(--soft);
  font-size: 12.5px;
}

.legal-updated svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.legal-content h2 {
  margin: 30px 0 8px;
  color: var(--ink);
  font-family: var(--font-heading);
  font-size: 17.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

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

.legal-content p {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 15px;
}

.legal-content ul {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--text);
}

.legal-content li {
  margin: 6px 0;
  font-size: 15px;
}

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

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

.legal-content a {
  color: var(--brand-strong);
  text-underline-offset: 2px;
}

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.legal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.legal-btn svg {
  width: 15px;
  height: 15px;
}

.legal-btn-primary {
  background: var(--brand-strong);
  color: #ffffff;
}

.legal-btn-primary:hover {
  background: var(--brand-strong-hover);
}

.legal-btn-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.legal-btn-secondary:hover {
  background: #f9fafb;
  border-color: #98a2b3;
}

/* Footer ---------------------------------------------------------------- */

.legal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 40px;
  color: var(--soft);
  font-size: 12.5px;
}

.legal-footer p {
  margin: 0;
}

.legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.legal-footer a {
  color: var(--muted);
  text-decoration: none;
}

.legal-footer a:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

/* Responsive ------------------------------------------------------------ */

@media (max-width: 760px) {
  .legal-topbar-inner {
    width: calc(100% - 24px);
    height: 60px;
  }

  .legal-brand-copy span {
    display: none;
  }

  .legal-nav-link {
    display: none;
  }

  .legal-dashboard-btn {
    height: 36px;
    margin-left: 0;
    padding: 0 12px;
    font-size: 12.5px;
  }

  .legal-main {
    width: calc(100% - 28px);
    margin-top: 18px;
    padding-bottom: 40px;
  }

  .legal-breadcrumb {
    margin-bottom: 10px;
  }

  .legal-card {
    padding: 26px 20px;
    border-radius: 14px;
  }

  .legal-head {
    margin-bottom: 22px;
    padding-bottom: 18px;
  }

  .legal-head h1 {
    font-size: 26px;
  }

  .legal-actions {
    flex-direction: column;
    margin-top: 28px;
    padding-top: 22px;
  }

  .legal-btn {
    width: 100%;
  }

  .legal-footer {
    flex-direction: column;
    align-items: flex-start;
    width: calc(100% - 28px);
    padding-bottom: 32px;
  }
}

@media (max-width: 400px) {
  .legal-brand-copy strong {
    max-width: 140px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .legal-topbar,
  .legal-breadcrumb,
  .legal-actions,
  .legal-footer {
    display: none !important;
  }

  .legal-main {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .legal-card {
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}

/* ==========================================
   Dark theme
   Pilihan disimpan theme.js di localStorage (invoicegen_theme).
   ========================================== */
[data-theme="dark"] {
  color-scheme: dark;

  --brand-soft: #3a2230;
  --brand-strong: #f2b3cb;
  --brand-strong-hover: #f8c9db;
  --ink: #e3e6ea;
  --text: #c3cad3;
  --muted: #a7b0bd;
  --soft: #8b93a1;
  --line: #2b313a;
  --line-strong: #3a424e;
  --surface: #1b1e24;
  --bg: #15171b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 14px 36px rgba(0, 0, 0, 0.55);
}

/* Tombol terisi: teks gelap di atas pink terang, 7,4:1 */
[data-theme="dark"] .legal-dashboard-btn,
[data-theme="dark"] .legal-btn-primary {
  background: #e985ab;
  color: #171013;
}

[data-theme="dark"] .legal-dashboard-btn:hover,
[data-theme="dark"] .legal-btn-primary:hover {
  background: #f2a3c1;
}

[data-theme="dark"] .legal-topbar {
  background: rgba(21, 23, 27, 0.94);
}

[data-theme="dark"] .legal-nav-link:hover {
  background: var(--surface-muted);
}

[data-theme="dark"] .legal-btn-secondary:hover {
  background: var(--surface-subtle);
  border-color: var(--line-strong);
}

/* ==========================================
   Theme toggle
   ========================================== */
.legal-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.legal-theme-toggle:hover {
  background: var(--surface-subtle);
  color: var(--ink);
}

.legal-theme-toggle svg {
  width: 17px;
  height: 17px;
}

.legal-theme-toggle .theme-icon-sun {
  display: none;
}

.legal-theme-toggle[aria-pressed="true"] .theme-icon-moon {
  display: none;
}

.legal-theme-toggle[aria-pressed="true"] .theme-icon-sun {
  display: block;
}
