/* ============================================================
   book.erek.space — design system
   warm paper + deep ink + refined indigo
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700;900&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

:root {
  /* paper / ink palette */
  --paper:        #faf7f2;
  --paper-2:      #f4efe5;
  --surface:      #fffdf8;
  --surface-2:    #f8f4ec;
  --ink:          #1a1814;
  --ink-2:        #2d2823;
  --muted:        #6b6356;
  --muted-2:      #948b7c;
  --faint:        #b8b0a1;
  --line:         #e8e2d3;
  --line-strong:  #d6cfbd;

  /* accent — deep refined indigo, tuned for warm paper */
  --indigo:       oklch(0.48 0.18 272);
  --indigo-hover: oklch(0.42 0.20 272);
  --indigo-soft:  oklch(0.95 0.03 272);
  --indigo-edge:  oklch(0.85 0.06 272);

  /* status */
  --success:      oklch(0.55 0.12 155);
  --warning:      oklch(0.70 0.15 75);
  --danger:       oklch(0.55 0.18 25);

  /* type */
  --font-sans:    "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  --font-serif:   "Noto Serif SC", "Source Han Serif SC", "Songti SC", "Times New Roman", serif;
  --font-mono:    ui-monospace, "SF Mono", "Menlo", monospace;

  /* radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* shadows — soft and warm */
  --shadow-sm: 0 1px 2px rgba(60, 50, 30, 0.05);
  --shadow-md: 0 2px 8px rgba(60, 50, 30, 0.06), 0 1px 2px rgba(60, 50, 30, 0.04);
  --shadow-lg: 0 12px 32px rgba(60, 50, 30, 0.08), 0 4px 8px rgba(60, 50, 30, 0.04);
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

/* ----- typography helpers ----- */
.serif { font-family: var(--font-serif); }
.mono  { font-family: var(--font-mono); }

/* ----- shared topnav ----- */
.topnav {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 247, 242, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topnav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.topnav .brand .mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 15px;
}
.topnav .nav {
  display: flex;
  gap: 28px;
  font-size: 13.5px;
  color: var(--muted);
}
.topnav .nav a:hover { color: var(--ink); }
.topnav .right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ----- buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, transform 100ms;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(0.5px); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); }

.btn-accent {
  background: var(--indigo);
  color: white;
  border-color: var(--indigo);
}
.btn-accent:hover { background: var(--indigo-hover); border-color: var(--indigo-hover); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { padding: 13px 22px; font-size: 14.5px; }

/* ----- inputs ----- */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 13.5px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-soft);
}
.input::placeholder { color: var(--faint); }

.label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

/* ----- card ----- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

/* ----- chips / tags ----- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.chip.indigo { background: var(--indigo-soft); color: var(--indigo); border-color: var(--indigo-edge); }
.chip.green  { background: oklch(0.95 0.04 155); color: var(--success); border-color: oklch(0.85 0.08 155); }
.chip.warn   { background: oklch(0.96 0.05 75);  color: oklch(0.45 0.12 75); border-color: oklch(0.85 0.10 75); }

/* ----- divider ----- */
.hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

/* ----- icon (uses inline svg sized to em) ----- */
.icon { width: 1em; height: 1em; vertical-align: -0.1em; }

/* ----- utility ----- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.max-960 { max-width: 960px; margin: 0 auto; }
.max-1200 { max-width: 1200px; margin: 0 auto; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }

/* ----- book cover (procedural — no real images) ----- */
.cover {
  position: relative;
  border-radius: 4px;
  display: flex;
  align-items: flex-end;
  padding: 18px 14px;
  overflow: hidden;
  color: white;
  font-family: var(--font-serif);
  isolation: isolate;
  box-shadow:
    inset -2px 0 6px rgba(0,0,0,0.18),
    inset 2px 0 0 rgba(255,255,255,0.06),
    0 2px 6px rgba(60, 50, 30, 0.18);
}
.cover::before {
  /* paper grain */
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.12), transparent 60%);
  pointer-events: none;
  z-index: -1;
}
.cover::after {
  /* spine shadow */
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: linear-gradient(90deg, rgba(0,0,0,0.22), transparent);
  pointer-events: none;
}
.cover .ctitle {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
}
.cover .cauthor {
  margin-top: 6px;
  font-family: var(--font-sans);
  font-size: 11px;
  opacity: 0.7;
  letter-spacing: 0.04em;
}


.cover.has-image {
  padding: 0;
  background: var(--surface-2);
  align-items: stretch;
}
.cover.has-image::before,
.cover.has-image::after {
  z-index: 1;
}
.cover.has-image::before {
  background: linear-gradient(90deg, rgba(0,0,0,0.18), transparent 18%);
}
.cover.has-image .cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover.has-image .cover-fallback-text { display: none; }

/* cover color variants */
.cover-indigo { background: linear-gradient(155deg, #4338ca, #2d2675); }
.cover-ink    { background: linear-gradient(155deg, #2d2823, #0f0d0a); }
.cover-rust   { background: linear-gradient(155deg, #a8431a, #6b2810); }
.cover-sage   { background: linear-gradient(155deg, #4a6b4c, #2a4530); }
.cover-wine   { background: linear-gradient(155deg, #6b1f3a, #3a0f20); }
.cover-mustard{ background: linear-gradient(155deg, #b8862a, #6b4810); color: #fef9e8; }
.cover-cream  { background: linear-gradient(155deg, #ede4c8, #c8b88a); color: #3a2a10; }
.cover-teal   { background: linear-gradient(155deg, #1e5560, #0e2f38); }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 2px solid var(--paper);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
::-webkit-scrollbar-track { background: transparent; }
