:root {
  --bg: #f6efe4;
  --paper: #fffdf9;
  --ink: #2b2420;
  --muted: #8a7c70;
  --line: #e6dccd;
  --accent: #c2553a;
  --accent-dk: #a3442c;
  --soft: #f1e4d3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60,40,20,.06), 0 6px 18px rgba(60,40,20,.08);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 Inter, system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, .brand { font-family: Fraunces, Georgia, serif; line-height: 1.2; }
h1 { font-size: 2.1rem; margin: .2em 0; }
img { display: block; max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; margin: 0 auto; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Top bar */
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { font-size: 1.6rem; font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }
nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
nav a { color: var(--ink); font-weight: 500; }
.who { color: var(--muted); }

main { padding: 28px 20px 60px; }
.foot { color: var(--muted); text-align: center; padding: 20px; font-size: .9rem; }

/* Buttons */
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 10px 20px; font: 600 15px Inter, sans-serif; cursor: pointer; }
.btn:hover { background: var(--accent-dk); text-decoration: none; }
nav a.btn { color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 14px; }
.btn-block { display: block; text-align: center; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--soft); }
.btn-danger { background: transparent; color: #b3261e; border: 1px solid #e8c0bb; }
.btn-danger:hover { background: #fbeceb; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; cursor: pointer; }
.linkbtn:hover { color: #b3261e; }

/* Messages */
.flash, .error { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; }
.flash { background: #e7f2e4; color: #2d5a27; }
.error { background: #fbeceb; color: #9c2a20; margin-bottom: 10px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label, .label { font-weight: 600; font-size: 14px; display: flex; flex-direction: column; gap: 6px; margin: 0; }
input:not([type=checkbox]):not([type=file]), textarea {
  font: 16px Inter, sans-serif; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--paper); color: var(--ink); width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { font-weight: 500 !important; flex-direction: row !important; align-items: center; background: var(--paper); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.actions { display: flex; align-items: center; gap: 18px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; }
.thumb-rm { font-weight: 400 !important; font-size: 13px !important; align-items: center; }

/* Auth */
.auth { max-width: 400px; margin: 40px auto; background: var(--paper); padding: 32px; border-radius: var(--radius); box-shadow: var(--shadow); }
.auth h1 { text-align: center; }
.tagline { text-align: center; color: var(--muted); margin-top: 0; }

/* Timeline layout */
.layout { display: grid; grid-template-columns: 1fr 280px; gap: 32px; align-items: start; }
.side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; }
.box { background: var(--paper); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.box h3 { margin: 0 0 12px; font-size: 1.1rem; }
.month { font-size: 1.4rem; margin: 32px 0 14px; padding-bottom: 6px; border-bottom: 2px dashed var(--line); }
.feed > .month:first-child, .otd + .month { margin-top: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }

/* Polaroid cards */
.card { background: var(--paper); padding: 10px 10px 0; border-radius: 6px; box-shadow: var(--shadow); color: var(--ink); transition: transform .15s ease, box-shadow .15s ease; }
.card:nth-child(3n+1) { transform: rotate(-.8deg); }
.card:nth-child(3n+2) { transform: rotate(.6deg); }
.card:hover { transform: rotate(0) translateY(-3px); box-shadow: 0 10px 28px rgba(60,40,20,.16); text-decoration: none; }
.card-photo { aspect-ratio: 1; overflow: hidden; border-radius: 3px; background: var(--soft); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.noimg { height: 100%; display: grid; place-items: center; font: 700 4rem Fraunces, serif; color: var(--accent); opacity: .5; }
.card-body { padding: 10px 4px 12px; }
.card-body h3 { margin: 0 0 4px; font-size: 1.05rem; }
.card-body p { margin: 0; font-size: 13px; }
.meta { color: var(--muted); }
.stats { color: var(--muted); margin-top: 4px !important; }

.otd { background: linear-gradient(135deg, #fbe3d4, #f7ecd9); padding: 18px 20px 22px; border-radius: var(--radius); margin-bottom: 18px; }
.otd h2 { margin: 0 0 14px; }

.filterbar { color: var(--muted); }
.empty { text-align: center; background: var(--paper); padding: 48px 20px; border-radius: var(--radius); box-shadow: var(--shadow); }

/* Chips, people */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { display: inline-block; background: var(--soft); color: var(--ink); padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.chip:hover, .chip.on { background: var(--accent); color: #fff; text-decoration: none; }
.chip-tag { background: transparent; border: 1px solid var(--line); }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.people a { display: flex; align-items: center; gap: 10px; color: var(--ink); padding: 4px 6px; border-radius: 8px; }
.people a:hover, .people a.on { background: var(--soft); text-decoration: none; }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.search input { border-radius: 999px; }

/* Memory page */
.back { margin: 0 0 8px; }
.gallery { display: grid; gap: 6px; margin: 20px 0; grid-template-columns: repeat(3, 1fr); }
.gallery.count-1 { grid-template-columns: 1fr; }
.gallery.count-2, .gallery.count-4 { grid-template-columns: repeat(2, 1fr); }
.gallery a { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 8px; cursor: zoom-in; }
.gallery.count-1 a { aspect-ratio: auto; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.gallery a:hover img { transform: scale(1.03); }
.story { background: var(--paper); padding: 20px 24px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 17px; margin: 18px 0; }
.label { margin-top: 14px; }
.react { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 22px 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.react form { margin: 0; }
.spacer { flex: 1; }
.heart { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; font: 600 15px Inter, sans-serif; color: var(--muted); cursor: pointer; }
.heart.on { background: #fde4e1; border-color: #f3b4ab; color: #d03b2c; }
.comments h2 { font-size: 1.3rem; }
.comment { display: flex; gap: 12px; margin-bottom: 16px; }
.comment p { margin: 0; }
.cmeta { font-size: 14px; }
.inline { display: inline; }
.comment-form { flex-direction: row; align-items: flex-end; gap: 10px; margin-top: 10px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(20,14,10,.92); display: flex; align-items: center; justify-content: center; z-index: 100; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 6px; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); color: #fff; border: 0; font-size: 2.4rem; width: 52px; height: 52px; border-radius: 50%; cursor: pointer; }
.lightbox .nav:hover { background: rgba(255,255,255,.25); }
.lightbox .prev { left: 16px; } .lightbox .next { right: 16px; }
.lightbox .nav[hidden] { display: none; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; order: -1; }
  .side .box:not(:first-of-type) { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  nav { gap: 12px; font-size: 14px; }
  .who { display: none; }
  h1 { font-size: 1.7rem; }
}
