@font-face {
  font-family: "Thmanyah Sans";
  src: url("assets/fonts/thmanyahsans-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Sans";
  src: url("assets/fonts/thmanyahsans-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Sans";
  src: url("assets/fonts/thmanyahsans-Medium.otf") format("opentype");
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Sans";
  src: url("assets/fonts/thmanyahsans-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Sans";
  src: url("assets/fonts/thmanyahsans-Black.otf") format("opentype");
  font-weight: 800 900;
  font-style: normal;
  font-display: swap;
}

html,
body,
button,
input,
select,
textarea {
  font-family: "Thmanyah Sans", Tahoma, Arial, sans-serif;
}

.brand {
  width: 112px;
  height: 46px;
  background: var(--green);
  border-radius: 7px;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.brand img {
  width: 108px;
  height: 54px;
  object-fit: contain;
}

.hero-logo {
  position: absolute;
  width: 90%;
  height: 70%;
  object-fit: contain;
  inset: 15% 5%;
}

.image-stage,
.marked-image {
  aspect-ratio: 4 / 5;
}

.compare {
  aspect-ratio: 4 / 3;
  background: #d9ded8;
}

.compare img {
  object-fit: contain;
}

.compare .after {
  filter: saturate(.94) contrast(1.03);
}

.before-wrap img {
  width: var(--compare-width);
  max-width: none;
  object-position: center;
}

.footer-logo {
  width: 130px;
  height: 64px;
  object-fit: contain;
}

footer {
  padding-block: 20px;
}

@media (max-width: 520px) {
  .brand {
    width: 94px;
    height: 40px;
  }

  .brand img {
    width: 92px;
    height: 46px;
  }
}

/* Brand applications */
.brand {
  width: 124px;
  height: 52px;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero-logo {
  width: 92%;
  height: 74%;
  inset: 13% 4%;
}

h1 {
  line-height: 1.13;
}

/* Markers are attached to the actual objects in the supplied before image. */
.m1 { top: 24%; left: 49%; }
.m2 { top: 52%; left: 55%; }
.m3 { top: 31%; left: 17%; }
.m4 { top: 15%; right: 7%; }
.m5 { top: 36%; right: 9%; bottom: auto; left: auto; }

/* Result-first comparison */
.result-view {
  position: relative;
}

.compare {
  direction: ltr;
}

.compare.final-only .before-wrap,
.compare.final-only .compare-line,
.compare.final-only .before-tag,
.compare.final-only .after-tag,
.compare.final-only input {
  opacity: 0;
  pointer-events: none;
}

.compare-toggle {
  position: absolute;
  left: 16px;
  top: 50%;
  z-index: 8;
  transform: translateY(-50%);
  width: 68px;
  min-height: 82px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 12px;
  background: rgba(6,63,56,.92);
  color: #fff;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 10px 8px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

.compare-toggle[aria-pressed="true"] {
  background: var(--coral);
}

.compare-toggle b {
  font-size: 9px;
}

.compare-icon {
  width: 34px;
  height: 26px;
  display: flex;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 5px;
}

.compare-icon i {
  flex: 1;
  background: var(--cream);
}

.compare-icon i:last-child {
  background: var(--coral);
}

/* Expandable reference library */
.ref-list {
  display: block;
}

.ref-item {
  border-top: 1px solid #43746e;
}

.ref-item:last-child {
  border-bottom: 1px solid #43746e;
}

.ref-item > button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 2px;
  font: 600 13px inherit;
  cursor: pointer;
  text-align: right;
}

.ref-item > button i {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid #5e8883;
  border-radius: 50%;
  font-style: normal;
}

.ref-detail {
  display: none;
  grid-template-columns: 120px 1fr;
  gap: 7px 14px;
  padding: 0 2px 20px;
  color: #c7d8d3;
}

.ref-item.active .ref-detail {
  display: grid;
  animation: fade .25s ease;
}

.ref-detail b {
  color: #fff;
  font-size: 10px;
}

.ref-detail p {
  margin: 0;
  font-size: 10px;
  line-height: 1.8;
}

@media (max-width: 700px) {
  .compare-toggle {
    left: 10px;
    top: auto;
    bottom: 10px;
    transform: none;
  }

  .ref-detail {
    grid-template-columns: 1fr;
  }
}

/* Dark header with the white brand mark. */
.site-header {
  background: rgba(6, 63, 56, .96);
  border-bottom-color: rgba(255, 255, 255, .12);
}

.site-header nav a {
  color: #fff;
}

.site-header .prototype-pill {
  color: #fff;
  border-color: rgba(255, 255, 255, .7);
}

.brand {
  background: transparent;
}

/* Anchor the logo visually at the base of the arch. */
.hero-logo {
  width: 88%;
  height: 46%;
  inset: auto 6% 3%;
  object-position: center bottom;
}

/* Make reference explanations comfortably readable. */
.ref-detail b {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.7;
}

.ref-detail p {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.9;
}

.human-review-note {
  margin-top: 12px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid #e1ddd2;
  border-radius: 9px;
  background: #fffaf1;
}

.human-review-note > span {
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--coral);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.human-review-note p {
  margin: 0;
  font-size: 11px;
  line-height: 1.9;
}

.human-review-note b {
  color: var(--green);
}

/* Keep the workspace footprint stable while stages crossfade. */
@media (min-width: 801px) {
  .app-shell {
    height: 1120px;
  }

  .panel.active {
    display: flex;
    flex-direction: column;
    height: calc(1120px - 92px);
    overflow: auto;
  }

  .panel.active > .action-row:last-child {
    margin-top: auto;
  }
}

.panel.active {
  animation: panelBlend .38s ease both;
}

@keyframes panelBlend {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Restrained text reveal across the page and on every stage change. */
.hero-copy > *,
.workspace-head > *,
.how article > *,
.reference-grid > div > * {
  animation: textReveal .65s cubic-bezier(.2,.7,.2,1) both;
}

.hero-copy > *:nth-child(2),
.workspace-head > *:nth-child(2) { animation-delay: .08s; }
.hero-copy > *:nth-child(3) { animation-delay: .16s; }
.hero-copy > *:nth-child(4) { animation-delay: .24s; }

.panel.active h3,
.panel.active p,
.panel.active .section-number,
.panel.active .score,
.panel.active .issue,
.panel.active .result-cards > div,
.panel.active .action-row button {
  animation: textReveal .42s ease both;
}

.panel.active .issue:nth-child(2),
.panel.active .result-cards > div:nth-child(2) { animation-delay: .05s; }
.panel.active .issue:nth-child(3),
.panel.active .result-cards > div:nth-child(3) { animation-delay: .1s; }
.panel.active .issue:nth-child(4) { animation-delay: .15s; }
.panel.active .issue:nth-child(5) { animation-delay: .2s; }

@keyframes textReveal {
  from { opacity: 0; transform: translateY(10px); filter: blur(3px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Percentage centered inside its ring. */
.score {
  width: 124px;
  height: 124px;
  flex: 0 0 124px;
}

.score svg {
  width: 104px;
  height: 104px;
  right: 10px;
  top: 0;
}

.score strong {
  position: absolute;
  top: 38px;
  right: 0;
  width: 100%;
  margin: 0;
  text-align: center;
  line-height: 1;
}

.score > span {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100%;
  margin: 0;
  text-align: center;
}

/* Linked image markers and finding rows. */
.marker,
.issue {
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}

.marker::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 12;
  bottom: calc(100% + 10px);
  left: 50%;
  width: 190px;
  padding: 9px 11px;
  border-radius: 7px;
  background: rgba(6,63,56,.96);
  color: #fff;
  font: 600 10px/1.7 "Thmanyah Sans", Tahoma, sans-serif;
  text-align: right;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 5px);
  transition: .2s ease;
}

.marker:hover,
.marker:focus-visible,
.marker.is-active {
  transform: scale(1.2);
  box-shadow: 0 0 0 8px rgba(216,75,61,.22), 0 4px 14px rgba(0,0,0,.25);
  outline: none;
}

.marker:hover::after,
.marker:focus-visible::after,
.marker.is-active::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.issue.is-active,
.issue:hover {
  background: #f1f7f4;
  box-shadow: inset -4px 0 0 var(--coral);
  padding-inline: 10px 6px;
}

.issue em.confidence-high {
  color: #12613f;
  background: #dff2e8;
}

.issue em.confidence-medium {
  color: #815d00;
  background: #fff0bd;
}

.issue em.confidence-low {
  color: #9b2f28;
  background: #fde1de;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* Optical centering for the transparent logo artwork in the header. */
.site-header .brand {
  align-self: stretch;
  height: 100%;
  width: 128px;
  display: grid;
  place-items: center;
}

.site-header .brand img {
  width: 118px;
  height: 52px;
  object-fit: contain;
  transform: translateY(-4px);
}

/* All stages occupy the stage-one canvas without inner scrolling. */
@media (min-width: 801px) {
  .panel.active {
    overflow: hidden;
  }
}

/* Compact stage-three composition: image and change summary side by side. */
.result-layout {
  display: grid;
  grid-template-columns: minmax(300px, .9fr) minmax(360px, 1.1fr);
  gap: 34px;
  align-items: start;
  min-height: 0;
}

.result-view {
  width: min(100%, 430px);
  justify-self: center;
}

.result-layout .compare {
  aspect-ratio: 4 / 5;
  background: var(--cream);
}

.result-layout .compare img {
  object-fit: cover;
}

.result-summary {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.result-summary h4 {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 18px;
}

.change-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.change-list li {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.change-list li > span {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #eef3f0;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.change-list b,
.change-list small {
  display: block;
}

.change-list b {
  color: var(--green);
  font-size: 12px;
}

.change-list small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.result-summary .result-cards {
  margin-top: 14px;
}

.result-summary .result-cards div {
  padding: 12px;
}

.result-summary .result-cards span {
  font-size: 20px;
}

.result-summary .human-review-note {
  margin-top: 10px;
  padding: 10px 12px;
}

.result-summary .action-row {
  margin-top: 16px;
  flex-wrap: wrap;
}

.result-summary .action-row .back-btn {
  margin-left: 0;
}

@media (max-width: 800px) {
  .result-layout {
    grid-template-columns: 1fr;
  }

  .result-view {
    width: min(100%, 430px);
  }
}

/* A compact rectangular workspace sized to its real content. */
@media (min-width: 801px) {
  .app-shell {
    height: 900px;
  }

  .panel.active {
    height: calc(900px - 92px);
  }
}

.result-layout {
  gap: 24px;
}

.score strong,
.score strong small {
  font-weight: 900;
}

.score strong {
  font-size: 28px;
}

.score strong small {
  font-size: 15px;
}

.score > span {
  bottom: -7px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

/* Stage three: remove unused track space between summary and image. */
.result-layout {
  grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  gap: 12px;
}

.result-view,
.result-summary {
  justify-self: stretch;
  width: 100%;
}

.result-summary {
  align-items: stretch;
}

.result-summary > *,
.result-summary .result-cards,
.result-summary .action-row {
  width: 100%;
  max-width: none;
}

@media (max-width: 980px) and (min-width: 801px) {
  .result-layout {
    grid-template-columns: minmax(0, 52%) minmax(0, 48%);
  }
}

/* Stage three must use the exact stage-one column geometry. */
.result-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
}

.result-summary {
  justify-self: stretch;
  align-self: start;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.result-summary .result-heading,
.result-summary .result-kicker,
.result-summary h4,
.result-summary .result-cards,
.result-summary .action-row {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 800px) {
  .result-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .result-summary,
  .result-summary .result-heading,
  .result-summary .result-kicker,
  .result-summary h4,
  .result-summary .result-cards,
  .result-summary .action-row {
    min-width: 0;
  }
}

/* Thmanyah Serif Display — primary typeface */
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("assets/fonts/thmanyahserifdisplay-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("assets/fonts/thmanyahserifdisplay-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("assets/fonts/thmanyahserifdisplay-Medium.otf") format("opentype");
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("assets/fonts/thmanyahserifdisplay-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("assets/fonts/thmanyahserifdisplay-Black.otf") format("opentype");
  font-weight: 800 900;
  font-style: normal;
  font-display: swap;
}

html,
body,
button,
input,
select,
textarea,
.marker::after {
  font-family: "Thmanyah Serif Display", Tahoma, Arial, sans-serif;
}

/* Prominent stage labels above each panel title. */
.panel .section-number {
  display: block;
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.result-kicker {
  display: block;
  color: var(--coral);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
  margin-bottom: 8px;
}

.result-summary h4 {
  font-size: 31px;
  line-height: 1.25;
}

/* Analysis markers: green by default, amber for medium confidence. */
.marker {
  background: var(--green);
}

.marker[data-issue="3"] {
  background: #d8a51d;
}

.marker:hover,
.marker:focus-visible,
.marker.is-active {
  box-shadow: 0 0 0 8px rgba(6,63,56,.2), 0 4px 14px rgba(0,0,0,.25);
}

.marker[data-issue="3"]:hover,
.marker[data-issue="3"]:focus-visible,
.marker[data-issue="3"].is-active {
  box-shadow: 0 0 0 8px rgba(216,165,29,.24), 0 4px 14px rgba(0,0,0,.25);
}

/* Before layer is anchored left so the divider reveals after right-to-left. */
.before-wrap {
  inset: 0 auto 0 0;
}

.before-wrap img {
  right: auto;
  left: 0;
}

/* Translucent green manual comparison slider. */
.compare input[type="range"] {
  opacity: .72;
}

.compare input[type="range"]:hover,
.compare input[type="range"]:focus-visible,
.compare input[type="range"]:active {
  opacity: 1;
}

.compare input[type="range"]::-webkit-slider-runnable-track {
  background: rgba(6,63,56,.48);
  border: 1px solid rgba(255,255,255,.72);
}

.compare input[type="range"]::-webkit-slider-thumb {
  background: var(--green);
}

.compare input[type="range"]::-moz-range-track {
  background: rgba(6,63,56,.48);
  border: 1px solid rgba(255,255,255,.72);
}

.compare input[type="range"]::-moz-range-thumb {
  background: var(--green);
}

/* Treat the whole comparison as a control, never as draggable media. */
.compare {
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.compare img,
.compare .before-wrap {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.compare input[type="range"] {
  pointer-events: auto;
  touch-action: none;
}

/* One invariant two-column workspace across all three stages. */
.upload-grid,
.analysis-grid,
.result-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
  align-items: start;
}

.preview-card,
.marked-image,
.result-view {
  width: 100%;
  max-width: none;
  justify-self: stretch;
}

.image-stage,
.marked-image,
.result-layout .compare {
  aspect-ratio: 4 / 5;
}

.analysis-side,
.result-summary {
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.analysis-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
  margin-bottom: 18px;
}

.analysis-heading .score {
  margin-top: 5px;
}

.analysis-side .issues {
  flex: 0 0 auto;
}

.analysis-side .action-row,
.result-summary .action-row {
  margin-top: auto;
}

.result-heading {
  position: relative;
  padding-bottom: 22px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.result-heading .success-badge {
  display: inline-block;
  margin-top: 12px;
}

.result-summary .result-kicker {
  margin-top: 0;
}

@media (max-width: 800px) {
  .upload-grid,
  .analysis-grid,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .analysis-heading {
    grid-template-columns: 1fr;
  }
}

/* Final-stage emphasis: large comparison, minimal summary. */
.result-layout {
  grid-template-columns: minmax(470px, 1.55fr) minmax(230px, .45fr);
  gap: 26px;
  align-items: center;
}

.result-view {
  width: min(100%, 560px);
}

.result-layout .compare {
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  box-shadow: 0 14px 38px rgba(4,47,42,.12);
}

.result-summary {
  justify-content: center;
}

.result-summary h4 {
  margin-top: 7px;
  font-size: 24px;
}

.result-summary .result-cards {
  grid-template-columns: 1fr;
  gap: 9px;
}

.result-summary .result-cards div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
}

.result-summary .result-cards p {
  font-size: 10px;
}

.result-summary .result-cards span {
  font-size: 24px;
}

.result-summary .action-row {
  display: grid;
  grid-template-columns: 1fr;
}

.result-summary .action-row button {
  width: 100%;
}

.compare-toggle {
  display: none;
}

/* Visible bottom comparison control. */
.compare input[type="range"] {
  inset: auto 24px 18px;
  width: calc(100% - 48px);
  height: 24px;
  opacity: 1;
  pointer-events: auto;
  z-index: 10;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: ew-resize;
}

.compare input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(216,75,61,.95), rgba(255,255,255,.95));
  box-shadow: 0 1px 5px rgba(0,0,0,.24);
}

.compare input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  appearance: none;
  -webkit-appearance: none;
}

.compare input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(216,75,61,.95), rgba(255,255,255,.95));
}

.compare input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
}

@media (max-width: 800px) {
  .result-layout {
    grid-template-columns: 1fr;
  }

  .result-summary .result-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}
