/* Basic reset and variables */
:root{
  /* Dark theme (default) */
  --bg:#0a0c12;           /* deeper, less blue */
  --surface:#0f1420;
  --card:#131a2a;
  --text:#f3f6ff;         /* brighter text */
  --muted:#b2bdd3;        /* lighter muted for readability */
  --brand:#3f8cff;        /* slightly richer brand */
  --accent:#4fe3b5;
  --warning:#ffd480;
  --danger:#ff7878;
  --border:rgba(255,255,255,0.12); /* stronger borders for separation */
  --focus:#8ab8ff;
  --shadow:0 16px 40px rgba(0,0,0,0.55);
}

/* Light theme overrides */
[data-theme='light']{
  --bg:#f5f7fb;          /* soft gray background */
  --surface:#ffffff;      /* pure white surfaces */
  --card:#ffffff;
  --text:#0a0c12;        /* strong text */
  --muted:#515b70;       /* darker muted for contrast on white */
  --brand:#1f73ff;
  --accent:#10b981;
  --warning:#a86c00;
  --danger:#b91c1c;
  --border:rgba(3,7,18,0.12);
  --focus:#2f89ff;
  --shadow:0 14px 28px rgba(2,6,23,0.08);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);font-family:"Source Sans 3",system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif}
html{scroll-behavior:smooth}
body.nav-open{overflow:hidden}
img{max-width:100%;display:block}
a{color:inherit;text-decoration:none}
.container{max-width:1100px;margin:0 auto;padding:0 20px}

/* Header */
.site-header{border-bottom:1px solid var(--border);background:linear-gradient(180deg,rgba(255,255,255,0.04),transparent)}
.header-row{display:flex;align-items:center;justify-content:space-between;gap:16px;position:relative;z-index:100}
.site-header .brand{display:flex;align-items:center;gap:12px;padding:18px 0}
.logo{display:block;width:40px;height:40px;border-radius:10px}
.theme-toggle{margin-left:4px;display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:10px;border:1px solid var(--border);background:transparent;color:var(--text);cursor:pointer}
.theme-toggle:hover{background:rgba(0,0,0,0.06);border-color:var(--border)}
[data-theme='light'] .theme-toggle:hover{background:rgba(0,0,0,0.04)}
.brand-text h1{font-size:1.1rem;margin:0 0 2px}
.brand-text .tagline{margin:0;color:var(--muted);font-size:0.9rem}
.site-nav{display:flex;gap:12px;z-index:1000}
.nav-link{padding:8px 10px;border-radius:8px;border:1px solid transparent;color:var(--muted)}
.nav-link:hover{color:var(--text);border-color:var(--border);background:rgba(255,255,255,0.03)}
.menu-toggle{display:none;flex-direction:column;gap:4px;width:44px;height:38px;border-radius:10px;border:1px solid var(--border);background:transparent;align-items:center;justify-content:center;color:var(--text)}
.menu-toggle .bar{display:block;width:20px;height:2px;background:currentColor;border-radius:2px}

/* Hero */
.hero{padding:40px 0 10px}
.hero h2{font-size:1.65rem;margin:0 0 8px;letter-spacing:-0.01em}
.hero p{margin:0;color:var(--muted)}

/* Apps grid */
.apps{padding:10px 0 60px}
.apps-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px}
.card{background:var(--card);border:1px solid var(--border);border-radius:14px;padding:20px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:10px;transition:transform .15s ease, border-color .15s ease, box-shadow .15s ease}
.card:hover{transform:translateY(-3px);border-color:rgba(122,179,255,0.5);box-shadow:0 18px 44px rgba(0,0,0,0.6)}
.card h3{margin:0;font-size:1.06rem;line-height:1.3;letter-spacing:-0.005em}
.card p{margin:0;color:var(--muted);font-size:0.95rem}
.card .meta{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:0.85rem}
.badge{padding:2px 8px;border-radius:999px;border:1px solid var(--border);background:rgba(255,255,255,0.04)}

.card .actions{margin-top:auto;display:flex;gap:8px;flex-wrap:wrap}
.button{display:inline-flex;align-items:center;gap:10px;padding:10px 14px;border-radius:12px;border:1px solid var(--border);background:linear-gradient(180deg,rgba(255,255,255,0.04),rgba(255,255,255,0.01));color:var(--text);font-weight:700;cursor:pointer;transition:background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .04s ease}
.button:hover{background:linear-gradient(180deg,rgba(255,255,255,0.08),rgba(255,255,255,0.02));border-color:rgba(122,179,255,0.5)}
.button:active{transform:translateY(1px)}
.button:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(123,178,255,0.25)}
.button.primary{background:linear-gradient(135deg,var(--brand),#7aa7ff);border-color:transparent;color:#081020}
[data-theme='light'] .button{background:linear-gradient(180deg,rgba(10,12,18,0.02),rgba(10,12,18,0.01))}
[data-theme='light'] .button:hover{background:linear-gradient(180deg,rgba(10,12,18,0.04),rgba(10,12,18,0.015))}
.button.ghost{background:transparent}
.button.outline{background:transparent;border-color:rgba(122,179,255,0.5)}
.button[disabled],.button.disabled{opacity:0.7;cursor:not-allowed}
[data-theme='light'] .button[disabled],
[data-theme='light'] .button.disabled{
  opacity:1;
  background:#eef2f9; /* subtle contrast on white */
  border-color:rgba(3,7,18,0.14);
  color:#374151; /* readable on light bg */
}
.hint{font-size:0.8rem;color:var(--muted)}
.hint.error{color:var(--danger);min-height:1.1em}
input[aria-invalid='true'], textarea[aria-invalid='true']{border-color:var(--danger)}
input[aria-invalid='true']:focus, textarea[aria-invalid='true']:focus{box-shadow:0 0 0 3px rgba(185,36,36,0.15)}

/* Contact */
.contact{padding:30px 0 70px;background:linear-gradient(180deg,rgba(255,255,255,0.02),transparent)}
.contact h2{margin:0 0 8px}
.contact-intro{margin:0 0 18px;color:var(--muted)}
.form-grid{display:grid;grid-template-columns:1fr;gap:12px}
.form-row{display:flex;flex-direction:column;gap:6px}
label{font-weight:600;color:var(--text);letter-spacing:0.005em}
input[type="text"],input[type="email"],textarea{background:var(--surface);border:1px solid var(--border);color:var(--text);border-radius:10px;padding:10px 12px;outline:none}
input:focus,textarea:focus{border-color:var(--focus);box-shadow:0 0 0 3px rgba(123,178,255,0.15)}
.form-actions{display:flex;align-items:center;gap:12px;margin-top:12px;flex-wrap:wrap}
.status{color:var(--muted)}
.status.success{color:var(--accent)}
.status.error{color:var(--danger)}
.recaptcha{position:relative;min-height:78px;margin-bottom:12px}
.recaptcha .recaptcha-inner{transform-origin:left top}
.privacy-note{margin-top:10px;color:var(--muted);font-size:0.85rem}
.privacy-note a{color:inherit;text-decoration:underline}

/* Footer */
.site-footer{border-top:1px solid var(--border);color:var(--muted);padding:22px 0; padding-bottom:calc(22px + env(safe-area-inset-bottom))}

/* Responsive tweaks */
@media (min-width: 900px){
  .hero{padding-top:50px}
  .form-grid{grid-template-columns:1fr 1fr}
}

/* Mobile nav behavior */
@media (max-width: 899px){
  .header-row{position:relative}
  .menu-toggle{display:flex}
  .site-nav{position:absolute;top:64px;right:20px;left:20px;flex-direction:column;gap:8px;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:10px;box-shadow:var(--shadow);display:none;max-height:70vh;overflow:auto}
  .site-nav.open{display:flex}
  .theme-toggle{order:3}
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce){
  *{transition:none !important}
}
