/* ══════════════════════════════════════════════════════════════════════════
   Zahra · Messages / Our Words page
   ══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

body {
  background: #060e08;
  color: #f0e8d8;
  font-family: 'EB Garamond', Georgia, serif;
  overflow-x: hidden;
  cursor: none;
  padding-top: 62px;
}

::selection { background: rgba(200,168,74,.22); color: #e0cc80; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #060e08; }
::-webkit-scrollbar-thumb { background: #e89ab0; border-radius: 2px; }

/* ── Canvas / cursor ────────────────────────────────────────────────────── */
#petalCanvas { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
#cursorGlow {
  position: fixed; width: 380px; height: 380px; border-radius: 50%;
  pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(232,154,176,.06) 0%, rgba(26,92,53,.04) 50%, transparent 70%);
  transform: translate(-50%,-50%);
}
body::after {
  content: ''; position: fixed; width: 6px; height: 6px; border-radius: 50%;
  background: #e89ab0; pointer-events: none; z-index: 9999;
  transform: translate(-50%,-50%);
  top: var(--cy,50%); left: var(--cx,50%);
}

/* ── Progress ───────────────────────────────────────────────────────────── */
#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, #e89ab0, #c8a84a, #4a8a5a);
  z-index: 10001; transition: width .1s linear;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
#msgHeader {
  position: fixed; top: 0; left: 0; right: 0; height: 62px; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  background: rgba(6,14,8,.9);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.header-back {
  display: flex; align-items: center; gap: .5rem;
  font-family: 'Josefin Sans', sans-serif; font-size: .62rem; font-weight: 300;
  letter-spacing: .2em; text-transform: uppercase;
  color: #9ab8a0; text-decoration: none; transition: color .2s;
}
.header-back svg { width: 16px; height: 12px; }
.header-back:hover { color: #c8a84a; }
.header-centre { display: flex; align-items: center; gap: .5rem; font-family: 'Cormorant Garamond', serif; }
.header-arabic { font-size: 1.2rem; color: #e89ab0; font-weight: 300; letter-spacing: .1em; }
.header-dot    { color: rgba(200,168,74,.4); }
.header-title  { font-size: 1rem; color: #f0e8d8; letter-spacing: .06em; }
.header-dates  {
  font-family: 'Josefin Sans', sans-serif; font-size: .56rem; font-weight: 200;
  letter-spacing: .18em; text-transform: uppercase; color: #9ab8a0;
}

/* ── Intro section ──────────────────────────────────────────────────────── */
.msg-intro {
  position: relative; z-index: 1;
  min-height: 60vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 4rem 2rem;
}
.msg-intro-arabic {
  font-family: 'Cormorant Garamond', serif; font-size: 2rem; font-weight: 300;
  color: #e89ab0; letter-spacing: .15em; margin-bottom: .3rem;
  animation: introFade .9s ease both;
}
.msg-intro-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(3rem, 10vw, 6.5rem);
  font-weight: 700; line-height: .9;
  color: #f0e8d8; margin-bottom: .8rem;
  animation: introFade .9s .2s ease both;
}
.msg-intro-sub {
  font-family: 'EB Garamond', serif; font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: #9ab8a0; line-height: 1.6;
  animation: introFade .9s .4s ease both;
}
.msg-intro-scroll {
  margin-top: 2.5rem; font-size: 1.2rem; color: #c8a84a; opacity: .6;
  animation: bob 2s ease-in-out infinite, introFade .9s .8s ease both;
}
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(6px)} }
@keyframes introFade { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:none} }

/* ── Chapter nav ────────────────────────────────────────────────────────── */
.chapter-nav {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; gap: .5rem;
  justify-content: center;
  padding: 0 2rem 3rem;
  max-width: 800px; margin: 0 auto;
}
.chapter-pill {
  font-family: 'Josefin Sans', sans-serif;
  font-size: .58rem; font-weight: 300; letter-spacing: .18em; text-transform: uppercase;
  color: #9ab8a0;
  border: 1px solid rgba(255,255,255,.08); border-radius: 20px;
  padding: .3rem .85rem;
  cursor: pointer; text-decoration: none;
  transition: color .2s, border-color .2s, background .2s;
  white-space: nowrap;
}
.chapter-pill:hover {
  color: #c8a84a; border-color: rgba(200,168,74,.4); background: rgba(200,168,74,.06);
}

/* ── Message feed ───────────────────────────────────────────────────────── */
.msg-feed {
  position: relative; z-index: 1;
  max-width: 680px; margin: 0 auto;
  padding: 0 1.5rem 6rem;
  display: flex; flex-direction: column; gap: 6rem;
}

/* ── Conversation block ─────────────────────────────────────────────────── */
.convo-block {
  display: flex; flex-direction: column; gap: 0;
  opacity: 0; transform: translateY(30px);
  transition: opacity .8s cubic-bezier(0.16,1,0.3,1), transform .8s cubic-bezier(0.16,1,0.3,1);
}
.convo-block.visible { opacity: 1; transform: translateY(0); }

/* Chapter header */
.convo-header {
  text-align: center; margin-bottom: 2.2rem;
}
.convo-num {
  font-family: 'Josefin Sans', sans-serif; font-size: .55rem; font-weight: 300;
  letter-spacing: .3em; text-transform: uppercase; color: #c8a84a; opacity: .6;
  display: block; margin-bottom: .4rem;
}
.convo-chapter {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 600;
  color: #f0e8d8; line-height: 1.1; margin-bottom: .4rem;
}
.convo-date {
  font-family: 'Josefin Sans', sans-serif; font-size: .58rem; font-weight: 200;
  letter-spacing: .25em; text-transform: uppercase; color: #9ab8a0;
  display: block; margin-bottom: .3rem;
}
.convo-subtitle {
  font-family: 'EB Garamond', serif; font-style: italic;
  font-size: .95rem; color: #7a9880;
}

/* Divider line */
.convo-divider {
  display: flex; align-items: center; gap: .7rem;
  margin: 0 auto 1.8rem; width: 60%;
  color: rgba(200,168,74,.2); font-size: .6rem; letter-spacing: .4em;
}
.convo-divider::before, .convo-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(to right, transparent, rgba(200,168,74,.15), transparent);
}

/* Messages */
.convo-messages {
  display: flex; flex-direction: column; gap: .4rem;
  padding: 0 .5rem;
}

/* Individual message bubble */
.msg-bubble {
  max-width: 75%;
  display: flex; flex-direction: column; gap: .15rem;
}
.msg-bubble.from-greg {
  align-self: flex-end; align-items: flex-end;
}
.msg-bubble.from-zahra {
  align-self: flex-start; align-items: flex-start;
}

.msg-bubble-inner {
  padding: .6rem 1rem;
  border-radius: 18px;
  font-family: 'EB Garamond', serif;
  font-size: 1.05rem; line-height: 1.55;
  position: relative;
  word-break: break-word;
  transition: transform .2s;
}
.msg-bubble:hover .msg-bubble-inner { transform: scale(1.01); }

/* His bubbles — forest green */
.from-greg .msg-bubble-inner {
  background: linear-gradient(145deg, #1a4a2e, #112018);
  color: #e0f0e4;
  border: 1px solid rgba(74,138,90,.25);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}

/* Her bubbles — rose blush */
.from-zahra .msg-bubble-inner {
  background: linear-gradient(145deg, #3a1020, #2a0818);
  color: #f5e0e8;
  border: 1px solid rgba(232,154,176,.2);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}

/* Highlighted special messages */
.msg-bubble.highlight .msg-bubble-inner {
  border-color: rgba(200,168,74,.4);
  box-shadow: 0 0 0 1px rgba(200,168,74,.1), 0 4px 20px rgba(0,0,0,.4);
}
.from-greg.highlight .msg-bubble-inner  { background: linear-gradient(145deg, #1f5a36, #152d1e); }
.from-zahra.highlight .msg-bubble-inner { background: linear-gradient(145deg, #4a1428, #2a0818); }

/* Sender name */
.msg-sender {
  font-family: 'Josefin Sans', sans-serif; font-size: .54rem;
  font-weight: 300; letter-spacing: .18em; text-transform: uppercase;
  color: #9ab8a0; padding: 0 .2rem;
}
.from-zahra .msg-sender { color: #c4809a; }
.from-greg  .msg-sender { color: #7aaa8a; }

/* Timestamp */
.msg-time {
  font-family: 'Josefin Sans', sans-serif; font-size: .5rem;
  font-weight: 200; letter-spacing: .12em;
  color: rgba(255,255,255,.2); padding: 0 .3rem;
}

/* Group same sender — remove name for consecutive */
.msg-bubble.same-sender .msg-sender { display: none; }
.same-sender.from-greg  .msg-bubble-inner { border-bottom-right-radius: 18px; border-top-right-radius: 5px; }
.same-sender.from-zahra .msg-bubble-inner { border-bottom-left-radius: 18px; border-top-left-radius: 5px; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.msg-footer {
  position: relative; z-index: 1;
  text-align: center; padding: 4rem 2rem 6rem;
  border-top: 1px solid rgba(255,255,255,.04);
}
.msg-footer-text {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: 1.4rem; color: #f0e8d8; margin-bottom: .4rem;
}
.msg-footer-sub {
  font-family: 'Josefin Sans', sans-serif; font-size: .6rem; font-weight: 200;
  letter-spacing: .25em; text-transform: uppercase; color: #9ab8a0;
  margin-bottom: 1.5rem;
}
.msg-footer-link {
  font-family: 'Josefin Sans', sans-serif; font-size: .62rem; font-weight: 300;
  letter-spacing: .2em; text-transform: uppercase;
  color: #c8a84a; text-decoration: none; transition: color .2s;
}
.msg-footer-link:hover { color: #e0cc80; }

/* ── Responsive ─────────────────────────────────────────────────────────── */

/* iPad portrait (≤ 768px) */
@media (max-width: 768px) {
  body::after { display: none; }
  #cursorGlow  { display: none; }
  .msg-feed { max-width: 100%; }
  .msg-bubble { max-width: 82%; }
}

/* Large phone (≤ 600px) */
@media (max-width: 600px) {
  body { padding-top: 60px; }
  #msgHeader { padding: 0 1rem; height: 60px; }
  .header-back span { display: none; }
  .header-arabic { font-size: 1rem; }
  .header-title  { font-size: .85rem; }
  .header-dates  { display: none; }

  .msg-intro { min-height: 50vh; padding: 3rem 1.5rem; }
  .msg-intro-arabic { font-size: 1.6rem; }

  .chapter-nav { padding: 0 1rem 2rem; gap: .4rem; }
  .chapter-pill { font-size: .54rem; padding: .28rem .7rem; }

  .msg-feed { padding: 0 .9rem 4rem; gap: 3.5rem; }

  .convo-chapter { font-size: clamp(1.3rem, 6vw, 2rem); }
  .convo-divider { width: 80%; }

  .msg-bubble { max-width: 88%; }
  .msg-bubble-inner {
    font-size: .95rem;
    padding: .55rem .85rem;
    border-radius: 14px;
  }
  .msg-time { font-size: .48rem; }
}

/* Small phone (≤ 420px) */
@media (max-width: 420px) {
  #msgHeader { padding: 0 .8rem; }
  .msg-feed { padding: 0 .7rem 4rem; gap: 3rem; }
  .msg-bubble { max-width: 92%; }
  .msg-bubble-inner { font-size: .9rem; padding: .5rem .75rem; }
  .convo-chapter { font-size: clamp(1.2rem, 7vw, 1.8rem); }
  .msg-footer { padding: 3rem 1.5rem 5rem; }
  .msg-footer-text { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .convo-block { opacity: 1; transform: none; }
  #petalCanvas { display: none; }
}
