/*
 * Scrivla — app.css
 *
 * Uses CSS custom properties for every colour so dark mode can be
 * added later by toggling a [data-theme="dark"] attribute on <html>
 * without touching any other CSS.
 *
 * Palette inspiration: Novelcrafter — warm off-white backgrounds,
 * muted borders, rich accent colour, clean readable typography.
 */

/* ─────────────────────────────────────────────────────────────
   1. Design tokens — light (default)
───────────────────────────────────────────────────────────────*/
:root {
  /* Backgrounds */
  --bg-page:        #f9f7f4;
  --bg-surface:     #ffffff;
  --bg-surface-alt: #f3f0eb;
  --bg-input:       #ffffff;

  /* Borders */
  --border:         #e2ddd7;
  --border-focus:   #a8855c;

  /* Text */
  --text-primary:   #1a1714;
  --text-secondary: #5c5651;
  --text-muted:     #9e9690;
  --text-on-accent: #ffffff;

  /* Accent (warm amber-brown) */
  --accent:         #b5763a;
  --accent-hover:   #9a6230;
  --accent-light:   #f5ede2;

  /* Danger */
  --danger:         #c0392b;
  --danger-hover:   #a93226;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow-md:      0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,.12);

  /* Typography */
  --font-body:      'Inter', system-ui, -apple-system, sans-serif;
  --font-display:   'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing & shape */
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-pill:    999px;
}

/* Dark mode — tokens only; no structural overrides needed */
[data-theme="dark"] {
  --bg-page:        #18161399;   /* placeholder — fill in when dark mode is built */
  --bg-surface:     #221f1b;
  --bg-surface-alt: #2c2824;
  --bg-input:       #2c2824;
  --border:         #3d3830;
  --border-focus:   #c9985a;
  --text-primary:   #f0ece6;
  --text-secondary: #b0a89e;
  --text-muted:     #6e665e;
  --accent:         #c9985a;
  --accent-hover:   #b5843e;
  --accent-light:   #332a1f;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.3);
  --shadow-md:      0 4px 12px rgba(0,0,0,.35);
  --shadow-lg:      0 8px 32px rgba(0,0,0,.45);
}

/* ─────────────────────────────────────────────────────────────
   2. Reset / base
───────────────────────────────────────────────────────────────*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family:      var(--font-body);
  background-color: var(--bg-page);
  color:            var(--text-primary);
  line-height:      1.6;
  min-height:       100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ─────────────────────────────────────────────────────────────
   3. Layout helpers
───────────────────────────────────────────────────────────────*/
.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow {
  max-width: 560px;
}

/* ─────────────────────────────────────────────────────────────
   4. Navigation bar
───────────────────────────────────────────────────────────────*/
.site-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.site-nav__logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.site-nav__logo span { color: var(--accent); }
.site-nav__logo:hover { text-decoration: none; color: var(--text-primary); }

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}
.site-nav__links a { color: var(--text-secondary); font-size: .9rem; }
.site-nav__links a:hover { color: var(--text-primary); text-decoration: none; }
.site-nav__links a.btn { color: var(--text-on-accent); }
.site-nav__links a.btn:hover { color: var(--text-on-accent); }

/* ─────────────────────────────────────────────────────────────
   5. Buttons
───────────────────────────────────────────────────────────────*/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn--primary {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--text-on-accent); }

.btn--outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn--outline:hover { background: var(--accent-light); }

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--bg-surface-alt); color: var(--text-primary); }

.btn--danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn--danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

.btn--lg { padding: 14px 32px; font-size: 1rem; }
.btn--sm { padding: 7px 14px; font-size: .82rem; }

.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ─────────────────────────────────────────────────────────────
   6. Forms
───────────────────────────────────────────────────────────────*/
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: .95rem;
  font-family: var(--font-body);
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(165,120,80,.15);
}
.form-control::placeholder { color: var(--text-muted); }

.form-hint {
  margin-top: 5px;
  font-size: .8rem;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────
   7. Alerts / flash messages
───────────────────────────────────────────────────────────────*/
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert--error   { background: #fdecea; color: var(--danger);   border-color: #f5c2bd; }
.alert--success { background: #eaf7ef; color: #1d7a3e;          border-color: #b8e8c8; }
.alert--info    { background: var(--accent-light); color: var(--accent-hover); border-color: #e4c8a4; }

/* ─────────────────────────────────────────────────────────────
   8. Card
───────────────────────────────────────────────────────────────*/
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card__body { padding: 28px; }
.card__header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}
.card__footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface-alt);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ─────────────────────────────────────────────────────────────
   9. Landing page — hero
───────────────────────────────────────────────────────────────*/
.hero {
  padding: 96px 0 80px;
  text-align: center;
}

.hero__eyebrow {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #e4c8a4;
  border-radius: var(--radius-pill);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 5px 14px;
  margin-bottom: 24px;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 20px;
}
.hero__title em { font-style: normal; color: var(--accent); }

.hero__subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 40px;
  line-height: 1.65;
}

.hero__cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero__preview-wrap {
  margin-top: 72px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  background: var(--bg-surface-alt);
}

.hero__preview-placeholder {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────
   10. Landing page — feature grid
───────────────────────────────────────────────────────────────*/
.features {
  padding: 80px 0;
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 52px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
}

.feature-card__icon {
  font-size: 1.5rem;
  margin-bottom: 14px;
  color: var(--accent);
  line-height: 1;
}
.feature-card__icon i {
  color: var(--accent);
}
.feature-card__icon svg {
  width: 28px;
  height: 28px;
  display: block;
}

.feature-card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.feature-card__text {
  font-size: .9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────────
   11. Landing page — pricing
───────────────────────────────────────────────────────────────*/
.pricing {
  padding: 80px 0;
  border-top: 1px solid var(--border);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  max-width: 720px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
}
.pricing-card--featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}

.pricing-card__badge {
  display: inline-block;
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
}

.pricing-card__name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.pricing-card__price {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.pricing-card__price span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pricing-card__desc {
  font-size: .88rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.pricing-card__list {
  list-style: none;
  margin-bottom: 28px;
}
.pricing-card__list li {
  font-size: .9rem;
  color: var(--text-secondary);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.pricing-card__list li:last-child { border-bottom: none; }
.pricing-card__list li::before { content: '✓'; color: var(--accent); font-weight: 700; flex-shrink: 0; }

/* ─────────────────────────────────────────────────────────────
   12. Landing page — footer
───────────────────────────────────────────────────────────────*/
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────
   13. Auth pages (login / register)
───────────────────────────────────────────────────────────────*/
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text-primary);
}
.auth-logo span { color: var(--accent); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: .82rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─────────────────────────────────────────────────────────────
   14. Utility classes
───────────────────────────────────────────────────────────────*/
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: .875rem; }
.mt-1  { margin-top: 4px;  }
.mt-2  { margin-top: 8px;  }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mt-8  { margin-top: 32px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.w-full { width: 100%; }
