/* Theme tokens mirror design/tokens.json; change both together. */
:root {
  color-scheme: light dark;
  --paper: #ffffff;
  --well: #f2f2f2;
  --ink: #111111;
  --muted: #444444;
  --faint: #888888;
  --link: #0000ee;
  --link-visited: #551a8b;
  --seal: #c4161c;
  --on-seal: #ffffff;
  --highlight: #ffff66;
  --scrim: rgba(0, 0, 0, 0.5);
  --pressed: #444444;
  --font-body: Georgia, "Noto Serif", "Songti SC", "Noto Serif SC", "Noto Serif JP", serif;
  --font-logo: "Times New Roman", Times, serif;
  --font-meta: "Courier New", Courier, monospace;
  --seal-edge: polygon(0% 1.5%, 18% 0%, 47% 1%, 76% 0%, 100% 1.2%, 99% 28%, 100% 61%, 98.8% 100%, 70% 99%, 39% 100%, 12% 98.8%, 0.6% 100%, 0% 72%, 1% 40%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111111;
    --well: #1e1e1e;
    --ink: #eeeeee;
    --muted: #aaaaaa;
    --faint: #666666;
    --link: #8ab4ff;
    --link-visited: #c9a0ff;
    --highlight: #5c5c00;
    --scrim: rgba(0, 0, 0, 0.6);
    --pressed: #bbbbbb;
  }
}

/* Design rule: no rounded corners anywhere, including native controls. */
*,
*::before,
*::after { box-sizing: border-box; border-radius: 0; }

html { background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}

::selection { background: var(--highlight); }

a { color: var(--link); text-underline-offset: 0.18em; }
a:visited { color: var(--link-visited); }

h1, h2 { margin: 0; line-height: 1.3; }
h1 { font-size: 32px; }
p { margin: 0 0 12px; }

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

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.wrap { width: min(100% - 32px, 680px); margin: 0 auto; }
.page { padding-bottom: 24px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.meta { color: var(--muted); font-family: var(--font-meta); font-size: 14px; line-height: 1.5; }

/* Header and footer */
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.brand, .brand:visited { color: var(--ink); text-decoration: none; }

.brand strong {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-logo);
  font-size: 21px;
  line-height: 1;
}

/* The seal: vermilion square, white "me", slightly uneven straight edges like a hand-pressed stamp. */
.brand__seal,
.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  padding-bottom: 0.1em;
  color: var(--on-seal);
  background: var(--seal);
  clip-path: var(--seal-edge);
  font-family: var(--font-logo);
  font-size: 0.66em;
  font-weight: 700;
  line-height: 1;
}

.seal { font-size: 15px; width: 28px; height: 28px; flex: none; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 64px;
  padding: 16px 0 40px;
  color: var(--muted);
  font-size: 15px;
}

.site-footer__langs { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.site-footer form { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 0; }

/* Buttons: one style only. Secondary actions are links. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  color: var(--paper);
  background: var(--ink);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.button:active { background: var(--pressed); }
.button:disabled { color: var(--faint); background: transparent; outline: 1px solid var(--faint); outline-offset: -1px; cursor: default; }
.button--block { width: 100%; }

.link-button {
  min-height: 44px;
  padding: 0;
  border: 0;
  color: var(--link);
  background: none;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* Profile */
.profile-head { margin: 16px 0 40px; }
.profile-head__bio { margin-top: 8px; }

.search { display: flex; gap: 8px; margin: 16px 0 8px; }
.search input { flex: 1; min-width: 0; height: 48px; }

.entry-card { margin-bottom: 48px; }
.entry-card__title { font-size: 24px; }
.entry-card__title a { text-decoration: none; }
.entry-card__title a:hover { text-decoration: underline; }
.entry-card__place, .entry__place { color: var(--muted); font-size: 15px; margin: 2px 0 0; }
.entry-card__facts { margin: 12px 0 0; font-size: 16px; }

.take { white-space: pre-line; margin: 12px 0; }

/* Tapping a time switches between relative and exact; padding grows the touch target without moving layout. */
.time-toggle {
  margin-block: -12px;
  padding: 12px 0;
  border: 0;
  color: inherit;
  background: none;
  font: inherit;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 0.25em;
}

.empty { margin: 32px 0; }
.pager { margin: 32px 0; }

/* Photos: tight 4px gaps, no frames. Lists show up to three; the detail page shows all. */
.photos, .gallery { display: grid; gap: 4px; margin: 14px 0; }
.photo { position: relative; display: block; overflow: hidden; background: var(--well); }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

.photos--one .photo { aspect-ratio: 3 / 2; }
.photos--two { grid-template-columns: 1fr 1fr; }
.photos--two .photo { aspect-ratio: 1; }
.photos--three { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 3 / 2; }
.photos--three .photo:first-child { grid-row: span 2; }

.photo--more span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--scrim);
  font-size: 22px;
  font-weight: 700;
}

.gallery { grid-template-columns: 1fr 1fr; }
.gallery .photo { aspect-ratio: 3 / 2; }
.gallery__hero { grid-column: 1 / -1; }

/* Entry */
.entry__head { margin: 8px 0 16px; }
.entry__head h1 { margin-top: 4px; }
.entry__body { margin-top: 16px; }

.place-box {
  display: flex;
  flex-direction: column;
  margin: 24px 0;
  padding: 12px;
  border: 1px solid var(--ink);
  font-style: normal;
  font-size: 16px;
}

.place-box a { display: inline-flex; align-items: center; min-height: 44px; }

.stamp { display: flex; align-items: center; gap: 10px; margin: 24px 0; }

.owner-tools { display: flex; flex-direction: column; gap: 16px; margin-top: 40px; }
.owner-tools p { margin: 0; }

.confirm summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--link); text-decoration: underline; cursor: pointer; }
.confirm__box { margin-top: 8px; padding: 14px; border: 1px solid var(--ink); }

/* Forms */
.form { margin-top: 24px; }
.field { display: block; margin-bottom: 28px; }
.field > label, .field__label { display: block; margin-bottom: 6px; font-weight: 700; }
.field__sub { display: block; margin: 14px 0 6px; font-size: 15px; font-weight: 700; }
.field__error { margin: 6px 0 0; font-weight: 700; }
.field .meta { margin-bottom: 8px; }

input:not([type="checkbox"]):not([type="file"]), select, textarea {
  width: 100%;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  -webkit-appearance: none;
  appearance: none;
}

input:not([type="checkbox"]):not([type="file"]), select { height: 52px; padding: 0 10px; }
textarea { padding: 10px; line-height: 1.75; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--ink); outline-offset: -2px; }
::placeholder { color: var(--faint); opacity: 1; }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.price { display: flex; gap: 6px; }
.price input { flex: 1; min-width: 0; }
.price select { width: 92px; flex: none; }

details.field summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--link); text-decoration: underline; cursor: pointer; }

.notice { margin: 8px 0 0; padding: 12px; border: 1px solid var(--ink); font-size: 15px; }

.add-photos { display: inline-flex; align-items: center; min-height: 44px; color: var(--link); text-decoration: underline; cursor: pointer; font-weight: 400; }

.photo-previews { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; }
.photo-previews:empty { display: none; }
.photo-preview { position: relative; display: block; aspect-ratio: 1; margin: 0; overflow: hidden; background: var(--well); font-weight: 400; }
.photo-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }

.photo-preview__cover,
.photo-preview__remove {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 0 6px;
  color: #fff;
  background: var(--scrim);
  font-size: 12px;
  line-height: 1.6;
}

.photo-preview__remove { left: auto; right: 0; }

.photo-preview button {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border: 0;
  color: #fff;
  background: var(--scrim);
  font-size: 18px;
  cursor: pointer;
}

.form__actions { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 32px; }
.form__actions .meta { margin: 0; }
.login { max-width: 420px; }

.home-profile { display: flex; flex-direction: column; margin: 24px 0; }
.home-profile a { font-size: 20px; }
.home-profile span { color: var(--muted); }

/* Feedback: a black bar at the bottom, with at most one link. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 10;
  width: min(100% - 32px, 680px);
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 10px 16px;
  color: #fff;
  background: #111;
  font-size: 15px;
  transform: translateX(-50%);
}

.toast[hidden] { display: none; }

/* Lightbox */
.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: #fff;
  background: rgba(0, 0, 0, 0.95);
}

.lightbox::backdrop { background: rgba(0, 0, 0, 0.95); }
.lightbox figure { display: flex; flex-direction: column; justify-content: center; height: 100%; margin: 0; padding: 56px 0 24px; }
.lightbox img { max-width: 100%; max-height: calc(100% - 48px); margin: 0 auto; object-fit: contain; }
.lightbox figcaption { padding: 12px 16px 0; color: #ccc; font-size: 14px; text-align: center; }
.lightbox .link-button { position: absolute; color: #fff; font-size: 32px; text-decoration: none; width: 48px; height: 48px; }
.lightbox__close { top: 4px; right: 8px; }
.lightbox__nav { top: 50%; transform: translateY(-50%); }
.lightbox__nav--prev { left: 0; }
.lightbox__nav--next { right: 0; }
