/* Vesper Lab — dusk editorial. Deep ink sky, one warm star, serif display. */
:root {
  --ink-900: #0a0c16;
  --ink-800: #0d0f1a;
  --ink-700: #151a2c;
  --ink-600: #232a42;
  --line: rgb(214 207 255 / 0.12);
  --line-strong: rgb(214 207 255 / 0.24);
  --text: #ece7df;
  --text-muted: #9b9bb3;
  --text-faint: #6b6d88;
  --star: #f4c989;
  --star-glow: rgb(244 201 137 / 0.35);
  --dusk: #c46b5b;
  --violet: #6e62c4;
  --danger: #ff8d7a;

  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --text-sm: 0.8125rem;
  --text-base: clamp(1rem, 0.94rem + 0.3vw, 1.125rem);
  --text-lg: clamp(1.25rem, 1.05rem + 0.8vw, 1.6rem);
  --text-xl: clamp(2rem, 1.3rem + 3vw, 3.4rem);
  --text-hero: clamp(2.75rem, 1rem + 7vw, 7.25rem);

  --gutter: clamp(1rem, 0.5rem + 3vw, 3.5rem);
  --space-section: clamp(4.5rem, 3rem + 6vw, 10rem);
  --radius: 2px;
  --duration-fast: 150ms;
  --duration-normal: 320ms;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink-800);
  color: var(--text);
  font: 400 var(--text-base)/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
em { font-style: italic; color: var(--star); }
.mono { font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: 0.02em; }
:focus-visible { outline: 2px solid var(--star); outline-offset: 3px; }

/* Film grain for atmosphere; static so it costs nothing after first paint. */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ——— Header / footer ——— */
.site-header {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.5rem var(--gutter);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font: 400 1.5rem/1 var(--font-display); text-decoration: none; letter-spacing: 0.01em;
}
.star {
  width: 9px; height: 9px; border-radius: 50%; background: var(--star);
  box-shadow: 0 0 0 4px rgb(244 201 137 / 0.12), 0 0 18px 4px var(--star-glow);
}
.nav-link {
  font: 500 var(--text-sm)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em;
  text-decoration: none; color: var(--text-muted);
  padding: 0.75rem 1.1rem; border: 1px solid transparent; border-radius: 999px;
  transition: color var(--duration-fast), border-color var(--duration-fast), background-color var(--duration-fast);
}
.nav-link:hover { color: var(--text); border-color: var(--line-strong); }
.nav-cta { color: var(--text); border-color: var(--line-strong); }
.nav-cta:hover { background: var(--text); color: var(--ink-900); }
.nav-button { background: none; cursor: pointer; }
.site-footer {
  display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; justify-content: space-between;
  padding: 2rem var(--gutter); border-top: 1px solid var(--line);
  color: var(--text-faint); font-size: var(--text-sm);
}

/* ——— Buttons ——— */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem; padding: 0 1.5rem; border-radius: var(--radius);
  font: 500 0.95rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--duration-fast) var(--ease-out-expo), background-color var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast);
}
.button:active { transform: translateY(1px) scale(0.99); }
.button-primary { background: var(--star); color: var(--ink-900); }
.button-primary:hover { background: #fbd9a6; }
.button-ghost { border-color: var(--line-strong); color: var(--text); }
.button-ghost:hover { border-color: var(--text); }
.button-block { width: 100%; }

/* ——— Hero ——— */
.hero {
  position: relative; isolation: isolate;
  min-height: calc(100svh - 5.5rem);
  display: grid; grid-template-rows: auto 1fr auto; gap: 2rem;
  padding: clamp(2rem, 1rem + 5vw, 6rem) var(--gutter) 0;
  overflow: hidden;
}
.hero::before { /* dusk sky: ink above, ember at the horizon */
  content: ''; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(120% 60% at 72% 100%, rgb(196 107 91 / 0.38), transparent 60%),
    radial-gradient(90% 55% at 20% 100%, rgb(110 98 196 / 0.30), transparent 65%),
    linear-gradient(180deg, var(--ink-800) 0%, var(--ink-700) 55%, #2a2140 100%);
}
.eyebrow { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.16em; margin: 0; }
.hero h1 {
  margin: 0; max-width: 19ch; align-self: center;
  font: 400 var(--text-hero)/0.95 var(--font-display); letter-spacing: -0.02em;
  animation: rise 1.1s var(--ease-out-expo) both;
}
.hero-foot {
  display: grid; grid-template-columns: minmax(0, 34rem) auto; gap: 2rem 4rem;
  align-items: end; justify-content: space-between;
  padding-bottom: clamp(5rem, 4rem + 6vw, 9rem);
  animation: rise 1.1s 0.15s var(--ease-out-expo) both;
}
.lede { margin: 0; color: var(--text-muted); font-size: var(--text-lg); line-height: 1.45; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.horizon {
  position: absolute; left: 0; right: 0; bottom: clamp(2.5rem, 2rem + 3vw, 5rem); z-index: -1;
  height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong) 15%, rgb(244 201 137 / 0.5) 70%, transparent);
}
.horizon-star {
  position: absolute; right: 12%; bottom: clamp(10rem, 8rem + 10vw, 18rem);
  width: 14px; height: 14px; border-radius: 50%; background: var(--star);
  box-shadow: 0 0 0 6px rgb(244 201 137 / 0.10), 0 0 60px 18px var(--star-glow);
  animation: glow 5s ease-in-out infinite alternate;
}

/* ——— Principles ——— */
.principles { padding: var(--space-section) var(--gutter); }
.section-label {
  margin: 0 0 2.5rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.16em; font-weight: 400;
}
.principle-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 var(--gutter);
  border-top: 1px solid var(--line);
}
.principle {
  grid-column: span 4; padding: 2rem 0 0; position: relative;
}
.principle:nth-child(2) { margin-top: 4rem; }
.principle:nth-child(3) { margin-top: 8rem; }
.principle-n { color: var(--star); }
.principle h3 { margin: 0.75rem 0 0.5rem; font: 400 var(--text-xl)/1.05 var(--font-display); }
.principle p { margin: 0; color: var(--text-muted); max-width: 28ch; }

/* ——— Closing ——— */
.closing {
  padding: var(--space-section) var(--gutter);
  border-top: 1px solid var(--line);
  background: radial-gradient(60% 80% at 50% 0%, rgb(110 98 196 / 0.14), transparent 70%);
}
.closing h2 { margin: 0 0 1.5rem; font: 400 var(--text-xl)/1.1 var(--font-display); max-width: 24ch; }
.closing p { color: var(--text-faint); margin: 0; }

/* ——— Auth ——— */
.page-auth {
  background:
    radial-gradient(80% 50% at 50% 110%, rgb(196 107 91 / 0.30), transparent 60%),
    radial-gradient(70% 40% at 10% 100%, rgb(110 98 196 / 0.25), transparent 60%),
    var(--ink-800);
}
.auth-shell {
  min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2rem; padding: 2rem 1rem;
}
.auth-card {
  width: min(100%, 26rem); padding: clamp(1.75rem, 1rem + 3vw, 2.75rem);
  background: rgb(21 26 44 / 0.72); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.7), inset 0 1px 0 rgb(255 255 255 / 0.04);
  animation: rise 0.8s var(--ease-out-expo) both;
}
.auth-card h1 { margin: 0; font: 400 2.5rem/1 var(--font-display); }
.auth-sub { margin: 0.6rem 0 1.75rem; color: var(--text-muted); }
.auth-form { display: grid; gap: 0.5rem; }
.auth-form label { font-size: var(--text-sm); color: var(--text-muted); margin-top: 0.5rem; }
.auth-form input {
  width: 100%; min-height: 3rem; padding: 0 0.9rem;
  background: var(--ink-900); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  font: inherit; transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.auth-form input:hover { border-color: rgb(214 207 255 / 0.4); }
.auth-form input:focus { outline: none; border-color: var(--star); box-shadow: 0 0 0 3px rgb(244 201 137 / 0.18); }
.auth-form button { margin-top: 1.25rem; }
.form-error {
  margin: 0 0 1rem; padding: 0.75rem 0.9rem; border-left: 2px solid var(--danger);
  background: rgb(255 141 122 / 0.08); color: var(--danger); font-size: 0.925rem;
}
.auth-note { margin: 1.5rem 0 0; color: var(--text-faint); }
.auth-sub a { color: var(--star); }

/* ——— Dashboard ——— */
.dashboard { padding: clamp(2rem, 1rem + 4vw, 5rem) var(--gutter) var(--space-section); min-height: 70vh; }
.dashboard h1 { margin: 0.75rem 0 clamp(3rem, 2rem + 4vw, 6rem); font: 400 var(--text-xl)/1.05 var(--font-display); }
.app-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.app-row {
  display: grid; grid-template-columns: 3rem minmax(8rem, 16rem) 1fr auto; gap: 1rem; align-items: baseline;
  padding: 1.4rem 0; border-bottom: 1px solid var(--line); text-decoration: none;
  transition: background-color var(--duration-fast);
}
.app-row:hover { background: rgb(214 207 255 / 0.03); }
.app-n { color: var(--text-faint); }
.app-name { font: 400 var(--text-lg)/1.2 var(--font-display); }
.app-desc { color: var(--text-muted); }
.app-go { color: var(--star); transition: transform var(--duration-normal) var(--ease-out-expo); }
.app-row:hover .app-go { transform: translateX(6px); }
.empty { padding: 3rem 0; border-top: 1px solid var(--line); color: var(--text-muted); }
.empty .mono { color: var(--star); margin: 0 0 0.5rem; }
.empty p { margin: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes glow { from { opacity: 0.75; transform: scale(0.92); } to { opacity: 1; transform: scale(1.06); } }

@media (max-width: 800px) {
  .hero-foot { grid-template-columns: 1fr; }
  .principle { grid-column: 1 / -1; margin-top: 0 !important; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
  .app-row { grid-template-columns: 2.5rem 1fr auto; }
  .app-desc { grid-column: 2 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
