/* Gallery wall: warm paper ground, ink text, one vermilion accent. Each picture sits whole on a square mat. */
:root {
  --paper: #f6f2ea; --ink: #1d1b18; --soft: #6a6359; --line: #e2dacb; --mat: #fffdf8; --accent: #b83a22; --note: #fff3c9;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #171614; --ink: #ece7dd; --soft: #a59d90; --line: #35312b; --mat: #211f1c; --accent: #f08a6f; --note: #3b3212; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1.0625rem/1.6 var(--sans); }
#app { max-width: 1240px; margin: 0 auto; padding: 0 clamp(14px, 4vw, 40px); }
img { max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 10px 16px; z-index: 10; }
.skip:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

.preview-note { margin: 12px 0 0; padding: 8px 14px; background: var(--note); border: 1px solid var(--line); border-radius: 6px; font-size: 0.9rem; }

/* Masthead */
.masthead { padding: clamp(36px, 9vw, 96px) 0 clamp(20px, 4vw, 36px); max-width: 46rem; }
.eyebrow { margin: 0 0 6px; font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--soft); }
.masthead h1 { margin: 0; font: 500 clamp(2.4rem, 8vw, 4.6rem)/1.02 var(--serif); letter-spacing: -0.015em; }
.intro { margin-top: 18px; font-size: 1.1rem; color: var(--ink); }
.intro p { margin: 0 0 0.7em; }
.sections { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.sections a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 1px solid var(--ink); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.sections a:hover { background: var(--ink); color: var(--paper); }
.count { font-weight: 400; color: var(--soft); }
.sections a:hover .count { color: inherit; }

/* Order switch */
.order { display: inline-flex; margin: 8px 0 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.order button { min-height: 44px; padding: 8px 14px; border: 0; background: transparent; color: var(--soft); font: inherit; font-size: 0.9rem; cursor: pointer; }
.order button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.order button:focus-visible { outline-offset: -3px; }

/* Sections and the wall */
main section { padding-top: clamp(28px, 6vw, 56px); scroll-margin-top: 8px; }
main h2 { margin: 0 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font: 500 clamp(1.5rem, 4vw, 2rem)/1.2 var(--serif); }
.wall { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 3vw, 34px); }
@media (min-width: 700px) { .wall { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .wall { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.frame { display: block; text-decoration: none; }
.mat { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; padding: 9%; background: var(--mat); border: 1px solid var(--line); border-radius: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 24px -18px rgba(0, 0, 0, 0.35); transition: transform 0.18s ease, box-shadow 0.18s ease; }
.mat img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.frame:hover .mat, .frame:focus-visible .mat { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 18px 30px -18px rgba(0, 0, 0, 0.45); }
.cap { display: block; padding: 10px 2px 0; }
.cap-title { display: block; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.cap-date { display: block; font-size: 0.85rem; color: var(--soft); }
.empty { color: var(--soft); }

/* Artwork page */
.topbar { padding: 14px 0; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; text-decoration: none; font-weight: 600; }
.art { margin: 0; }
.art-img { display: flex; justify-content: center; background: var(--mat); border: 1px solid var(--line); border-radius: 3px; padding: clamp(10px, 3vw, 36px); }
.art-img img { display: block; max-width: 100%; max-height: 82vh; width: auto; height: auto; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); }
.art figcaption { margin-top: 8px; font-size: 0.85rem; color: var(--soft); }
.art-text { max-width: 40rem; padding-top: 14px; }
.art-text h1 { margin: 0; font: 500 clamp(1.8rem, 6vw, 3rem)/1.1 var(--serif); overflow-wrap: anywhere; }
.art-meta { margin: 6px 0 14px; color: var(--soft); }
.art-desc p { margin: 0 0 0.8em; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.pager a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.pager a[rel="next"] { text-align: right; margin-left: auto; }

.foot { margin-top: clamp(40px, 8vw, 80px); padding: 20px 0 40px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--soft); }
.foot p { margin: 0 0 4px; }

/* ---------- Studio and Manage (the two tool pages) ---------- */
.tool { max-width: 44rem; margin: 0 auto; padding: 0 clamp(14px, 4vw, 32px) 60px; }
.tool header { padding: 28px 0 8px; }
.tool h1 { margin: 0; font: 500 clamp(1.9rem, 6vw, 2.8rem)/1.1 var(--serif); }
.tool h2 { margin: 0 0 12px; font: 500 1.4rem/1.2 var(--serif); }
.tool .card { margin-top: 22px; padding: clamp(14px, 4vw, 24px); background: var(--mat); border: 1px solid var(--line); border-radius: 10px; }
.tool label, .tool legend { display: block; font-weight: 600; margin: 16px 0 6px; padding: 0; }
.tool .hint { display: block; font-weight: 400; font-size: 0.88rem; color: var(--soft); }
.tool input[type="text"], .tool input[type="password"], .tool textarea, .tool select { width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--soft); border-radius: 8px; }
.tool textarea { min-height: 96px; resize: vertical; }
.tool fieldset { border: 0; margin: 16px 0 0; padding: 0; min-width: 0; }
.tool fieldset legend { margin-top: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; font: inherit; font-weight: 600; color: var(--ink); background: transparent; border: 1.5px solid var(--ink); border-radius: 999px; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.danger { border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.small { min-height: 44px; padding: 6px 14px; font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.filebtn { position: relative; }
.filebtn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.filebtn:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices label { display: flex; align-items: center; gap: 10px; margin: 0; min-height: 56px; padding: 10px 14px; border: 1.5px solid var(--soft); border-radius: 10px; cursor: pointer; }
.choices label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.choices input, .checks input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.checks { list-style: none; margin: 8px 0 0; padding: 0; }
.checks label { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; margin: 0; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.pic { margin-top: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px; text-align: center; overflow: auto; max-height: 75vh; }
.pic img { display: block; margin: 0 auto; max-width: 100%; max-height: 60vh; width: auto; height: auto; cursor: zoom-in; }
.pic.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
.status { margin: 14px 0 0; padding: 10px 14px; border-radius: 8px; background: var(--note); border: 1px solid var(--line); }
.status:empty { display: none; }
.status.bad { border-color: var(--accent); }
.tips { margin: 0; padding-left: 1.2em; }
.tips li { margin: 4px 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list li:first-child { border-top: 0; }
.list img { width: 64px; height: 64px; object-fit: contain; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; flex: none; }
.list .what { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.list .what small { display: block; color: var(--soft); }
.list .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tool details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.tool code { font-size: 0.9em; background: var(--paper); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); overflow-wrap: anywhere; }
[hidden] { display: none !important; }
