/* ────────────────────────────────────────────────────────────
   Peniel · Ed & Sharon — warm, playful, modern travel journal
   More color, rounder shapes, friendlier micro-interactions.
   ──────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,700;0,9..144,900;1,9..144,400&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --paper:      #FAF3E3;
  --paper-2:    #F1E8D1;
  --paper-deep: #E4D6B2;
  --ink:        #1F1A13;
  --ink-soft:   #4E4538;
  --ink-dim:    #8A7E6A;

  /* vibrant but warm palette */
  --coral:      #E85A3E;
  --coral-deep: #B33A22;
  --sun:        #F2C94C;
  --mint:       #6FC3A8;
  --sky:        #6EA8D6;
  --plum:       #9A5AA8;
  --moss:       #5E6B44;

  --card:       #FFFDF7;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  font-family: 'DM Sans', -apple-system, system-ui, sans-serif;
  color: var(--ink);
  background: #1E1912;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  width: 100%;
}

#root {
  width: 100%;
  height: 100dvh;
}

.paper-bg {
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 12% 6%, rgba(232,90,62,0.10), transparent 55%),
    radial-gradient(ellipse at 88% 92%, rgba(111,195,168,0.10), transparent 55%),
    radial-gradient(ellipse at 90% 30%, rgba(242,201,76,0.08), transparent 40%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.15  0 0 0 0 0.1  0 0 0 0 0.08  0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.stage { width: 100%; height: 100%; position: relative; overflow: hidden; }
.landing {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.landing::-webkit-scrollbar { display: none; }
.landing-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 0 16px 40px;
}

.hand    { font-family: 'Caveat', cursive; font-weight: 600; }
.display { font-family: 'Fraunces', serif; font-variation-settings: 'opsz' 144; letter-spacing: -0.02em; }
.mono    { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.body-text { font-family: 'Fraunces', serif; font-variation-settings: 'opsz' 18; font-weight: 400; line-height: 1.72; }

/* Section label */
.kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* Washi tape */
.tape {
  position: absolute;
  width: 60px; height: 18px;
  background: rgba(232, 90, 62, 0.38);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.tape::before, .tape::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 4px;
  background: inherit;
}
.tape::before { left: -2px; clip-path: polygon(0 15%, 100% 0, 100% 100%, 0 85%); }
.tape::after  { right: -2px; clip-path: polygon(0 0, 100% 15%, 100% 85%, 0 100%); }
.tape-sun   { background: rgba(242,201,76,0.55); }
.tape-mint  { background: rgba(111,195,168,0.55); }
.tape-sky   { background: rgba(110,168,214,0.55); }

/* Animations */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes float-y { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes wiggle { 0%,100% { transform: rotate(-1deg); } 50% { transform: rotate(1deg); } }
@keyframes pop-in { 0% { transform: scale(0.5); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
.float-slow { animation: float-y 4.8s ease-in-out infinite; }
.float-fast { animation: float-y 3.6s ease-in-out infinite; }
.wiggle     { animation: wiggle 3.2s ease-in-out infinite; }
.pop-in     { animation: pop-in 420ms cubic-bezier(0.4, 1.6, 0.5, 1) both; }

/* Card modal */
.card-stack { position: absolute; inset: 0; overflow: hidden; }

.story-body {
  flex: 1;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior: contain;
  padding: 22px 28px 46px;
}
.story-body::-webkit-scrollbar { display: none; }

/* Progress rail */
.progress-rail {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 160px;
  background: rgba(31,26,19,0.12);
  border-radius: 2px;
  overflow: hidden; z-index: 10;
}
.progress-fill {
  width: 100%; background: var(--coral);
  border-radius: 2px;
  transition: height 260ms ease;
}

/* Tweaks panel */
.tweaks-panel {
  position: absolute; right: 14px; bottom: 14px;
  width: 240px;
  background: var(--card);
  border: 1.5px solid rgba(31,26,19,0.14);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.1);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  z-index: 200;
}
.tweaks-panel h4 {
  margin: 0 0 10px;
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.tweak-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.tweak-row > span:first-child { color: var(--ink-soft); font-weight: 500; }
.tweak-chip {
  display: inline-block;
  padding: 4px 10px; border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-soft);
  cursor: pointer; margin-left: 4px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 140ms;
}
.tweak-chip:hover { background: var(--paper-deep); }
.tweak-chip.active { background: var(--ink); color: var(--paper); }

/* Divider */
.hr-fine { height: 1px; background: rgba(31,26,19,0.1); border: 0; margin: 0; }

/* Tag pill — now with color */
.tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(31,26,19,0.06);
  color: var(--ink-soft);
  font-weight: 500;
}
.tag.tag-coral { background: rgba(232,90,62,0.14); color: var(--coral-deep); }
.tag.tag-mint  { background: rgba(111,195,168,0.22); color: #3F7D66; }
.tag.tag-sun   { background: rgba(242,201,76,0.28); color: #8A6A15; }
.tag.tag-sky   { background: rgba(110,168,214,0.22); color: #3B6A94; }
.tag.tag-plum  { background: rgba(154,90,168,0.18); color: #6D3B7A; }

/* Photo tile — polaroid with rounded corners */
.photo-tile {
  background: var(--card);
  padding: 10px 10px 14px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
  border-radius: 6px;
  position: relative;
  transition: transform 240ms cubic-bezier(0.3, 1.4, 0.5, 1), box-shadow 240ms;
}
.photo-tile:hover {
  transform: rotate(0deg) translateY(-4px) !important;
  box-shadow: 0 14px 28px rgba(0,0,0,0.16), 0 2px 4px rgba(0,0,0,0.08);
}

/* Friendly buttons */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 180ms cubic-bezier(0.3, 1.4, 0.5, 1), box-shadow 180ms, background 180ms;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }

.btn-coral {
  background: var(--coral);
  color: #FFFDF7;
  box-shadow: 0 4px 10px rgba(232,90,62,0.35), inset 0 -2px 0 rgba(0,0,0,0.12);
}
.btn-coral:hover { background: var(--coral-deep); transform: translateY(-1px); }

.btn-ghost {
  background: rgba(31,26,19,0.06);
  color: var(--ink);
}
.btn-ghost:hover { background: rgba(31,26,19,0.12); }

.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,253,247,0.9);
  color: var(--ink);
  cursor: pointer;
  border: 1.5px solid rgba(31,26,19,0.1);
  transition: all 180ms;
}
.btn-icon:hover { background: var(--card); transform: scale(1.06); }

/* Upload tile — dashed border, friendly */
.upload-tile {
  background: transparent;
  border: 2px dashed rgba(31,26,19,0.24);
  border-radius: 10px;
  padding: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 200ms;
  min-height: 120px;
  aspect-ratio: 1 / 1;
}
.upload-tile:hover {
  border-color: var(--coral);
  color: var(--coral);
  background: rgba(232,90,62,0.04);
  transform: translateY(-2px);
}

/* Input / textarea */
.field-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 6px;
  display: block;
}
.input, .textarea {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid rgba(31,26,19,0.14);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 180ms, box-shadow 180ms;
  resize: none;
  font-weight: 500;
  -webkit-user-select: text; user-select: text;
}
.input:focus, .textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(232,90,62,0.15);
}
.textarea { line-height: 1.55; min-height: 160px; font-family: 'Fraunces', serif; font-variation-settings: 'opsz' 18; font-weight: 400; font-size: 15px; }

/* Modal shared */
.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 300;
  background: rgba(20,16,10,0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-up 220ms ease both;
  overflow: hidden;
}
.modal-sheet {
  width: 100%;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at 12% 6%, rgba(232,90,62,0.08), transparent 55%),
    radial-gradient(ellipse at 88% 92%, rgba(111,195,168,0.08), transparent 55%);
  border-radius: 22px 22px 0 0;
  padding: 18px 22px 28px;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
  max-height: 86%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: sheet-up 320ms cubic-bezier(0.3, 1.2, 0.5, 1);
  position: relative;
}
.modal-sheet::-webkit-scrollbar { display: none; }
.modal-sheet::-webkit-scrollbar { display: none; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

.sheet-handle {
  width: 44px; height: 4px;
  background: rgba(31,26,19,0.2);
  border-radius: 4px;
  margin: 0 auto 14px;
}

/* Sticker badge */
.chip-pop {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--sun); color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 6px rgba(242,201,76,0.4);
  transform: rotate(-4deg);
}

@media (max-width: 480px) {
  body {
    background: var(--paper);
  }

  .landing-shell {
    width: 100%;
    padding: 0 0 28px;
  }

  .story-body {
    padding: 20px 20px 40px;
  }

  .progress-rail {
    right: 6px;
    height: 120px;
  }

  .photo-tile {
    padding: 8px 8px 10px;
  }

  .modal-sheet {
    max-height: 92%;
    padding: 16px 16px 24px;
  }

  .upload-tile {
    min-height: 104px;
  }
}

@media (min-width: 769px) {
  .stage {
    height: 100dvh;
    min-height: 100dvh;
  }

  .landing {
    position: absolute;
    inset: 0;
    overflow-y: auto;
  }
}
