/* Capykraft app — UI kit styles. Composes the design-system tokens
   from ../../styles.css. Self-contained so the kit renders anywhere. */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--surface-page); color: var(--text-body); font-family: var(--font-sans); }
#root { height: 100%; }
button { font-family: inherit; }

/* ---------------- App shell ---------------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.nav {
  height: var(--nav-height); flex: none; display: flex; align-items: center; gap: 20px;
  padding: 0 28px; background: color-mix(in srgb, var(--paper-50) 86%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 40;
}
.nav__brand { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.nav__mark { width: 30px; height: 30px; object-fit: contain; }
.nav__word { font-family: var(--font-sans); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; color: var(--ink-900); }
.nav__word b { font-weight: 700; }
.nav__links { display: flex; gap: 4px; margin-left: 14px; }
.nav__link { padding: 8px 13px; border-radius: var(--radius-sm); font-size: var(--text-base); font-weight: 500; color: var(--text-muted); background: none; border: none; cursor: pointer; transition: var(--transition-colors); }
.nav__link:hover { color: var(--text-strong); background: var(--paper-200); }
.nav__link--active { color: var(--text-strong); background: var(--paper-200); }
.nav__spacer { flex: 1; }

.page { flex: 1; width: 100%; }
.wrap { max-width: var(--container-xl); margin: 0 auto; padding: 40px 28px 80px; }
.wrap--narrow { max-width: 920px; }
.wrap--reading { max-width: var(--container-md); }

/* ---------------- Headings ---------------- */
.eyebrow { font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 700; letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px; }
.eyebrow--clay { color: var(--clay-600); }
.h-display { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.025em; line-height: 1.06; color: var(--text-strong); margin: 0; }
.serif { font-family: var(--font-display); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }

/* ---------------- Buttons (mirror DS Button) ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-sans); font-weight: 600; line-height: 1; border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--sm { font-size: var(--text-sm); padding: 7px 13px; }
.btn--md { font-size: var(--text-base); padding: 10px 18px; }
.btn--lg { font-size: var(--text-md); padding: 14px 26px; border-radius: var(--radius-lg); }
.btn--primary { background: var(--accent); color: var(--text-on-accent); box-shadow: var(--shadow-sm); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn--secondary { background: var(--surface-card); color: var(--text-strong); border-color: var(--border-default); box-shadow: var(--shadow-xs); }
.btn--secondary:hover:not(:disabled) { background: var(--paper-50); border-color: var(--border-strong); }
.btn--ghost { background: none; color: var(--text-body); }
.btn--ghost:hover:not(:disabled) { background: var(--paper-200); }
.btn--soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn--soft:hover:not(:disabled) { background: var(--clay-100); }
.btn--block { width: 100%; }

.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-md); border: 1px solid transparent; background: none; color: var(--text-body); cursor: pointer; transition: var(--transition-colors); }
.iconbtn:hover:not(:disabled) { background: var(--paper-200); color: var(--text-strong); }
.iconbtn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.iconbtn--sm { width: 32px; height: 32px; }
.iconbtn--outline { border-color: var(--border-default); background: var(--surface-card); }
.iconbtn--solid { background: var(--accent); color: var(--text-on-accent); box-shadow: var(--shadow-sm); }
.iconbtn--solid:hover { background: var(--accent-hover); }

/* ---------------- Badge ---------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--text-sm); line-height: 1; padding: 6px 12px; border-radius: var(--radius-pill); }
.badge--sm { font-size: var(--text-xs); padding: 4px 9px; }
.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------------- Card ---------------- */
.card { background: var(--surface-card); border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); }
.card--raised { box-shadow: var(--shadow-sm); border-color: transparent; }
.card--pad { padding: var(--space-6); }

/* ---------------- Inputs ---------------- */
.field { display: block; }
.field__label { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--text-body); margin: 0 0 7px; }
.input, .textarea { width: 100%; font-family: var(--font-sans); font-size: var(--text-base); color: var(--text-strong); background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 11px 14px; transition: var(--transition-colors), box-shadow var(--dur-fast) var(--ease-out); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus { outline: none; border-color: var(--clay-400); box-shadow: var(--shadow-focus); }
.textarea { resize: none; line-height: 1.5; }

/* ---------------- Avatar ---------------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; font-weight: 600; color: var(--ink-700); background: var(--clay-100); box-shadow: inset 0 0 0 1px var(--border-subtle); overflow: hidden; user-select: none; }
/* Capy mark stands alone — no circle, no padded backdrop. (User-initial avatars stay round.) */
.avatar--capy { background: none; padding: 0; box-shadow: none; border-radius: 0; overflow: visible; }
.avatar--capy img { width: 100%; height: 100%; object-fit: contain; }

/* ---------------- Cover (typographic ebook cover) ---------------- */
.cover { position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius-md); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-md); container-type: inline-size; }
.cover__pad { padding: 9% 9% 11%; display: flex; flex-direction: column; height: 100%; }
.cover__kicker { font-family: var(--font-sans); font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.62rem; opacity: 0.85; }
.cover__rule { width: 28px; height: 2px; margin-top: 10%; }
.cover__title { font-family: var(--font-display); color: inherit; font-weight: 600; letter-spacing: -0.02em; line-height: 1.04; font-size: clamp(0.75rem, 4cqw, 1rem); margin-top: auto; }
.cover__author { font-family: var(--font-sans); font-size: 0.7rem; font-weight: 500; margin-top: 12%; opacity: 0.8; }
.cover__pixels { display: flex; gap: 4px; margin-top: 10%; }
.cover__pixels span { width: 9px; height: 9px; border-radius: 1px; }

/* ---------------- Dashboard grid ---------------- */
.dash__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 26px; }
.pcard { cursor: pointer; transition: transform var(--dur) var(--ease-out); }
.pcard:hover { transform: translateY(-3px); }
.pcard:hover .pcard__cover { box-shadow: var(--shadow-lg); }
.pcard__cover { transition: box-shadow var(--dur) var(--ease-out); }
.pcard__meta { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 10px; }
.pcard__title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; line-height: 1.2; color: var(--text-strong); margin: 0; letter-spacing: -0.01em; }
.pcard__sub { font-size: var(--text-sm); color: var(--text-faint); margin: 4px 0 0; }

/* ---------------- Empty state ---------------- */
.empty { text-align: center; max-width: 460px; margin: 6vh auto; }
.empty__art { width: 132px; height: 132px; margin: 0 auto 28px; display: block; }
.empty__pixels { display: flex; gap: 7px; justify-content: center; margin-top: 26px; }
.empty__pixels span { width: 12px; height: 12px; border-radius: 2px; background: var(--clay-400); }

/* ---------------- Interview ---------------- */
.chat { display: flex; flex-direction: column; gap: 22px; }
.turn { display: flex; gap: 14px; max-width: 88%; }
.turn--user { align-self: flex-end; flex-direction: row-reverse; }
.turn__body { }
.bubble { padding: 14px 17px; border-radius: var(--radius-lg); font-size: var(--text-md); line-height: 1.55; }
.bubble--agent { background: var(--surface-card); border: 1px solid var(--border-subtle); border-top-left-radius: 6px; color: var(--text-body); box-shadow: var(--shadow-xs); }
.bubble--user { background: var(--ink-900); color: var(--paper-100); border-top-right-radius: 6px; }
.turn--user .turn__body { text-align: right; }
.turn__voice { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 8px; font-size: var(--text-sm); font-weight: 600; color: var(--clay-200); }
.wave { display: inline-flex; align-items: center; gap: 3px; height: 16px; }
.wave i { width: 3px; background: currentColor; border-radius: 2px; display: block; }
.research { display: inline-flex; align-items: center; gap: 9px; font-size: var(--text-sm); font-weight: 600; color: var(--river-600); background: var(--river-50); padding: 8px 13px; border-radius: var(--radius-pill); }
.dots i { display:inline-block; width:5px; height:5px; border-radius:50%; background: currentColor; margin: 0 1px; animation: cd 1.2s var(--ease-in-out) infinite; }
.dots i:nth-child(2){ animation-delay:.16s } .dots i:nth-child(3){ animation-delay:.32s }
@keyframes cd { 0%,60%,100%{ opacity:.3; transform:translateY(0) } 30%{ opacity:1; transform:translateY(-3px) } }

.composer { position: sticky; bottom: 0; background: linear-gradient(to top, var(--surface-page) 72%, transparent); padding: 18px 0 22px; }
.composer__box { display: flex; gap: 10px; align-items: flex-end; background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-xl); padding: 8px 8px 8px 18px; box-shadow: var(--shadow-md); }
.composer__input { flex: 1; border: none; background: none; resize: none; font-family: var(--font-sans); font-size: var(--text-md); color: var(--text-strong); padding: 9px 0; max-height: 120px; }
.composer__input:focus { outline: none; }
.recording { display: flex; align-items: center; gap: 12px; flex: 1; padding: 9px 0; color: var(--rust-500); font-weight: 600; font-size: var(--text-base); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rust-500); animation: pulse 1.2s var(--ease-in-out) infinite; }
@keyframes pulse { 0%,100%{ opacity:1 } 50%{ opacity:.35 } }

/* ---------------- Brief card ---------------- */
.brief { border-radius: var(--radius-xl); }
.brief__row { padding: 20px 26px; border-top: 1px solid var(--border-subtle); }
.brief__row:first-child { border-top: none; }
.brief__k { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); margin: 0 0 7px; }
.brief__v { font-family: var(--font-display); font-size: var(--text-lg); line-height: 1.4; color: var(--text-strong); margin: 0; }
.outline-item { display: flex; gap: 14px; padding: 10px 0; }
.outline-num { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--clay-500); font-weight: 600; padding-top: 2px; }
.insight { display: flex; gap: 11px; padding: 7px 0; font-size: var(--text-base); color: var(--text-body); line-height: 1.5; }
.insight svg { color: var(--clay-500); flex: none; margin-top: 2px; }

/* ---------------- Generation ---------------- */
.gen { max-width: 680px; margin: 4vh auto 0; }
.gen__stage-label { font-family: var(--font-display); font-size: var(--text-2xl); color: var(--text-strong); margin: 0; letter-spacing: -0.02em; }
.progress { height: 7px; border-radius: var(--radius-pill); background: var(--paper-300); overflow: hidden; }
.progress__bar { height: 100%; background: var(--clay-500); border-radius: var(--radius-pill); transition: width var(--dur-slow) var(--ease-out); }
.stages { display: flex; gap: 8px; margin: 26px 0; }
.stage-pip { flex: 1; }
.stage-pip__dot { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: 600; color: var(--text-faint); }
.stage-pip--active .stage-pip__dot { color: var(--clay-600); }
.stage-pip--done .stage-pip__dot { color: var(--sage-600); }
.stage-pip__track { height: 4px; border-radius: var(--radius-pill); background: var(--paper-300); margin-top: 9px; overflow: hidden; }
.stage-pip__fill { height: 100%; background: var(--clay-400); width: 0; transition: width var(--dur-slow) var(--ease-out); }
.stage-pip--done .stage-pip__fill { background: var(--sage-500); width: 100% !important; }
.log { font-family: var(--font-mono); font-size: var(--text-sm); line-height: 2; background: var(--ink-900); border-radius: var(--radius-lg); padding: 20px 22px; color: var(--paper-200); max-height: 260px; overflow: hidden; box-shadow: var(--shadow-lg); }
.log__line { display: flex; gap: 12px; animation: logIn var(--dur) var(--ease-out); }
.log__t { color: var(--ink-400); flex: none; }
.log__m { color: var(--paper-200); }
.log__line--done .log__m { color: var(--sage-300); }
@keyframes logIn { from { transform: translateY(7px); } to { transform: none; } }
.gen-pixels { display: flex; gap: 6px; justify-content: center; }
.gen-pixels span { width: 12px; height: 12px; border-radius: 2px; background: var(--clay-400); animation: shimmer 1.6s var(--ease-in-out) infinite; }
@keyframes shimmer { 0%,100%{ opacity:.25 } 50%{ opacity:1 } }

/* ---------------- Review / product ---------------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--paper-200); border-radius: var(--radius-pill); }
.tab { padding: 8px 18px; border-radius: var(--radius-pill); border: none; background: none; font-family: var(--font-sans); font-size: var(--text-base); font-weight: 600; color: var(--text-muted); cursor: pointer; transition: var(--transition-colors); }
.tab:hover { color: var(--text-strong); }
.tab--active { background: var(--surface-card); color: var(--text-strong); box-shadow: var(--shadow-xs); }

.reader { background: var(--paper-card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 56px clamp(28px, 7%, 72px); }
.reader h2 { font-family: var(--font-display); font-weight: 600; font-size: var(--text-2xl); letter-spacing: -0.02em; color: var(--text-strong); margin: 0 0 18px; }
.reader p { font-family: var(--font-display); font-size: var(--text-md); line-height: 1.7; color: var(--ink-800); margin: 0 0 1.1em; }
.reader ul { font-family: var(--font-display); font-size: var(--text-md); line-height: 1.7; color: var(--ink-800); padding-left: 1.2em; }
.reader li { margin-bottom: .4em; }
.reader blockquote { margin: 1.4em 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--clay-400); font-style: italic; color: var(--ink-700); }
.reader .dropcap::first-letter { font-size: 3.1em; font-weight: 600; float: left; line-height: 0.82; padding: 6px 10px 0 0; color: var(--clay-600); }
.reader__chnum { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--clay-500); font-weight: 600; letter-spacing: 0.05em; display: block; margin-bottom: 8px; }
.section-shell { position: relative; }
.section-shell + .section-shell { margin-top: 12px; padding-top: 40px; border-top: 1px solid var(--border-subtle); }
.section-actions { display: flex; gap: 8px; position: absolute; top: 38px; right: 0; opacity: 0; transition: opacity var(--dur) var(--ease-out); }
.section-shell:hover .section-actions { opacity: 1; }

.sales { background: var(--ink-900); color: var(--paper-100); border-radius: var(--radius-xl); overflow: hidden; }
.sales__hero { padding: 64px clamp(28px, 8%, 80px) 52px; position: relative; }
.sales__headline { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.8rem, 4.2vw, 3rem); line-height: 1.08; letter-spacing: -0.025em; color: var(--paper-50); margin: 0 0 18px; max-width: 16ch; }
.sales__sub { font-size: var(--text-lg); line-height: 1.55; color: var(--paper-300); max-width: 52ch; margin: 0 0 30px; }
.sales__bullets { list-style: none; padding: 0; margin: 0 0 34px; display: grid; gap: 13px; max-width: 56ch; }
.sales__bullets li { display: flex; gap: 12px; font-size: var(--text-md); color: var(--paper-200); line-height: 1.45; }
.sales__bullets svg { color: var(--clay-300); flex: none; margin-top: 3px; }
.sales__body { background: var(--paper-100); color: var(--text-body); padding: 52px clamp(28px,8%,80px); display: grid; gap: 34px; grid-template-columns: 1fr 1fr; }
.sales__sec h3 { font-family: var(--font-display); font-size: var(--text-xl); color: var(--text-strong); margin: 0 0 10px; }
.sales__sec p { font-size: var(--text-base); line-height: 1.6; color: var(--text-muted); margin: 0; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--ink-900); color: var(--paper-100); padding: 13px 20px; border-radius: var(--radius-pill); font-size: var(--text-base); font-weight: 500; box-shadow: var(--shadow-xl); display: flex; align-items: center; gap: 10px; z-index: 80; animation: toastIn var(--dur) var(--ease-out); }
.toast svg { color: var(--sage-300); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* dialog */
.scrim { position: fixed; inset: 0; background: rgba(31,27,21,0.42); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 70; padding: 24px; animation: fade var(--dur) var(--ease-out); }
.dialog { background: var(--surface-card); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); max-width: 440px; width: 100%; padding: 30px; text-align: center; animation: pop var(--dur) var(--ease-out); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }

.fade-up { animation: fadeUp var(--dur-slow) var(--ease-out); }
@keyframes fadeUp { from { transform: translateY(9px); } to { transform: none; } }

@media (max-width: 720px) {
  .nav__links { display: none; }
  .sales__body { grid-template-columns: 1fr; }
  .dash__head { flex-direction: column; align-items: flex-start; }
}
