@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/atkinson-regular.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/atkinson-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/atkinson-bold.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 500 650;
  font-display: swap;
  src: url("/fonts/newsreader.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #f3efe6;
  --ink: #221e19;
  --muted: #4e463e;
  --line: #d9d0c3;
  --green: #0e5a3c;
  --warn: #8d2b1f;
  --field: #cbbfae;
  --card: #fffdf8;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", "Avenir Next", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.45;
}

body.admin { padding-bottom: 6.5rem; }

.admin input,
.admin textarea {
  scroll-margin-bottom: 9rem;
}

.wrap {
  width: min(1040px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

body.admin .wrap { width: min(760px, calc(100% - 2rem)); }

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  background: var(--card);
  color: var(--ink);
  padding: 0.4rem 0.6rem;
}

.skip:focus { top: 0.75rem; }

h1, h2, .now, .was, .phone {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
}

h1 {
  margin: 0 0 0.55rem;
  font-size: clamp(2.7rem, 7vw, 4.6rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 1.9rem);
  line-height: 1.15;
  text-wrap: balance;
}

p { text-wrap: pretty; }

a {
  color: inherit;
  text-underline-offset: 0.16em;
}

.tools {
  margin: 0 0 0.75rem;
  text-align: right;
}

.tools a { color: var(--muted); }

.lede {
  max-width: 38rem;
  margin: 0;
  font-size: 1.125rem;
}

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

.photo {
  display: block;
  background: #e7e0d4;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
}

.lines { min-width: 0; }

.line + .line {
  margin-top: 0.95rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
}

.line { scroll-margin-top: 1rem; }

.line-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem 1.25rem;
}

.line-head h2 { flex: 1 1 12rem; }

.price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin: 0 0 0 auto;
}

.now {
  font-weight: 600;
  font-size: clamp(1.55rem, 2.4vw, 1.9rem);
  color: var(--green);
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}

.was {
  order: -1;
  color: var(--muted);
  font-size: 1.05rem;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  white-space: nowrap;
}

.unset {
  color: var(--muted);
  font-style: italic;
  font-size: 1.05rem;
  white-space: nowrap;
}

.note, .hint, .preview, figcaption {
  color: var(--muted);
  margin: 0.4rem 0 0;
}

.refs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
}

.refs a {
  color: var(--green);
  overflow-wrap: anywhere;
}

.contact {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 0.7rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: rgba(243, 239, 230, 0.96);
  border-top: 1px solid var(--ink);
  text-align: center;
}

body:not(.admin) .wrap { padding-bottom: calc(11rem + env(safe-area-inset-bottom)); }

.line, .block { scroll-margin-bottom: calc(11rem + env(safe-area-inset-bottom)); }

.contact-label {
  margin: 0 0 0.2rem;
}

.phone {
  display: block;
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-decoration: none;
  overflow-wrap: anywhere;
}

a.phone:hover, a.phone:focus-visible { text-decoration: underline; }

.phone.missing {
  font-family: "Atkinson Hyperlegible", "Avenir Next", sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

#photo-dialog {
  width: min(1100px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  margin: auto;
  padding: 0;
  border: 0;
  background: #221e19;
}

#photo-dialog[open] {
  display: flex;
  flex-direction: column;
}

#photo-dialog::backdrop { background: rgba(28, 24, 20, 0.84); }

#photo-dialog img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 5rem);
  object-fit: contain;
  background: #221e19;
}

#photo-dialog form {
  display: flex;
  justify-content: flex-end;
  padding: 0.45rem;
}

#photo-dialog button {
  background: transparent;
  color: var(--paper);
  border-color: var(--paper);
  font-weight: 400;
}

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

button {
  min-height: 44px;
  padding: 0.55rem 0.95rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--ink);
  font-weight: 400;
}

button:hover { background: #3a332c; }
button.secondary:hover { background: #e7e0d4; }
button:disabled { opacity: 0.55; cursor: wait; }

input, textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  background: var(--card);
  border: 1px solid var(--field);
  border-radius: 4px;
}

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

input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--warn); }

.field, .stack { display: grid; gap: 0.35rem; }

.stack { gap: 0.9rem; }

.field span { font-size: 0.98rem; }

#login, #editor .lede { margin-bottom: 1rem; }

.page-copy {
  display: grid;
  gap: 0.9rem;
  margin: 0 0 1.15rem;
}

#login { display: grid; justify-items: start; gap: 0.8rem; max-width: 24rem; }

#login .field { width: 100%; }

.editor-group {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 1rem 1.25rem;
  padding: 1.3rem 0;
  border-top: 1px solid var(--line);
}

.editor-group figure { margin: 0; }

.photo-picker,
.file-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
}

.photo-picker {
  width: 100%;
  min-height: 8rem;
  border-style: dashed;
}

.photo-picker[data-invalid="true"],
.file-button[data-invalid="true"] { border-color: var(--warn); }

.file-button { width: 100%; margin-top: 0.45rem; }

.photo-picker:focus-within,
.file-button:focus-within {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.group-actions { display: flex; }

.group-actions button,
.item .remove-item { width: 100%; }

.add-item-row {
  display: grid;
  justify-items: start;
  gap: 0.35rem;
  margin: 0.4rem 0 1.2rem;
}

.editor-group img {
  display: block;
  width: 100%;
  height: auto;
  background: #e7e0d4;
}

.item.is-hidden { opacity: 0.62; }

.price-row {
  display: flex;
  align-items: end;
  gap: 0.5rem;
}

.price-row .field { flex: 1; }

.links { display: grid; gap: 0.35rem; }

.links-label {
  margin: 0.15rem 0 0;
  font-size: 0.98rem;
}

.link-rows { display: grid; gap: 0.55rem; }

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) auto;
  gap: 0.45rem;
  align-items: end;
}

.links > .hint { margin: 0; }

.check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.check input { width: 1.2rem; height: 1.2rem; min-height: 0; }

.preview { min-height: 1.45em; }

.error { color: var(--warn); }

.savebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  background: rgba(243, 239, 230, 0.96);
  border-top: 1px solid var(--ink);
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
}

.savebar-inner {
  width: min(760px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#status { margin: 0; flex: 1; }

:focus { outline: none; }

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

::selection { background: #d5eadc; }

@media (min-width: 760px) {
  .block {
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
    align-items: start;
  }
}

@media (max-width: 640px) {
  .editor-group { grid-template-columns: 1fr; }

  .editor-group img {
    max-height: 280px;
    object-fit: contain;
  }

  .price-row { align-items: stretch; flex-direction: column; }
  .price-row button { width: 100%; }
  .link-row { grid-template-columns: 1fr; }
  .link-row button { width: 100%; }
  .savebar-inner { flex-wrap: wrap; }
  #status:not(:empty) { flex-basis: 100%; order: -1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  .tools, .skip, #photo-dialog, .savebar { display: none !important; }
  .contact { position: static; border-top: 1px solid #000; background: #fff; padding: 1rem 0 0; }
  body, body.admin { background: #fff; padding: 0; }
  .wrap { width: auto; }
  a { text-decoration: none; }
  .block, .editor-group { break-inside: avoid; }
}
