:root {
  color-scheme: light;
  --ink: #17130f;
  --muted: #6e655d;
  --paper: #fffdf8;
  --line: #e7ded3;
  --accent: #e6542b;
  --accent-dark: #a93218;
  --mint: #d8eee1;
  --sky: #dbe9fb;
  --sun: #ffe08a;
  --shadow: 0 18px 50px rgba(63, 44, 27, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(231, 222, 211, 0.45) 1px, transparent 1px),
    linear-gradient(rgba(231, 222, 211, 0.45) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.nav-link {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--accent-dark);
}

.family-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.family-link:hover {
  border-color: rgba(230, 84, 43, 0.45);
  background: #fff7f0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.small-button {
  min-height: 38px;
  padding: 0 12px;
}

.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

main {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding-bottom: 64px;
}

.hero {
  padding: clamp(30px, 6vw, 62px) 0 28px;
}

.kicker,
.post-meta {
  color: var(--accent);
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

.intro {
  max-width: 560px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.upload-panel {
  margin: 12px 0 34px;
  border-top: 4px solid var(--ink);
  border-bottom: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-main {
  width: min(1180px, calc(100% - 36px));
}

.admin-hero {
  padding-bottom: 20px;
}

.admin-panel {
  margin: 12px 0 34px;
  border-top: 4px solid var(--ink);
  border-bottom: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 32px);
}

.admin-panel h2 {
  margin: 0 0 20px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1;
}

.auth-card {
  max-width: 460px;
}

.single-form {
  display: grid;
  gap: 14px;
}

.upload-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: clamp(18px, 4vw, 32px);
}

.full,
.form-actions,
.form-status {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
}

textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
}

.feed {
  display: grid;
  gap: 30px;
}

.post {
  display: grid;
  grid-template-columns: minmax(0, 65fr) minmax(300px, 35fr);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.post:nth-child(3n + 1) {
  border-top: 8px solid var(--sun);
}

.post:nth-child(3n + 2) {
  border-top: 8px solid var(--mint);
}

.post:nth-child(3n + 3) {
  border-top: 8px solid var(--sky);
}

.post-image-wrap {
  aspect-ratio: 1 / 1.414;
  min-height: 520px;
  background: #f7f1e8;
  display: grid;
  place-items: center;
  padding: 18px;
}

.post-image {
  width: min(100%, calc((100vh - 120px) / 1.414));
  max-width: 100%;
  height: 100%;
  max-height: 760px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 12px 30px rgba(32, 22, 12, 0.14);
}

.post-content {
  padding: clamp(22px, 4vw, 40px);
}

.post h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.post-description {
  min-height: 1.4em;
  color: var(--muted);
  line-height: 1.55;
  font-size: 17px;
}

.comments {
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.comments h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.comment {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 12px;
}

.comment-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

.comment strong {
  display: block;
}

.comment-rating {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 15px;
  letter-spacing: 0;
}

.comment p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.comment-form {
  display: grid;
  gap: 10px;
}

.rating-field {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  margin: 0;
  padding: 0;
  border: 0;
}

.rating-field legend {
  width: 100%;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.rating-field label {
  display: inline-grid;
  place-items: center;
  margin: 0;
}

.rating-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating-field span {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #d7c9bb;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  transition: color 120ms ease, transform 120ms ease;
}

.rating-field label:hover span,
.rating-field label.is-active span {
  color: var(--accent);
}

.rating-field label:hover span {
  transform: translateY(-1px);
}

.comment-form button {
  justify-self: end;
}

.empty {
  margin: 36px 0;
  color: var(--muted);
  font-size: 18px;
}

.admin-list {
  display: grid;
  gap: 20px;
}

.admin-drawing {
  display: grid;
  grid-template-columns: minmax(160px, 280px) minmax(0, 1fr);
  gap: 20px;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
}

.admin-drawing:first-child {
  padding-top: 0;
  border-top: 0;
}

.admin-drawing img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #f7f1e8;
  border: 1px solid var(--line);
}

.edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .open-upload {
    padding: 0 12px;
  }

  .upload-form,
  .post,
  .edit-form,
  .admin-drawing {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(28px, 9vw, 42px);
  }

  .post-image-wrap {
    min-height: 280px;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions button {
    flex: 1;
  }
}
