/**
 * Design system for the signed-in surfaces (login, account, dashboard).
 *
 * Tokens are the measured values from a real production capture (type scale,
 * easings, radii — see REBUILD.md in the capture archive), not guesses: the
 * two eases below account for the large majority of transitions on that site,
 * and the word-reveal mechanic mirrors its markup exactly. The marketing
 * landing page keeps its own dark theme deliberately — see main.js — this
 * system is for the app surfaces, which had no design of their own yet.
 */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600&family=Parkinsans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #fbf8f1;
  --surface: #ffffff;
  --ink: #0c1e18;
  --ink-soft: rgba(12, 30, 24, 0.62);
  --ink-faint: rgba(12, 30, 24, 0.4);
  --line: rgba(12, 30, 24, 0.12);
  --brand: #005236;
  --brand-dark: #0c1e18;
  --accent: #e6ff55;
  --good: #1a7a4c;
  --warn: #b5750a;
  --bad: #c23b3b;
  --radius: 1.2rem;
  --radius-lg: 2rem;
  --radius-sm: 0.6rem;
  --radius-pill: 100rem;
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-inout: cubic-bezier(0.77, 0, 0.175, 1);
  /* hand-tuned spring/overshoot curve measured off the real site's button
     hover/press — peaks ~1.14 at 24%, settles by 81% */
  --ease-spring: linear(
    0 0%, 0.5737 7.6%, 0.8382 11.87%, 0.9463 14.19%, 1.0292 16.54%,
    1.0886 18.97%, 1.1258 21.53%, 1.137 22.97%, 1.1424 24.48%,
    1.1423 26.1%, 1.1366 27.86%, 1.1165 31.01%, 1.0507 38.62%,
    1.0219 42.57%, 0.9995 46.99%, 0.9872 51.63%, 0.9842 58.77%,
    1.0011 81.26%, 1 100%
  );
  --ease-spring-fallback: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font-display: 'Parkinsans', 'Space Grotesk', sans-serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
}

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

.app {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.app h1, .app h2, .app h3 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.1; }
.app a { color: inherit; text-decoration: none; }
.app code, .app pre { font-family: 'Fira Code', ui-monospace, monospace; }

/* ── Split-text word reveal ──
   Each word sits in an overflow-hidden outer span with an inner span that
   translates up into place — the exact two-span mechanic a real word-reveal
   uses, since GSAP's own SplitText plugin is a paid Club add-on we won't
   pull from an unofficial mirror. */
.split-word { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.1em; }
.split-word-inner { display: inline-block; transform: translateY(110%); will-change: transform; }

.reveal-up { opacity: 0; transform: translateY(2.4rem); will-change: transform, opacity; }

/* ── Header: persistent nav, breadcrumbs, credits ── */
.app-header {
  position: sticky; top: 0; z-index: 40;
  padding: 1.4rem 2rem;
}
.app-header__bar {
  max-width: 112rem; margin: 0 auto;
  display: flex; align-items: center; gap: 1.6rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1.4rem;
  box-shadow: 0 1px 2px rgba(12, 30, 24, 0.04), 0 8px 24px rgba(12, 30, 24, 0.05);
}
.app-header__logo {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-display); font-weight: 800; font-size: 1.3rem;
  letter-spacing: -0.02em; color: var(--brand-dark); flex-shrink: 0;
}
.logo-mark { width: 1.1rem; height: 1.1rem; color: currentColor; flex-shrink: 0; }

/* ── Split-character reveal (logo wordmark) ── */
.split-char { display: inline-block; overflow: hidden; }
.split-char-inner {
  display: inline-block;
  transform: translateY(115%);
  opacity: 0;
  animation: charRise 0.6s var(--ease-out) forwards;
}
@keyframes charRise { to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .split-char-inner { animation: none; transform: none; opacity: 1; }
}
.app-breadcrumbs {
  display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0;
  font-size: 0.85rem; color: var(--ink-soft); overflow: hidden; white-space: nowrap;
}
.app-breadcrumbs a { color: var(--ink-soft); transition: color 0.2s var(--ease-out); }
.app-breadcrumbs a:hover { color: var(--brand); }
.app-breadcrumbs .sep { color: var(--ink-faint); }
.app-breadcrumbs .current { color: var(--ink); font-weight: 500; }

.credits-pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--brand-dark); color: #fff;
  border-radius: var(--radius-pill);
  padding: 0.55rem 1.1rem 0.55rem 0.8rem;
  font-size: 0.82rem; font-weight: 600; flex-shrink: 0;
  transition: transform 0.2s var(--ease-out);
}
.credits-pill:hover { transform: scale(1.03); }
.credits-pill__dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(230, 255, 85, 0.25);
}
.credits-pill__value { color: var(--accent); font-family: var(--font-display); }
.credits-pill.is-low .credits-pill__dot { background: #ffb27a; box-shadow: 0 0 0 3px rgba(255, 178, 122, 0.25); }
.credits-pill.is-empty .credits-pill__dot { background: #ff8a8a; box-shadow: 0 0 0 3px rgba(255, 138, 138, 0.25); }

.app-header__actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }

/* ── Header: signed-in profile chip ── */
.auth-chip { position: relative; }
.auth-chip__btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 0.35rem 0.9rem 0.35rem 0.35rem; cursor: pointer; font-family: var(--font-body);
  transition: border-color 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
}
.auth-chip__btn:hover { border-color: var(--ink-faint); background: var(--bg); }
.auth-chip__avatar {
  width: 1.7rem; height: 1.7rem; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-dark); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 0.78rem;
}
.auth-chip__email {
  font-size: 0.82rem; color: var(--ink); max-width: 11rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.auth-chip__menu {
  position: absolute; top: calc(100% + 0.5rem); right: 0; z-index: 50;
  min-width: 10rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0.4rem;
  box-shadow: 0 1px 2px rgba(12, 30, 24, 0.04), 0 16px 32px rgba(12, 30, 24, 0.1);
  display: flex; flex-direction: column; gap: 0.1rem;
  transform-origin: top right;
  transition: transform 0.3s var(--ease-out), opacity 0.2s var(--ease-out);
}
.auth-chip__menu.is-closed { opacity: 0; transform: scale(0.95) translateY(-4px); pointer-events: none; }
.auth-chip__menu a, .auth-chip__menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  font-family: var(--font-body); font-size: 0.85rem; color: var(--ink);
  padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); cursor: pointer;
  transition: background-color 0.15s var(--ease-out);
}
.auth-chip__menu a:hover, .auth-chip__menu button:hover { background: var(--bg); }
@media (max-width: 720px) {
  .auth-chip__email { display: none; }
  .auth-chip__btn { padding: 0.35rem; }
}

@media (max-width: 720px) {
  .app-header { padding: 1rem; }
  .app-breadcrumbs { display: none; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-display); font-weight: 600; font-size: 0.88rem;
  border-radius: var(--radius-pill); border: 1px solid transparent;
  padding: 0.75rem 1.3rem; cursor: pointer;
  transition: transform 0.45s var(--ease-spring-fallback), background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
@supports (transition-timing-function: linear(0, 1)) {
  .btn { transition-timing-function: var(--ease-spring), var(--ease-out), var(--ease-out); }
}
.btn:hover:not(:disabled) { transform: scale(1.045, 1.07); }
.btn:active:not(:disabled) { transform: scale(0.975); }
.btn:focus-visible { transform: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-secondary { background: var(--accent); color: var(--brand-dark); }
.btn-secondary:hover:not(:disabled) { background: #c9df49; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-faint); }
.btn-google {
  background: #fff; color: var(--ink); border-color: var(--line);
  width: 100%; padding: 0.9rem 1.3rem; font-size: 0.95rem;
}
.btn-google:hover:not(:disabled) { border-color: var(--ink-soft); box-shadow: 0 2px 8px rgba(12, 30, 24, 0.08); }
.btn-google svg { flex-shrink: 0; }

/* ── Cards / surfaces ── */
.app-main { max-width: 76rem; margin: 0 auto; padding: 3rem 2rem 6rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2rem; margin-bottom: 1.6rem;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 1px 2px rgba(12, 30, 24, 0.04), 0 8px 24px rgba(12, 30, 24, 0.06);
}
.card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.3rem; }
.card .hint { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: 1.4rem; }
.card-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.card-row .spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.1rem 1.2rem; }
.stat .v { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; }
.stat .l { color: var(--ink-soft); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.3rem; }

.bar { height: 0.5rem; background: var(--bg); border-radius: var(--radius-pill); overflow: hidden; margin-top: 1rem; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--brand); transition: width 0.4s var(--ease-out); }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; color: var(--ink-soft); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); }
td { padding: 0.7rem; border-bottom: 1px solid var(--line); }

pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; overflow-x: auto; font-size: 0.78rem; color: var(--brand); white-space: pre; }

input[type=email], input[type=text] {
  padding: 0.8rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 0.9rem; font-family: var(--font-body); min-width: 16rem;
  outline: 2px solid transparent; outline-offset: 0px;
  transition: border-color 0.2s var(--ease-out), outline-color 0.2s var(--ease-out), outline-offset 0.2s var(--ease-out);
}
input:focus { border-color: var(--brand); }
input:focus-visible { outline-color: var(--brand); outline-offset: 2px; }

.pill { padding: 0.2rem 0.7rem; border-radius: var(--radius-pill); font-size: 0.72rem; font-weight: 600; border: 1px solid var(--line); }
.pill.free { color: var(--ink-soft); }
.pill.paid { color: #fff; background: var(--brand); border-color: var(--brand); }

.notice { border-radius: var(--radius-sm); padding: 0.9rem 1.1rem; font-size: 0.85rem; margin-bottom: 1.2rem; border: 1px solid; }
.notice.warn { background: rgba(181, 117, 10, 0.08); border-color: rgba(181, 117, 10, 0.3); color: var(--warn); }
.notice.bad  { background: rgba(194, 59, 59, 0.08);  border-color: rgba(194, 59, 59, 0.3);  color: var(--bad); }
.notice.good { background: rgba(26, 122, 76, 0.08);  border-color: rgba(26, 122, 76, 0.3);  color: var(--good); }

.keyout { background: var(--bg); border: 1px dashed var(--good); border-radius: var(--radius-sm); padding: 1rem; margin-top: 0.8rem; }
.keyout code { color: var(--good); word-break: break-all; font-size: 0.85rem; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
.plan { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.3rem; }
.plan.current { border-color: var(--brand); }
.plan .price { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin: 0.4rem 0; }
.plan ul { list-style: none; margin: 0.6rem 0 0.9rem; color: var(--ink-soft); font-size: 0.78rem; }
.plan li { padding: 0.15rem 0; }

.muted { color: var(--ink-soft); }
.hidden { display: none !important; }

/* ── Decorative parallax shapes ── */
.app-shape {
  position: absolute; pointer-events: none; z-index: 0;
  color: var(--brand); opacity: 0.06;
}
.app-shape svg { display: block; width: 100%; height: auto; }
