/* Shared design system — premium dark-forest branding, glassmorphism,
   layout primitives, navbar/footer, and micro-animations. */

:root {
  --brand: #10b981; /* Premium Emerald */
  --brand-dark: #064e3b; /* Dark Forest Green */
  --brand-bright: #34d399; /* Mint Green */
  --brand-bright-dark: #059669;
  --brand-light: rgba(16, 185, 129, 0.1);
  --ink: #f3f4f6; /* Off-white for dark mode */
  --ink-soft: #9ca3af; /* Muted gray */
  --ink-faint: #6b7280; /* Darker gray */
  --bg: #070d0b; /* Deep Dark Green-Black background */
  --bg-soft: #0c1512; /* Slightly lighter container background */
  --bg-card: rgba(15, 26, 23, 0.65);
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(52, 211, 153, 0.25);
  --err: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5);
  --max-width: 1120px;
  --wallpaper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M40 0l2 2-2 2-2-2zm0 80l2-2-2-2-2 2zm40-40l-2 2-2-2 2-2zm-80 0l2 2 2-2-2-2z' fill='%2310b981' fill-opacity='0.03'/%3E%3Ccircle cx='40' cy='40' r='1' fill='%2310b981' fill-opacity='0.06'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--brand-dark);
  border-radius: 99px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--brand);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  font-family:
    "Outfit",
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
  background-image: var(--wallpaper);
}

/* Background Glowing Orbs */
.orb-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}
.orb-green {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0) 70%);
}
.orb-mint {
  background: radial-gradient(circle, rgba(52, 211, 153, 0.12) 0%, rgba(52, 211, 153, 0) 70%);
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
  color: #ffffff;
}

p {
  margin: 0 0 16px;
  color: var(--ink-soft);
}

a {
  color: inherit;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 2;
}

.section {
  padding: 100px 0;
  position: relative;
  overflow: hidden;
}

.section--soft {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-bright);
  margin-bottom: 16px;
}

.eyebrow::before {
  content: "✦";
  font-size: 12px;
}

.section-heading {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 64px;
}

.section-heading h2 {
  font-size: clamp(28px, 4vw, 42px);
  background: linear-gradient(135deg, #ffffff 30%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 18px;
}

.section-heading p {
  font-size: 18px;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  border-radius: 99px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn:hover::after {
  opacity: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-bright) 0%, var(--brand) 100%);
  color: #030712;
  box-shadow: 0 4px 20px rgba(52, 211, 153, 0.25);
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(52, 211, 153, 0.4);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-pulse {
  animation: btn-pulse-glow 2.5s infinite;
}

@keyframes btn-pulse-glow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(52, 211, 153, 0.25);
  }
  50% {
    box-shadow: 0 4px 32px rgba(52, 211, 153, 0.55);
  }
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--brand-bright);
  color: var(--brand-bright);
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
}

/* ── Navbar ─────────────────────────────────────────────────────────────── */

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 13, 11, 0.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}

.navbar.is-scrolled {
  background: rgba(7, 13, 11, 0.9);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.navbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.03em;
}

.logo-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(52, 211, 153, 0.3));
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.navbar-links a:not(.btn) {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  position: relative;
  transition: color 0.25s ease;
  padding: 8px 0;
}

.navbar-links a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--brand-bright);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar-links a:not(.btn):hover {
  color: #fff;
}

.navbar-links a:not(.btn):hover::after {
  width: 100%;
}

.navbar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.navbar-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition:
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.2s ease;
}

.navbar-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.navbar-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.navbar-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 760px) {
  .navbar-links {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    background: rgba(7, 13, 11, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 24px;
    gap: 20px;
    display: none;
  }

  .navbar-links.is-open {
    display: flex;
    animation: navbar-drop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .navbar-links a:not(.btn)::after {
    display: none;
  }

  .navbar-toggle {
    display: inline-flex;
  }
}

@keyframes navbar-drop {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.footer {
  background: #030807;
  border-top: 1px solid var(--border);
  color: var(--ink-soft);
  padding: 64px 0;
  position: relative;
  z-index: 2;
}

.footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  color: #fff;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.footer-logo .logo-mark {
  width: 28px;
  height: 28px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a,
.footer-links span {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--brand-bright);
}

.footer-links .is-disabled {
  cursor: default;
  opacity: 0.5;
}

/* ── Cards (Glassmorphism + Hover Glows) ────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(52, 211, 153, 0.05) 0%, rgba(52, 211, 153, 0) 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.card:hover::before {
  opacity: 1;
}

.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(52, 211, 153, 0.1);
  border-color: var(--border-glow);
}

/* ── Scroll-reveal animation ────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > * {
  transition-delay: calc(var(--reveal-index, 0) * 80ms);
}

@media (max-width: 640px) {
  .section {
    padding: 72px 0;
  }
}

/* ── Legal / contact pages ──────────────────────────────────────────────── */

.legal {
  max-width: 760px;
  margin: 0 auto;
}

.legal--narrow {
  max-width: 560px;
  margin: 0 auto;
}

.legal h1 {
  font-size: clamp(32px, 5vw, 44px);
  background: linear-gradient(135deg, #ffffff 40%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.legal h3 {
  margin-top: 40px;
  font-size: 20px;
  color: var(--brand-bright);
}

.legal-updated {
  color: var(--ink-faint);
  font-size: 14px;
  margin-top: -8px;
  margin-bottom: 32px;
}

.contact-card {
  margin: 32px 0;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.contact-row:last-child {
  border-bottom: none;
}

.contact-label {
  font-weight: 600;
  color: #fff;
}

.contact-value {
  color: var(--ink-soft);
}

/* ── Small-phone refinements ────────────────────────────────────────────── */

@media (max-width: 400px) {
  .container {
    padding: 0 18px;
  }

  .btn {
    padding: 14px 24px;
    font-size: 15px;
  }

  .navbar .container {
    height: 72px;
  }

  .navbar-links {
    top: 72px;
  }

  .card {
    padding: 24px;
  }
}

/* Touch devices */
@media (hover: none) {
  .card-hover:hover,
  .btn-primary:hover:not(:disabled),
  .btn-secondary:hover:not(:disabled) {
    transform: none !important;
    box-shadow: var(--shadow) !important;
    border-color: var(--border) !important;
  }
}

/* ── Wake overlay (backend cold-start cover) ────────────────────────────── */
/* Shown instead of navigating straight to the Render backend, in case it's
   spun down after inactivity — replaces Render's own splash with ours. */

.wake-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  background-image: var(--wallpaper);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.wake-overlay.is-visible {
  opacity: 1;
}

.wake-overlay .orb {
  opacity: 0.5;
}

.wake-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(52, 211, 153, 0.08);
  padding: 44px 32px;
  backdrop-filter: blur(16px);
}

.wake-spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 24px;
  border-radius: 50%;
  border: 3px solid rgba(52, 211, 153, 0.15);
  border-top-color: var(--brand-bright);
  animation: wake-spin 0.9s linear infinite;
}

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

.wake-card h2 {
  font-size: 20px;
  margin-bottom: 10px;
}

.wake-message {
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0;
  min-height: 44px;
}

.wake-retry {
  min-height: 0;
  margin-top: 12px;
}

.wake-retry a {
  color: var(--brand-bright);
  text-decoration: none;
}

.wake-retry a:hover {
  text-decoration: underline;
}

@media (max-width: 400px) {
  .wake-card {
    padding: 32px 22px;
  }
}
