:root {
  color-scheme: light dark;
  --page: light-dark(#f5f5f5, #191919);
  --surface: light-dark(#ffffff, #242424);
  --ink: light-dark(#202020, #f2f2f2);
  --quiet: light-dark(#565656, #bcbcbc);
  --line: light-dark(#d8d8d8, #535353);
  --accent: light-dark(#484848, #cccccc);
  --button: light-dark(#242424, #dedede);
  --button-ink: light-dark(#ffffff, #222222);
  --button-hover: light-dark(#404040, #f0f0f0);
  --notice: light-dark(#eaeaea, #333333);
  --shadow: 0 1.25rem 3.4rem light-dark(#00000017, #0003);
  font: 100%/1.5 system-ui, -apple-system, sans-serif;
  background: var(--page);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { max-width: 72rem; margin: 0 auto; padding: clamp(1rem, 4vw, 3.75rem); }
main > nav { display: flex; flex-wrap: wrap; gap: .25rem .6rem; color: var(--quiet); font-size: .875rem; }
a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: .25em; }
a:hover { color: var(--accent); }
nav a[aria-current="page"] { font-weight: 750; }
:focus-visible { outline: .18rem solid var(--accent); outline-offset: .17rem; }
::selection { background: var(--ink); color: var(--page); }

.study-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.1rem 2rem;
  margin-block: clamp(1.5rem, 4vw, 3.25rem) 1.45rem;
}

h1, h2, p, figure { margin: 0; }
h1, h2 { text-wrap: balance; }
h1 { font-size: clamp(2.05rem, 5vw, 3.65rem); letter-spacing: -.055em; line-height: 1; font-weight: 790; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.38rem); letter-spacing: -.045em; line-height: 1.13; }
.study-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(4.6rem, 1fr));
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.study-counts > div { border-inline-start: 1px solid var(--line); padding-inline: .8rem; }
.study-counts dt { color: var(--quiet); font-size: .78rem; }
.study-counts dd { margin: 0; font-size: 1.45rem; line-height: 1.15; font-weight: 730; }
.storage-notice { padding: .7rem .9rem; margin: 0 0 1rem; background: var(--notice); color: var(--ink); border-radius: .6rem; }


.study-card, .empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
}

.study-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.13fr);
  align-items: stretch;
  min-height: 25rem;
  overflow: hidden;
}

.product {
  min-width: 0;
  background: light-dark(#eeeeee, #313131);
  border-inline-end: 1px solid var(--line);
  padding: clamp(.85rem, 2.5vw, 1.7rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .75rem;
}

.study-photos {
  display: grid;
  grid-template-columns: repeat(var(--photo-columns, 1), minmax(0, 1fr));
  align-items: center;
  gap: clamp(.25rem, 1.2vw, .75rem);
}

.product-figure {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 5 / 4;
  container-type: size;
}

.photo-filters { position: absolute; overflow: hidden; }
.product-crop { width: 100%; height: 100%; }
.product-crop.has-frame {
  position: relative;
  width: min(92cqw, calc(92cqh * var(--crop-aspect)));
  height: auto;
  aspect-ratio: var(--crop-aspect);
  overflow: hidden;
}
.product-figure img { display: block; width: 100%; height: 100%; object-fit: contain; }
.product-crop.has-frame img {
  position: absolute;
  width: var(--image-width);
  height: auto;
  left: var(--image-left);
  top: var(--image-top);
}
.product-crop[data-matte="grey"] img { filter: url("#footwear-matte-grey"); }
.product-crop[data-matte="white"] img { filter: url("#footwear-matte-white"); }
.product-figure img:not([src]) { visibility: hidden; }
.product-name { font-size: clamp(1.04rem, 2vw, 1.24rem); font-weight: 720; line-height: 1.28; text-wrap: pretty; }

.question-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
  padding: clamp(1.1rem, 4vw, 2.65rem);
}

.answer-entry { display: grid; gap: .6rem; }
input, button { font: inherit; }
input {
  width: 100%;
  min-height: 3rem;
  padding: .65rem .85rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  color: var(--ink);
  background: var(--page);
}

input::placeholder { color: var(--quiet); opacity: 1; }
button {
  min-height: 2.8rem;
  font-weight: 670;
  border: 1px solid transparent;
  border-radius: .6rem;
  cursor: pointer;
  padding: .65rem .85rem;
}

button:disabled { cursor: default; }
.primary-button { color: var(--button-ink); background: var(--button); }
.primary-button:hover:not(:disabled) { background: var(--button-hover); }
.secondary-button { color: var(--quiet); background: transparent; border-color: var(--line); margin-top: .6rem; }
.secondary-button:hover:not(:disabled) { color: var(--ink); border-color: var(--accent); }

.choices {
  display: grid;
  gap: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.25rem), 1fr));
}

.choices button {
  color: var(--ink);
  border-color: var(--line);
  background: var(--page);
  min-width: 0;
}

.choices button:hover:not(:disabled) { border-color: var(--accent); }
.choices button:disabled { opacity: .65; }
.choices button[aria-pressed="true"], .choices button.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  opacity: 1;
}
.choices button[data-result] { opacity: 1; }
.choices button[data-result="correct"] { text-decoration: underline; text-underline-offset: .2em; }

.feedback {
  border-inline-start: .22rem solid var(--accent);
  background: var(--notice);
  padding: .7rem .85rem;
  color: var(--ink);
  border-radius: .2rem .65rem .65rem .2rem;
}

.feedback-title { font-weight: 750; }
.feedback p + p { margin-top: .22rem; }
.feedback p:empty, .empty-state p:empty { display: none; }
.feedback-schedule, .feedback-source { font-size: .88rem; }
.feedback-schedule { color: var(--quiet); }
.feedback-source { display: inline-block; margin-top: .4rem; }
.advance-controls {
  display: grid;
  grid-template-columns: max-content minmax(5.3rem, 1fr);
  align-items: center;
  gap: .65rem;
}

.advance-controls .secondary-button { justify-self: start; min-width: 5.3rem; margin-top: 0; }
.advance-meter {
  grid-column: 1 / -1;
  height: .23rem;
  overflow: hidden;
  background: var(--line);
  border-radius: 1rem;
}

#advance-progress {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
}

.next-button span { padding-inline-start: .36rem; }
.empty-state { padding: clamp(1.5rem, 5vw, 3rem); }
.empty-state p { color: var(--quiet); margin-top: .55rem; }

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

@media (min-width: 56rem) {
  .answer-entry { grid-template-columns: minmax(0, 1fr) auto; }
}

@media (max-width: 42rem) {
  .study-card { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .product { border-inline-end: 0; border-block-end: 1px solid var(--line); }
  .product-figure { aspect-ratio: 2 / 1; }
}

@media (prefers-contrast: more) {
  :root { --line: var(--quiet); }
}
