/* ==========================================================================
   ewony.de — game reviews (/reviews/)
   Loaded after site.css, which provides the fonts, tokens and base styles.
   ========================================================================== */

/* reviews.js shows and hides things with the hidden attribute; this keeps it
   working on elements that set their own display. */
[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Page
   -------------------------------------------------------------------------- */

.page {
  min-height: 100vh;
  min-height: 100svh;

  /* Same gutters and safe-area handling as .stage in site.css. */
  padding: var(--pad-y) var(--pad-x);
  padding-block: calc(var(--pad-y) + env(safe-area-inset-top, 0px))
                 calc(var(--pad-y) + env(safe-area-inset-bottom, 0px));
  padding-inline: calc(var(--pad-x) + env(safe-area-inset-left, 0px))
                  calc(var(--pad-x) + env(safe-area-inset-right, 0px));

  /* The home page backdrop, pinned to the top so it doesn't stretch as the
     list grows — it fades out into --bg well before the 900px mark. */
  background: radial-gradient(110% 80% at 50% 0%, #04181a 0%, #020c0d 55%, #010506 100%)
              top / 100% 900px no-repeat;
}

.reviews {
  /* Score colours: 8 and up, 5 to 7.9, below 5. */
  --score-high: var(--accent-bright);
  --score-mid: #fbbf24;
  --score-low: #f87171;

  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.reviews__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: clamp(24px, 5vw, 32px);
}

.reviews__back {
  margin-bottom: clamp(14px, 4vw, 22px);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-faint);
  transition: color 220ms ease;
}

.reviews__back:focus-visible {
  color: var(--accent-bright);
  outline: 1px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .reviews__back:hover { color: var(--accent-bright); }
}

.reviews__title {
  margin: 0;
  font-size: clamp(36px, 10vw, 54px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.035em;
  color: var(--text-strong);
  animation: float-up 700ms ease backwards;
}

.reviews__intro {
  max-width: 52ch;
  margin: 0 0 4px;
  font-size: clamp(15px, 4.2vw, 17px);
  line-height: 1.6;
  color: var(--text-muted);
  text-wrap: pretty;
  animation: float-up 700ms 60ms ease backwards;
}

.reviews__status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   Toolbar — search and sort
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  /* Clicking a tag far down the list scrolls back up to here. */
  scroll-margin-top: 16px;
  animation: float-up 700ms 100ms ease backwards;
}

.search {
  position: relative;
  display: block;
  flex: 1 1 220px;
}

.search__icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  pointer-events: none;
  background-color: var(--text-faint);
  transition: background-color 180ms ease;
  -webkit-mask: url('/assets/icons/search.svg') center / contain no-repeat;
          mask: url('/assets/icons/search.svg') center / contain no-repeat;
}

.search:focus-within .search__icon { background-color: var(--accent-bright); }

.search__input {
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 16px 0 38px;
  -webkit-appearance: none;
          appearance: none;
  border: 1px solid var(--tile-border);
  border-radius: 999px;
  background: var(--tile-bg);
  font: 400 14px/1 var(--font-sans);
  color: var(--text-strong);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.search__input::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

.search__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .15);
}

.sort {
  display: inline-flex;
  flex: none;
  padding: 3px;
  border: 1px solid var(--tile-border);
  border-radius: 999px;
  background: var(--tile-bg);
}

.sort__option {
  margin: 0;
  padding: 7px 12px;
  -webkit-appearance: none;
          appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: 500 13px/1.2 var(--font-sans);
  white-space: nowrap;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}

.sort__option[aria-pressed="true"] {
  background: rgba(20, 184, 166, .14);
  color: var(--accent-bright);
}

.sort__option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@media (hover: hover) and (pointer: fine) {
  .sort__option:hover { color: var(--accent-bright); }
}

/* On phones the sort control gets its own full-width line. */
@media (max-width: 520px) {
  .sort { width: 100%; }
  .sort__option { flex: 1; }
}

/* --------------------------------------------------------------------------
   Categories — the filter bar and the tags on each card. Both are buttons;
   the one matching the current filter has aria-pressed.
   -------------------------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  animation: float-up 700ms 160ms ease backwards;
}

.filter,
.tag,
.reviews__clear {
  margin: 0;
  -webkit-appearance: none;
          appearance: none;
  border: 1px solid var(--tile-border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.filter,
.reviews__clear {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 13px;
  background: var(--tile-bg);
  font: 500 13px/1.2 var(--font-sans);
  color: var(--text-muted);
}

.filter__count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}

.tag {
  padding: 4px 9px;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.filter[aria-pressed="true"],
.tag[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(20, 184, 166, .1);
  color: var(--accent-bright);
}

.filter[aria-pressed="true"] .filter__count { color: var(--accent); }

.filter:focus-visible,
.tag:focus-visible,
.reviews__clear:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .filter:hover,
  .tag:hover,
  .reviews__clear:hover {
    border-color: var(--accent);
    color: var(--accent-bright);
  }
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { margin-top: clamp(26px, 6vw, 34px); }

.section__title {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.features,
.rows {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.features { gap: 16px; }
.rows { gap: 10px; }

.reviews__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 30px;
  padding: 30px 20px;
  border: 1px dashed var(--tile-border);
  border-radius: 16px;
  text-align: center;
}

.reviews__empty p {
  margin: 0;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Card parts shared by featured cards and rows
   -------------------------------------------------------------------------- */

/* Score colour — reviews.js puts one of these on every card. */
.tier-high { --tier: var(--score-high); }
.tier-mid  { --tier: var(--score-mid); }
.tier-low  { --tier: var(--score-low); }

/* Fills the square: a non-square image is cropped from the centre rather than
   shrunk with empty bars beside it. */
.cover {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--cover-size);
  height: var(--cover-size);
  overflow: hidden;
  border: 1px solid var(--tile-border);
  border-radius: 12px;
  background: var(--bg);
}

.cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* No logo, or it failed to load — the game's first letter instead. */
.cover--initial {
  font-size: calc(var(--cover-size) * .44);
  font-weight: 700;
  color: var(--accent);
}

.badge {
  margin: 0;
  padding: 4px 9px;
  border: 1px solid rgba(20, 184, 166, .45);
  border-radius: 999px;
  background: rgba(20, 184, 166, .08);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

.name {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

.score {
  margin: 0;
  white-space: nowrap;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
}

.score__value { color: var(--tier, var(--text-strong)); }

.score__max {
  margin-left: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--text-faint);
}

.meter {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--tile-border);
}

/* --score (0–1) is set per card by reviews.js. */
.meter__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--tier, var(--accent));
  transform: scaleX(var(--score, 0));
  transform-origin: left;
  animation: meter-fill 900ms calc(var(--delay, 0ms) + 250ms) var(--ease-out) backwards;
}

.card-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.comment {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

/* Cut to --lines lines until "read more" is clicked. Line breaks written as
   \n in the JSON show up as line breaks. */
.comment__text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--lines, 3);
  overflow: hidden;
  margin: 0;
  line-height: 1.65;
  color: var(--text-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.comment.is-open .comment__text {
  display: block;
  -webkit-line-clamp: none;
  overflow: visible;
}

.comment__more {
  margin: 0;
  padding: 2px 0;
  -webkit-appearance: none;
          appearance: none;
  border: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-bright);
  cursor: pointer;
}

.comment__more:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .comment__more:hover { color: var(--text-strong); }
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --------------------------------------------------------------------------
   Featured card — highlighted reviews in the default order
   -------------------------------------------------------------------------- */

.feature {
  --cover-size: clamp(88px, 24vw, 168px);

  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--cover-size) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "cover head"
    "cover text";
  column-gap: clamp(16px, 4vw, 24px);
  row-gap: 16px;
  padding: clamp(16px, 4.5vw, 24px);
  border: 1px solid var(--accent);
  border-radius: 20px;
  background: linear-gradient(180deg, #062221 0%, var(--tile-bg) 80%);
  box-shadow: 0 22px 48px -26px rgba(20, 184, 166, .65);

  /* --delay is set per card by reviews.js to stagger the entrance. */
  animation: float-up 700ms var(--delay, 0ms) ease backwards;
}

/* The cover again, blurred, as the card's background — with a dark wash on
   top (::after) so the text stays readable over bright art. */
.feature__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .5;
  filter: blur(36px) saturate(1.4);
  transform: scale(1.3);
}

.feature::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  background: linear-gradient(100deg, rgba(4, 18, 19, .3) 0%, rgba(4, 18, 19, .8) 50%, rgba(4, 18, 19, .9) 100%);
}

.feature > .cover {
  grid-area: cover;
  align-self: start;
  border-color: rgba(20, 184, 166, .45);
  border-radius: 14px;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .9);
}

.feature > .card-head {
  grid-area: head;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 12px;
  row-gap: 12px;
}

.feature .badge {
  grid-column: 1 / -1;
  justify-self: start;
}

.feature .meter { grid-column: 1 / -1; }

.feature .name { font-size: clamp(19px, 5vw, 26px); }
.feature .score__value { font-size: clamp(26px, 7vw, 36px); }

.feature > .card-text {
  grid-area: text;
  align-self: start;
}

.feature .comment__text {
  --lines: 4;
  font-size: 15px;
}

/* No comment and no categories. */
.feature--bare {
  grid-template-rows: auto;
  grid-template-areas: "cover head";
  align-items: center;
}

/* Phones: comment and tags go full width under the cover. */
@media (max-width: 600px) {
  .feature {
    grid-template-rows: auto;
    grid-template-areas:
      "cover head"
      "text  text";
    align-items: center;
  }

  .feature--bare { grid-template-areas: "cover head"; }
}

/* --------------------------------------------------------------------------
   Row — every other review, and all of them when sorted
   -------------------------------------------------------------------------- */

.row {
  --cover-size: clamp(48px, 13vw, 60px);

  display: grid;
  grid-template-columns: var(--cover-size) minmax(0, 1fr) auto;
  grid-template-areas:
    "cover head score"
    "cover text text";
  align-items: center;
  column-gap: clamp(12px, 3.5vw, 16px);
  row-gap: 10px;
  padding: clamp(12px, 3.5vw, 16px);
  border: 1px solid var(--tile-border);
  border-radius: 16px;
  background: var(--tile-bg);
  animation: float-up 600ms var(--delay, 0ms) ease backwards;
}

.row--highlight { border-color: rgba(20, 184, 166, .6); }

.row > .cover {
  grid-area: cover;
  align-self: start;
}

.row > .card-head {
  grid-area: head;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.row .name { font-size: clamp(16px, 4.4vw, 18px); }

.row__score {
  grid-area: score;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}

.row .score__value { font-size: clamp(20px, 5.4vw, 24px); }
.row .meter { width: 56px; }

.row > .card-text { grid-area: text; }

.row .comment__text {
  --lines: 2;
  font-size: 14px;
}

.row--bare {
  grid-template-areas: "cover head score";
}

@media (max-width: 600px) {
  .row {
    grid-template-areas:
      "cover head score"
      "text  text text";
  }

  .row--bare { grid-template-areas: "cover head score"; }
}

/* --------------------------------------------------------------------------
   Motion — float-up lives in site.css
   -------------------------------------------------------------------------- */

@keyframes meter-fill {
  from { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reviews__title,
  .reviews__intro,
  .toolbar,
  .filters,
  .feature,
  .row,
  .meter__fill {
    animation: none;
  }

  .reviews__back,
  .search__icon,
  .search__input,
  .sort__option,
  .filter,
  .tag,
  .reviews__clear {
    transition-duration: 1ms;
  }
}
