/* ==========================================================================
   Tunely Privacy Policy — styles.css
   Responsive · Dark-mode · Print-friendly · No external dependencies
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Brand palette */
  --color-accent:        #7C5CFC;
  --color-accent-light:  #9D82FD;
  --color-accent-hover:  #6344E8;

  /* Light-mode surfaces */
  --color-bg:            #F8F7FF;
  --color-surface:       #FFFFFF;
  --color-surface-2:     #F0EEF9;
  --color-border:        #E2DDF8;

  /* Light-mode text */
  --color-text-primary:  #1A1530;
  --color-text-secondary:#4A4468;
  --color-text-muted:    #7A748E;

  /* Header */
  --color-header-bg:     rgba(255, 255, 255, 0.88);
  --color-header-border: rgba(124, 92, 252, 0.15);

  /* Sizing & spacing */
  --header-height:       64px;
  --sidebar-width:       260px;
  --content-max:         760px;
  --layout-gap:          40px;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs:   0.75rem;
  --font-size-sm:   0.875rem;
  --font-size-base: 1rem;
  --font-size-md:   1.125rem;
  --font-size-lg:   1.375rem;
  --font-size-xl:   1.75rem;
  --font-size-2xl:  2.25rem;

  /* Radius & shadow */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --shadow-sm:  0 1px 3px rgba(124, 92, 252, 0.08);
  --shadow-md:  0 4px 16px rgba(124, 92, 252, 0.12);
  --shadow-lg:  0 8px 32px rgba(124, 92, 252, 0.16);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
}

/* --------------------------------------------------------------------------
   2. Dark Mode Overrides
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg:            #0F0D1A;
    --color-surface:       #1A1730;
    --color-surface-2:     #231F3A;
    --color-border:        #2E2950;

    --color-text-primary:  #EDE9FF;
    --color-text-secondary:#B8B0D8;
    --color-text-muted:    #7A748E;

    --color-header-bg:     rgba(15, 13, 26, 0.90);
    --color-header-border: rgba(124, 92, 252, 0.25);
    --color-accent-light:  #A990FE;

    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.40);
    --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.50);
    --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.60);
  }
}

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

html {
  scroll-behavior: smooth;
  /* Offset anchor links so sticky header doesn't cover headings */
  scroll-padding-top: calc(var(--header-height) + 24px);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.7;
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Import Inter from Google Fonts — single request, no JS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   4. Skip Link (Accessibility)
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -999px;
  left: 16px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 8px;
}

/* --------------------------------------------------------------------------
   5. Sticky Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--color-header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-header-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  transition: background var(--transition-normal), box-shadow var(--transition-normal);
}

/* Logo / app name area */
.site-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.site-header__logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: var(--font-size-sm);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.site-header__app-name {
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.3px;
}

.site-header__badge {
  margin-left: auto;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   6. Page Layout (sidebar + content)
   -------------------------------------------------------------------------- */
.page-wrapper {
  display: flex;
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 80px;
  gap: var(--layout-gap);
  align-items: flex-start;
}

/* --------------------------------------------------------------------------
   7. Table of Contents Sidebar
   -------------------------------------------------------------------------- */
.toc-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  /* hide scrollbar but remain scrollable */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.toc-sidebar::-webkit-scrollbar { width: 4px; }
.toc-sidebar::-webkit-scrollbar-track { background: transparent; }
.toc-sidebar::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

.toc-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.toc-card__title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-list a {
  display: block;
  padding: 6px 10px;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  line-height: 1.4;
}

.toc-list a:hover,
.toc-list a:focus-visible {
  background: var(--color-surface-2);
  color: var(--color-accent);
  border-left-color: var(--color-accent);
  outline: none;
}

/* --------------------------------------------------------------------------
   8. Main Content Area
   -------------------------------------------------------------------------- */
.policy-content {
  flex: 1;
  min-width: 0; /* prevent flex blowout */
}

/* Hero / intro card */
.policy-hero {
  background: linear-gradient(135deg, var(--color-accent) 0%, #9D5CFC 60%, #C45CFC 100%);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  margin-bottom: 40px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

/* Decorative background circles */
.policy-hero::before,
.policy-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}

.policy-hero::before {
  width: 220px;
  height: 220px;
  top: -60px;
  right: -60px;
}

.policy-hero::after {
  width: 140px;
  height: 140px;
  bottom: -40px;
  left: 20px;
}

.policy-hero__eyebrow {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  margin-bottom: 10px;
}

.policy-hero__title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 14px;
}

.policy-hero__meta {
  font-size: var(--font-size-sm);
  opacity: 0.85;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.policy-hero__meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Section cards */
.policy-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-height) + 24px);
  transition: box-shadow var(--transition-normal);
}

.policy-section:hover {
  box-shadow: var(--shadow-md);
}

/* Section headings */
.policy-section__heading {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--color-surface-2);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Accent number badge on headings */
.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
  color: #fff;
  font-size: var(--font-size-xs);
  font-weight: 700;
  flex-shrink: 0;
}

/* Sub-headings */
.policy-section h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-top: 24px;
  margin-bottom: 10px;
}

/* Paragraphs & lists */
.policy-section p {
  color: var(--color-text-secondary);
  margin-bottom: 14px;
}

.policy-section p:last-child {
  margin-bottom: 0;
}

.policy-section ul,
.policy-section ol {
  color: var(--color-text-secondary);
  padding-left: 20px;
  margin-bottom: 14px;
}

.policy-section li {
  margin-bottom: 6px;
}

.policy-section ul li::marker {
  color: var(--color-accent);
}

/* Inline links */
.policy-section a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

.policy-section a:hover {
  color: var(--color-accent-hover);
}

/* Info / notice callout box */
.notice-box {
  background: var(--color-surface-2);
  border-left: 3px solid var(--color-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.notice-box strong {
  color: var(--color-text-primary);
}

/* Third-party service card */
.service-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 14px;
}

.service-card__name {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}

.service-card__desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.service-card__link {
  font-size: var(--font-size-sm);
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Permission tag pills */
.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 14px 0;
}

.permission-tag {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-accent);
}

/* Contact table */
.contact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  margin-top: 14px;
  color: var(--color-text-secondary);
}

.contact-table th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-primary);
  padding: 10px 12px;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
}

.contact-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
}

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

/* --------------------------------------------------------------------------
   9. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 36px 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.site-footer__brand {
  font-weight: 700;
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
  margin-bottom: 8px;
}

.site-footer__links {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 12px 0;
}

.site-footer__links a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.site-footer__links a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.site-footer__copy {
  margin-top: 10px;
  font-size: var(--font-size-xs);
}

/* --------------------------------------------------------------------------
   10. Responsive — Tablet & Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .toc-sidebar {
    display: none; /* collapsed on tablet; could be turned into accordion with JS */
  }

  .page-wrapper {
    padding: 32px 20px 60px;
  }

  .policy-hero {
    padding: 32px 24px;
  }

  .policy-hero__title {
    font-size: var(--font-size-xl);
  }

  .policy-section {
    padding: 24px 20px;
  }
}

@media (max-width: 480px) {
  .policy-hero {
    padding: 24px 18px;
  }

  .policy-hero__title {
    font-size: var(--font-size-lg);
  }

  .site-header__badge {
    display: none;
  }

  .page-wrapper {
    padding: 24px 16px 48px;
  }
}

/* --------------------------------------------------------------------------
   11. Focus Styles (Accessibility)
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   12. Print Styles
   -------------------------------------------------------------------------- */
@media print {
  /* Reset layout for print */
  .site-header,
  .toc-sidebar,
  .site-footer {
    display: none !important;
  }

  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
  }

  .page-wrapper {
    display: block;
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  .policy-hero {
    background: none !important;
    color: #000 !important;
    border: 2px solid #000;
    box-shadow: none;
    border-radius: 0;
    padding: 20pt 16pt;
    margin-bottom: 16pt;
  }

  .policy-section {
    border: 1px solid #ccc;
    box-shadow: none;
    border-radius: 0;
    padding: 16pt 12pt;
    margin-bottom: 12pt;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .policy-section__heading {
    font-size: 13pt;
    border-bottom: 1pt solid #ccc;
    margin-bottom: 10pt;
  }

  .section-num {
    background: #000;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .notice-box {
    border-left: 2pt solid #000;
    background: #f5f5f5;
    print-color-adjust: exact;
  }

  .service-card {
    border: 1pt solid #ccc;
    background: #f9f9f9;
    print-color-adjust: exact;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }

  /* Don't show URL expansion for anchors */
  a[href^="#"]::after {
    content: none;
  }
}
