:root {
  --color-bg: #F5EFE8;
  --color-surface: #FFFCF8;
  --color-beige: #E7D8C8;
  --color-sage: #8B6A4E;
  --color-gold: #B58A62;
  --color-text: #2F241C;
  --color-muted: #7A6656;
  --color-border: rgba(66, 48, 33, 0.16);

  --radius-sm: 12px;
  --radius-md: 16px;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.08);
  --transition: all .25s ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Montserrat", system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-weight: 700;
}

h1 {
  font-size: 40px;
  line-height: 1.05;
}

h2 {
  font-size: 28px;
  line-height: 1.15;
}

p,
button,
input,
label {
  font-size: 16px;
}

small {
  font-size: 14px;
}

.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

img,
video {
  max-width: 100%;
  display: block;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 8% 12%, rgba(231, 216, 200, .65), transparent 36%),
    radial-gradient(circle at 92% 6%, rgba(139, 106, 78, .16), transparent 38%);
}

.desktop-only {
  display: none;
}

.container {
  position: relative;
  max-width: 1248px;
  margin: 0 auto;
  padding: 14px 14px 88px;
}

.controls {
  margin-bottom: 14px;
}

.chips {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chip {
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0 14px;
  font-size: .92rem;
  transition: var(--transition);
}

.chip.active {
  background: var(--color-beige);
  border-color: rgba(46, 46, 46, .2);
}

.sort {
  margin-left: auto;
  color: var(--color-muted);
  font-size: .9rem;
}

.hero-note {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow-card);
}

.hero-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-gold);
}

.hero-note h2 {
  margin: 0;
  max-width: 28ch;
  font-size: clamp(0.92rem, 3.1vw, 1.15rem);
  line-height: 1.32;
  color: var(--color-text);
}

.btn-primary {
  border: 0;
  height: 48px;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-size: .95rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-sage);
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.btn-primary:disabled {
  opacity: .72;
  cursor: not-allowed;
}

.fab-add {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 40;
  height: 52px;
  min-width: 126px;
  border-radius: 999px;
  background: var(--color-gold);
  animation: ctaPulse 2.6s ease-in-out infinite;
}

.fab-add:hover {
  background: #9d7652;
}

.btn-primary.full {
  width: 100%;
  margin-top: 12px;
}

@keyframes ctaPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(201, 168, 106, 0);
  }
  40% {
    box-shadow: 0 0 0 8px rgba(201, 168, 106, 0.2);
  }
}

.gallery {
  column-count: 1;
  column-gap: 12px;
}

.post-card {
  position: relative;
  margin: 0 0 12px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
  break-inside: avoid;
  cursor: zoom-in;
  transition: var(--transition);
}

.post-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0));
  pointer-events: none;
  z-index: 1;
}

.post-card:hover {
  transform: scale(1.02);
}

.post-card.just-added {
  animation: cardPop .6s cubic-bezier(.2, .8, .2, 1);
}

.post-card.live-added {
  animation: liveFlash 1.1s cubic-bezier(.2, .8, .2, 1);
}

.post-card img,
.post-card video {
  width: 100%;
  display: block;
  border-radius: var(--radius-md);
}

.progressive-media {
  transform: scale(1.02);
  transition: filter .45s ease, transform .45s ease, opacity .35s ease;
}

.progressive-media.is-blur {
  filter: blur(10px);
  opacity: .9;
}

.progressive-media.is-sharp {
  filter: blur(0);
  opacity: 1;
  transform: scale(1);
}

.caption {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 42px;
  background: transparent;
  color: #fff;
  padding: 4px 2px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  z-index: 3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.video-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 12px;
  border-radius: 999px;
  padding: 5px 8px;
}

.reactions-overlay {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 6px;
  z-index: 3;
}

.reaction-btn {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(20, 20, 20, 0.34);
  color: #fff;
  border-radius: 999px;
  min-height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  backdrop-filter: blur(4px);
  transition: var(--transition);
}

.reaction-btn .emoji {
  font-size: 13px;
  line-height: 1;
}

.reaction-btn .count {
  font-weight: 600;
  min-width: 10px;
}

.reaction-btn:hover {
  transform: translateY(-1px);
  background: rgba(20, 20, 20, 0.5);
}

.reaction-btn.is-active {
  transform: scale(1.06);
}

.reaction-btn.is-pop {
  animation: reactionPop .34s cubic-bezier(.2, .8, .2, 1);
}

.reaction-btn.is-pop .emoji {
  animation: reactionEmoji .34s cubic-bezier(.2, .8, .2, 1);
}

.reaction-btn.is-pop .count {
  animation: reactionCount .34s cubic-bezier(.2, .8, .2, 1);
}

.load-more {
  width: 100%;
  margin: 10px 0 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  height: 46px;
  font-weight: 600;
  transition: var(--transition);
}

.load-more:hover {
  background: var(--color-beige);
}

.infinite-sentinel {
  width: 100%;
  height: 2px;
}

.infinite-spinner {
  display: grid;
  place-items: center;
  margin: 8px 0 14px;
  min-height: 28px;
}

.infinite-spinner span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(139, 106, 78, 0.28);
  border-top-color: var(--color-sage);
  animation: subtleSpin .8s linear infinite;
}

.empty {
  text-align: center;
  color: var(--color-muted);
  margin: 30px 0;
}

.hidden {
  display: none !important;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 50;
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 240px;
  z-index: 60;
  background: var(--color-surface);
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--color-border);
  padding: 12px 16px 18px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
  transform: translateY(0);
  animation: sheetIn 220ms cubic-bezier(.2, .8, .2, 1);
}

@keyframes sheetIn {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.sheet-handle {
  width: 50px;
  height: 5px;
  border-radius: 999px;
  background: #d9d1cb;
  margin: 0 auto 10px;
}

.bottom-sheet h2 {
  margin: 0 0 10px;
}

.sheet-actions {
  display: grid;
  gap: 9px;
}

.sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  padding: 0 12px;
  background: var(--color-surface);
  font-weight: 600;
  transition: var(--transition);
}

.sheet-item:hover {
  background: rgba(232, 222, 215, .35);
}

.sheet-item.column {
  display: block;
  padding: 10px 12px;
}

.sheet-item input[type="text"],
.caption-label input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  padding: 0 12px;
  font: inherit;
  background: #fff;
  transition: var(--transition);
}

.sheet-item input[type="text"]:focus,
.caption-label input:focus {
  outline: none;
  border-color: var(--color-sage);
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
}

.viewer-content,
.preview-card {
  position: relative;
  z-index: 2;
  margin: 2.5vh auto;
  width: min(96vw, 900px);
  max-height: 95vh;
  border-radius: var(--radius-md);
  overflow: hidden;
  animation: panelIn .24s cubic-bezier(.2, .8, .2, 1);
}

.viewer-content {
  background: #111;
  color: #fff;
}

.camera-shell {
  position: relative;
  z-index: 2;
  margin: 0 auto;
  width: min(100vw, 560px);
  height: 100vh;
  background: #000;
  overflow: hidden;
}

.camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-top-ui,
.camera-bottom-ui {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
}

.camera-top-ui {
  top: 8px;
}

.camera-bottom-ui {
  bottom: max(16px, env(safe-area-inset-bottom));
}

.camera-hint {
  max-width: 78%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  backdrop-filter: blur(4px);
}

.camera-timer {
  background: rgba(201, 168, 106, 0.92);
  color: #fff;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}

.camera-pick {
  min-width: 70px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.camera-spacer {
  width: 70px;
  height: 36px;
}

.shutter-btn {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.2);
  transition: transform .15s ease, box-shadow .2s ease;
}

.shutter-btn:active,
.shutter-btn.is-recording {
  transform: scale(0.94);
  box-shadow: 0 0 0 8px rgba(201, 168, 106, 0.35);
  background: rgba(201, 168, 106, 0.7);
}

.preview-card {
  width: min(96vw, 560px);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 16px;
  box-shadow: var(--shadow-card);
  max-height: calc(100vh - 18px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

.preview-card h3 {
  margin: 0 0 12px;
}

.preview-media-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  min-height: 220px;
  max-height: 44vh;
}

.preview-media-wrap img,
.preview-media-wrap video {
  width: 100%;
  max-height: 44vh;
  object-fit: contain;
}

@media (min-width: 768px) {
  .preview-media-wrap {
    max-height: 52vh;
  }

  .preview-media-wrap img,
  .preview-media-wrap video {
    max-height: 52vh;
  }
}

.preview-video-tools {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.ghost-btn {
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: #fff;
  padding: 0 12px;
  font-weight: 600;
  transition: var(--transition);
}

.ghost-btn:hover {
  background: var(--color-beige);
}

.caption-label {
  display: block;
  margin-top: 12px;
}

.progress-wrap {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #eee3db;
  margin: 12px 0;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--color-sage), var(--color-gold), var(--color-sage));
  background-size: 200% 100%;
  animation: progressShimmer 1.1s linear infinite;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 30px;
  line-height: 32px;
  transition: var(--transition);
}

.preview-card .close-btn {
  background: #fff;
  border-color: var(--color-border);
  color: var(--color-text);
}

.viewer-body {
  min-height: 72vh;
  display: grid;
  place-items: center;
}

.viewer-body img,
.viewer-body video {
  max-width: 100%;
  max-height: 90vh;
}

.nav-btn {
  position: absolute;
  top: 50%;
  margin-top: -26px;
  z-index: 3;
  width: 42px;
  height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 34px;
  transition: var(--transition);
}

.nav-btn.prev {
  left: 12px;
}

.nav-btn.next {
  right: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #2d2a27;
  color: #fff;
  border-radius: 999px;
  width: min(92vw, 460px);
  text-align: center;
  white-space: normal;
  padding: 11px 16px;
  z-index: 100;
  animation: toastIn .26s cubic-bezier(.2, .8, .2, 1);
}

.emoji-burst-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 120;
  overflow: hidden;
}

.emoji-particle {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 22px;
  line-height: 1;
  will-change: transform, opacity;
  animation: emojiBurst .95s cubic-bezier(.2, .8, .2, 1) forwards;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: var(--transition);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes cardPop {
  0% {
    transform: scale(.95) translateY(10px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes reactionPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.16);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes reactionEmoji {
  0% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(-2px) scale(1.12);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes reactionCount {
  0% {
    transform: scale(1);
    opacity: .9;
  }
  45% {
    transform: scale(1.14);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes emojiBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.7) rotate(0deg);
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15) rotate(var(--rot));
  }
}

@keyframes liveFlash {
  0% {
    transform: translateY(10px) scale(.98);
    box-shadow: 0 0 0 0 rgba(201, 168, 106, 0);
  }
  45% {
    transform: translateY(0) scale(1.02);
    box-shadow: 0 0 0 12px rgba(201, 168, 106, 0.2);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(.96);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes progressShimmer {
  from {
    background-position: 0% 0%;
  }
  to {
    background-position: 200% 0%;
  }
}

@keyframes subtleSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

body.wall-mode {
  background: #0f0f0f;
  color: #fff;
}

body.wall-mode .page-bg,
body.wall-mode .fab-add,
body.wall-mode .controls,
body.wall-mode .load-more,
body.wall-mode #emptyState,
body.wall-mode .viewer,
body.wall-mode .bottom-sheet,
body.wall-mode #sheetBackdrop,
body.wall-mode .toast {
  display: none !important;
}

body.wall-mode .container {
  max-width: 100%;
  padding: 10px;
}

body.wall-mode .gallery {
  column-count: 3;
  column-gap: 10px;
}

@media (min-width: 1200px) {
  body.wall-mode .gallery {
    column-count: 4;
    column-gap: 12px;
  }
}

body.wall-mode .post-card {
  cursor: default;
  margin-bottom: 10px;
}

body.wall-mode .post-card::after,
body.wall-mode .caption,
body.wall-mode .reactions-overlay {
  display: none !important;
}

@media (min-width: 768px) {
  h1 {
    font-size: 56px;
  }

  h2 {
    font-size: 36px;
  }

  .container {
    padding-bottom: 96px;
  }

  .hero-note h2 {
    font-size: clamp(1.02rem, 1.55vw, 1.22rem);
  }

  .desktop-only {
    display: inline;
  }

  .fab-add {
    right: 24px;
    bottom: 22px;
  }

  .gallery {
    column-count: 3;
    column-gap: 14px;
  }

  .post-card {
    margin-bottom: 14px;
  }
}

@media (min-width: 1100px) {
  .gallery {
    column-count: 4;
    column-gap: 16px;
  }
}
