/* ============================================================
   ROOT & RESET
============================================================ */
:root {
  --cream:       #EDE0C8;
  --ink:         #2C1810;
  --maroon:      #7B2D2D;
  --chat-bg:     rgba(255, 255, 255, 0.32);
  --chat-border: rgba(44, 24, 16, 0.10);
  --font-serif:  'Cormorant Garamond', Georgia, serif;
  --font-sc:     'Cormorant SC', Georgia, serif;
  --font-script: 'Pinyon Script', cursive;
  --font-mono:   'Space Mono', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  background-color: var(--cream);
  color: var(--ink);
  font-family: var(--font-serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }


/* ============================================================
   PAPER GRAIN OVERLAY
============================================================ */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.80' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  background-repeat: repeat;
}


/* ============================================================
   WELCOME SCREEN  — LOCKED ✓
============================================================ */
#welcome {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url('assets/pashmina-new.jpg');
  background-size: cover;
  background-position: center;
  will-change: opacity, transform;
  transform-origin: center center;
}


/* ============================================================
   PHOTO PRINT
============================================================ */
.photo-print {
  background: #EDE8DB;
  padding: 13px;
  position: relative;
  display: inline-block;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.45);
  transition: opacity 0.8s ease;
}

.photo-print .sm-img {
  display: block;
  width: 460px;
  height: 570px;
  object-fit: cover;
}

.photo-print.dimmed { opacity: 0.42; }

.ph-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  pointer-events: none;
  color: #8c735c;
}

.ph-name  { top: 1px; left: 13px; }

.ph-date {
  right: 1px;
  top: 13px;
  writing-mode: vertical-rl;
  letter-spacing: 0.2em;
}

.ph-place { bottom: 1px; right: 13px; white-space: nowrap; }
.ph-love  { bottom: 1px; right: 13px; white-space: nowrap; }


/* ============================================================
   PASSWORD UI
============================================================ */
#pw-ui {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  z-index: 10;
}

#pw-ui.visible {
  opacity: 1;
  pointer-events: all;
}

#pw-btn {
  background: none;
  border: none;
  font-family: var(--font-sc);
  font-weight: 900;
  font-size: 22px;
  text-align: center;
  line-height: 1.4;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  padding: 6px 2px;
  transition: opacity 0.3s ease;
}

#pw-btn:hover { opacity: 0.6; }

#pw-field {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#pw-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: rgba(255, 255, 255, 0.95);
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: 17px;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 10px 20px;
  width: 260px;
  outline: none;
  transition: border-color 0.3s ease;
}

#pw-input:focus { border-color: rgba(255, 255, 255, 0.9); }

#pw-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.08em;
}

#pw-err {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}


/* ============================================================
   SCROLL HINT
============================================================ */
#scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

#scroll-hint.visible { opacity: 1; }

.sh-label {
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.4);
}

.sh-line {
  display: block;
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.32);
  animation: scrollPulse 1.8s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.7) translateY(-4px); }
  50%       { opacity: 0.9; transform: scaleY(1)   translateY(4px);  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

.shake { animation: shake 0.5s ease; }


/* ============================================================
   MAIN CONTENT + PAGE SECTIONS
============================================================ */
#main {
  margin-top: 100vh;
  position: relative;
  z-index: 1;
}

/* Each section snaps to its start */
#section-intro {
  scroll-snap-align: start;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

#section-chat {
  /* no snap — let the long content scroll freely */
  padding: 0 0 20px;
}

.page {
  width: 100%;
  padding: 0 6vw;
}


/* ── Header ── */
.hdr {
  text-align: center;
  padding-bottom: 4px;
}

.hdr-top {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: 52px;
  letter-spacing: 0.22em;
  line-height: 1;
  color: var(--ink);
}

.hdr-name {
  font-family: var(--font-script);
  font-size: 88px;
  color: var(--maroon);
  line-height: 1.05;
  margin-top: -4px;
}

.hdr-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.hdr-sub {
  font-family: var(--font-sc);
  font-size: 9.5px;
  letter-spacing: 0.26em;
  color: rgba(44, 24, 16, 0.65);
}

.stamp {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--maroon);
  border: 1px solid rgba(123, 45, 45, 0.7);
  padding: 3px 9px;
  transform: rotate(-1.5deg);
  opacity: 0.7;
  white-space: nowrap;
}


/* ── Rules ── */
.rule {
  border: none;
  border-top: 0.5px solid rgba(123, 45, 45, 0.3);
  margin: 28px 0;
}

.rule-flex {
  flex: 1;
  margin: 0;
}


/* ── Intro Note ── */
.intro-note {
  max-width: 580px;
  padding: 4px 0 8px;
}

.intro-salutation {
  font-family: var(--font-script);
  font-size: 34px;
  color: var(--maroon);
  text-align: center;
  margin-bottom: 24px;
}

.intro-note p {
  font-family: var(--font-serif);
  font-weight: 300;
  font-style: italic;
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 1.2em;
}

.intro-note p:last-child { margin-bottom: 0; }

.intro-close { margin-top: 20px !important; }


/* ── Leaf divider ── */
.leaf-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 48px 0 40px;
}

.leaf-img {
  width: 48px;
  opacity: 0.52;
  flex-shrink: 0;
}


/* ============================================================
   CHAT SECTION
============================================================ */
.chat-container {
  background: var(--chat-bg);
  border: 1px solid var(--chat-border);
  border-radius: 6px;
  padding: 22px 28px 24px;
  box-shadow: 0 1px 10px rgba(44, 24, 16, 0.04);
}


/* ── Chat chrome ── */
.chat-chrome {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--chat-border);
  margin-bottom: 20px;
}

.chat-model {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--maroon);
  opacity: 0.85;
}

.chat-chrome-sep {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(44, 24, 16, 0.22);
}

.chat-subtitle {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: rgba(44, 24, 16, 0.36);
}


/* ── User prompt bubble ── */
.chat-prompt-area {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-bottom: 16px;
}

.chat-bubble {
  background: rgba(123, 45, 45, 0.07);
  border: 0.5px solid rgba(123, 45, 45, 0.16);
  border-radius: 12px 12px 2px 12px;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink);
  max-width: 72%;
}

.chat-sent {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  color: rgba(44, 24, 16, 0.28);
  margin-top: 5px;
}


/* ── Ask button ── */
.chat-ask {
  display: block;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--maroon);
  cursor: pointer;
  padding: 0;
  opacity: 0.65;
  margin-bottom: 20px;
  transition: opacity 0.25s ease;
}

.chat-ask:hover { opacity: 1; }

.chat-ask.hidden-soft {
  opacity: 0;
  pointer-events: none;
}


/* ── Typing indicator ── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  height: 0;
  overflow: hidden;
}

.typing-indicator.visible {
  opacity: 1;
  height: auto;
  overflow: visible;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(44, 24, 16, 0.35);
  animation: dotPulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

.dot:nth-child(2) { animation-delay: 0.18s; }
.dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes dotPulse {
  0%, 60%, 100% { opacity: 0.15; transform: scale(0.75); }
  30%            { opacity: 0.85; transform: scale(1); }
}


/* ── Attribution ── */
.chat-attribution {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.chat-attribution.visible { opacity: 1; }

.attr-model {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--maroon);
  opacity: 0.8;
}

.attr-sep {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(44, 24, 16, 0.22);
}

.attr-status {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: rgba(44, 24, 16, 0.40);
}


/* ── Response paragraphs ── */
.response-content {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: 16.5px;
  line-height: 1.78;
  color: var(--ink);
  max-width: 680px;
}

.response-para {
  opacity: 0;
  transform: translateY(7px);
  transition: opacity 0.45s ease-out, transform 0.45s ease-out;
  margin-bottom: 1.25em;
}

.response-para.visible {
  opacity: 1;
  transform: translateY(0);
}

.response-para p { margin-bottom: 0.85em; }
.response-para p:last-child { margin-bottom: 0; }

.response-para .opener { font-style: italic; color: rgba(44, 24, 16, 0.78); }
.response-para em { font-style: italic; }


/* ── Text exchange block ── */
.text-exchange {
  background: rgba(44, 24, 16, 0.025);
  border-radius: 6px;
  padding: 16px 18px;
  margin: 2px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tx-msg {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
  max-width: 78%;
}

.tx-right {
  align-self: flex-end;
  text-align: right;
  color: var(--maroon);
  opacity: 0.82;
}

.tx-left {
  align-self: flex-start;
  text-align: left;
  color: var(--ink);
  opacity: 0.62;
}


/* ── Chat end / letter download ── */
.chat-end {
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.chat-end.visible {
  opacity: 1;
  pointer-events: all;
}

.chat-rule { margin: 18px 0 20px; }

.letter-download {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: var(--maroon);
  transition: opacity 0.25s ease;
  cursor: pointer;
}

.letter-download:hover { opacity: 0.6; }

.dl-arrow {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.65;
}

.dl-text {
  font-family: var(--font-script);
  font-size: 28px;
  line-height: 1;
}

.dl-sub {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.07em;
  color: rgba(44, 24, 16, 0.32);
  text-align: center;
  margin-top: 6px;
}


/* ── Outro ── */
.outro {
  text-align: center;
  padding: 8px 0 72px;
}

.outro-text {
  font-family: var(--font-serif);
  font-weight: 300;
  font-style: italic;
  font-size: 17px;
  line-height: 1.8;
  max-width: 400px;
  margin: 0 auto 32px;
  color: var(--ink);
}

.outro-text:empty { margin-bottom: 0; }

.outro-close {
  font-family: var(--font-sc);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--maroon);
}


/* ============================================================
   END SCREEN  — LOCKED ✓
============================================================ */
#end {
  min-height: 100vh;
  scroll-snap-align: start;
  background-image: url('assets/pashmina-new.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ============================================================
   MOBILE
============================================================ */
@media (max-width: 768px) {
  .photo-print .sm-img { width: 280px; height: 348px; }

  .hdr-top  { font-size: 34px; letter-spacing: 0.14em; }
  .hdr-name { font-size: 64px; }

  #section-intro { padding: 48px 0; }
  .page { padding: 0 28px; }

  .chat-container { padding: 18px 18px 20px; }
  .chat-bubble { max-width: 90%; font-size: 10px; }
  .response-content { font-size: 15.5px; }

  .outro-text { font-size: 15px; }
  #pw-input { width: 210px; }
}
