
:root {
  --ink: #1a1a1a;
  --muted: #8a8a8a;
  --line: #e6e6e6;
  --bg: #ffffff;
  --gap: 28px;
  --gap-y: 72px;
  --col: 300px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ---- masthead ---- */
.masthead {
  text-align: center;
  padding: 8vh 24px 6vh;
}
.masthead h1 {
  font-weight: 700;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: 0.02em;
  margin: 0;
}
.masthead p {
  color: var(--muted);
  font-weight: 400;
  margin: 12px 0 0;
  font-size: clamp(16px, 2.4vw, 22px);
}

/* ---- masonry grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--col), 1fr));
  grid-auto-rows: 4px;
  align-items: start;
  column-gap: var(--gap);
  row-gap: var(--gap-y);
  padding: 0 var(--gap) 12vh;
  max-width: 1600px;
  margin: 0 auto;
}
.item { grid-row-end: span 60; } /* replaced by JS from aspect ratio */
.item a { text-decoration: none; display: block; }
.frame {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.7s ease;
}
.frame img.loaded { opacity: 1; }
.frame.matted { padding: 20%; }
.caption {
  padding: 10px 2px 0;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}
.caption .t { color: var(--ink); }
.sold-dot {
  color: var(--muted);
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 12px;
}
.site-footer {
  text-align: center;
  padding: 6vh 24px 8vh;
  font-size: 15px;
}
.site-footer a { color: var(--ink); text-decoration: underline; font-weight: 500; }

/* ---- detail ---- */
.detail { max-width: 1100px; margin: 0 auto; padding: 6vh var(--gap) 12vh; }
.back { color: var(--muted); text-decoration: none; font-size: 14px; }
.detail .photos { margin: 4vh 0; display: grid; gap: var(--gap); }
.detail .photos img { width: 100%; height: auto; display: block; }
.detail h2 { font-weight: 400; font-size: clamp(24px, 4vw, 34px); margin: 0 0 4px; }
.meta { color: var(--muted); margin: 0; }
.meta .sold { font-variant: small-caps; letter-spacing: 0.08em; }
.desc { margin-top: 3vh; max-width: 60ch; white-space: pre-wrap; }

/* ---- admin ---- */
body.admin {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 32px 48px 100px;
  background: #fbfbfb;
  font-size: 17px;
}
.admin nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 32px;
}
.admin nav a { text-decoration: none; color: var(--muted); margin-left: 20px; font-size: 17px; }
.admin h1 { font-weight: 500; font-size: 28px; margin: 0; }
.admin table { width: 100%; border-collapse: collapse; }
.admin th, .admin td { text-align: left; padding: 16px 14px; border-bottom: 1px solid var(--line); font-size: 17px; }
.admin th { color: var(--muted); font-weight: 500; }
.admin th:first-child, .admin td:first-child { width: 72px; padding-right: 0; }
.admin th:nth-child(2), .admin td:nth-child(2) { width: 64px; padding-left: 24px; }
.admin th:last-child, .admin td:last-child { text-align: right; }
@media (hover: hover) {
  .admin tbody tr:hover { background: #f7f7f7; }
}
.thumb {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: #eee;
}
.thumb-empty { display: block; width: 64px; height: 64px; border-radius: 6px; background: #eee; }
.admin tr.sold td { color: var(--muted); }
.badge { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.badge.sold { color: #b23; }

.field { margin-bottom: 22px; }
.field label { display: block; font-size: 16px; font-weight: 500; color: #5f5f5f; margin-bottom: 6px; }
.field input[type=text], .field input[type=number], .field textarea, .field select {
  width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 17px; background: #fff;
}
.field textarea { min-height: 110px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 22px; height: 22px; }

button, .btn {
  font: inherit; font-size: 17px; padding: 14px 22px; border: 1px solid var(--ink); border-radius: 8px;
  background: var(--ink); color: #fff; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn.ghost { background: #fff; color: var(--ink); }
.btn.big { width: 100%; text-align: center; padding: 20px; font-size: 20px; }
.btn.small { padding: 8px 16px; font-size: 15px; border-radius: 6px; }
.fieldset-admin { border-top: 1px dashed var(--line); margin-top: 32px; padding-top: 20px; }
.fieldset-admin legend { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; }
.login {
  max-width: 520px;
  margin: 10vh auto;
  padding: 0 24px;
}
.login h1 { font-size: clamp(22px, 5vw, 28px); margin-bottom: 28px; }
.login .field label { font-size: 19px; margin-bottom: 10px; }
.login .field input[type=password] {
  font-size: 25px;
  padding: 18px 16px;
  border-radius: 10px;
  min-height: 62px;
}
.login button[type=submit] {
  width: 100%;
  font-size: 23px;
  padding: 18px;
  border-radius: 10px;
  min-height: 62px;
  margin-top: 12px;
}
.err { color: #b23; font-size: 17px; margin-top: 14px; }
@media (max-width: 520px) {
  body.admin { padding: 20px 16px 70px; }
  .login { margin: 6vh auto; padding: 0; max-width: 100%; }
}
.photo-strip { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 20px; }
.photo-strip img { height: 96px; width: auto; border: 1px solid var(--line); border-radius: 6px; }
