:root {
  --navy: #233c6b;
  --red: #be1e2d;
  --text: #4a5568;
  --line: #e2e8f0;
  --bg: #f3f5f8;
}

* { box-sizing: border-box; }

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

a { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--navy);
  color: white;
}

.topbar a.brand {
  color: white;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.topbar p {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 0.92rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}

a.back {
  flex: 0 0 auto;
  background: var(--red);
  color: white;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.page {
  width: min(1100px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
}

h1, h2, h3 { color: var(--navy); line-height: 1.15; }

h1 { margin: 0 0 0.75rem; font-size: 2rem; }

.meta-form {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(35, 60, 107, 0.06);
}

.export-row {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
}

.era-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.era-tile {
  position: relative;
  display: block;
  min-height: 180px;
  border-radius: 1rem;
  overflow: hidden;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.era-tile img,
.section-card img,
.thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.era-tile span,
.section-card span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-align: center;
  text-transform: uppercase;
}

.section-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.section-card {
  position: relative;
  display: block;
  min-height: 120px;
  border-radius: 0.9rem;
  overflow: hidden;
  text-decoration: none;
}

.section {
  margin: 0 0 2.5rem;
  padding: 1.25rem 1.25rem 0.5rem;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(35, 60, 107, 0.06);
}

.section-head {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.section-head form { margin: 0; }

.section-head img {
  width: 180px;
  height: 120px;
  object-fit: cover;
  border-radius: 0.75rem;
}

.group-title {
  margin: 1.5rem 0 0.25rem;
  font-size: 1.35rem;
}

.entry {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem;
  padding: 1.25rem 0.75rem;
  border-top: 1px solid var(--line);
  border-radius: 0.75rem;
}

.entry.dirty {
  background: #fde8ea;
}

.entry .form-row,
.entry button[type="submit"] {
  display: none;
}

.entry.dirty .form-row,
.entry:has(.status:not(:empty)) .form-row {
  display: flex;
}

.entry.dirty button[type="submit"] {
  display: inline-block;
}

.thumbs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.thumbs img {
  width: 140px;
  height: 140px;
  border-radius: 999px;
  object-fit: cover;
}

form {
  display: grid;
  gap: 0.65rem;
}

label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid #cbd5e0;
  border-radius: 0.55rem;
  color: #1a202c;
  font: 1rem/1.4 Georgia, serif;
  text-transform: none;
  letter-spacing: 0;
}

textarea { min-height: 7rem; resize: vertical; }

.caption-field textarea { min-height: 4.5rem; }

.form-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  background: var(--red);
  color: white;
  font: 700 0.85rem/1 Futura, "Trebuchet MS", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

button:disabled { opacity: 0.6; cursor: wait; }

.status { margin: 0; min-height: 1.2em; font-family: Georgia, serif; text-transform: none; letter-spacing: 0; }

.status.ok { color: #276749; }
.status.err { color: var(--red); }

@media (max-width: 800px) {
  .era-grid,
  .section-head,
  .entry { grid-template-columns: 1fr; }
  .topbar,
  .topbar-actions { align-items: flex-start; flex-direction: column; }
}
