/* ═══════════════════════════════════════════════════════════════════════════
   Jejo.ai — Site Theme (the editorial-tailor design system)
   Single source of truth for tokens + chrome shared across every page.
   The homepage (homepage.css) is the bespoke reference; this file mirrors its
   palette, type, nav, footer, buttons and adds the primitives inner pages need
   (forms, cards, prose, reveals). Loaded globally by base.html.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --paper: #f7f5f0;
  --paper-2: #f1eee6;        /* recessed surfaces / cards */
  --paper-3: #eae5da;        /* deeper recessed surface */
  --ink: #1a1712;
  --ink-soft: #4a443b;
  --ink-faint: rgba(26, 23, 18, 0.14);
  --accent: #2e4a6b;         /* quiet ink-blue */
  --accent-soft: rgba(46, 74, 107, 0.12);
  --accent-line: rgba(46, 74, 107, 0.5);
  --rule: rgba(26, 23, 18, 0.16);
  --danger: #8c2f2f;
  --success: #2f6b46;
  --serif: "Spectral", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, sans-serif;
  --hand: "Caveat", "Segoe Script", cursive;
  --maxw: 1280px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --settle: cubic-bezier(0.16, 1, 0.3, 1);
  /* legacy aliases — keep old page CSS that still references these from breaking
     while it is migrated; all resolve to the editorial palette. */
  --color-bg: var(--paper);
  --color-text: var(--ink);
  --color-text-secondary: var(--ink-soft);
  --color-text-tertiary: var(--ink-soft);
  --color-accent: var(--accent);
  --color-accent-purple: var(--accent);
  --color-accent-pink: var(--accent);
  --color-surface: var(--paper-2);
  --color-surface-hover: var(--paper-3);
  --color-border: var(--ink-faint);
  --color-border-strong: var(--rule);
  --font-system: var(--sans);
  --font-serif: var(--serif);
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}

::selection { background: var(--accent); color: var(--paper); }

a { color: inherit; text-decoration: none; transition: color 0.3s var(--ease); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

img { max-width: 100%; display: block; }

/* ═══ Layout ═══ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 40px; }

/* ═══ Eyebrow ═══ */
.eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
  opacity: 0.55;
  display: inline-block;
}

/* ═══ Headings ═══ */
.h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 5.4vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.h1 em { font-style: italic; font-weight: 300; color: var(--accent); }
.h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.2vw, 3.3rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  max-width: 16ch;
}
.h2 em { font-style: italic; color: var(--accent); font-weight: 300; }

/* ═══ Buttons ═══ */
.btn {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--ink);
  color: var(--paper);
  padding: 0.72em 1.4em;
  border-radius: 2px;
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: background 0.35s var(--ease), color 0.35s var(--ease), transform 0.35s var(--ease);
  display: inline-block;
  white-space: nowrap;
  text-align: center;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); transform: translateY(-1px); }
.btn-lg { font-size: 1rem; padding: 1em 2em; }
.btn-block { display: block; width: 100%; }

/* ghost / secondary — bordered, paper background */
.btn-ghost {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  background: transparent;
  color: var(--ink);
  padding: 0.72em 1.4em;
  border-radius: 2px;
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: border-color 0.35s var(--ease), background 0.35s var(--ease), color 0.35s var(--ease);
  display: inline-block;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: var(--paper-2); }

/* quiet text link with arrow, e.g. "← Back to jejo.ai" */
.back-link {
  display: inline-block;
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.back-link:hover { color: var(--ink); }

/* inline prose links — accent with thin underline */
.link-accent { color: var(--accent); border-bottom: 1px solid var(--accent-line); }
.link-accent:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ═══ Section rule ═══ */
.section-rule {
  height: 1px;
  background: var(--rule);
  max-width: var(--maxw);
  margin: 0 auto;
  width: calc(100% - 80px);
}

/* ═══ NAV (shared with homepage's nav.site) ═══ */
nav.site {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 245, 240, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ink-faint);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 78px;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.wordmark .dot { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 2.1rem;
}
.nav-links a.link {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  padding-bottom: 2px;
}
.nav-links a.link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}
.nav-links a.link:hover { color: var(--ink); }
.nav-links a.link:hover::after { transform: scaleX(1); }
.nav-toggle { display: none; }

/* ═══ FOOTER (shared with homepage's footer.site) ═══ */
footer.site {
  border-top: 1px solid var(--rule);
  padding: 3.4rem 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer-links { display: flex; gap: 1.8rem; flex-wrap: wrap; }
.footer-links a { font-size: 0.92rem; color: var(--ink-soft); }
.footer-links a:hover { color: var(--ink); }
.footer-copy { font-size: 0.88rem; color: var(--ink-soft); }

/* ═══ Page shell — sticky footer column ═══ */
body.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
body.site-shell > main,
body.site-shell > .page-main { flex: 1 0 auto; }

/* ═══ Forms (shared: login, contact, onboarding, dashboard) ═══ */
.form-group { margin-bottom: 1.1rem; text-align: left; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.form-group input,
.form-group select,
.form-group textarea,
.field {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-size: 1rem;
  color: var(--ink);
  font-family: var(--sans);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group input::placeholder,
.field::placeholder { color: var(--ink-soft); opacity: 0.6; }
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a443b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}
.form-group select option { background: var(--paper); color: var(--ink); }
.form-group .helper-text {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 0.4rem;
  line-height: 1.4;
}

/* solid primary submit button used in forms */
.btn-primary {
  width: 100%;
  padding: 0.92rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 3px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  margin-top: 0.4rem;
  transition: background 0.35s var(--ease), transform 0.35s var(--ease);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.btn-loading { opacity: 0.65; cursor: not-allowed; transform: none; }
.btn-primary:disabled { pointer-events: none; opacity: 0.65; }

/* ═══ Card primitive ═══ */
.card {
  background: var(--paper-2);
  border: 1px solid var(--ink-faint);
  border-radius: 3px;
  padding: 2.6rem;
  position: relative;
}

/* ═══ Document / prose (legal pages: terms, privacy, fair-use) ═══ */
.document-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 120px 40px 96px;
}
.document-content h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 0.6rem;
  color: var(--ink);
}
.document-content .last-updated {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-bottom: 3rem;
  font-style: italic;
  font-family: var(--serif);
}
.document-content h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--ink);
}
.document-content p,
.document-content ul,
.document-content li {
  font-size: 1.05rem;
  color: var(--ink-soft);
  line-height: 1.7;
}
.document-content p { margin-bottom: 1.1rem; }
.document-content ul { padding-left: 1.4rem; margin-bottom: 1.1rem; }
.document-content li { margin-bottom: 0.5rem; }
.document-content strong { color: var(--ink); font-weight: 600; }
.document-content a { color: var(--accent); border-bottom: 1px solid var(--accent-line); }
.document-content a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ═══ Reveal-on-scroll (driven by site.js; safe baseline) ═══ */
.reveal { opacity: 1; transform: none; }
body.anim .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
body.anim .reveal.in { opacity: 1; transform: translateY(0); }

/* ═══ Flash messages (editorial) ═══ */
.flash-messages {
  position: relative;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 560px;
  width: calc(100% - 48px);
  margin: 1.5rem auto 0;
}
.flash-message {
  position: relative;
  padding: 0.9rem 2.4rem 0.9rem 1.2rem;
  border-radius: 3px;
  font-size: 0.92rem;
  font-weight: 500;
  border: 1px solid var(--ink-faint);
  background: var(--paper-2);
  color: var(--ink);
  animation: flashIn 0.4s var(--ease) forwards;
  opacity: 0;
  transform: translateY(-8px);
}
.flash-message.dismissing { animation: flashOut 0.4s var(--ease) forwards; opacity: 1; transform: translateY(0); }
.flash-success { border-left: 3px solid var(--success); }
.flash-error { border-left: 3px solid var(--danger); }
.flash-info { border-left: 3px solid var(--accent); }
.flash-warning { border-left: 3px solid #9a6b1f; }
.flash-close {
  position: absolute; top: 50%; right: 12px; transform: translateY(-50%);
  background: none; border: none; color: var(--ink-soft); opacity: 0.7;
  cursor: pointer; font-size: 18px; line-height: 1; padding: 0;
}
.flash-close:hover { opacity: 1; }
.flash-close:disabled { opacity: 0.3; cursor: not-allowed; }
@keyframes flashIn { to { opacity: 1; transform: translateY(0); } }
@keyframes flashOut { to { opacity: 0; transform: translateY(-8px); } }

/* ═══ Responsive ═══ */
@media (max-width: 720px) {
  .nav-links {
    display: none;
  }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 78px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 1.6rem 40px 2rem;
    gap: 1.2rem;
  }
  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
  }
  .nav-toggle span { width: 24px; height: 2px; background: var(--ink); display: block; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 22px; }
  .nav-links.open { padding: 1.6rem 22px 2rem; }
  .document-content { padding: 96px 22px 72px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .flash-message { opacity: 1 !important; transform: none !important; }
}
