/* ========================================
   Dewrito.net — Modern Design System
   Inspired by: Linear, Supabase, x.ai, ElevenLabs
   No framework dependencies. Pure CSS custom properties.
   ======================================== */

/* ---- Design Tokens ---- */
:root {
  /* Backgrounds - near-black canvas (Linear/Supabase) */
  --bg-primary: #050510;
  --bg-surface: rgba(255, 255, 255, 0.03);
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-glass: rgba(10, 10, 30, 0.7);

  /* Text - white on dark (x.ai) */
  --text-primary: #f0f0f5;
  --text-secondary: rgba(240, 240, 245, 0.6);
  --text-muted: rgba(240, 240, 245, 0.35);

  /* Brand accent - cyan (dewrito identity) */
  --accent-cyan: #00d4ff;
  --accent-cyan-dim: rgba(0, 212, 255, 0.15);
  --accent-cyan-glow: rgba(0, 212, 255, 0.3);

  /* Secondary accent - green (Matrix/community) */
  --accent-green: #3ecf8e;
  --accent-green-dim: rgba(62, 207, 142, 0.15);

  /* Borders - semi-transparent white (Linear technique) */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);

  /* Typography */
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 72px;
  --space-4xl: 96px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* Shadows - multi-layer, sub-0.1 opacity (ElevenLabs technique) */
  --shadow-card: rgba(0, 0, 0, 0.4) 0px 0px 1px, rgba(255, 255, 255, 0.03) 0px 8px 24px;
  --shadow-elevated: rgba(0, 0, 0, 0.5) 0px 0px 1px, rgba(0, 0, 0, 0.15) 0px 16px 48px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ---- Starfield Canvas ---- */
#starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---- CRT Scanline Overlay (subtle) ---- */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* ---- Typography ---- */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.0;
}

h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  letter-spacing: -0.03em;
}

h3 {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  letter-spacing: -0.02em;
}

p {
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 65ch;
}

/* Monospace labels (x.ai/Supabase technique) */
.mono-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* Gradient text (hero headlines) */
.gradient-text {
  background: linear-gradient(135deg, var(--accent-cyan), #a78bfa, var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Links ---- */
a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.75;
}

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent-cyan);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary:hover {
  opacity: 1;
  background: #33ddff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-cyan-glow);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-secondary:hover {
  opacity: 1;
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

/* ---- Container ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

/* ---- Section Spacing (Supabase dramatic pacing) ---- */
.section {
  padding: var(--space-4xl) 0;
}

.section-label {
  display: inline-block;
  margin-bottom: var(--space-md);
}

/* ---- Header / Navigation ---- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-sm) 0;
  background: rgba(5, 5, 16, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

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

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-logo:hover {
  opacity: 1;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  text-decoration: none;
}

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

.nav-cta .btn-primary {
  padding: 8px 20px;
  font-size: 0.8rem;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all 0.3s ease;
}

/* Hamburger → X animation when menu is open */
.navbar.mobile-open .nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.navbar.mobile-open .nav-toggle span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.navbar.mobile-open .nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Hero Section ---- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 64px;
  position: relative;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-xl);
}

.hero h1 {
  margin-bottom: var(--space-lg);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 60ch;
  margin: 0 auto var(--space-2xl);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* ---- Feature Cards (Linear glassmorphism) ---- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan-dim), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feature-card:hover {
  border-color: var(--border-default);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

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

.feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  font-size: 1.5rem;
}

.feature-icon.matrix {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.feature-icon.fluxer {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
}

.feature-icon.community {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
}

.feature-card h3 {
  margin-bottom: var(--space-sm);
}

.feature-card p {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ---- Matrix Section (community hub) ---- */
.matrix-section {
  position: relative;
}

.matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: center;
}

.matrix-info h2 {
  margin-bottom: var(--space-md);
}

.matrix-info p {
  margin-bottom: var(--space-lg);
}

.matrix-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.matrix-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.matrix-link-item:hover {
  opacity: 1;
  border-color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.04);
}

.matrix-link-label {
  font-weight: 500;
  font-size: 0.9rem;
}

.matrix-link-desc {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---- Support / Donate Section ---- */
.support-section {
  text-align: center;
}

.support-card {
  max-width: 640px;
  margin: var(--space-2xl) auto 0;
  padding: var(--space-2xl);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.05), rgba(62, 207, 142, 0.05));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.support-card h3 {
  margin-bottom: var(--space-md);
}

.support-card p {
  margin: 0 auto var(--space-xl);
}

/* ---- Footer ---- */
.footer {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--border-subtle);
}

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

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

.footer-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  opacity: 1;
  color: var(--text-secondary);
}

/* ---- Page Header (inner pages) ---- */
.page-header {
  padding-top: calc(64px + var(--space-3xl));
  padding-bottom: var(--space-2xl);
  text-align: center;
}

.page-header h1 {
  margin-bottom: var(--space-md);
}

/* ---- Content Sections (inner pages) ---- */
.content-section {
  max-width: 768px;
  margin: 0 auto;
  padding: var(--space-2xl) 0;
}

.content-section h2 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  font-size: 1.5rem;
}

.content-section h3 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
  font-size: 1.1rem;
}

.content-section p,
.content-section li {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--space-md);
}

.content-section ul,
.content-section ol {
  padding-left: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.content-section li {
  margin-bottom: var(--space-sm);
}

/* ---- Client Cards (register page) ---- */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.client-card:hover {
  border-color: var(--border-default);
  background: rgba(255, 255, 255, 0.06);
}

.client-card h3 {
  margin-bottom: var(--space-sm);
}

.client-card p {
  font-size: 0.875rem;
  margin-bottom: var(--space-md);
}

.client-card .btn-primary {
  margin-top: auto;
}

/* ---- Contact Cards ---- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  transition: all 0.2s ease;
}

.contact-card:hover {
  border-color: var(--border-default);
}

.contact-card h3 {
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.contact-card p {
  font-size: 0.875rem;
}

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--border-subtle);
  border: none;
  margin: var(--space-2xl) 0;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .matrix-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --space-4xl: 64px;
    --space-3xl: 48px;
    --space-2xl: 32px;
  }

  .hero {
    min-height: auto;
    padding-top: calc(64px + var(--space-2xl));
    padding-bottom: var(--space-2xl);
  }

  .hero-content {
    padding: var(--space-xl) var(--space-md);
  }

  .nav-links,
  .nav-cta {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  /* Mobile menu — navbar expands into column layout */
  .navbar.mobile-open {
    height: auto;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }

  .navbar.mobile-open .container {
    flex-direction: column;
    align-items: stretch;
    height: auto;
  }

  .nav-logo {
    order: 1;
  }

  .nav-toggle {
    order: 2;
  }

  .navbar.mobile-open .nav-links {
    display: flex;
    flex-direction: column;
    position: static;
    background: rgba(5, 5, 16, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-md) var(--space-lg) var(--space-md);
    gap: var(--space-md);
    order: 3;
  }

  .navbar.mobile-open .nav-cta {
    display: flex;
    justify-content: center;
    align-items: center;
    position: static;
    background: rgba(5, 5, 16, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: var(--space-md) var(--space-lg) var(--space-xl);
    order: 4;
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
  }

  .footer .container {
    flex-direction: column;
    text-align: center;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ---- Scrollbar (subtle) ---- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
