/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Colors */
  --bg-color: #0f172a;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-red: #ff0000;
  --accent-red-hover: #cc0000;
  --card-bg: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);
  --status-green: #22c55e;
  --status-amber: #f59e0b;

  /* ── Space scale (fluid: scales with viewport) ──
     clamp(min, preferred, max) shrinks on small screens,
     expands on large ones — no magic numbers needed.        */
  --space-xs: clamp(8px, 1.5vw, 12px);
  --space-sm: clamp(12px, 2vw, 20px);
  --space-md: clamp(20px, 3vw, 30px);
  --space-lg: clamp(32px, 5vw, 60px);
  --space-xl: clamp(48px, 7vw, 100px);

  /* ── Layout ──
     Container uses width: min(95%, 100% - 2rem) pattern:
     • 95%    → 2.5% gutter on each side on mid/large screens
     • 100% - 2rem → guarantees ≥ 1rem (16px) edge margin on tiny phones
     Whichever is smaller wins, so the layout never touches screen edges. */
  --container-max: 1100px;

  /* ── Header ── */
  --header-height: 73px; /* keep in sync with actual rendered height */

  /* ── Typography scale (fluid) ── */
  --text-h1: clamp(2rem, 6vw, 4rem);
  --text-h2: clamp(1.6rem, 4vw, 2.5rem);
  --text-h3: clamp(1.1rem, 2.5vw, 1.5rem);
  --text-body: clamp(1rem, 1.5vw, 1.25rem);
  --text-sm: 0.94rem;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.95);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px rgba(255, 0, 0, 0.45);
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10000;
  transform: translateY(-140%);
  border-radius: 8px;
  background: var(--text-primary);
  color: var(--bg-color);
  font-weight: 800;
  padding: 10px 14px;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   AMBIENT BACKGROUND
   ============================================================ */
.glass-bg {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 0, 0, 0.05) 0%, rgba(15, 23, 42, 0) 50%);
  z-index: -1;
  pointer-events: none;
}

/* ============================================================
   LAYOUT CONTAINER
   ============================================================ */
.container {
  max-width: var(--container-max);
  /* Never touches screen edges: at least 16px each side on tiny phones,
     2.5% gutter each side on larger viewports — whichever is smaller.  */
  width: min(95%, 100% - 2rem);
  margin-inline: auto;
}

/* ============================================================
   HEADER & NAV
   ============================================================ */
header {
  border-bottom: 1px solid var(--border-color);
  padding: 20px 0;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* All anchor targets clear the sticky navbar on every device */
section[id],
[id].anchor-alias {
  scroll-margin-top: var(--header-height, 73px);
}

.header-content {
  display: grid;
  /* 3-column: logo on left | nav-links centered | actions on right */
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  /* Mirror container: ≥ 1rem (16px) on each edge, grows to 2.5% on wider screens */
  padding: 0 max(1rem, 2.5%);
  gap: var(--space-sm);
}

.logo {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.logo-img {
  height: 32px;
  width: auto;
}

.version-badge {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  padding: 5px 8px;
}

/* Hidden on desktop; shown via media query below */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  /* Accessibility: large enough tap target on touch devices */
  min-width: 44px;
  min-height: 44px;
}

nav {
  /* nav spans all 3 columns when open on mobile; on desktop
     it is auto-sized and placed in the center column        */
  display: contents; /* let nav-links and nav-actions participate in the grid */
}

/* ── Center column: the section links ── */
.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 0;
  /* Center column in the grid */
  grid-column: 2;
}

/* Pipe separator: appears before every link except the first */
.nav-links a + a::before {
  content: '|';
  color: var(--text-secondary);
  font-weight: 400;
  opacity: 0.5;
  padding: 0 10px;
  pointer-events: none;
  user-select: none;
}

.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: color 0.2s;
  white-space: nowrap;
  padding: 4px 2px;
}

.nav-links a:hover {
  color: var(--accent-red);
}

/* ── Right column: Nav icons ── */
.nav-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  grid-column: 3;
  gap: 8px;
}

.language-select {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.language-select select {
  appearance: none;
  min-width: 172px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(45deg, transparent 50%, var(--text-primary) 50%) right 18px center / 6px 6px
      no-repeat,
    linear-gradient(135deg, var(--text-primary) 50%, transparent 50%) right 12px center / 6px 6px
      no-repeat,
    rgba(15, 23, 42, 0.72);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0 42px 0 16px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.language-select select:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background-color: rgba(30, 41, 59, 0.88);
}

.language-select option {
  background: var(--bg-color);
  color: var(--text-primary);
  font-weight: 600;
}

.github-icon-btn,
.linkedin-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  transition:
    color 0.2s,
    background 0.2s,
    transform 0.2s;
  text-decoration: none;
}

.github-icon-btn:hover,
.linkedin-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.1);
}

.github-icon-btn:hover {
  color: var(--accent-red);
}

.linkedin-icon-btn:hover {
  color: #0a66c2;
}

.github-icon-btn svg,
.linkedin-icon-btn svg {
  display: block;
  flex-shrink: 0;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-lg);
}

.hero h1 {
  font-size: var(--text-h1);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: var(--space-sm);
  letter-spacing: 0;
}

.highlight {
  color: var(--accent-red);
  background: linear-gradient(90deg, #ff0000, #ff4d4d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: var(--text-body);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-md);
}

/* ============================================================
   CTA BUTTONS
   ============================================================ */
.cta-group {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.btn {
  padding: clamp(10px, 2vw, 14px) clamp(20px, 3vw, 28px);
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    background 0.2s;
  overflow-wrap: anywhere;
  text-align: center;
}

.primary-btn {
  background-color: var(--accent-red);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
}

.primary-btn:hover {
  background-color: var(--accent-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 0, 0, 0.4);
}

.secondary-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid var(--border-color);
}

.secondary-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* ============================================================
   FEATURE SECTIONS
   ============================================================ */
.features {
  padding: var(--space-lg) 0;
  text-align: center;
}

.features h2 {
  font-size: var(--text-h2);
  margin-bottom: var(--space-md);
}

/* ============================================================
   CARDS GRID
   ============================================================ */
.grid {
  display: grid;
  /* min(300px, 100%) prevents overflow on narrow phones */
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: var(--space-md);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: clamp(24px, 4vw, 40px) clamp(20px, 3vw, 30px);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  transition: transform 0.3s;
  text-align: left;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.2);
}

.icon {
  font-size: clamp(2rem, 4vw, 2.5rem);
  margin-bottom: var(--space-sm);
}

.card h3 {
  font-size: var(--text-h3);
  margin-bottom: var(--space-xs);
}

.card p {
  color: var(--text-secondary);
}

.section-intro {
  max-width: 800px;
  margin: 0 auto 2rem;
  color: var(--text-secondary);
}

/* ============================================================
   DOWNLOAD CARDS
   ============================================================ */
.download-grid {
  align-items: stretch;
}

.download-card {
  display: flex;
  flex-direction: column;
}

.download-card p {
  flex: 1;
}

.browser-logo {
  display: block;
  width: clamp(42px, 7vw, 56px);
  height: clamp(42px, 7vw, 56px);
  margin-bottom: var(--space-sm);
  object-fit: contain;
}

.download-btn {
  display: inline-block;
  margin-top: var(--space-md);
  text-align: center;
}

.install-steps {
  text-align: left;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ============================================================
   ANCHOR ALIAS (invisible scroll target helper)
   ============================================================ */
.anchor-alias {
  height: 0;
  visibility: hidden;
}

/* ============================================================
   STATUS PILLS
   ============================================================ */
.status-pill {
  align-self: flex-start;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
  margin-top: var(--space-md);
  padding: 10px 12px;
}

.status-pill.coming-soon {
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: var(--status-green);
}

.status-pill.pending {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--status-amber);
}

/* ============================================================
   ACCORDION (Auto-Like Modes)
   ============================================================ */
.accordion-list {
  display: grid;
  gap: var(--space-sm);
  margin: 0 auto;
  /* min(820px, 100%) prevents overflow when container is narrow */
  max-width: min(820px, 100%);
  text-align: left;
  width: 100%;
}

.mode-accordion {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.mode-accordion summary {
  cursor: pointer;
  font-size: clamp(1rem, 2vw, 1.12rem);
  font-weight: 700;
  list-style: none;
  padding: clamp(14px, 2.5vw, 18px) clamp(16px, 3vw, 22px);
}

.mode-accordion summary::-webkit-details-marker {
  display: none;
}

.mode-accordion summary::after {
  color: var(--accent-red);
  content: '+';
  float: right;
  font-weight: 800;
}

.mode-accordion[open] summary::after {
  content: '-';
}

.mode-accordion p {
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: var(--space-sm) clamp(16px, 3vw, 22px) var(--space-md);
}

/* ============================================================
   PRIVACY BANNER
   ============================================================ */
.privacy-banner {
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.1), rgba(0, 0, 0, 0));
  border: 1px solid var(--border-color);
  border-radius: clamp(16px, 3vw, 24px);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  margin: var(--space-lg) auto;
}

.privacy-banner h2 {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  margin-bottom: var(--space-sm);
}

.privacy-banner p {
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.1rem);
  max-width: 600px;
  margin: 0 auto var(--space-md);
}

.text-link {
  color: var(--accent-red);
  text-decoration: none;
  font-weight: 600;
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.text-link:hover {
  text-decoration: underline;
}

/* ============================================================
   THANKS
   ============================================================ */
.thanks-section {
  padding: var(--space-lg) 0;
  text-align: center;
}

.thanks-section h2 {
  font-size: var(--text-h2);
  margin-bottom: var(--space-sm);
}

.thanks-section p {
  max-width: 680px;
  margin: 0 auto var(--space-md);
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.thanks-links {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  border-top: 1px solid var(--border-color);
  padding: var(--space-lg) 0;
  margin-top: var(--space-lg);
  color: var(--text-secondary);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.links {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

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

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

/* ============================================================
   RESPONSIVE — HAMBURGER NAV  (≤ 1120px)
   Covers large tablets, small laptops, and everything smaller
   ============================================================ */
@media (max-width: 1120px) {
  /* Switch header back to flex so the hamburger toggle works */
  .header-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0;
  }

  .menu-toggle {
    display: flex;
  }

  /* nav becomes a hidden full-width flex column; shown on .open */
  nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    padding: var(--space-sm) 0 var(--space-xs);
    gap: var(--space-xs);
  }

  nav.open {
    display: flex;
  }

  /* nav-links stacks vertically, centered */
  .nav-links {
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0;
    grid-column: unset;
  }

  /* Hide the pipe separators on mobile — they look wrong stacked */
  .nav-links a + a::before {
    display: none;
  }

  .nav-links a {
    font-size: 1.05rem;
    padding: 10px 0;
    white-space: normal;
    width: 100%;
    text-align: center;
    /* WCAG touch target: at least 44×44px */
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* GitHub icon centered below the links */
  .nav-actions {
    justify-content: center;
    padding: var(--space-xs) 0;
    grid-column: unset;
  }

  /* Full-width stacked CTA buttons on narrow screens */
  .cta-group {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .download-btn,
  .status-pill {
    align-self: stretch;
    justify-content: center;
  }
}

/* ============================================================
   RESPONSIVE — TABLET  (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
    justify-content: center;
  }

  .links {
    justify-content: center;
  }
}

/* ============================================================
   RESPONSIVE — SMALL PHONE  (≤ 480px)
   Extra tweaks for 320–480 px viewports
   ============================================================ */
@media (max-width: 480px) {
  /* Logo slightly smaller so it doesn't crowd the hamburger */
  .logo {
    font-size: 1.2rem;
    gap: 8px;
  }

  .logo-img {
    height: 28px;
  }

  /* Softer card corners feel less cramped on tiny screens */
  .card {
    border-radius: 14px;
  }

  /* Extra padding-right so +/− indicator never overlaps text */
  .mode-accordion summary {
    padding-right: 40px;
  }

  .privacy-banner {
    border-radius: 12px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    justify-content: center;
  }
}
/* ============================================================
   VIEWPORT WARNING OVERLAY
   Base rule shows the overlay; the media query at the bottom
   hides it when the viewport is within the supported range.
   Order matters — the media query MUST come last so it wins.
   ============================================================ */

/* 1. Base: overlay is always present in the DOM */
.viewport-warning {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: vw-fade-in 0.3s ease both;
}

@keyframes vw-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.viewport-warning__box {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(255, 0, 0, 0.15),
    0 24px 60px rgba(0, 0, 0, 0.5);
  max-width: 420px;
  width: 100%;
  padding: 40px 36px;
  text-align: center;
  animation: vw-slide-up 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes vw-slide-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.viewport-warning__icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 16px;
  display: block;
}

.viewport-warning__title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.viewport-warning__body {
  font-size: 0.97rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.viewport-warning__body strong {
  color: var(--accent-red);
  font-weight: 700;
}

.viewport-warning__hint {
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.55);
  font-style: italic;
}

/* 2. Override: hide overlay when viewport is within the supported range.
      MUST be last so it beats the display:flex above in the cascade.    */
@media (min-width: 280px) and (max-width: 3840px) {
  .viewport-warning {
    display: none;
  }
}
