/* Matribhasa Press — v2 design system
   Modern & bold · DM Sans + Sora · 3 themes · responsive
*/

/* THEME A — Indigo Surge (default) */
:root, [data-theme="indigo"] {
  --bg:        #F6F4EF;
  --bg-2:      #FFFFFF;
  --surface:   #FFFFFF;
  --surface-2: #EFEBE2;
  --ink:       #0F0F12;
  --ink-2:     #2B2B33;
  --muted:     #6B6B75;
  --line:      #E5E1D7;
  --line-2:    #D7D2C5;

  --primary:   #4F35FF;
  --primary-2: #3D27D9;
  --accent:    #FF5A36;
  --accent-2:  #E94A24;
  --success:   #1F8A4C;
  --warn:      #E5A21A;
  --hi:        #FFE34D;

  --on-primary: #FFFFFF;
  --on-accent:  #FFFFFF;
}

/* THEME B — Saffron Modern */
[data-theme="saffron"] {
  --bg:        #FBF6EC;
  --bg-2:      #FFFFFF;
  --surface:   #FFFFFF;
  --surface-2: #F0E7D0;
  --ink:       #1B1B14;
  --ink-2:     #2D2D22;
  --muted:     #6E6A5A;
  --line:      #E9DFC4;
  --line-2:    #D9CCA6;

  --primary:   #0E5C5B;
  --primary-2: #0A4847;
  --accent:    #F5A300;
  --accent-2:  #E69200;
  --success:   #1F8A4C;
  --warn:      #E5A21A;
  --hi:        #FFD23F;

  --on-primary: #FFFFFF;
  --on-accent:  #1B1B14;
}

/* THEME C — Midnight Spectrum */
[data-theme="midnight"] {
  --bg:        #0B0E1A;
  --bg-2:      #11152A;
  --surface:   #161B33;
  --surface-2: #1F2547;
  --ink:       #F6F7FF;
  --ink-2:     #C5C8E0;
  --muted:     #8B8FAE;
  --line:      #2A3060;
  --line-2:    #353B72;

  --primary:   #6F5BFF;
  --primary-2: #5947E0;
  --accent:    #FF3D8A;
  --accent-2:  #E62B76;
  --success:   #2EE093;
  --warn:      #FFB833;
  --hi:        #7AE3FF;

  --on-primary: #FFFFFF;
  --on-accent:  #FFFFFF;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", "Inter", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ============ Type ============ */
.t-display {
  font-family: "Sora", "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.035em;
}
.t-h1 {
  font-family: "Sora", "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.t-h2 {
  font-family: "Sora", "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.t-h3 {
  font-family: "Sora", "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.012em;
}
.t-body { font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.t-small { font-size: 14px; line-height: 1.5; color: var(--muted); }
.t-eyebrow {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.t-mono {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
}

/* big stat number */
.stat-num {
  font-family: "Sora", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -0.03em;
}

/* ============ Button ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-2);
  transition: transform 80ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
  white-space: nowrap;
  text-align: left;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-accent {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ink {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-ink:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 16px 26px; font-size: 16px; }

/* ============ Card ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.card-soft {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.card-ink {
  background: var(--ink-fixed, #0F0F12);
  color: var(--bg-fixed, #F6F4EF);
  border-radius: 6px;
}
.card-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 6px;
}
.card-accent {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 6px;
}

/* ============ Form ============ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.field-help {
  font-size: 13px;
  color: var(--muted);
}
.input, .textarea, .select {
  width: 100%;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent);
}
.textarea { resize: vertical; min-height: 120px; }

/* ============ Selectable tile ============ */
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 100ms ease;
  text-align: left;
  width: 100%;
}
.tile:hover { border-color: var(--ink); }
.tile.is-selected {
  border-color: var(--primary);
  border-width: 2px;
  padding: 17px;
  background: color-mix(in oklab, var(--primary) 6%, var(--surface));
}
.tile.is-selected::after {
  content: "";
  position: absolute;
  top: 12px; right: 12px;
  width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: inset 0 0 0 4px var(--surface);
}

/* ============ Pill ============ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid transparent;
}
.pill-published { background: color-mix(in oklab, var(--success) 18%, var(--surface)); color: var(--success); }
.pill-review    { background: color-mix(in oklab, var(--warn) 22%, var(--surface));    color: color-mix(in oklab, var(--warn) 70%, var(--ink)); }
.pill-draft     { background: var(--surface-2); color: var(--muted); }
.pill-accent    { background: var(--accent);  color: var(--on-accent); }
.pill-primary   { background: var(--primary); color: var(--on-primary); }

/* ============ Layout ============ */
.app {
  display: grid;
  grid-template-columns: 80px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  background: var(--ink);
  color: var(--bg);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 12px;
  gap: 8px;
  z-index: 20;
}
.sidebar .logo-mark {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 8px;
}
.nav-icon {
  width: 44px; height: 44px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.55);
  position: relative;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.nav-icon:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-icon.is-active {
  background: var(--primary);
  color: var(--on-primary);
}
.nav-icon .tip {
  position: absolute;
  left: 56px;
  background: var(--ink-2);
  color: var(--bg);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}
.nav-icon:hover .tip { opacity: 1; }

.main {
  padding: 32px 40px 80px;
  max-width: 1480px;
  width: 100%;
}

/* Mobile bottom-bar nav */
.mobile-tabs {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--ink);
  color: var(--bg);
  z-index: 30;
  padding: 8px 8px 14px;
  border-top: 1px solid var(--line-2);
}
.mobile-tabs .row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}
.mobile-tab {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 8px 4px;
  border-radius: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
}
.mobile-tab.is-active { color: #fff; background: var(--primary); }

.mobile-topbar {
  display: none;
  position: sticky; top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 15;
  padding: 14px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ============ Step indicator (wizard) ============ */
.steps {
  display: flex;
  gap: 8px;
}
.step-pip {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--line-2);
  overflow: hidden;
  position: relative;
}
.step-pip.is-current { background: var(--primary); }
.step-pip.is-done    { background: var(--ink); }

/* ============ Book cover ============ */
.cover {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow:
    0 1px 0 0 rgba(0,0,0,0.15),
    8px 12px 24px -8px rgba(0,0,0,0.25);
}
.cover::before {
  content: "";
  position: absolute;
  left: 8%;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(0,0,0,0.18);
  z-index: 2;
}

/* ============ Photo placeholder ============ */
.photo {
  position: relative;
  background: var(--surface-2);
  overflow: hidden;
  border-radius: 6px;
}
.photo::after {
  content: attr(data-label);
  position: absolute;
  left: 12px; top: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.45);
  padding: 4px 8px;
  border-radius: 3px;
  backdrop-filter: blur(4px);
}

/* ============ Animations ============ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 14px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  box-shadow: 0 16px 40px rgba(0,0,0,0.18);
  animation: fadeIn 260ms ease-out;
  max-width: 90vw;
}

/* ============ Sales bar chart bar ============ */
.bar {
  background: var(--ink);
  border-radius: 4px 4px 0 0;
  transition: opacity 120ms ease;
}
.bar:hover { opacity: 0.7; }
.bar.is-current { background: var(--accent); }

/* ============ Utilities ============ */
.row    { display: flex; align-items: center; gap: 12px; }
.col    { display: flex; flex-direction: column; gap: 12px; }
.grow   { flex: 1; }
.between{ justify-content: space-between; }
.wrap   { flex-wrap: wrap; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

/* ============ Responsive ============ */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-tabs { display: block; }
  .mobile-topbar { display: flex; }
  .main { padding: 16px 16px 100px; }
  .desktop-only { display: none !important; }
}
@media (min-width: 881px) {
  .mobile-only { display: none !important; }
}

/* Tweak: density */
body.density-compact { font-size: 15px; }
body.density-compact .main { padding: 24px 28px 80px; }
body.density-compact .input, body.density-compact .textarea { padding: 10px 12px; font-size: 14px; }
body.density-compact .btn { padding: 10px 16px; }
