@import url('design-tokens.css');

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

*:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

h1, h2, h3, h4, h5 {
  letter-spacing: -0.01em;
}
h1, h2, h3, .h1, .h2, .h3 {
  color: var(--heading-accent);
}
h4, h5, h6, .h4, .h5, .h6 {
  color: var(--heading-accent);
}

/* Content links use the theme accent so they match the red/orange palette
   in both dark and light modes (Bootstrap's default link color is blue).
   Colors are muted per mode so they stay readable without glaring. */
a {
  color: var(--link-color);
  text-decoration-color: color-mix(in srgb, var(--link-color) 45%, transparent);
  text-underline-offset: 2px;
}
a:hover,
a:focus {
  color: var(--link-hover);
}

img { max-width: 100%; height: auto; }
.container { max-width: var(--container-max); }

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0.5rem;
  background: var(--accent);
  color: var(--accent-text);
  padding: var(--space-xs) var(--space-sm);
  text-decoration: none;
  border-radius: var(--border-radius);
  z-index: 2000;
}
.skip-link:focus { top: 0.5rem; }

/* Header */
.site-header {
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1020;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-heading);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--font-size-xl);
  letter-spacing: -0.02em;
}
.site-logo {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

/* Map Bootstrap navbar variables to our theme tokens so the active link,
   hover states and toggler use theme-aware colors in both modes. */
.navbar {
  --bs-navbar-color: var(--text-secondary);
  --bs-navbar-hover-color: var(--text-heading);
  --bs-navbar-active-color: var(--accent-hover);
  --bs-navbar-brand-color: var(--text-heading);
  --bs-navbar-brand-hover-color: var(--text-heading);
  --bs-navbar-toggler-border-color: var(--border-color);
}

/* Always-visible actions (theme toggle + hamburger) pinned to the top-right on mobile */
.navbar-actions {
  margin-left: auto;
}
/* On desktop the nav sits after this group, so drop the auto margin (two auto
   margins would split the free space and make the gap to the menu inconsistent)
   and use a fixed gap that matches the spacing between nav items. */
@media (min-width: 992px) {
  .navbar-actions {
    margin-left: 1rem;
  }
}

.nav-link {
  color: var(--text-secondary);
  padding: 0.5rem 0.9rem;
  border-radius: var(--border-radius);
  font-weight: 500;
}
.nav-link:hover,
.nav-link:focus {
  color: var(--text-heading);
  background-color: var(--bg-tertiary);
}
.nav-link.active {
  color: var(--accent-hover);
  font-weight: 700;
}
.nav-link.active:hover,
.nav-link.active:focus {
  color: var(--accent-hover);
  background-color: var(--bg-tertiary);
}

.navbar-toggler {
  border-color: var(--border-color);
}
.navbar-toggler-icon {
  filter: invert(var(--theme-invert, 1));
}

/* Theme toggle - the button previews the theme it will switch TO.
   Dark mode active -> light button (sun). Light mode active -> dark button (moon). */
.theme-toggle {
  background: #f2ecdf;
  border: 1px solid #e3d9c6;
  color: #1b1712;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover,
.theme-toggle:focus {
  filter: brightness(0.93);
}

[data-theme="light"] .theme-toggle {
  background: #1b1712;
  color: #f5e6c4;
  border-color: #3a3129;
}
[data-theme="light"] .theme-toggle:hover,
[data-theme="light"] .theme-toggle:focus {
  filter: brightness(1.18);
}

/* Show the icon/label of the TARGET theme */
.theme-toggle .icon-moon,
.theme-toggle .label-dark { display: none; }

[data-theme="light"] .theme-toggle .icon-sun,
[data-theme="light"] .theme-toggle .label-light { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: inline-flex; }
[data-theme="light"] .theme-toggle .label-dark { display: inline; }

/* Hero */
.hero {
  position: relative;
  padding: var(--space-2xl) 0;
  background-image: var(--gradient-hero);
  background-color: var(--bg-primary);
  overflow: hidden;
}

.hero-title {
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.15;
  margin-bottom: var(--space-md);
}

.text-gradient {
  background: var(--heading-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-text {
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
  max-width: 58ch;
  margin-bottom: var(--space-lg);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-heading);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  margin-bottom: var(--space-md);
}
.hero-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 10px var(--accent-3);
}

.hero-art {
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card);
  width: 100%;
}

/* Phone screenshot in the hero - thin glowing accent border, no thick bezel */
.hero-phone {
  max-width: 320px;
  border-radius: 1.5rem;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid rgba(220, 38, 38, 0.4);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: 0 0 30px -6px rgba(220, 38, 38, 0.5), var(--shadow-lg);
}
.hero-phone img {
  display: block;
  width: 100%;
  height: auto;
}

/* Responsive screenshots gallery: full-width on mobile, growing to 3 columns */
.screenshot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.screenshot-grid .shot {
  margin: 0;
  aspect-ratio: 9 / 19;
  border-radius: 1rem;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid rgba(220, 38, 38, 0.45);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 28px -8px rgba(220, 38, 38, 0.55), 0 12px 30px -16px rgba(0, 0, 0, 0.7);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.screenshot-grid .shot:hover {
  transform: translateY(-4px);
  border-color: rgba(220, 38, 38, 0.7);
  box-shadow: 0 0 32px -6px rgba(220, 38, 38, 0.6), 0 16px 34px -16px rgba(0, 0, 0, 0.75);
}
.screenshot-grid .shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
@media (min-width: 640px) {
  .screenshot-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 992px) {
  .screenshot-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  height: 100%;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.card-title { color: var(--heading-accent); }
.card-text { color: var(--text-secondary); }

/* Feature icon chip */
.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-accent);
  color: #fff;
  margin-bottom: var(--space-sm);
  box-shadow: var(--shadow-accent);
}

/* Buttons */
.btn {
  border-radius: var(--border-radius);
  font-weight: 600;
  gap: 0.4rem;
}
.btn svg {
  width: 1.05em;
  height: 1.05em;
  flex: 0 0 auto;
}
.btn-lg { padding: 0.75rem 1.4rem; }

.btn-primary {
  background: var(--gradient-accent);
  border: none;
  color: var(--accent-text);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--gradient-accent);
  filter: brightness(1.1);
  color: var(--accent-text);
}

.btn-outline-secondary {
  border: 1px solid var(--border-color);
  color: var(--text-heading);
  background: transparent;
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background-color: var(--bg-tertiary);
  border-color: var(--accent);
  color: var(--text-heading);
}

/* Accent outline button - clearly reads as a button */
.btn-outline-primary {
  border: 1.5px solid var(--accent);
  color: var(--accent-hover);
  background: transparent;
  font-weight: 600;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--gradient-accent);
  border-color: transparent;
  color: var(--accent-text);
  box-shadow: var(--shadow-accent);
}

/* Sections */
.section { padding: var(--space-xl) 0; }
.section-alt {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.section-title {
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: var(--space-lg);
  color: var(--heading-accent);
}
/* Soft lighter-to-darker theme gradient on section headings.
   Transparent fill is applied only when background-clip: text is supported,
   so the solid fallback above is never lost. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .section-title,
  .hero-title {
    background: var(--heading-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--heading-accent);
  margin-bottom: 0.5rem;
}

/* Tables - override Bootstrap's --bs-table-bg (white) so tables follow the theme */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: var(--border-color);
  color: var(--text-primary);
  background-color: transparent;
  border-color: var(--border-color);
  margin-bottom: 0;
}
.table thead th {
  background-color: var(--bg-secondary);
  color: var(--text-heading);
  border-color: var(--border-color);
  border-bottom: 2px solid var(--border-color);
  font-weight: 600;
}
.table td, .table th { border-color: var(--border-color); }

/* Alerts */
.alert-warning {
  background-color: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--text-primary);
  border-radius: var(--border-radius);
}

/* Accordion */
.accordion-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius) !important;
  overflow: hidden;
}
.accordion-button {
  background-color: var(--bg-card);
  color: var(--text-heading);
  font-weight: 600;
}
.accordion-button:not(.collapsed) {
  background-color: var(--bg-tertiary);
  color: var(--text-heading);
  box-shadow: none;
}
.accordion-button::after {
  filter: invert(var(--theme-invert, 1));
}
.accordion-button:focus {
  box-shadow: none;
  border-color: var(--accent);
}
.accordion-body { color: var(--text-primary); }

/* Breadcrumb */
.breadcrumb { background-color: transparent; padding: 0; margin-bottom: var(--space-md); }
.breadcrumb-item a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--link-hover); }
.breadcrumb-item.active { color: var(--text-primary); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-secondary); }

/* Table of contents */
.toc {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  margin: var(--space-md) 0 var(--space-lg);
}
.toc-title {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.toc-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.toc-list li + li { margin-top: 0.35rem; }
.toc-list a { color: var(--text-secondary); text-decoration: none; }
.toc-list a:hover { color: var(--link-hover); }

/* Related links */
.related-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}
.related-list a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.related-list a:hover {
  color: var(--link-hover);
  border-bottom-color: currentColor;
}

/* In-content image used on guide / login pages (portrait app screenshots).
   Sits in its own grid column next to the text, so it is centered in the column
   with no vertical margin (the row's `gy-*` handles the stacked (mobile) gap). */
.content-image {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  margin: 0 auto;
  border-radius: 1rem;
  background: var(--bg-card);
  border: 1px solid rgba(220, 38, 38, 0.35);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 0 22px -8px rgba(220, 38, 38, 0.45), 0 12px 30px -16px rgba(0, 0, 0, 0.7);
}

/* Steps */
.step {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px dashed var(--border-color);
}
.step:last-child { border-bottom: none; }
.steps-narrow { max-width: 760px; }
.step-num {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: var(--space-xl) 0 var(--space-lg);
  color: var(--text-secondary);
}
.footer-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--heading-accent);
  margin-bottom: 1rem;
}
.footer-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-list li { margin-bottom: 0.35rem; }
.footer-link {
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0;
}
.footer-link::before {
  content: "\203A";
  color: var(--link-color);
  font-weight: 700;
}
.footer-link:hover,
.footer-link:focus { color: var(--link-hover); }

/* Mobile menu download CTA */
.mobile-cta { padding: 0 0.25rem; }

/* Mobile sticky download bar */
.mobile-download-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
}
.mobile-download-bar .btn { flex: 1; }

/* Utilities */
.text-muted { color: var(--text-secondary) !important; }
.border { border-color: var(--border-color) !important; }
.bg-secondary { background-color: var(--bg-secondary) !important; }

/* Touch targets */
.btn, .nav-link, .theme-toggle, .footer-link { min-height: 44px; }
.btn, .nav-link, .theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.footer-link, .accordion-button { min-height: 44px; }
.accordion-button { display: flex; }

/* ---------- Mobile refinements (<=767px) ---------- */
@media (max-width: 767.98px) {
  .mobile-download-bar { display: flex; }
  body.has-mobile-bar { padding-bottom: 82px; }

  /* Center hero content and CTAs on small screens */
  .hero { text-align: center; }
  .hero-text { margin-left: auto; margin-right: auto; }
  .cta-row { justify-content: center; }

  /* Center section headings */
  .section-title,
  .eyebrow { text-align: center; }

  /* Feature cards: bigger, centered icons and text */
  .feature-card { text-align: center; }
  .feature-card .feature-icon {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    margin-left: auto;
    margin-right: auto;
  }
  .feature-card .feature-icon svg { width: 32px; height: 32px; }
  .feature-card .card-text { margin-left: auto; margin-right: auto; }
  .feature-card .btn { margin-left: auto; margin-right: auto; }

  /* Center step titles */
  .howto-intro { text-align: center; }
}
