.reader-page {
  --reader-panel: #FFFBF3;
  --reader-sheet: #FFFDF8;
  --reader-glow: rgb(244 186 112 / .35);
  --reader-input-edge: color-mix(in srgb, var(--ink) 32%, var(--line));
  background: radial-gradient(ellipse min(76vw, 940px) 610px at 83% 30%, var(--reader-glow), transparent), var(--paper);
}

[data-theme="dark"] .reader-page {
  --reader-panel: #151F31;
  --reader-sheet: #1B2940;
  --reader-glow: rgb(176 116 62 / .29);
}

.reader-page .site-nav a,
.reader-page .site-theme span {
  min-height: 44px;
}

.reader-page .site-nav a {
  display: inline-flex;
  align-items: center;
}

.reader-intro {
  padding-block: clamp(36px, 5.2vw, 76px) clamp(26px, 3.9vw, 51px);
}

.reader-intro h1 {
  max-width: 20ch;
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: .99;
  font-weight: 690;
  text-wrap: balance;
}

.reader-intro > p:not(.reader-eyebrow) {
  max-width: 51ch;
  margin-top: 16px;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1.65vw, 1.25rem);
  text-wrap: pretty;
}

.reader-eyebrow {
  margin-bottom: 10px;
  color: var(--link);
  font-size: .9375rem;
  font-weight: 720;
}

.reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  align-items: start;
  gap: clamp(20px, 3vw, 42px);
}

.reader-input,
.reader-results {
  min-width: 0;
  padding: clamp(19px, 3.2vw, 38px);
  border: 1px solid var(--line);
}

.reader-input {
  background: var(--reader-panel);
  border-radius: 22px;
}

.reader-results {
  background: var(--reader-sheet);
  border-radius: 14px 14px 22px 22px;
  border-top: 3px solid var(--red);
}

.reader-layout h2,
.reader-dish :is(h3, dt) {
  font-weight: 700;
  letter-spacing: -.036em;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.reader-layout h2 { font-size: clamp(1.45rem, 2.45vw, 2rem); }
.reader-dish :is(h3, dt) { font-size: clamp(1.125rem, 2vw, 1.35rem); }
.reader-layout :is(h2, h3) + p { margin-top: 8px; }
.reader-layout :is(p, dd, dt) { overflow-wrap: anywhere; }

.reader-controls {
  display: grid;
  min-width: 0;
  gap: 12px;
  margin-top: 20px;
}

.reader-layout label {
  display: block;
  margin-bottom: 5px;
  font-weight: 650;
  font-size: .9375rem;
}

.reader-file,
.reader-text {
  min-width: 0;
}

.reader-text {
  margin-top: 21px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.reader-file-control,
.reader-page textarea,
.reader-page select {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--reader-input-edge);
  border-radius: 11px;
  background: var(--reader-sheet);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.reader-file-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 4px;
}

.reader-file-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.reader-file-action {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 44px;
  padding-inline: 12px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 700;
}

.reader-file-name {
  overflow: hidden;
  color: var(--muted);
  font-size: .875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-page textarea {
  min-height: 142px;
  padding: 10px 12px;
  resize: vertical;
}

.reader-page textarea::placeholder { color: var(--muted); opacity: 1; }

.reader-page select {
  min-height: 44px;
  max-width: 16rem;
  appearance: none;
  padding: 8px 36px 8px 12px;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) right 17px center / 5px 5px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) right 12px center / 5px 5px no-repeat,
    var(--reader-sheet);
}

.reader-file-control:has(input:focus-visible),
.reader-page :is(textarea, select):focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.reader-photo {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--reader-sheet);
}

img.reader-photo,
.reader-photo img {
  width: 100%;
  max-height: 288px;
  object-fit: contain;
}

.reader-photo figcaption { margin-top: 8px; color: var(--muted); font-size: .875rem; }
.reader-controls > .button { justify-self: start; }

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 17px;
}

.reader-actions :is(a, button) { min-height: 44px; }

.reader-progress {
  width: 100%;
  min-height: 8px;
  accent-color: var(--red);
}

.reader-status,
.reader-disclosure,
#reader-photo-hint,
#reader-text-hint {
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.reader-status:not(:empty) { margin-top: 10px; }
.reader-status:is([data-state="error"], [role="alert"]) { color: var(--link); font-weight: 650; }
.reader-disclosure { margin-top: 16px; }
.reader-layout + .reader-disclosure { margin-bottom: clamp(41px, 6vw, 72px); }
#reader-text-hint { margin-top: 7px; }

.reader-results-placeholder {
  min-height: clamp(105px, 15vw, 175px);
  margin-top: 20px;
  padding: 17px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-wrap: pretty;
}

.reader-results :is(ul, ol) {
  padding: 0;
  margin: 15px 0 0;
  list-style-type: none;
}

.reader-results dl { margin-bottom: 0; }

.reader-dish {
  padding-block: 15px;
  border-top: 1px solid var(--line);
}

.reader-dish :is(p, dd) { line-height: 1.45; }
.reader-dish > :is(p, dd) { margin: 5px 0 0; }
.reader-dish :is(small, dd) { color: var(--muted); }

.reader-page .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
}

.reader-page :is(.reader-controls, .reader-input, .reader-file, .reader-photo, .reader-text, .reader-actions, .reader-progress, .reader-results, .reader-results-placeholder, .reader-disclosure, .reader-status)[hidden] {
  display: none;
}

@media (max-width: 740px) {
  .reader-layout { grid-template-columns: minmax(0, 1fr); }
  .reader-intro h1 { font-size: clamp(2.4rem, 8vw, 4rem); }
  .reader-results-placeholder { min-height: 0; }
}

@media (max-width: 410px) {
  .reader-layout .reader-actions { align-items: stretch; }
  .reader-actions .button-primary { flex-basis: 100%; }
}

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

@media (forced-colors: active) {
  .reader-page select { appearance: auto; background: Canvas; }
  .reader-file-control:has(input:focus-visible),
  .reader-page :is(textarea, select):focus-visible { outline-color: Highlight; }
}
