:root {
  --bg: #f6f2e8;
  --ink: #262321;
  --muted: #7d766c;
  --rule: #e3dccd;
  --accent: #c98a1b;
  --film: #2b2724;
  --frame-blank: #3b3631;
  --frame-zero: #5e564d;

  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Hanken Grotesk', system-ui, sans-serif;

  --gutter: 16px;
  --column: 34rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

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

.page {
  max-width: calc(var(--column) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter) 3rem;
}

/* Masthead */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0 1rem;
}

.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

.wordmark__dot {
  color: var(--accent);
}

.tagline {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
}

/* Rating panel, pinned while scrolling */

.reading {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 1rem 0 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.reading__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.score {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--serif);
  line-height: 0.9;
}

.score__figure {
  font-size: clamp(3.5rem, 15vw, 5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums tabular-nums;
}

.score__scale {
  font-size: 1.25rem;
  color: var(--muted);
}

.reading:not(.is-complete) .score__figure {
  color: var(--muted);
  opacity: 0.7;
}

/* Stars: an amber copy clipped over a pale base, so halves are exact */

.stars {
  display: flex;
  gap: 2px;
  padding-bottom: 0.35rem;
}

.star {
  position: relative;
  width: 1.4rem;
  height: 1.4rem;
}

.star svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.star__base {
  fill: var(--rule);
}

.star__lit {
  fill: var(--accent);
  clip-path: inset(0 calc(100% - var(--fill, 0%)) 0 0);
  transition: clip-path 240ms var(--ease);
}

/* Film strip: one frame per criterion */

.strip {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  padding: 13px 6px;
  background: var(--film);
  border-radius: 3px;
}

.strip::before,
.strip::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 5px;
  background: repeating-linear-gradient(
    to right,
    var(--bg) 0 6px,
    transparent 6px 14px
  );
  border-radius: 1px;
  opacity: 0.85;
}

.strip::before {
  top: 4px;
}

.strip::after {
  bottom: 4px;
}

.frame {
  aspect-ratio: 4 / 3;
  border-radius: 2px;
  background: var(--frame-blank);
  transition: background 240ms var(--ease), box-shadow 240ms var(--ease);
}

.frame[data-score='0'] {
  background: var(--frame-zero);
}

.frame[data-score='0.5'] {
  background: linear-gradient(to top, var(--accent) 50%, var(--frame-zero) 50%);
  box-shadow: 0 0 6px rgba(201, 138, 27, 0.3);
}

.frame[data-score='1'] {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(201, 138, 27, 0.55);
}

.status {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Criteria rows */

.criteria {
  margin: 0;
}

.criterion {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}

.criterion__head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.criterion__name {
  font-weight: 500;
  font-size: 1.0625rem;
}

.criterion__info {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.criterion__info svg {
  width: 1rem;
  height: 1rem;
}

.criterion__info:hover,
.criterion__info[aria-expanded='true'] {
  color: var(--ink);
}

.criterion__hint {
  grid-column: 1 / -1;
  margin: 0.5rem 0 0;
  max-width: 30rem;
  font-family: var(--serif);
  font-size: 0.975rem;
  line-height: 1.55;
  color: var(--muted);
}

/* Segmented 0 / ½ / 1 control built from radios */

.scale {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--rule);
}

.scale__option {
  position: relative;
}

.scale__option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.scale__option span {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.25rem;
  border-radius: 999px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  transition: background 160ms var(--ease), color 160ms var(--ease);
}

.scale__option input:hover + span {
  color: var(--ink);
}

.scale__option input:checked + span {
  background: var(--ink);
  color: var(--bg);
}

.scale__option input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Actions */

.actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1.75rem;
}

.button {
  height: 2.75rem;
  padding: 0 1.25rem;
  border-radius: 999px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease), opacity 160ms var(--ease);
}

.button--primary {
  border: 0;
  background: var(--ink);
  color: var(--bg);
}

.button--primary:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.button--quiet {
  border: 1px solid var(--rule);
  background: none;
  color: var(--muted);
}

.button--quiet:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.shortcut-hint {
  margin: 1.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Only useful with a physical keyboard */
@media (hover: none) {
  .shortcut-hint {
    display: none;
  }
}

@media (max-width: 380px) {
  .scale__option span {
    width: 2.5rem;
  }

  .tagline {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
