/* ========================================================
   BOOKIFY ARCHIVE — MAIN STYLESHEET
   Core tokens, base resets, header, footer, toast & cursor
   ======================================================== */

:root {
  --paper: #ECE8E0;
  --sheet: #F4F1EA;
  --card-bg: #FFFFFF;
  --reader-bg: #F8F5EE;
  --ink: #141414;
  --muted: #6B6861;
  --cobalt: #1B3BA8;
  --accent: #B83A24;
  --green: #236E44;
  --gold: #C59A3F;
  --rule: rgba(20, 20, 20, 0.85);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --H: min(48vh, 34vw);
  --cy: 41%;
  --sans: "Inter Tight", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Newsreader", "Georgia", "Baskerville", serif;
  --display: "Cinzel", "Newsreader", "Georgia", serif;
}

@media (max-width: 767px) {
  :root {
    --H: min(68vw, 40svh);
    --cy: 43%;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  user-select: none;
  -webkit-user-select: none;
}

/* Interactive Cursor Standards */
body {
  cursor: default;
}

button, a, .clickable, .box-btn, .close-btn, .nav-tab-btn, .user-pill, .genre-pill,
.book-card, .detail-action-btn, .auth-tab-btn, .auth-submit-btn, .auth-demo-btn,
.auth-close-btn, .play-ring, .tape {
  cursor: pointer;
}

input, textarea {
  cursor: text;
}

select {
  cursor: pointer;
}

/* Paper Grain Texture */
.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.55;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.42 0 0 0 0 0.38 0 0 0 0 0.22 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Typography Helpers */
.lbl {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Universal Button Styles */
.box-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: all 0.2s var(--ease);
  border-radius: 2px;
  white-space: nowrap;
  text-decoration: none;
}

.box-btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.box-btn.primary {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #FFFFFF;
}

.box-btn.primary:hover {
  background: #122870;
  border-color: #122870;
  color: #FFFFFF;
}

.box-btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.box-btn.accent:hover {
  background: #902613;
}

.box-btn.green-btn {
  background: var(--green);
  border-color: var(--green);
  color: #FFFFFF;
}

.box-btn.green-btn:hover {
  background: #195232;
}

/* Top Navigation Bar */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 76px;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--cobalt);
  z-index: 50;
  border-bottom: 1px solid rgba(27, 59, 168, 0.1);
  background: rgba(236, 232, 224, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-decoration: none;
}

.top-left img {
  height: 38px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  display: block;
  transition: transform 0.2s;
}

.top-left:hover img {
  transform: scale(1.02);
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--cobalt);
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 8px;
  letter-spacing: 0.2em;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.brand-line {
  width: 28px;
  height: 1px;
  background: var(--cobalt);
  opacity: 0.4;
  margin: 0 4px;
}

.top-nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(20, 20, 20, 0.05);
  padding: 4px;
  border-radius: 6px;
  border: 1px solid rgba(20, 20, 20, 0.08);
}

.nav-tab-btn {
  border: none;
  background: transparent;
  padding: 8px 18px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-radius: 4px;
  transition: all 0.2s var(--ease);
  text-decoration: none;
}

.nav-tab-btn:hover {
  color: var(--ink);
}

.nav-tab-btn.active {
  background: #FFFFFF;
  color: var(--cobalt);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 6px;
  background: #FFFFFF;
  border: 1px solid rgba(27, 59, 168, 0.25);
  border-radius: 20px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  transition: all 0.2s;
}

.user-pill:hover {
  border-color: var(--cobalt);
  background: #FAF9F6;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cobalt);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 767px) {
  .top-bar {
    height: 60px;
    padding: 0 16px;
  }
  .brand-line, .brand-subtitle, .top-nav-tabs {
    display: none;
  }
  .brand-title {
    font-size: 16px;
  }
  .top-right {
    gap: 8px;
  }
  .box-btn {
    height: 28px;
    padding: 0 10px;
    font-size: 10px;
  }
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  border-top: 1px solid rgba(20, 20, 20, 0.08);
  z-index: 15;
  background: rgba(236, 232, 224, 0.85);
  backdrop-filter: blur(6px);
}

.footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--cobalt);
}

@media (max-width: 767px) {
  .footer {
    display: none;
  }
}

/* Mobile Bottom Tab Bar */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #FFFFFF;
  border-top: 1px solid rgba(20, 20, 20, 0.1);
  z-index: 55;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
}

@media (max-width: 767px) {
  .mobile-tab-bar {
    display: flex;
  }
}

.mobile-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s;
  text-decoration: none;
}

.mobile-tab-item.active {
  color: var(--cobalt);
}

.mobile-tab-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Custom Cursor */
.custom-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  will-change: left, top;
  display: none;
}

@media (pointer: fine) {
  .custom-cursor {
    display: block;
  }
}

.cursor-ring {
  width: 48px;
  height: 48px;
  border: 1px solid var(--cobalt);
  border-radius: 50%;
  background: rgba(236, 232, 224, 0.2);
  transition: transform 0.25s var(--ease), border-color 0.25s, background-color 0.25s;
}

.cursor-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  background: var(--cobalt);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.cursor-label {
  position: absolute;
  left: 56px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--cobalt);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}

.custom-cursor.state-open .cursor-ring {
  transform: scale(1.35);
  border-color: var(--cobalt);
  background: rgba(27, 59, 168, 0.12);
}

.custom-cursor.state-open .cursor-label {
  opacity: 1;
}

.custom-cursor.state-btn .cursor-ring {
  transform: scale(0.65);
  border-color: var(--ink);
}

.custom-cursor.state-spine .cursor-ring {
  transform: scale(0.85);
  border-color: var(--accent);
}

/* Animated Toast Notification */
.toast-msg {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  background: var(--cobalt);
  color: #FFFFFF;
  padding: 12px 26px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s var(--ease), opacity 0.4s;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

