:root {
  --bg: #f3efe6;
  --panel: #fffdf8;
  --text: #171411;
  --muted: #6d655d;
  --line: #d7d0c7;
  --accent: #171411;
  --danger: #8d2f2f;
  --shadow: 0 18px 40px rgba(23, 20, 17, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: radial-gradient(circle at top, #fffaf0 0%, var(--bg) 48%, #ebe4d9 100%);
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Aptos", "Trebuchet MS", sans-serif;
}

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

button,
input {
  font: inherit;
}

.page {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.intro {
  padding: 24px 0 28px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

h1,
h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.2rem, 8vw, 4.8rem);
  line-height: 0.95;
  max-width: 7ch;
}

h2 {
  font-size: 1.35rem;
}

.lead,
.status,
.date,
.empty p,
.field span {
  color: var(--muted);
}

.lead {
  max-width: 36rem;
  margin: 16px 0 0;
  font-size: 1rem;
}

.status {
  margin: 18px 0 0;
  font-size: 0.95rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 176px));
  justify-content: start;
  gap: 16px;
}

.card,
.empty,
.panel {
  background: color-mix(in srgb, var(--panel) 88%, white 12%);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.card {
  overflow: hidden;
}

.card-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #e4ddd3;
}

.meta {
  padding: 12px 14px 16px;
}

.name {
  margin: 0;
  font-weight: 700;
}

.date {
  margin: 6px 0 0;
  font-size: 0.9rem;
}

.empty {
  grid-column: 1 / -1;
  padding: 22px;
}

.empty p {
  margin: 10px 0 0;
}

.admin-page {
  width: min(980px, calc(100vw - 32px));
}

.admin-intro h1 {
  max-width: 9ch;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}

.input:focus {
  outline: 2px solid #b5aea5;
  outline-offset: 2px;
}

.input-file {
  padding: 12px 14px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.button,
.ghost-button,
.delete-button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.button:hover,
.ghost-button:hover,
.delete-button:hover {
  transform: translateY(-1px);
}

.button {
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
}

.ghost-button {
  padding: 0 16px;
  background: #ebe4d9;
  color: var(--text);
}

.delete-button {
  width: calc(100% - 28px);
  margin: 0 14px 14px;
  background: #f3dcdc;
  color: var(--danger);
}

.viewer-open {
  overflow: hidden;
}

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

.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 20, 17, 0.82);
}

.viewer-dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 980px);
  max-height: calc(100vh - 40px);
  margin: 20px auto;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.viewer-image {
  width: 100%;
  max-height: calc(100vh - 170px);
  border-radius: 18px;
  object-fit: contain;
  background: #ece5da;
}

.viewer-meta {
  padding-top: 12px;
}

.viewer-title,
.viewer-date {
  margin: 0;
}

.viewer-title {
  font-weight: 700;
}

.viewer-date {
  padding-top: 6px;
  color: var(--muted);
}

.viewer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  margin: 0 0 12px auto;
  border: 0;
  border-radius: 999px;
  background: #ebe4d9;
  cursor: pointer;
}

@media (max-width: 640px) {
  .page {
    width: min(100vw - 20px, 1120px);
    padding-top: 24px;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .ghost-button,
  .button {
    width: 100%;
  }

  .viewer-dialog {
    width: calc(100vw - 20px);
    margin: 10px auto;
    padding: 12px;
  }
}
