:root {
  color-scheme: dark;
  --paper: #111316;
  --surface: #1b1e22;
  --ink: #f5f1ea;
  --muted: #b8b6b1;
  --line: #34373b;
  --action: #e8c887;
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {box-sizing: border-box}
body {margin: 0}
a {color: inherit}
button, input {font: inherit}
:focus-visible {outline: 2px solid #eac783; outline-offset: 3px}
.site-head {
  max-width: 1200px;
  margin: auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-head {min-height: 72px; border-bottom: 1px solid var(--line)}
.brand {display: inline-flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none}
.brand img {display: block; border-radius: 50%; background: #222}
.text-link {color: var(--action); text-underline-offset: 3px; font-size: .875rem}
button.text-link {border: 0; padding: 0; background: none; text-decoration: underline; cursor: pointer; min-height: 44px}
main {width: min(100% - 48px, 650px); margin: 64px auto 48px}
main.has-result {width: min(100% - 48px, 1080px); margin-top: 35px}
h1 {font-size: 3rem; line-height: 1.05; letter-spacing: -.045em; margin: 0 0 14px}
h2 {font-size: 1.125rem; margin: 0}
.intro {margin-bottom: 28px}
.intro p {font-size: 1.05rem; line-height: 1.55; margin: 0; max-width: 42ch; color: var(--muted)}
.upload {
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.upload-picker {display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px}
.upload-picker small, .physical-note, .photo-preview figcaption {color: var(--muted)}
.primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--action);
  color: #211b12;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.primary:hover {background: #f4d89d}
.file-picker {position: relative}
.file-picker input {position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer}
.file-picker:focus-within {outline: 2px solid #eac783; outline-offset: 3px}
.consent {display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: .875rem; line-height: 1.45; cursor: pointer}
.consent input {margin: 2px 0 0; width: 18px; height: 18px; flex: none; accent-color: var(--action)}
.consent a {text-underline-offset: 2px}
.upload-status, .error {font-size: .875rem; line-height: 1.45; margin: 0}
.error {color: #ffb7ac}
.upload[aria-busy="true"] .file-picker {opacity: .65; pointer-events: none}
.photo-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(265px, 330px);
  grid-template-areas: "preview assessment" "preview actions";
  grid-template-rows: auto 1fr;
  gap: 14px 20px;
  margin-bottom: 20px;
}
.assessment, .result-actions {padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface)}
.assessment {grid-area: assessment}
.result-actions {grid-area: actions; align-self: start}
.result-actions .primary {width: 100%}
.verdict {display: inline-block; padding: 7px 10px; font-size: 1rem; font-weight: 700; border-radius: 7px; background: #392d1d; color: #f4d598}
.verdict[data-status="excellent"] {background: #23372b; color: #b4dfbe}
.verdict:is([data-status="bad"], [data-status="fix"]) {background: #3b2427; color: #ffc4be}
.findings {padding-left: 17px; margin: 12px 0 0; font-size: .9rem; line-height: 1.48}
.findings li + li {margin-top: 6px}
.physical-note {font-size: .82rem; line-height: 1.45; margin: 12px 0 0}
.photo-preview {grid-area: preview; margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden}
.photo-preview-frame {display: grid; place-items: center; padding: 12px; background: #0c0e11}
.photo-preview img {display: block; width: auto; height: auto; max-width: 100%; max-height: min(64svh, 660px); object-fit: contain}
.photo-preview figcaption {display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0 10px; min-height: 44px; padding: 0 12px; font-size: .82rem}
@media (max-width: 720px) {
  .site-head {padding-inline: 14px}
  main, main.has-result {width: calc(100% - 24px); margin: 28px auto 30px}
  h1 {font-size: 2.15rem}
  .intro {margin-bottom: 18px}
  .upload {padding: 14px}
  .upload-picker {align-items: stretch; flex-direction: column}
  .photo-result {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "assessment" "preview" "actions";
    gap: 10px;
  }
  .assessment, .result-actions {padding: 13px}
  .photo-preview img {max-height: 46svh}
}

/* The score explains the verdict; the progress line only indicates activity. */
.assessment-heading {display: flex; gap: 12px; align-items: flex-start; justify-content: space-between}
.assessment-label {margin: 0 0 7px; color: var(--muted); font-size: .8rem; font-weight: 600}
.score-number {flex: none; font-size: 2.5rem; line-height: 1; letter-spacing: -.06em; font-variant-numeric: tabular-nums}
.score-number span {font-size: .5em; margin-left: 2px; letter-spacing: normal}
.quality-meter, .upload-track {height: 5px; border-radius: 999px; overflow: hidden; background: #373531}
.quality-meter {margin-top: 14px; color: #e8c887}
.quality-meter[data-status="excellent"] {color: #9dccab}
.quality-meter:is([data-status="fix"], [data-status="bad"]) {color: #f3a5a1}
.quality-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  transform-origin: left;
  transform: scaleX(var(--score));
}
.upload-track {display: none}
.upload[aria-busy="true"] .upload-track {display: block}
.upload-track > span {display: block; width: 38%; height: 100%; background: #e8c887; border-radius: inherit}
.primary {transition: background-color 150ms ease, transform 150ms ease}
.primary:active {transform: scale(.985)}
.result-actions {padding: 0; border: 0; background: transparent}
.physical-note {margin: 0 0 20px}
.preview-error {padding: 0 12px 12px}

@media (max-width: 720px) {
  .photo-result {grid-template-areas: "assessment" "actions" "preview"}
  .score-number {font-size: 2.1rem}
  .assessment-heading .verdict {font-size: .9rem}
}
@media (prefers-reduced-motion: no-preference) {
  .intro, .photo-preview {animation: photo-reveal 310ms ease-out both}
  .quality-meter > span {animation: score-reveal 480ms cubic-bezier(.2,.7,.25,1) both}
  .upload[aria-busy="true"] .upload-track > span {animation: upload-scan 1000ms ease-in-out infinite alternate}
}
@media (prefers-reduced-motion: reduce) {
  .primary {transition: none}
  .primary:active {transform: none}
}
@keyframes photo-reveal {
  from {opacity: .65; transform: translateY(5px)}
  to {opacity: 1; transform: translateY(0)}
}
@keyframes score-reveal {
  from {transform: scaleX(0)}
  to {transform: scaleX(var(--score))}
}
@keyframes upload-scan {
  from {transform: translateX(0)}
  to {transform: translateX(163%)}
}

/* Keep the work area calm and let the engraving example carry the visual weight. */
body {min-height: 100svh; display: flex; flex-direction: column}
.site-head {width: min(100% - 48px, 1200px); padding-inline: 0}
.head-actions > .text-link {border: 1px solid var(--line); border-radius: 9px; padding: 10px 13px; text-decoration: none; color: var(--ink)}
.head-actions > .text-link span {margin-inline-start: 4px; color: var(--action)}
.photo-landing {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(0, 1fr);
  grid-template-areas: "intro art" "upload art";
  grid-template-rows: 1fr 1fr;
  gap: 24px clamp(24px, 5vw, 85px);
  width: min(100% - 48px, 1110px);
  margin-block: clamp(36px, 7vh, 100px);
  align-items: start;
}
.photo-landing .intro {grid-area: intro; margin: 0; align-self: end}
.photo-landing h1 {font-size: clamp(3rem, 5.4vw, 4.9rem); max-width: 10ch; font-weight: 720}
.photo-landing .intro p {margin-top: 20px; max-width: 37ch}
.photo-landing .upload {grid-area: upload; padding: 20px}
.engraving-example {
  grid-area: art;
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  background: #0a0b0d;
  border-radius: 18px;
  overflow: hidden;
}
.engraving-example img {display: block; width: 100%; height: clamp(385px, 61svh, 580px); object-fit: contain}
.engraving-example figcaption {padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem}
.has-result h1 {margin-bottom: 24px}
.has-result .photo-preview, .has-result .assessment {border-radius: 16px}
.has-result .photo-preview-frame {padding: 16px}
.has-result .photo-preview figcaption {padding-inline: 16px}
.has-result .score-number {color: var(--action)}
.has-result > .upload {background: transparent}

@media (max-width: 720px) {
  .site-head {width: calc(100% - 28px)}
  .head-actions > .text-link {padding: 9px; font-size: .75rem}
  .photo-landing {
    width: calc(100% - 28px);
    margin-block: 32px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "intro" "upload" "art";
    gap: 20px;
  }
  .photo-landing h1 {font-size: clamp(2.65rem, 10vw, 3.3rem)}
  .photo-landing .intro p {margin-top: 12px}
  .photo-landing .upload {padding: 14px}
  .engraving-example img {height: 240px}
  .has-result .photo-preview-frame {padding: 8px}
  .has-result h1 {margin-bottom: 16px}
}


/* Light is the default palette; both palettes share layout and motion. */
:root:not([data-theme="dark"]) {
  color-scheme: light;
  --paper: #f4f1ea;
  --surface: #fffcf6;
  --ink: #252521;
  --muted: #57564f;
  --line: #d4cfc3;
  --action: #725224;
}
:root:not([data-theme="dark"]) .primary {background: #dfbf7c; color: #281e10}
:root:not([data-theme="dark"]) .primary:hover {background: #ecce91}
:root:not([data-theme="dark"]) .photo-preview-frame {background: #e7e1d7}
:root:not([data-theme="dark"]) .engraving-example {color-scheme: dark; border-color: #262625}
:root:not([data-theme="dark"]) .engraving-example figcaption {color: #dedbd4; border-color: #373734}
:root:not([data-theme="dark"]) .quality-meter,
:root:not([data-theme="dark"]) .upload-track {background: #e7dfd1; color: #846021}
:root:not([data-theme="dark"]) .quality-meter[data-status="excellent"] {color: #3c6b4c}
:root:not([data-theme="dark"]) .quality-meter:is([data-status="fix"],[data-status="bad"]) {color: #a04b45}
:root:not([data-theme="dark"]) .error {color: #8d282a}
:root:not([data-theme="dark"]) :focus-visible,
:root:not([data-theme="dark"]) .file-picker:focus-within {outline-color: #795720}

.head-actions {display: flex; align-items: center; gap: 8px}
.theme-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle[hidden], .theme-sun, [data-theme="dark"] .theme-moon {display: none}
[data-theme="dark"] .theme-sun {display: inline}
.theme-icon {font-size: 21px; line-height: 1}
.brand-mark {display: grid; place-items: center; position: relative; flex: none}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px solid var(--action);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.primary {position: relative; isolation: isolate; overflow: hidden}
.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 22%, #ffffff48 50%, transparent 78%);
  transform: translateX(-120%);
}
@media (max-width: 420px) {
  .site-head {gap: 8px}
  .brand {gap: 5px; font-size: .82rem}
  .brand img {width: 30px; height: 30px}
  .head-actions > .text-link {padding-inline: 7px; white-space: nowrap}
  .head-actions {gap: 5px}
}
@media (prefers-reduced-motion: no-preference) {
  .brand-mark img {animation: brand-arrive 600ms cubic-bezier(.2,.8,.25,1) both}
  .brand-mark::after {animation: brand-ring 750ms 90ms ease-out both}
  .theme-icon {animation: theme-arrive 210ms ease-out both}
  .primary:is(:hover,:focus-visible,:focus-within)::after {animation: button-light 530ms ease-out both}
}
@keyframes brand-arrive {
  from {transform: rotate(-16deg) scale(.86); opacity: .6}
  to {transform: rotate(0) scale(1); opacity: 1}
}
@keyframes brand-ring {
  0% {transform: scale(.9); opacity: 0}
  35% {opacity: .5}
  100% {transform: scale(1.22); opacity: 0}
}
@keyframes theme-arrive {
  from {transform: rotate(-28deg) scale(.8); opacity: .55}
  to {transform: rotate(0) scale(1); opacity: 1}
}
@keyframes button-light {
  from {transform: translateX(-120%)}
  to {transform: translateX(120%)}
}
