/* =========================================================
   Cloud Notebook — unified theme
   Premium tech · light default · dark mode toggle
   ========================================================= */

:root {
  /* Color tokens — light */
  --bg: #fafaf7;
  --bg-elev: #ffffff;
  --bg-soft: #f3f3ee;
  --bg-tint: #eef0fb;
  --ink: #0a0b1e;
  --ink-2: #1f2138;
  --ink-3: #4a4d6b;
  --ink-4: #7a7e9a;
  --line: #e6e4dc;
  --line-2: #ecebe4;

  /* Brand */
  --indigo: #4f46e5;
  --indigo-2: #6366f1;
  --violet: #7c3aed;
  --teal: #0d9488;
  --teal-2: #14b8a6;
  --amber: #f59e0b;
  --rose: #e11d48;

  /* Aurora gradient */
  --aurora-1: #4f46e5;
  --aurora-2: #7c3aed;
  --aurora-3: #0d9488;
  --aurora-4: #ec4899;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(10, 11, 30, 0.04), 0 2px 6px rgba(10, 11, 30, 0.04);
  --shadow-md: 0 8px 16px -4px rgba(10, 11, 30, 0.06), 0 24px 48px -12px rgba(10, 11, 30, 0.10);
  --shadow-lg: 0 24px 60px -20px rgba(79, 70, 229, 0.18), 0 8px 24px -8px rgba(10, 11, 30, 0.10);
  --shadow-glow: 0 0 60px -10px rgba(79, 70, 229, 0.35);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;

  --container: 1180px;
  --gutter: clamp(20px, 4vw, 40px);

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode */
html.dark, html.dark body {
  --bg: #0a0b1e;
  --bg-elev: #131432;
  --bg-soft: #0f1027;
  --bg-tint: #1a1c40;
  --ink: #f5f4ef;
  --ink-2: #e2e1da;
  --ink-3: #b3b3cc;
  --ink-4: #7a7e9a;
  --line: #232545;
  --line-2: #1c1e3d;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, 0.4), 0 24px 48px -12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px -20px rgba(124, 58, 237, 0.4), 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 80px -10px rgba(124, 58, 237, 0.5);
}

/* Reset */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* Type scale */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.lead { font-size: clamp(17px, 2vw, 20px); color: var(--ink-3); line-height: 1.55; }

/* Container */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* =========================================================
   Aurora background — faux 3D depth
   ========================================================= */
.aurora {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.aurora .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  mix-blend-mode: screen;
  animation: floatBlob 18s ease-in-out infinite;
  will-change: transform;
}
.aurora .b1 { width: 520px; height: 520px; top: -120px; left: -100px; background: radial-gradient(circle, var(--aurora-1), transparent 65%); }
.aurora .b2 { width: 600px; height: 600px; top: 20%; right: -180px; background: radial-gradient(circle, var(--aurora-2), transparent 65%); animation-delay: -6s; }
.aurora .b3 { width: 480px; height: 480px; bottom: -160px; left: 30%; background: radial-gradient(circle, var(--aurora-3), transparent 65%); animation-delay: -12s; }
.aurora .b4 { width: 360px; height: 360px; top: 50%; left: 10%; background: radial-gradient(circle, var(--aurora-4), transparent 65%); opacity: 0.35; animation-delay: -3s; }

@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(60px, -40px) scale(1.08); }
  66% { transform: translate(-40px, 50px) scale(0.95); }
}

/* Grid overlay for depth */
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(10, 11, 30, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(10, 11, 30, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}
html.dark .grid-overlay {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

/* =========================================================
   Top navigation
   ========================================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 14px 0;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease-out), background-color 0.3s var(--ease-out);
}
.nav.scrolled { border-bottom-color: var(--line); }

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
/* Cloud-with-notebook-lines mark: a cloud silhouette with three horizontal
   ruling lines inside, evoking a notebook page. Drawn via SVG mask so it
   inherits the aurora gradient. */
.brand-mark {
  width: 32px; height: 32px;
  position: relative;
  display: inline-block;
  background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2) 55%, var(--aurora-3));
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M9 22a5 5 0 0 1-1-9.9A7 7 0 0 1 22 11.5a4.5 4.5 0 0 1 1 8.9' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/><path d='M11 15h10M11 18h8M11 21h6' stroke='black' stroke-width='1.6' stroke-linecap='round' fill='none'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M9 22a5 5 0 0 1-1-9.9A7 7 0 0 1 22 11.5a4.5 4.5 0 0 1 1 8.9' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/><path d='M11 15h10M11 18h8M11 21h6' stroke='black' stroke-width='1.6' stroke-linecap='round' fill='none'/></svg>");
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  filter: drop-shadow(0 4px 10px color-mix(in oklab, var(--indigo) 35%, transparent));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--ink-3);
  transition: color 0.2s, background-color 0.2s;
}
.nav-links a:hover { color: var(--ink); background: var(--bg-soft); }
.nav-links a.active { color: var(--ink); background: var(--bg-soft); }

.nav-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--ink-3);
  transition: background-color 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }

.menu-btn { display: none; }

/* Mobile drawer */
.mobile-drawer {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  padding: 20px var(--gutter);
  transform: translateY(-100%);
  transition: transform 0.4s var(--ease-out), visibility 0s linear 0.4s;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  pointer-events: none;
  overflow-y: auto;
}
.mobile-drawer.open {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.4s var(--ease-out), visibility 0s linear 0s;
}
.mobile-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
}
.mobile-drawer nav {
  display: flex; flex-direction: column; gap: 4px;
}
.mobile-drawer nav a {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  display: flex; justify-content: space-between; align-items: center;
}
.mobile-drawer nav a small {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 400;
  letter-spacing: 0.08em;
}

@media (max-width: 820px) {
  .nav-links { display: none; }
  .menu-btn { display: inline-flex; }
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.005em;
  transition: transform 0.18s var(--ease-out), box-shadow 0.25s var(--ease-out), background-color 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 6px 16px -6px rgba(10, 11, 30, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 24px -8px rgba(10, 11, 30, 0.45); }
html.dark .btn-primary { background: var(--bg); color: var(--ink); }

.btn-aurora {
  color: white;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 50%, var(--teal) 100%);
  background-size: 200% 200%;
  box-shadow: 0 12px 30px -10px rgba(79, 70, 229, 0.55);
  animation: auroraShift 8s ease infinite;
}
.btn-aurora:hover { box-shadow: 0 16px 36px -10px rgba(124, 58, 237, 0.7); }
@keyframes auroraShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--ink-4); }

.btn-sm { padding: 8px 14px; font-size: 13.5px; }

/* =========================================================
   Cards
   ========================================================= */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out), border-color 0.3s;
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in oklab, var(--indigo) 25%, var(--line));
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* Sections */
section { position: relative; }
.section-head {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 56px;
}
.section-head h2 {
  font-size: clamp(28px, 4vw, 44px);
  margin-top: 14px;
  margin-bottom: 14px;
}

/* Theme toggle */
.theme-toggle .sun { display: block; }
.theme-toggle .moon { display: none; }
html.dark .theme-toggle .sun { display: none; }
html.dark .theme-toggle .moon { display: block; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 48px 0 32px;
  margin-top: 80px;
}
.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--ink-3);
  font-size: 14px;
}
.site-footer a { color: var(--ink-2); border-bottom: 1px solid var(--line); }
.site-footer a:hover { color: var(--indigo); border-color: var(--indigo); }

/* Selection */
::selection { background: color-mix(in oklab, var(--indigo) 30%, transparent); color: var(--ink); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
