/* =====================================================================
   Wild Ruby palette
   Ruby #ECBAAD · Lipstick #AE4227 · Vivid Crimson #E8907B
   True Cherry #60281A · Plasma Brick #E36140
   ===================================================================== */

:root {
  --ruby: #ECBAAD;
  --lipstick: #AE4227;
  --crimson: #E8907B;
  --cherry: #60281A;
  --brick: #E36140;
  --ink: #1C100C;
  --cream: #FFF4F0;

  /* Theme: Cherry Night */
  --bg: var(--cherry);
  --surface: #6E3123;          /* inputs, cards */
  --surface-2: #532216;        /* chat window */
  --text: var(--ruby);
  --heading: #F8DCD3;
  --muted: #D59A8A;
  --line: rgba(236, 186, 173, .2);
  --primary: var(--ruby);
  --primary-text: var(--cherry);
  --primary-hover: var(--crimson);
  --stage: #4A1D12;
  --chat-head: var(--brick);
  --chat-head-text: var(--cream);
  --heart: var(--brick);
  --offset: var(--brick);      /* the hard drop shadow colour */
  --offset-size: 6px;
  --radius: 4px;
  --radius-lg: 6px;

  --display: "Anton", Impact, "Haettenschweiler", "Arial Narrow Bold", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--lipstick); color: var(--cream); }

a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--ruby); outline-offset: 3px; }

.eyebrow {
  margin: 0;
  font: 700 12px/1.2 var(--sans);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--heading);
}
.heart { color: var(--heart); }

/* The chunky editorial button */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 18px 28px;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-text);
  font: 700 14px/1 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: var(--offset-size) var(--offset-size) 0 var(--offset);
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), background .15s;
}
.btn svg { transition: transform .2s var(--ease-out); }
.btn:hover { transform: translate(-2px, -2px); box-shadow: calc(var(--offset-size) + 2px) calc(var(--offset-size) + 2px) 0 var(--offset); background: var(--primary-hover); color: var(--cream); }
.btn:hover { color: var(--cherry); }
.btn:hover svg { transform: translateX(4px); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--offset); }

/* =====================================================================
   Landing page
   ===================================================================== */

.landing {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
}

.hero {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 72px 48px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  align-items: center;
  gap: 56px;
}
.hero-copy { animation: rise .7s var(--ease-out) both; }

.display {
  margin: 22px 0 18px;
  font: 400 clamp(64px, 10.5vw, 158px)/.86 var(--display);
  letter-spacing: -.005em;
  text-transform: uppercase;
  color: var(--heading);
}
.lede {
  max-width: 440px;
  margin: 0 0 36px;
  font: 500 15px/1.6 var(--mono);
  color: var(--muted);
}

.hero-photo {
  justify-self: center;
  width: min(100%, 360px);
  display: block;
  padding: 14px 14px 52px;
  position: relative;
  background: var(--surface-2);
  border-radius: var(--radius);
  box-shadow: 12px 12px 0 var(--offset);
  transform: rotate(3deg);
  transition: transform .4s var(--ease-out);
  animation: drop .9s .1s var(--ease-out) both;
  text-decoration: none;
}
.hero-photo:hover { transform: rotate(0deg) translateY(-4px); }
.hero-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--stage);
}
.caption {
  position: absolute;
  left: 18px;
  bottom: 17px;
  font: 500 13px var(--mono);
  color: var(--muted);
}

@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes drop { from { opacity: 0; transform: rotate(9deg) translateY(30px); } }

.swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.swatch {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  min-height: 150px;
  padding: 22px 28px 26px;
  border: 0;
  border-radius: 0;
  text-align: left;
  text-decoration: none;
  transition: padding .25s var(--ease-out);
}
a.swatch:hover, button.swatch:hover { padding-bottom: 34px; }
.swatch .eyebrow { color: inherit; opacity: .85; }
.swatch-name {
  font: 400 30px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .01em;
}
.s-lipstick { background: var(--lipstick); color: var(--cream); }
.s-crimson  { background: var(--crimson);  color: var(--ink); }
.s-cherry   { background: var(--cherry);   color: var(--cream); }
.s-brick    { background: var(--brick);    color: var(--cream); }
.s-cherry { background: #4A1D12; }


/* =====================================================================
   Pictures page
   ===================================================================== */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: 68px;
  padding: 0 28px;
}
.back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  margin-left: -8px;
  border-radius: var(--radius);
  font: 700 12px var(--sans);
  letter-spacing: .2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--heading);
}
.back svg { width: 18px; height: 18px; transition: transform .2s var(--ease-out); }
.back:hover svg { transform: translateX(-3px); }
.wordmark {
  font: 400 24px/1 var(--display);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--heading);
  white-space: nowrap;
}
.topbar #photo-count { justify-self: end; font-family: var(--mono); font-weight: 500; letter-spacing: .08em; }

.stage {
  position: relative;
  height: calc(100vh - 68px - 84px);
  height: calc(100svh - 68px - 84px);
  min-height: 340px;
  margin: 0 28px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--stage);
}

#pic {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity .3s ease;
}
#pic.loading { opacity: 0; }

.nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ruby);
  color: var(--cherry);
  box-shadow: 0 6px 18px rgba(28, 16, 12, .3);
  transition: transform .15s var(--ease-out), background .15s;
}
.nav:hover { transform: scale(1.08); background: var(--cream); }
.nav.prev { left: 20px; }
.nav.next { right: 20px; }

.shuffle {
  position: absolute;
  right: 20px;
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ruby);
  color: var(--cherry);
  font: 700 12px var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  box-shadow: 0 6px 18px rgba(28, 16, 12, .3);
}
.shuffle:hover { background: var(--cream); }
.shuffle svg { width: 16px; height: 16px; }
.single .nav, .single .shuffle { display: none; }

/* ---------- Comments ---------- */

.comments {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 28px 140px;
}
.comments-head { margin-bottom: 22px; }
.comments-title {
  margin: 10px 0 0;
  font: 400 52px/.95 var(--display);
  text-transform: uppercase;
  color: var(--heading);
}
.count { font: 500 20px var(--mono); color: var(--muted); vertical-align: middle; }

.comments .composer { margin-bottom: 26px; }
.comments .feed { border-top: 2px solid var(--heading); }
.comments .msg { padding: 18px 4px; border-bottom: 1px solid var(--line); }
.comments .empty, .comments .status { padding: 40px 16px; }

/* =====================================================================
   Messages (comments and chat)
   ===================================================================== */

.empty, .status {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  height: 100%;
  padding: 24px;
  text-align: center;
  font: 500 13px/1.6 var(--mono);
  color: var(--muted);
}
.status p { margin: 0; }
.status button {
  padding: 8px 16px;
  border: 1.5px solid var(--text);
  border-radius: var(--radius);
  background: transparent;
  font: 700 11px var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
}

.msg {
  display: grid;
  grid-template-columns: 36px 1fr;
  column-gap: 12px;
  animation: pop .25s var(--ease-out);
}
@keyframes pop { from { opacity: 0; transform: translateY(5px); } }

.avatar {
  grid-row: span 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font: 400 17px/1 var(--display);
  text-transform: uppercase;
  user-select: none;
}
.msg.mine .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brick); }
.meta { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 14px;
  color: var(--heading);
}
.when { flex: none; font: 500 11.5px var(--mono); color: var(--muted); }
.text {
  margin: 2px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.skeleton { display: grid; gap: 14px; padding: 16px 0; }
.skeleton div {
  height: 44px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--line) 0%, transparent 50%, var(--line) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* =====================================================================
   Composer (comments and chat)
   ===================================================================== */

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.name {
  width: 100%;
  margin-bottom: 8px;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: transparent;
  font: 700 11.5px var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}
.name:hover, .name:focus { border-bottom-color: var(--line); outline: none; color: var(--heading); }
.name::placeholder { color: var(--muted); opacity: .8; }

.row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px 7px 7px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.row:focus-within { border-color: var(--lipstick); box-shadow: 0 0 0 3px rgba(174, 66, 39, .16); }
.row:focus-within { border-color: var(--ruby); box-shadow: 0 0 0 3px rgba(236, 186, 173, .16); }
.composer.over .row { border-color: var(--brick); }

textarea {
  flex: 1;
  min-height: 24px;
  max-height: 140px;
  padding: 6px 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  line-height: 1.45;
  color: var(--heading);
}
textarea::placeholder { color: var(--muted); opacity: .75; }
textarea:focus-visible, .name:focus-visible { outline: none; }

.send {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-text);
  transition: opacity .15s, transform .1s, background .15s;
}
.send:hover:not(:disabled) { background: var(--primary-hover); color: var(--cream); }
.send:hover:not(:disabled) { color: var(--cherry); }
.send:active:not(:disabled) { transform: scale(.93); }
.send:disabled { opacity: .3; cursor: default; }
.send svg { width: 18px; height: 18px; }
.composer.sending .send { opacity: .6; }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 18px;
  margin-top: 6px;
  font: 500 11.5px var(--mono);
}
.error { color: var(--lipstick); font-weight: 500; }
.error { color: var(--crimson); }
.counter { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.warn { color: var(--brick); }
.counter.over { color: var(--lipstick); font-weight: 700; }
.counter.over { color: var(--crimson); }

/* =====================================================================
   Chat bubble + window (on every page)
   ===================================================================== */

.chat-bubble {
  position: fixed;
  right: 28px;
  bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 40;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--chat-head);
  color: var(--chat-head-text);
  box-shadow: 0 0 0 4px var(--bg), 0 14px 30px rgba(28, 16, 12, .35);
  transition: transform .3s cubic-bezier(.3, 1.4, .5, 1), box-shadow .2s;
}
.chat-bubble:hover { transform: scale(1.07); }
.chat-bubble:active { transform: scale(.94); }
.chat-bubble svg {
  grid-area: 1 / 1;
  width: 28px;
  height: 28px;
  transition: transform .3s cubic-bezier(.3, 1.3, .5, 1), opacity .2s;
}
.chat-bubble .i-close { opacity: 0; transform: rotate(-90deg) scale(.5); }
.chat.open .chat-bubble .i-open { opacity: 0; transform: rotate(90deg) scale(.5); }
.chat.open .chat-bubble .i-close { opacity: 1; transform: none; }

.chat-bubble .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--brick);
  color: var(--cream);
  font: 700 12px/18px var(--sans);
  text-align: center;
  box-shadow: 0 0 0 3px var(--bg);
  animation: badge-in .35s cubic-bezier(.3, 1.6, .5, 1);
}
.chat-bubble .badge { background: var(--ruby); color: var(--cherry); }
.chat-bubble.nudge { animation: nudge .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes badge-in { from { transform: scale(0); } }
@keyframes nudge {
  30% { transform: scale(1.12) rotate(-8deg); }
  60% { transform: scale(1.04) rotate(5deg); }
}

.chat-popup {
  position: fixed;
  right: 28px;
  bottom: calc(max(28px, env(safe-area-inset-bottom)) + 80px);
  z-index: 41;
  width: 380px;
  height: min(600px, calc(100vh - 140px));
  height: min(600px, calc(100dvh - 140px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: calc(var(--radius-lg) + 6px);
  background: var(--surface-2);
  box-shadow: var(--offset-size) var(--offset-size) 0 var(--offset), 0 24px 60px rgba(28, 16, 12, .35);
  transform-origin: calc(100% - 32px) calc(100% + 48px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(.55);
  transition: opacity .18s ease, transform .3s var(--ease-out), visibility 0s linear .3s;
}
.chat.open .chat-popup {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .18s ease, transform .38s cubic-bezier(.25, 1.2, .4, 1), visibility 0s;
}

.chat-head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 18px 14px 16px 20px;
  background: var(--chat-head);
  color: var(--chat-head-text);
}
.chat-heading { flex: 1; min-width: 0; }
.chat-heading .eyebrow { color: inherit; opacity: .8; font-size: 10.5px; }
.chat-heading h2 {
  margin: 6px 0 0;
  font: 400 30px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .01em;
}
.icon-btn {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 244, 240, .14);
  color: inherit;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(255, 244, 240, .26); }

.chat-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line);
  font: 500 11.5px var(--mono);
  color: var(--muted);
}
.live-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--brick);
  animation: live 2.2s ease-out infinite;
}
.chat.offline .live-dot { background: var(--muted); animation: none; }
@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(227, 97, 64, .55); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(227, 97, 64, 0); }
}

.chat .feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px 14px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  overscroll-behavior: contain;
}
.chat .msg { margin-top: 14px; }
.chat .msg.cont { margin-top: 3px; }
.chat .msg.cont .avatar, .chat .msg.cont .meta { display: none; }
.chat .msg.cont .text { grid-column: 2; }
.chat .msg.mine .avatar { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--brick); }

.chat .composer {
  padding: 12px 14px 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.jump {
  position: absolute;
  left: 50%;
  bottom: 136px;
  translate: -50% 0;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--chat-head);
  color: var(--chat-head-text);
  font: 700 11px var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  box-shadow: 0 8px 20px rgba(28, 16, 12, .3);
  animation: pop .2s ease-out;
}

/* A little preview of new messages while the chat is collapsed */
.chat-peek {
  position: fixed;
  right: 108px;
  bottom: calc(max(28px, env(safe-area-inset-bottom)) + 8px);
  z-index: 39;
  max-width: 270px;
  display: grid;
  gap: 2px;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 2px var(--radius-lg);
  background: var(--surface-2);
  box-shadow: 4px 4px 0 var(--offset), 0 12px 30px rgba(28, 16, 12, .25);
  text-align: left;
  animation: peek-in .3s cubic-bezier(.25, 1.25, .4, 1);
}
.peek-name {
  font: 700 10.5px var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--lipstick);
}
.peek-name { color: var(--brick); }
.peek-text {
  font-size: 14px;
  color: var(--heading);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.chat-peek.out { animation: peek-out .2s ease-in forwards; }
@keyframes peek-in { from { opacity: 0; transform: translateX(10px) scale(.92); } }
@keyframes peek-out { to { opacity: 0; transform: translateX(6px) scale(.96); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   Phones and narrow windows
   ===================================================================== */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 48px 24px 40px; gap: 44px; }
  .hero-photo { width: min(78%, 300px); }
  .swatches { grid-template-columns: repeat(2, 1fr); }
  .swatch { min-height: 110px; padding: 18px 20px 20px; }
  .swatch-name { font-size: 24px; }
}

@media (max-width: 720px) {
  .topbar { grid-template-columns: auto 1fr; height: 60px; padding: 0 16px; }
  .topbar .wordmark { display: none; }
  .stage { margin: 0 12px; height: 64vh; height: 64svh; }
  .nav { width: 40px; height: 40px; }
  .nav.prev { left: 10px; }
  .nav.next { right: 10px; }
  .shuffle { right: 12px; bottom: 12px; }
  .comments { padding: 40px 18px 120px; }
  .comments-title { font-size: 42px; }
  textarea, .name { font-size: 16px; } /* stops iOS zooming in on focus */

  .chat-bubble { right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); width: 58px; height: 58px; }
  .chat-peek { right: 90px; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 6px); max-width: calc(100vw - 112px); }

  /* The chat opens as a full-screen sheet */
  .chat-popup {
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    box-shadow: none;
    transform-origin: 50% 100%;
    transform: translateY(40px);
  }
  .chat.open .chat-bubble { opacity: 0; pointer-events: none; transform: scale(.5); }
  body.chat-locked { overflow: hidden; }
}
