/* 游戏打折情报 website v2. Phones first; >= 720px: game cards with the large picture, details always open. */

:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #17202b;
  --muted: #5d6a79;
  --line: #d8dee5;
  --accent: #1d5bc9;
  --tag: #ffd43b;
  --tag-ink: #a8101c;
  --disc: #4c6b22;
  --disc-ink: #beee11;
  --sale: #cf2419;
  --down: #13804f;
  --fest: #b66a00;
  --fresh: #0e7c7b;
  /* running sale on the index page, Steam-like green (#beee11 is unreadable on white) */
  --live: #436c09;
  /* the seasonal sale on the index page, by the month it starts: spring green, summer blue, autumn yellow, winter cream */
  --spring: #7cb342;
  --summer: #3b8fd9;
  --autumn: #ffd43b;
  --winter: #e2d6b8;
  --shade: rgba(23, 32, 43, 0.06);
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB",
    "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  /* figures of prices and countdowns: DIN on iOS / macOS, Bahnschrift (a DIN) on Windows */
  --num: "DIN Alternate", "Bahnschrift", "Roboto Condensed", "Arial Narrow", var(--sans);
  color-scheme: light;
}

/* dark: the system setting (unless the reader chose light), or the reader chose dark (html[data-theme], site.js) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161c;
    --surface: #1a212a;
    --ink: #e6ebf1;
    --muted: #97a4b3;
    --line: #2b3542;
    --accent: #82a9ff;
    --tag: #ffd43b;
    --tag-ink: #9a0e19;
    --disc: #4c6b22;
    --disc-ink: #beee11;
    --sale: #ff6a5c;
    --down: #3fc58a;
    --fest: #f0a640;
    --fresh: #4fc3c0;
    --live: #a4d007;
    --spring: #9ccc65;
    --summer: #5aa9ee;
    --autumn: #ffd43b;
    --winter: #ece4d2;
    --shade: rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11161c;
  --surface: #1a212a;
  --ink: #e6ebf1;
  --muted: #97a4b3;
  --line: #2b3542;
  --accent: #82a9ff;
  --tag: #ffd43b;
  --tag-ink: #9a0e19;
  --disc: #4c6b22;
  --disc-ink: #beee11;
  --sale: #ff6a5c;
  --down: #3fc58a;
  --fest: #f0a640;
  --fresh: #4fc3c0;
  --live: #a4d007;
  --spring: #9ccc65;
  --summer: #5aa9ee;
  --autumn: #ffd43b;
  --winter: #ece4d2;
  --shade: rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
img { max-width: 100%; }
/* text links: no underline; on hover a line grows from the middle to both sides (a background, so it also works
   on links that wrap over two lines). Links inside running text keep a faint line at rest, otherwise they are hard to spot. */
a {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 50% 100%;
  background-size: 0 1px;
  padding-bottom: 1px;
  transition: background-size 0.25s ease, color 0.15s ease;
}
.page-text p a {
  background-image: linear-gradient(currentColor, currentColor), linear-gradient(var(--line), var(--line));
  background-size: 0 1px, 100% 1px;
}
@media (hover: hover) {
  a:hover { background-size: 100% 1px; }
  .page-text p a:hover { background-size: 100% 1px, 100% 1px; }
}
a:focus-visible, .page-text p a:focus-visible { background-size: 100% 1px; }
@media (prefers-reduced-motion: reduce) {
  a, .tabs a::after { transition: none; }
}
/* links that are boxes or tabs: no line */
.brand, .subtabs a, .panel, .ad, .pager a, .bundles a, .social, .hero-cal, .hero-main, .row-link { background-image: none; padding-bottom: 0; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
b { font-weight: 700; }
.nw { white-space: nowrap; }
/* read by screen readers only */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .top { background: var(--surface); }
}
.top-in { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 20px; }
.brand {
  flex: none;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 11px 0;
}
.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin-right: -16px;
  padding-right: 16px;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative;
  flex: none;
  color: var(--muted);
  background-image: none;
  padding: 11px 9px;
}
/* the tab line grows from the middle on hover; always shown under the current tab */
.tabs a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--line);
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; }
/* current tab: a grey line (red drew the eye away from the content); hover: a lighter one */
.tabs a[aria-current="page"]::after { background: var(--muted); transform: none; }
@media (hover: hover) {
  .tabs a:hover { color: var(--ink); }
  .tabs a:hover::after { transform: none; }
}
.theme-toggle {
  display: none;
  flex: none;
  margin-left: auto;
  width: 32px;
  height: 32px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.js .theme-toggle { display: inline-flex; }
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }
/* the icon shows the colors in use: sun = light, moon = dark (same conditions as the dark colors above) */
.theme-toggle .ti-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .ti-light { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .ti-dark { display: block; }
}
:root[data-theme="dark"] .theme-toggle .ti-light { display: none; }
:root[data-theme="dark"] .theme-toggle .ti-dark { display: block; }
@media (max-width: 719px) {
  .top-in { flex-wrap: wrap; gap: 0 12px; }
  .brand { padding: 8px 0 0; }
  /* first line: brand and the theme button, second line: the tabs */
  .theme-toggle { order: 1; margin-top: 6px; }
  .tabs { order: 2; }
  .tabs {
    width: calc(100% + 9px);
    margin-left: -9px;
    /* more tabs to the right: fade the edge */
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
    mask-image: linear-gradient(to right, #000 88%, transparent);
  }
  .tabs a { padding: 6px 9px 9px; }
}

/* ---------- page heads, texts ---------- */

main.wrap { padding-top: 20px; padding-bottom: 32px; }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 22px; line-height: 1.3; font-weight: 800; }
/* no max-width: the events page line (about 80 characters) fits the wide layout in one line, 46em broke it */
.lead { color: var(--muted); font-size: 14px; margin-top: 4px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
.more { display: inline-block; margin-top: 12px; font-weight: 700; }
.subtabs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; margin-bottom: 10px; background: var(--surface); }
.subtabs a { color: var(--muted); text-decoration: none; padding: 2px 14px; border-radius: 999px; font-size: 14px; }
.subtabs a[aria-current="page"] { background: var(--ink); color: var(--surface); font-weight: 700; }

.page-text { max-width: 42em; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 20px; }
.page-text h1 { font-size: 20px; margin-bottom: 12px; }
.page-text p, .page-text li { margin-bottom: 10px; line-height: 1.75; }
.page-text ol { padding-left: 1.4em; }
.qr { display: block; width: 155px; height: 155px; }

/* ---------- the price tag: the one loud thing on the page ---------- */

.tag {
  position: relative;
  display: inline-block;
  background: var(--disc);
  color: var(--disc-ink);
  font: 700 15px/1.35 var(--num);
  padding: 1px 7px 0 17px;
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 8px 100%, 0 50%);
  font-variant-numeric: tabular-nums;
}
.tag::before {
  /* the hole of the tag */
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: var(--surface);
}
.now { font: 700 19px/1.2 var(--num); font-variant-numeric: tabular-nums; }

/* ---------- games ---------- */

.games { display: grid; grid-template-columns: minmax(0, 1fr); }
.game {
  display: grid;
  grid-template-columns: 107px minmax(0, 1fr) auto;
  grid-template-areas: "art head price" "art head more" "detail detail detail";
  grid-template-rows: auto 1fr auto;
  column-gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.game-art { grid-area: art; position: relative; align-self: start; width: 107px; height: 40px; border-radius: 3px; overflow: hidden; background: var(--line); }
.game-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.game-art.img-missing img { visibility: hidden; }
.game-head { grid-area: head; min-width: 0; }
.game-title { font-size: 15px; line-height: 1.35; font-weight: 700; overflow-wrap: anywhere; }
.game-cn { color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 1px; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.flag, .chg { font-size: 12px; line-height: 18px; padding: 0 6px; border-radius: 3px; white-space: nowrap; }
.flag-rank { color: var(--ink); background: var(--shade); }
.art-rank { display: none; }
.flag-lang { color: var(--muted); padding: 0 2px; }
.chg { font-family: var(--num); font-weight: 700; padding: 0; }
.chg-up { color: var(--sale); }
.chg-down { color: var(--down); }
.chg-same { color: var(--muted); font-family: var(--sans); font-weight: 400; }
.chg-new, .chg-back { color: var(--accent); font-family: var(--sans); }

.game-price { grid-area: price; text-align: right; white-space: nowrap; }
.price-line { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.status { font-size: 12px; color: var(--muted); margin-top: 3px; }
.st-new_low { color: var(--tag-ink); background: var(--tag); padding: 0 5px; border-radius: 2px; font-weight: 700; display: inline-block; }
/* softer than red: amber for 持平历史低价, teal for 新折扣 */
.st-equal_low { color: var(--fest); font-weight: 700; }
.st-new_disc { color: var(--fresh); font-weight: 700; }
.st-near_low { color: var(--ink); }
.st-free { color: var(--down); font-weight: 700; }

.rank {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 22px;
  padding: 1px 5px;
  background: var(--ink);
  color: var(--surface);
  font: 700 13px/1.35 var(--num);
  text-align: center;
}
.rank-top { background: var(--tag); color: var(--tag-ink); }

.game-more {
  grid-area: more;
  align-self: end;
  justify-self: end;
  width: 22px;
  height: 18px;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.game-more span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.game-more::after {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  margin: 2px 0 0 auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.game.is-open .game-more::after { transform: rotate(225deg); margin-top: 8px; }

/* details: open without JS; site.js (html.js) closes them on phones */
.game-detail { grid-area: detail; display: grid; grid-template-rows: 1fr; cursor: default; }
.js .game .game-detail { grid-template-rows: 0fr; }
.js .game.is-open .game-detail { grid-template-rows: 1fr; }
.game-detail-in { overflow: hidden; min-height: 0; }
.game-detail-in > :first-child { margin-top: 10px; }
@media (prefers-reduced-motion: no-preference) {
  .game-detail { transition: grid-template-rows 0.22s ease; }
  .game-more::after { transition: transform 0.22s ease; }
}

.facts { font-size: 13px; line-height: 1.55; }
.facts div { display: flex; gap: 10px; padding: 2px 0; }
.facts dt { flex: none; width: 5.5em; color: var(--muted); }
.facts dd { min-width: 0; }
.facts s { color: var(--muted); }
.stack { display: flex; flex-direction: column; }
.drop { margin-left: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.hbref { margin-top: 8px; font-size: 13px; }
.hbref-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  padding: 2px 0;
  -webkit-user-select: none;
  user-select: none;
}
.hbref-title::-webkit-details-marker { display: none; }
/* chevron: points right when closed; open: down on phones, up on wide screens (the list opens upwards there) */
.hbref-title::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: -2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.hbref[open] > .hbref-title::after { transform: rotate(45deg); margin-top: -4px; }
.hbref-title:hover, .hbref[open] > .hbref-title { color: var(--ink); }
.hbref-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.hbref ul { display: grid; gap: 4px; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) {
  .hbref-title::after { transition: none; }
}
.hbref li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 8px 3px 7px; }
/* phones: always open (site.js), the summary is only the heading */
@media (max-width: 719px) {
  .js .hbref-title { pointer-events: none; cursor: default; }
  .js .hbref-title::after { display: none; }
}
/* wide screens: the list opens upwards as a panel over the card's own details, the page does not move */
@media (min-width: 720px) {
  .game-detail-in { overflow: visible; }
  .hbref { position: relative; }
  .hbref > ul {
    position: absolute;
    left: -6px;
    right: -6px;
    bottom: calc(100% + 4px);
    z-index: 3;
    margin: 0;
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    transform-origin: 50% 100%;
  }
  .hbref[open] > .hbref-title::after { transform: rotate(-135deg); margin-top: 3px; }
}
/* opening: a short rise and fade in (runs each time the list is shown); closing: the reverse, site.js sets
   .is-closing and closes the <details> when the animation has ended */
@media (min-width: 720px) and (prefers-reduced-motion: no-preference) {
  .hbref[open] > ul { animation: hbref-in 0.15s ease-out; }
  .hbref.is-closing > ul { animation: hbref-out 0.15s ease-in forwards; }
}
@keyframes hbref-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes hbref-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(6px) scale(0.98); }
}
.hbref-name { min-width: 0; overflow-wrap: anywhere; }
.hbref-price { flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.store { display: inline-block; margin: 8px 0 2px; font-size: 13px; font-weight: 700; }

.game-plain { cursor: default; grid-template-columns: minmax(0, 1fr); grid-template-areas: "head"; grid-template-rows: auto; }
.game-note { color: var(--muted); font-size: 13px; margin-top: 2px; }

@media (min-width: 720px) {
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .game {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "art art" "head price" "detail detail";
    grid-template-rows: auto auto 1fr;
    align-content: start;
    row-gap: 10px;
    padding: 0 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    overflow: hidden;
    cursor: default;
  }
  .game-art { width: auto; height: auto; aspect-ratio: 460 / 215; border-radius: 0; }
  .game-head { padding-left: 14px; }
  .game-price { padding-right: 14px; }
  .game-title { font-size: 16px; }
  .game-detail, .js .game .game-detail { grid-template-rows: 1fr; padding: 0 14px; }
  .game-detail-in > :first-child { margin-top: 0; padding-top: 10px; border-top: 1px solid var(--line); }
  .game-more { display: none; }
  .tag { font-size: 17px; }
  .now { font-size: 22px; }
  .rank { min-width: 34px; padding: 3px 8px; font-size: 18px; }
  /* the top seller rank moves onto the picture: a dark box, 75% opaque, in both themes */
  .art-rank {
    display: block;
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(12, 16, 22, 0.75);
    color: #fff;
    font-size: 13px;
    line-height: 20px;
    white-space: nowrap;
  }
  .flags .flag-rank { display: none; }
  /* no empty line left when the rank was the only flag */
  .flags:not(:has(> :not(.flag-rank))) { display: none; }
  .game-plain { padding: 14px; }
  .game-plain .game-head { padding: 0; }
}
@media (min-width: 1100px) {
  .games { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- pager ---------- */

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 24px; }
.pager a {
  min-width: 36px;
  padding: 5px 10px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--num);
}
.pager .pager-step { font-family: var(--sans); }
.pager a[aria-current="page"] { background: var(--ink); color: var(--surface); border-color: var(--ink); font-weight: 700; }

/* ---------- countdown ---------- */

/* running countdowns stay in the text color, the bar grey: no red, the site does not push anyone to buy */
.cd { font-variant-numeric: tabular-nums; }
.cd[data-state="ended"] { color: var(--muted); }
.cd-bar { display: block; width: 100%; height: 4px; margin-top: 6px; border: 0; border-radius: 2px; background: var(--line); overflow: hidden; -webkit-appearance: none; appearance: none; }
.cd-bar[hidden] { display: none; }
.cd-bar::-webkit-progress-bar { background: var(--line); }
.cd-bar::-webkit-progress-value { background: var(--muted); }
.cd-bar::-moz-progress-bar { background: var(--muted); }

/* ---------- index ---------- */

.hero { display: grid; gap: 16px; margin-bottom: 24px; }
.hero-main { --season: var(--autumn); display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px 12px; border-top: 4px solid var(--season); }
/* the top bar in the color of the season (format.py SEASONS, by the start month) */
.hero-main[data-season="spring"] { --season: var(--spring); }
.hero-main[data-season="summer"] { --season: var(--summer); }
.hero-main[data-season="winter"] { --season: var(--winter); }
/* the title is the first line now (there was a category line above it): no margin, tight line height */
.hero-title { font-size: 22px; line-height: 1.2; font-weight: 800; }
/* running sale: the card is a link to the Steam store; the colors stay, hover: all borders in the color of the top bar */
a.hero-main { color: var(--ink); }
@media (hover: hover) {
  a.hero-main:hover { border-color: var(--season); }
}
/* title and the state tag in one row; the countdown centred below (words left of the time), then the dates */
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
/* a soft tag: tinted background, no border */
.hero-tag {
  flex: none;
  margin-top: 2px;
  padding: 2px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-size: 12px;
  white-space: nowrap;
}
.hero-tag[data-tag="soon"] { color: var(--fest); }
.hero-tag[data-tag="running"] { color: var(--live); }
.hero-cd { margin: 12px 0; text-align: center; }
.cd-big .cd-value { white-space: nowrap; }
/* each digit in a box of its own fixed width (site.js), so the centred line does not move while the seconds run
   (the number fonts have no tabular digits everywhere) */
.cd-big .dg { display: inline-block; width: 0.6em; text-align: center; }
.cd-big { font: 700 18px/1.2 var(--num); color: var(--ink); }
/* 距离开始还有 smaller and lighter than the time. The time exactly in the middle: phones put the words on a line
   above it, wide screens left of it (a grid 1fr | time | 1fr, the words in the first column) */
.cd-big { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cd-big .cd-label { font: 400 14px/1.2 var(--sans); color: var(--muted); white-space: nowrap; }
.cd-big[data-state="ended"] .cd-label { font-size: inherit; }
.hero-dates { color: var(--muted); font-size: 14px; margin-top: 6px; text-align: center; }
/* running sale: the date line is the progress bar, green at the start, the part of the time gone turns back to grey
   from left to right (--p from site.js). An inline span: its background runs on across a line break, so the fill
   follows the reading order on phones too */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero-main[data-state="running"] .cd-fill {
    color: transparent;
    background-image: linear-gradient(to right, var(--muted) var(--p, 0%), var(--live) var(--p, 0%));
    -webkit-background-clip: text;
    background-clip: text;
    font-weight: 700;
  }
}
.preview h2 { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.updated { color: var(--muted); font-size: 13px; white-space: nowrap; }
/* 接下来的活动 (heading only for screen readers): the rows, and on their right a vertical button to the calendar */
.hero-next { display: flex; gap: 8px; }
.hero-next ul { flex: 1; min-width: 0; }
.hero-cal {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  letter-spacing: 0.25em;
  padding: 10px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}
@media (hover: hover) {
  .hero-cal:hover { border-color: var(--muted); }
}
/* each row its own color (「接下来的活动」, Humble Bundle 参考): a bar on the left and a light tint, mixed with
   the surface, so it works in both themes */
.hero-next ul { display: grid; gap: 6px; }
.hero-next li, .hbref li {
  --row: #3b82f6;
  border-left: 3px solid var(--row);
  border-radius: 4px;
  background: color-mix(in srgb, var(--row) 10%, var(--surface));
}
.hero-next li:nth-child(5n+2), .hbref li:nth-child(5n+2) { --row: #14a38b; }
.hero-next li:nth-child(5n+3), .hbref li:nth-child(5n+3) { --row: #8b5cf6; }
.hero-next li:nth-child(5n+4), .hbref li:nth-child(5n+4) { --row: #e08a1e; }
.hero-next li:nth-child(5n+5), .hbref li:nth-child(5n+5) { --row: #e0457b; }
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .hero-next li, .hbref li { background: var(--surface); }
}
.hero-next li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  align-content: center;
  gap: 2px 10px;
  padding: 7px 12px 7px 10px;
}
.hero-next-title { font-weight: 700; }
.hero-next-kind { color: var(--muted); font-size: 12px; }
.hero-next .cd { margin-left: auto; font-size: 13px; }
.hero-next li[data-state="ended"] { opacity: 0.55; }
/* running event: the link on its title covers the whole row (::after); hover: a thin frame in the row color */
.hero-next li { position: relative; }
.row-link { color: inherit; }
.row-link::after { content: ""; position: absolute; inset: 0; border-radius: 4px; }
@media (hover: hover) {
  .row-link:hover::after { box-shadow: inset 0 0 0 1px var(--row); }
}
/* phones: the first two events only (wide screens: three, as high as the sale next to them) */
@media (max-width: 719px) {
  .hero-next li:nth-child(n+3) { display: none; }
}
/* running: the row is its own progress bar, dark at the start, the part of the time gone light again from left to
   right (--p from site.js) */
.hero-next li.cd-fill[data-state="running"] {
  background: linear-gradient(to right, color-mix(in srgb, var(--row) 10%, var(--surface)) var(--p, 0%),
                                        color-mix(in srgb, var(--row) 32%, var(--surface)) var(--p, 0%));
}

.panels { display: grid; gap: 12px; margin-bottom: 28px; }
.panel {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}
a.panel:hover { border-color: var(--muted); }
.panel img { flex: none; border-radius: 4px; }
/* cards without a picture: an icon in a 50x50 box like the logos */
.panel-icon { flex: none; width: 50px; height: 50px; border-radius: 4px; display: grid; place-items: center; }
.panel-icon-top { background: var(--bg); color: var(--fest); }
.panel-icon-tg { background: #2aabee; color: #fff; }
/* index page, right above the footer: WeChat, Telegram */
.panels-follow { margin-bottom: 20px; }
.panel h2 { font-size: 15px; font-weight: 800; margin-bottom: 2px; }
.panel p { color: var(--muted); }
.panel b { color: var(--ink); }
@media (min-width: 720px) {
  /* both halves as high as the higher one; the event rows share the height */
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
  .hero-next ul { grid-auto-rows: 1fr; }
  /* about as high as three event rows. The card is stretched to the height of the rows: title at the top, dates at
     the bottom edge, the countdown in the middle of the room between them */
  .hero-main { padding: 12px 20px 12px; display: flex; flex-direction: column; justify-content: space-between; }
  .hero-title { font-size: 22px; }
  .hero-cd { margin: 8px 0 4px; }
  .cd-big { font-size: 24px; }
  .cd-big { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: baseline; gap: 0 10px; }
  /* the words at the left end of the first column (the card's left edge), the time stays in the middle */
  .cd-big .cd-label { justify-self: start; font-size: 14px; }
  .cd-big[data-state="ended"] .cd-label { grid-column: 1 / -1; justify-self: center; }
  .panels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panels-follow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- events ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.filters button {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 14px;
  cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.ev-group { margin-bottom: 22px; }
.ev-group[hidden] { display: none; }
.ev-group h2 { font-size: 15px; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.evs { display: grid; gap: 8px; }
.ev {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-areas: "date body" "date cd";
  gap: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: 4px;
  padding: 12px 14px 12px 10px;
}
.ev[hidden] { display: none; }
.ev-major { border-left-color: var(--sale); }
.ev-nextfest { border-left-color: var(--accent); }
.ev-fest { border-left-color: var(--fest); }
.ev[data-state="ended"] { opacity: 0.55; }
.ev-date { grid-area: date; text-align: center; line-height: 1.1; }
.ev-month { display: block; color: var(--muted); font-size: 12px; }
.ev-day { display: block; font: 700 26px/1.1 var(--num); }
.ev-body { grid-area: body; min-width: 0; }
.ev-kind { color: var(--muted); font-size: 12px; }
.ev-title { font-size: 16px; font-weight: 800; line-height: 1.35; }
.ev-major .ev-title { font-size: 19px; }
.ev-title a { color: inherit; }
.ev-en, .ev-dates, .ev-note { color: var(--muted); font-size: 13px; }
.ev-cd { grid-area: cd; font-size: 14px; }
@media (min-width: 720px) {
  .ev { grid-template-columns: 56px minmax(0, 1fr) 220px; grid-template-areas: "date body cd"; align-items: center; }
  .ev-cd { text-align: right; }
}

/* ---------- HB ---------- */

.bundles { display: grid; gap: 6px; margin-bottom: 22px; }
.bundles a {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--ink);
  text-decoration: none;
}
.bundles a[aria-current="page"] { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--tag); }
.bundles a { display: flex; flex-direction: column; }
.bundle-name { font-weight: 800; min-width: 0; }
.bundle-meta { color: var(--muted); font-size: 13px; }
/* lists of countdowns: only the last day is red */
.bundles .cd[data-state="running"], .hero-next .cd[data-state="running"] { color: var(--muted); }
.bundles .cd[data-soon], .hero-next .cd[data-soon] { color: var(--sale); }
.bundle-head .bundle-meta { flex-basis: 100%; }
.bundle-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 12px; }
.bundle-head h2 { font-size: 19px; font-weight: 800; }
.buy { font-weight: 700; }
.level { margin-bottom: 22px; }
.level > h3 { display: inline-block; font: 700 15px/1.4 var(--sans); padding: 2px 10px; margin-bottom: 8px; border-radius: 3px; background: var(--ink); color: var(--surface); }
.level-float > h3 { background: var(--down); }
.level-other > h3 { background: var(--fest); }
@media (min-width: 720px) {
  .bundles { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* ---------- ads, footer ---------- */

.ads { display: grid; justify-items: center; gap: 8px; padding-bottom: 20px; }
.ad img { display: block; max-width: 366px; width: 100%; height: auto; }
.ad.img-missing { display: none; }
.foot { padding-top: 16px; padding-bottom: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
/* footer: logo + name, the logos in the text color (light / dark); hover: the link gets the ink color */
.foot-social { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; }
.social { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.social .logo { flex: none; fill: currentColor; }
@media (hover: hover) {
  a.social:hover { color: var(--ink); }
}
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin: 8px 0; }
.foot-links a { color: var(--muted); }
