/* ─── Variables ─── */
:root {
  --bg: #030304;
  --bg-elevated: #0a0a0c;
  --surface: #111114;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f0f0f2;
  --text-muted: #8a8a94;
  --silver: #c8c8d0;
  --accent: #e8e8f0;
  --glow: rgba(200, 200, 220, 0.15);
  --gradient: linear-gradient(135deg, #fff 0%, #a0a0b0 50%, #fff 100%);
  --font: 'Inter', system-ui, sans-serif;
  --radius: 16px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ─── Intro: Buconero animation ─── */
.intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.intro.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#buconero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.intro-vortex {
  position: relative;
  width: 200px;
  height: 200px;
  z-index: 2;
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.7);
  border-right-color: rgba(200, 200, 220, 0.2);
  animation: spin linear infinite;
}

.ring-1 { inset: 0;    animation-duration: 3s;   opacity: 0.9; }
.ring-2 { inset: 12px; animation-duration: 2.4s; animation-direction: reverse; opacity: 0.75; border-top-color: rgba(220, 220, 240, 0.6); }
.ring-3 { inset: 24px; animation-duration: 1.8s; opacity: 0.6; }
.ring-4 { inset: 36px; animation-duration: 2.8s; animation-direction: reverse; opacity: 0.45; }
.ring-5 { inset: 48px; animation-duration: 1.4s; opacity: 0.3; border-width: 0.5px; }

.intro-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #666 40%, #000 70%);
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.4), 0 0 80px rgba(255, 255, 255, 0.1);
  animation: pulse-core 1.5s ease-in-out infinite;
}

.intro-label {
  margin-top: 2.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--silver);
  z-index: 2;
  animation: fade-label 2s ease-in-out infinite alternate;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-core {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(255,255,255,0.4); }
  50% { transform: scale(1.15); box-shadow: 0 0 60px rgba(255,255,255,0.6); }
}

@keyframes fade-label {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

/* ─── Main layout ─── */
.main {
  transition: opacity 0.6s ease;
}

.main.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Header ─── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(3, 3, 4, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 40px;
  height: auto;
}

.brand-text {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brand-accent {
  color: var(--silver);
  font-weight: 400;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

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

.nav-cta {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text) !important;
}

.nav-cta:hover {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.15);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

/* ─── Hero ─── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7rem 2rem 4rem;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(120, 120, 140, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 80% 80%, rgba(80, 80, 100, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 720px;
  z-index: 1;
}

.hero-logo {
  width: min(280px, 70vw);
  margin: 0 auto 1rem;
  filter: drop-shadow(0 8px 32px rgba(255, 255, 255, 0.08));
}

.hero-tagline {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.35em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

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

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.hero-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 500px;
  height: 500px;
  margin: -250px 0 0 -250px;
  pointer-events: none;
  opacity: 0.15;
}

.orbit-ring {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  animation: spin 20s linear infinite;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 10px;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--silver);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--surface);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

/* ─── Sections ─── */
.section-header {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 3.5rem;
}

.section-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--silver);
  margin-bottom: 0.75rem;
}

.section-header h2 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ─── Apps grid ─── */
.apps {
  padding: 6rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.app-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
}

.app-card.featured {
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(160deg, #141418 0%, #0e0e12 100%);
}

.app-card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, var(--glow) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.app-card:hover .app-card-glow {
  opacity: 1;
}

.app-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--silver);
}

.app-icon {
  width: 100%;
  max-width: 140px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 0.35rem;
}

.app-card[data-app="grading"] .app-icon {
  box-shadow: 0 8px 32px rgba(140, 80, 220, 0.2);
}

.app-card[data-app="book"] .app-icon {
  background: transparent;
  border: none;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(60, 120, 220, 0.3);
}

.app-card[data-app="book"] .app-icon img {
  padding: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border-radius: 20px;
}

.app-card[data-app="centering"] .app-icon {
  box-shadow: 0 8px 32px rgba(40, 160, 255, 0.2);
}

.app-card h3 {
  width: 100%;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-align: center;
}

.app-card > p {
  width: 100%;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.65;
}

.app-features {
  list-style: none;
  width: 100%;
  margin-bottom: 1.5rem;
}

.app-features li {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.35rem 0;
  padding-left: 1.25rem;
  position: relative;
}

.app-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--silver);
  opacity: 0.5;
}

.store-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: auto;
  padding-top: 0.5rem;
}

.store-badges--single {
  justify-content: center;
}

.store-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  line-height: 0;
  border-radius: 8px;
  transition: transform var(--transition), opacity var(--transition);
}

.store-badge:hover {
  transform: translateY(-2px);
  opacity: 0.92;
}

.store-badge img {
  display: block;
  height: 40px;
  width: auto;
  max-width: min(155px, 46vw);
  object-fit: contain;
}

/* Card accent colors on hover */
.app-card[data-app="grading"]:hover { --glow: rgba(180, 200, 255, 0.12); }
.app-card[data-app="book"]:hover { --glow: rgba(220, 200, 255, 0.12); }
.app-card[data-app="centering"]:hover { --glow: rgba(200, 255, 220, 0.1); }

/* ─── About ─── */
.about {
  padding: 5rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 4rem;
  align-items: center;
}

.about-text h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.about-text .section-label {
  margin-bottom: 0.5rem;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 0.95rem;
  line-height: 1.75;
}

.about-text strong {
  color: var(--text);
}

.about-closing {
  color: var(--silver);
  font-weight: 500;
}

.about-stats {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stat {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── Contact ─── */
.contact {
  padding: 4rem 2rem 6rem;
  max-width: 640px;
  margin: 0 auto;
}

.contact-box {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.04) 0%, transparent 60%);
}

.contact-box h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.contact-box p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* ─── Footer ─── */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-logo {
  opacity: 0.6;
  width: 36px;
}

.footer-legal {
  font-size: 0.72rem;
  opacity: 0.75;
  max-width: 28rem;
  text-align: center;
  line-height: 1.5;
}

.footer-link {
  font-size: 0.8rem;
  color: var(--silver);
  transition: color var(--transition);
}

.footer-link:hover {
  color: var(--text);
}

.legal-dl {
  display: grid;
  gap: 0.85rem 1.25rem;
  margin: 0;
}

@media (min-width: 520px) {
  .legal-dl {
    grid-template-columns: minmax(140px, 38%) 1fr;
  }
}

.legal-dl dt {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--silver);
  margin: 0;
}

.legal-dl dd {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ─── Nav dropdown (Help) ─── */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition);
}

.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
  color: var(--text);
}

.nav-dropdown-chevron {
  transition: transform var(--transition);
}

.nav-dropdown.open .nav-dropdown-chevron {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.65rem);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 240px;
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
  z-index: 200;
}

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
}

.nav-dropdown-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.nav-dropdown-item:hover,
.nav-dropdown-item[aria-current="page"] {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* ─── Help pages ─── */
.page-help .header {
  position: sticky;
}

.help-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 6.5rem 2rem 4rem;
}

.help-back {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  transition: color var(--transition);
}

.help-back:hover {
  color: var(--text);
}

.help-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.help-app-logo {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.help-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin: 0.35rem 0 0.5rem;
  letter-spacing: -0.02em;
}

.help-hero p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

.help-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.help-accordion-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  scroll-margin-top: 6rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.help-accordion-item.is-open {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.help-accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.15rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}

.help-accordion-trigger:hover {
  background: rgba(255, 255, 255, 0.03);
}

.help-accordion-chevron {
  flex-shrink: 0;
  color: var(--silver);
  transition: transform var(--transition), color var(--transition);
}

.help-accordion-item.is-open .help-accordion-chevron {
  transform: rotate(180deg);
  color: var(--text);
}

.help-accordion-panel {
  border-top: 1px solid transparent;
}

.help-accordion-item.is-open .help-accordion-panel {
  border-top-color: var(--border);
}

.help-accordion-panel .help-content {
  padding: 0 1.15rem 1.25rem;
}

.help-accordion-panel .help-content > :first-child {
  margin-top: 0.75rem;
}

.help-section {
  margin-bottom: 3rem;
  scroll-margin-top: 6rem;
}

.help-content {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.75;
}

.help-content p {
  margin-bottom: 0.75rem;
}

.help-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 0.65rem;
}

.help-content h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--silver);
  margin: 1rem 0 0.5rem;
}

.help-meta {
  color: var(--text);
  margin-bottom: 1.25rem;
}

.help-content ul,
.help-content ol {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}

.help-content li {
  margin-bottom: 0.4rem;
}

.help-lead {
  color: var(--text);
}

.help-callout {
  padding: 1rem 1.15rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--text-muted);
}

.help-placeholder {
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-style: italic;
}

.help-email {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.help-email:hover {
  color: var(--silver);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .apps-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin: 0 auto;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about-stats {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .stat {
    flex: 1;
    min-width: 120px;
  }
}

@media (max-width: 640px) {
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 1rem 2rem 1.5rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    gap: 1rem;
  }

  .nav.open {
    display: flex;
  }

  .menu-toggle {
    display: flex;
  }

  .header {
    flex-wrap: wrap;
    position: relative;
  }

  .hero {
    padding-top: 2rem;
  }

  .nav-dropdown-menu {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    display: none;
    margin-top: 0.5rem;
    box-shadow: none;
    width: 100%;
  }

  .nav-dropdown.open .nav-dropdown-menu {
    display: block;
    transform: none;
  }

  .help-hero {
    flex-direction: column;
    text-align: center;
  }

}
