:root {
  color-scheme: dark;
  --bg: #121110;
  --surface: #1c1a18;
  --line: #2c2925;
  --fg: #ece8e1;
  --muted: #9a948a;
  --accent: #e8b04a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 var(--sans);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Header */
.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 16px;
}
.brand {
  font: 600 1.35rem/1 var(--serif);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.brand::first-letter { color: var(--accent); }
.top nav { display: flex; gap: 18px; font-size: 0.95rem; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--fg); }
.top nav a[aria-current="page"] { box-shadow: 0 2px 0 var(--accent); }

/* Day page */
.day { max-width: 1400px; margin: 0 auto; padding: 0 16px 48px; }
.photo { margin: 0; display: flex; justify-content: center; }
.photo-open {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  max-width: 100%;
}
.photo img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: min(82vh, 1400px);
  border-radius: 6px;
  background: var(--surface) center / cover no-repeat;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.45);
}

.info { max-width: 680px; margin: 28px auto 0; }
.dateline { margin: 0; color: var(--muted); font-size: 0.9rem; letter-spacing: 0.04em; text-transform: uppercase; }
.info h1 { font: 500 clamp(1.7rem, 4vw, 2.4rem)/1.15 var(--serif); margin: 6px 0 4px; text-wrap: balance; }
.location { margin: 0; color: var(--muted); }

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  padding: 12px 0;
  border-block: 1px solid var(--line);
}
.reactions, .tools { display: flex; gap: 8px; flex-wrap: wrap; }
.react, .tools button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.react:hover, .tools button:hover { border-color: var(--muted); }
.react:active { transform: scale(0.94); }
.react[aria-pressed="true"], .save[aria-pressed="true"] { border-color: var(--accent); background: rgb(232 176 74 / 0.12); }
.react .count { font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.react .count:empty { display: none; }

.note {
  margin: 24px 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--accent);
  font: italic 1.15rem/1.55 var(--serif);
}
.note p { margin: 0; }
.description { margin: 16px 0; }
.details { margin: 20px 0; color: var(--muted); }
.details summary { cursor: pointer; color: var(--fg); }
.details p { margin: 8px 0; }
.details dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0 0; font-size: 0.95rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; color: var(--fg); }
.details .field-notes { color: var(--fg); margin-top: 14px; white-space: pre-line; }

.comments { margin-top: 32px; display: grid; gap: 18px; }
.comments::before {
  content: "What the critics say";
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.comments.waiting::after { content: "The critics are arguing…"; color: var(--muted); font-style: italic; }
.comment { display: grid; grid-template-columns: 40px 1fr; gap: 12px; }
.comment p { margin: 0; }
.comment .who { font-weight: 600; font-size: 0.95rem; }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 1.2rem;
}

.pager {
  max-width: 680px;
  margin: 40px auto 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
}
.pager a { color: var(--muted); text-decoration: none; }
.pager a:hover { color: var(--fg); }

.missed {
  max-width: 680px;
  margin: 28px auto 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
}
.missed img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.missed strong { display: block; }
.missed span span { color: var(--muted); }

/* Full-screen viewer */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.viewer img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
}
.viewer-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.55);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

/* Archive */
.archive, .saved { max-width: 1000px; margin: 0 auto; padding: 0 16px 48px; }
.month { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: 12px 0 20px; }
.month h1 { margin: 0; text-align: center; font: 500 1.8rem var(--serif); }
.month a { font-size: 1.4rem; text-decoration: none; color: var(--muted); text-align: center; }
.calendar { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekday { text-align: center; color: var(--muted); font-size: 0.8rem; }
.cell { aspect-ratio: 1; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 0.8rem; padding: 4px 6px; }
.cell.future { background: none; opacity: 0.35; }
.cell.has { padding: 0; position: relative; overflow: hidden; }
.cell.has a { display: block; height: 100%; }
.cell.has img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.cell.has a:hover img { transform: scale(1.05); }
.cell.has span {
  position: absolute;
  left: 5px;
  top: 3px;
  color: #fff;
  text-shadow: 0 1px 3px #000;
}
.cell.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.quiet { color: var(--muted); }

.saved h1 { font: 500 1.8rem var(--serif); }
.saved-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.saved-grid a { text-decoration: none; }
.saved-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; background: var(--surface); }
.saved-grid span { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

.message { min-height: 70vh; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 16px; }
.message a { color: var(--accent); }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .day { padding: 0 0 40px; }
  .photo img { border-radius: 0; max-height: 75vh; }
  .info, .pager, .missed { margin-inline: 16px; }
  .top nav { gap: 14px; }
  .calendar { gap: 3px; }
  .cell { font-size: 0.7rem; }
}
