:root {
  --paper: #f4f1eb;
  --ink: #161513;
  --muted: #5e574f;
  --line: rgba(22, 21, 19, 0.16);
  --dark: #121110;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.45;
}

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

button, input, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

[hidden] { display: none !important; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.gate form {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.gate img { height: 64px; width: auto; }

h1, h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.03em;
  margin: 0;
}

h1 { font-size: 3rem; }

.gate p { margin: 0; color: var(--muted); }

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

label span, .check {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

input, textarea {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0.55rem 0;
  width: 100%;
}

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

input:focus, textarea:focus {
  outline: none;
  border-bottom-color: var(--ink);
}

.gate button, .save, .add, .file-row button, .row-actions button, #logout {
  border: 0;
  background: var(--dark);
  color: var(--paper);
  padding: 0.75rem 1rem;
  width: fit-content;
}

.gate button { margin-top: 0.6rem; }

.error { color: #8a2e24; }

.app { min-height: 100vh; }

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: inherit;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.35rem;
  margin-right: auto;
}

.status { margin: 0; color: var(--muted); font-size: 0.92rem; }

.text {
  color: inherit;
}

#logout {
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 0.2rem 0;
}

.layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: start;
}

.side {
  position: sticky;
  top: 68px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.5rem 1.25rem;
}

.side a {
  color: inherit;
  text-decoration: none;
}

.side a:hover { text-decoration: underline; }

.editor {
  padding: 1.5rem 1.5rem 5rem;
  max-width: 860px;
}

.block {
  padding: 1.6rem 0 2rem;
  border-top: 1px solid var(--line);
}

.block h2 { font-size: 2.2rem; margin-bottom: 0.8rem; }

.card {
  border-top: 1px solid var(--line);
  padding: 0.4rem 0 1rem;
}

.card summary {
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.45rem;
  padding: 0.7rem 0;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-bottom: 0.6rem;
}

.preview {
  width: min(100%, 360px);
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #e4dfd6;
  margin: 0.4rem 0 0.6rem;
}

.photos { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 0.6rem; }

.photo {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.8rem;
  align-items: start;
}

.photo img {
  width: 140px;
  height: 96px;
  object-fit: cover;
  background: #e4dfd6;
}

.row-actions, .file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.row-actions button, .file-row button, .add {
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 0.15rem 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.check-row input { width: auto; }

.add { margin-top: 0.8rem; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .side {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.8rem 1rem;
  }
  .bar { flex-wrap: wrap; }
  .status { order: 5; width: 100%; }
  .photo { grid-template-columns: 1fr; }
}
