/* =============================================================================
   Como — Shared Design System
   Theme: Warm Scholar  |  Light (cream/tan) + Dark (warm charcoal)
   Accents: Baby blue (#color-blue) + Forest green (#color-green)
   Fonts: Lora (headings) + DM Sans (body/UI)
   ============================================================================= */

/* ── Design tokens: dark ────────────────────────────────────────────────────── */

[data-theme="dark"] {
  --color-bg:             #141410;
  --color-surface:        #1E1D18;
  --color-surface-raised: #2A2920;
  --color-border:         #38372E;
  --color-text:           #F5F4F0;
  --color-text-muted:     #9B9990;
  --color-blue:           #5AACDB;
  --color-green:          #3DA874;
  --color-accent:         #5AACDB;
  --color-success:        #3DA874;
  --color-destructive:    #F87171;
  --color-accent-muted:   rgba(90, 172, 219, 0.12);
  --shadow-card:          0 2px 12px rgba(0, 0, 0, 0.45);
  --shadow-nav:           0 1px 0 #38372E;
}

/* ── Design tokens: light ───────────────────────────────────────────────────── */

[data-theme="light"] {
  --color-bg:             #FAF7F2;
  --color-surface:        #F0EBE1;
  --color-surface-raised: #E5DDCF;
  --color-border:         #D0C4B0;
  --color-text:           #27180A;
  --color-text-muted:     #5C4D38;
  --color-blue:           #3585AF;
  --color-green:          #2B6648;
  --color-accent:         #3585AF;
  --color-success:        #2B6648;
  --color-destructive:    #B83C2B;
  --color-accent-muted:   rgba(53, 133, 175, 0.1);
  --shadow-card:          0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.07);
  --shadow-nav:           0 1px 0 #C8B89A, 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ── Spacing scale ──────────────────────────────────────────────────────────── */

:root {
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  --font-size-label:    14px;
  --font-size-body:     16px;
  --font-size-heading:  20px;
  --font-size-display:  28px;
  --font-weight-regular:  400;
  --font-weight-medium:   500;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;
  --line-height-body:    1.5;
  --line-height-label:   1.4;
  --line-height-heading: 1.2;
  --line-height-display: 1.15;

  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-pill: 100px;

  --transition-fast: 0.12s ease;
  --transition-base: 0.2s ease;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */

html {
  transition: background var(--transition-base);
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ─────────────────────────────────────────────────────────────── */

h1, h2, h3, h4,
.heading-serif {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  line-height: var(--line-height-heading);
  letter-spacing: -0.02em;
  color: var(--color-text);
}

h1 { font-weight: 700; letter-spacing: -0.03em; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: var(--color-blue);
  color: #fff;
  text-decoration: none;
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-label);
  min-height: 44px;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.btn-primary:hover  { opacity: 0.88; }
.btn-primary:active { opacity: 0.78; transform: scale(0.99); }
.btn-primary:focus  { outline: 2px solid var(--color-blue); outline-offset: 2px; }

.btn-green {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: var(--color-green);
  color: #fff;
  text-decoration: none;
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-label);
  min-height: 44px;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.btn-green:hover  { opacity: 0.88; }
.btn-green:active { opacity: 0.78; transform: scale(0.99); }
.btn-green:focus  { outline: 2px solid var(--color-green); outline-offset: 2px; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  text-decoration: none;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-label);
  min-height: 44px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.btn-outline:hover  { background: var(--color-accent-muted); }
.btn-outline:focus  { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: transparent;
  color: var(--color-text-muted);
  border: none;
  padding: 8px var(--space-md);
  border-radius: var(--radius-md);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: var(--font-size-body);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.btn-ghost:hover  { color: var(--color-text); background: var(--color-surface-raised); }
.btn-ghost:focus  { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ── Links ──────────────────────────────────────────────────────────────────── */

.link-accent {
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}
.link-accent:hover { opacity: 0.8; text-decoration: underline; }
.link-accent:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.link-secondary {
  color: var(--color-text-muted);
  text-decoration: none;
}
.link-secondary:hover { color: var(--color-text); text-decoration: underline; }

/* ── Form elements ──────────────────────────────────────────────────────────── */

.input {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: var(--font-size-body);
  width: 100%;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input::placeholder { color: var(--color-text-muted); }
.input:focus {
  border-color: var(--color-accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--color-accent-muted);
}
.input:disabled { opacity: 0.5; cursor: not-allowed; }

select.input { appearance: auto; cursor: pointer; }

textarea.input {
  resize: vertical;
  min-height: 80px;
  line-height: var(--line-height-body);
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
}

.card-sm {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

/* ── Pill / tag / badge ─────────────────────────────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 3px 10px;
  background: var(--color-surface-raised);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-label);
  color: var(--color-text);
  line-height: var(--line-height-label);
}

.tag-blue {
  background: var(--color-accent-muted);
  color: var(--color-accent);
}

.pill {
  display: inline-flex;
  align-items: center;
  background: var(--color-surface-raised);
  color: var(--color-text-muted);
  border: none;
  border-radius: var(--radius-pill);
  padding: var(--space-xs) 12px;
  font-family: inherit;
  font-size: var(--font-size-label);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.pill:hover { background: var(--color-border); color: var(--color-text); }

/* ── Public nav (landing, pricing, onboarding) ──────────────────────────────── */

.public-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: background var(--transition-base), border-color var(--transition-base);
}

.public-header.scrolled {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.public-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-family: 'Lora', Georgia, serif;
  font-size: 18px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-medium);
  transition: color var(--transition-fast);
}
.nav-link:hover { color: var(--color-text); }
.nav-link:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ── Theme toggle ────────────────────────────────────────────────────────────── */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--color-text); background: var(--color-surface-raised); }
.theme-toggle:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ── App-level top bar (authenticated pages) ─────────────────────────────────── */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  z-index: 1000;
}

.app-header-brand {
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  letter-spacing: -0.01em;
}

/* ── Side nav (authenticated app) ───────────────────────────────────────────── */

#side-nav {
  position: fixed;
  top: 48px;
  left: 0;
  bottom: 0;
  width: 240px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  transition: width 200ms ease;
  z-index: 900;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.nav-collapsed #side-nav { width: 48px; }

#nav-toggle {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
#nav-toggle:hover { color: var(--color-text); }
#nav-toggle svg { transition: transform 200ms ease; flex-shrink: 0; }
body.nav-collapsed #nav-toggle svg { transform: rotate(180deg); }

.nav-items {
  list-style: none;
  padding: var(--space-sm) 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-md);
  margin: 2px var(--space-xs);
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}
a.nav-item:hover,
a.nav-item.active {
  background: var(--color-surface-raised);
  color: var(--color-text);
}
a.nav-item.active { border-left: 3px solid var(--color-accent); padding-left: 13px; }

.nav-item-disabled { opacity: 0.4; cursor: default; }
.nav-icon  { flex-shrink: 0; width: 16px; height: 16px; }
.nav-label { overflow: hidden; white-space: nowrap; transition: opacity 150ms ease; }
body.nav-collapsed .nav-label { opacity: 0; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */

.site-footer {
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  font-family: 'Lora', Georgia, serif;
  font-size: var(--font-size-label);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
}

.footer-link {
  font-size: var(--font-size-label);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.footer-link:hover { color: var(--color-text); }

/* ── Page wrapper ───────────────────────────────────────────────────────────── */

.page-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-lg);
}

/* ── Utility ────────────────────────────────────────────────────────────────── */

.text-muted   { color: var(--color-text-muted); }
.text-accent  { color: var(--color-accent); }
.text-green   { color: var(--color-green); }
.text-label   { font-size: var(--font-size-label); }
.text-sm      { font-size: var(--font-size-label); }

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
}

/* ── Score badge (shared across app + landing preview) ──────────────────────── */

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 26px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-semibold);
  color: #fff;
  padding: 0 var(--space-sm);
}
