/* ════════════════════════════════════════════════════════════════
   Cover page — animated landing for Author of Words
   ════════════════════════════════════════════════════════════════ */

.cover-body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  cursor: url('/static/img/pencil-cursor.svg') 2 30, crosshair;
}
.cover-body a,
.cover-body button,
.cover-body input,
.cover-body textarea,
.cover-body label {
  cursor: url('/static/img/pencil-cursor.svg') 2 30, pointer;
}
.cover-body input,
.cover-body textarea {
  cursor: url('/static/img/pencil-cursor.svg') 2 30, text;
}

.cover {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem 5rem;
  background:
    radial-gradient(ellipse at 18% 15%, rgba(138, 111, 176, 0.22), transparent 50%),
    radial-gradient(ellipse at 82% 20%, rgba(90, 127, 184, 0.18), transparent 50%),
    radial-gradient(ellipse at 75% 88%, rgba(200, 143, 168, 0.18), transparent 55%),
    radial-gradient(ellipse at 15% 85%, rgba(196, 164, 124, 0.18), transparent 55%),
    linear-gradient(180deg, #f4efff 0%, #e8e3f5 50%, #ede8f7 100%);
  overflow: hidden;
}

/* Subtle paper-grain overlay */
.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 25% 30%, rgba(90, 63, 138, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(58, 88, 144, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 45% 85%, rgba(200, 143, 168, 0.03) 1px, transparent 1px);
  background-size: 90px 90px, 140px 140px, 110px 110px;
  pointer-events: none;
  opacity: 0.7;
}

/* ── Interactive canvas ───────────────────────────────── */
#inkCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ── Feather ──────────────────────────────────────────── */
.feather {
  position: absolute;
  top: 8%;
  right: 7%;
  width: 78px;
  height: 78px;
  opacity: 0.55;
  z-index: 2;
  animation: sway 7s ease-in-out infinite;
  transform-origin: 80% 10%;
}
@keyframes sway {
  0%, 100% { transform: rotate(-8deg) translateY(0); }
  50%      { transform: rotate(8deg) translateY(8px); }
}

/* ── Center stack ─────────────────────────────────────── */
.cover-inner {
  position: relative;
  z-index: 3;
  text-align: center;
  max-width: 780px;
  animation: fadeUp 1.2s ease-out;
  --mx: 0;
  --my: 0;
  transform:
    perspective(1200px)
    rotateY(calc(var(--mx) * 4deg))
    rotateX(calc(var(--my) * -3deg))
    translate3d(calc(var(--mx) * 10px), calc(var(--my) * 8px), 0);
  transition: transform 0.3s cubic-bezier(.2, .8, .3, 1);
  transform-style: preserve-3d;
}
.cover-inner > * {
  transform-style: preserve-3d;
}
.cover-title { transform: translateZ(30px); }
.cover-subtitle { transform: translateZ(20px); }
.cover-quote { transform: translateZ(15px); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ornament-top {
  font-size: 1.5rem;
  color: var(--gold);
  margin-bottom: 1rem;
  animation: fadeIn 2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.cover-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 5rem);
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 0 0 0.5rem;
  line-height: 1.1;
}
.cover-title .letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  animation: letterIn 0.6s cubic-bezier(.2, .9, .3, 1) forwards;
}
.cover-title .title-space { display: inline-block; width: 0.3em; }
@keyframes letterIn {
  to { opacity: 1; transform: translateY(0); }
}
/* stagger — "Iman Hamid" children: 1-4, 5=space, 6-10 */
.cover-title .letter:nth-child(1)  { animation-delay: 0.10s; }
.cover-title .letter:nth-child(2)  { animation-delay: 0.18s; }
.cover-title .letter:nth-child(3)  { animation-delay: 0.26s; }
.cover-title .letter:nth-child(4)  { animation-delay: 0.34s; }
.cover-title .letter:nth-child(6)  { animation-delay: 0.46s; }
.cover-title .letter:nth-child(7)  { animation-delay: 0.54s; }
.cover-title .letter:nth-child(8)  { animation-delay: 0.62s; }
.cover-title .letter:nth-child(9)  { animation-delay: 0.70s; }
.cover-title .letter:nth-child(10) { animation-delay: 0.78s; }

.cover-subtitle {
  font-family: var(--sans);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--accent-deep);
  margin: 0.25rem 0 1.25rem;
  padding-left: 0.32em;
  opacity: 0;
  animation: fadeIn 1.2s ease-out 1.0s forwards;
}
.cover-subtitle::before,
.cover-subtitle::after {
  content: "—";
  color: var(--gold);
  margin: 0 0.8em;
  letter-spacing: 0;
}

.cover-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  color: var(--ink-soft);
  min-height: 1.8em;
  margin: 0.5rem 0 2rem;
  letter-spacing: 0.02em;
}
.caret {
  display: inline-block;
  color: var(--gold);
  font-style: normal;
  animation: blink 1s steps(1) infinite;
  margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── Flipping quote book ──────────────────────────────── */
.quote-book {
  display: flex;
  width: min(580px, 100%);
  height: clamp(180px, 28vw, 240px);
  margin: 2rem auto 2.5rem;
  perspective: 2000px;
  cursor: pointer;
  transform-style: preserve-3d;
  opacity: 0;
  animation: fadeIn 1.5s ease-out 1.5s forwards;
  outline: none;
  transform: translateZ(15px);
}
.quote-book:hover .qb-hint { opacity: 1; transform: translateX(4px); }

.qb-left, .qb-right {
  flex: 1;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 23px, rgba(122,139,111,0.10) 23px, rgba(122,139,111,0.10) 24px),
    linear-gradient(135deg, #fefcf7 0%, #f4ecdc 100%);
  padding: 1.5rem 1.6rem;
  position: relative;
  border: 1px solid rgba(196, 164, 124, 0.45);
  font-family: var(--serif);
  overflow: hidden;
}
.qb-left {
  border-radius: 4px 1px 1px 4px;
  border-right: none;
  box-shadow: inset -14px 0 24px rgba(60, 48, 30, 0.18), 0 10px 28px rgba(60, 48, 30, 0.12);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.qb-right-wrap {
  flex: 1;
  position: relative;
  transform-style: preserve-3d;
}
.qb-right {
  position: absolute;
  inset: 0;
  border-radius: 1px 4px 4px 1px;
  border-left: none;
  box-shadow: inset 14px 0 24px rgba(60, 48, 30, 0.18), 0 10px 28px rgba(60, 48, 30, 0.12);
  transform-origin: left center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.qb-right.flipping {
  animation: pageFlip 0.95s cubic-bezier(.7, 0, .3, 1);
}
@keyframes pageFlip {
  0%   { transform: rotateY(0); }
  100% { transform: rotateY(-360deg); }
}

.qb-spine {
  width: 3px;
  background:
    linear-gradient(to right, rgba(60, 48, 30, 0.45), rgba(60, 48, 30, 0.15) 50%, rgba(60, 48, 30, 0.45));
  box-shadow: 0 0 8px rgba(60, 48, 30, 0.2);
  z-index: 2;
}

.qb-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(196, 164, 124, 0.6);
  pointer-events: none;
}
.qb-corner.tl { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.qb-corner.tr { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.qb-corner.bl { bottom: 8px; left: 8px; border-right: none; border-top: none; }
.qb-corner.br { bottom: 8px; right: 8px; border-left: none; border-top: none; }

.qb-ornament {
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.qb-brand {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.qb-brand-sub {
  font-family: var(--sans);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-top: 0.4rem;
}

.qb-right blockquote {
  margin: 0;
  font-style: italic;
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  color: var(--ink);
  line-height: 1.5;
  text-align: center;
  padding: 0 0.5rem;
}
.qb-right cite {
  display: block;
  margin-top: 0.9rem;
  font-family: var(--sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-style: normal;
  text-align: center;
}
.qb-hint {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-family: var(--sans);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.2s;
}

@media (max-width: 560px) {
  .quote-book { height: 200px; }
  .qb-left, .qb-right { padding: 1rem 1rem; }
  .qb-brand { font-size: 1.15rem; }
}

.cover-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeIn 1.5s ease-out 1.8s forwards;
}
.cover-nav a {
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.cover-nav a:hover {
  color: var(--accent-deep);
  border-bottom-color: var(--accent);
  transform: translateY(-2px);
}

.enter-row {
  display: flex;
  justify-content: center;
  opacity: 0;
  animation: fadeIn 1.5s ease-out 2.1s forwards;
}
.enter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.8rem;
  border-radius: 999px;
  background: var(--accent-deep);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border: none;
  border-bottom: none;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s;
  box-shadow: 0 4px 14px rgba(84, 103, 74, 0.25);
  cursor: pointer;
}
.enter-btn:hover {
  background: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(84, 103, 74, 0.32);
  border-bottom: none;
  color: #fff;
}
.enter-btn svg { transition: transform 0.25s; }
.enter-btn:hover svg { transform: translateX(4px); }

/* ── Sign-in drawer ───────────────────────────────────── */
.signin-trigger {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  border: 1px solid var(--rule);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, color 0.2s;
}
.signin-trigger:hover {
  background: var(--accent-deep);
  color: #fff;
  border-color: var(--accent-deep);
  transform: translateY(-2px);
}
.signin-trigger svg { flex-shrink: 0; }

.signin-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(46, 42, 38, 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 30;
}
.signin-backdrop.open { opacity: 1; pointer-events: auto; }

.signin-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 100%);
  height: 100%;
  background: #fdfaf5;
  box-shadow: -12px 0 32px rgba(46, 42, 38, 0.15);
  padding: 3.5rem 2rem 2rem;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(.2, .8, .3, 1);
  z-index: 40;
  overflow-y: auto;
}
.signin-panel.open { transform: translateX(0); }
.signin-panel h3 {
  font-family: var(--serif);
  font-size: 1.8rem;
  margin: 0 0 0.25rem;
  font-weight: 500;
}
.signin-sub {
  color: var(--muted);
  font-style: italic;
  margin: 0 0 1.5rem;
}
.signin-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s, transform 0.2s;
}
.signin-close:hover { color: var(--accent-deep); transform: rotate(90deg); }

/* ── Reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .drift-word { display: none; }
}

@media (max-width: 640px) {
  .feather { width: 54px; height: 54px; top: 5%; right: 5%; }
  .cover-nav { font-size: 0.7rem; gap: 0.4rem 1.1rem; }
  .signin-trigger span { display: none; }
  .signin-trigger { padding: 0.55rem; }
}
