/* Zhang's own additions to the theme. */

/* Results by year (<section class="zr">, see docs/WEBSITE.txt). Without the script, or in the editor,
   every year is simply listed. results.js adds the year and subject buttons. */
.zr { --step-1: var(--primary); --step-2: #2b2f87; --step-3: #51549c; --step-4: #cfd0e6; --step-5: #e1e2f0; --step-6: #eeeef7; }
.zr-head { max-width: 720px; margin-bottom: 40px; }
.zr-head p { color: var(--light); }
.zr h3 { font-size: 34px; margin: 0 0 20px; color: var(--primary); }
.zr-year + .zr-year { margin-top: 70px; }

.zr-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.zr-pick button { border: 1px solid #c9c9d8; background: var(--white); color: var(--dark); border-radius: 999px; padding: 9px 18px; font: inherit; font-weight: 500; line-height: 1.2; }
.zr-pick button:hover { border-color: var(--primary); }
.zr-pick button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--white); }
.zr-pick button:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; }

.zr-ranks { list-style: none; margin: 0 0 40px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
/* Longer selector on purpose: the theme fades and spaces out every list item. */
.page-components .zr ul.zr-ranks > li { background: var(--primary); color: var(--white); border-radius: 20px; padding: 18px 20px; margin: 0; opacity: 1; line-height: 1.4; }
.zr-ranks strong { display: block; font-size: 38px; font-weight: 600; line-height: 1.1; color: var(--yellow); }
.zr-ranks span { display: block; font-size: 17px; font-weight: 500; margin-top: 10px; }
.zr-ranks small { display: block; font-size: 14px; opacity: .85; }

.zr-set + .zr-set { margin-top: 36px; }
.zr h4 { font-size: 20px; margin: 0 0 14px; }
.zr dl { margin: 0; }
.zr dl > div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; padding: 5px 0; }
.zr dt { font-size: 18px; font-weight: 600; line-height: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.zr dd { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.zr dd span { min-width: 38px; height: 38px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--step-5); color: var(--primary); }
/* The higher the mark, the deeper the blue. */
.zr dl > div:nth-child(1) dd span { background: var(--step-1); color: var(--white); }
.zr dl > div:nth-child(2) dd span { background: var(--step-2); color: var(--white); }
.zr dl > div:nth-child(3) dd span { background: var(--step-3); color: var(--white); }
.zr dl > div:nth-child(4) dd span { background: var(--step-4); }
.zr dl > div:nth-child(n + 7) dd span { background: var(--step-6); }
.zr dl > div:hover dt { color: var(--secondary); }

.zr-on .zr-year[hidden], .zr-on .zr-set[hidden] { display: none; }
.zr-on .zr-year { margin-top: 0; }
.zr-on .zr-year > h3 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.zr-on .zr-set { margin-top: 0; }
.zr-on h4 small { color: var(--light); font-size: 15px; font-weight: 400; margin-left: 8px; }
@media (prefers-reduced-motion: no-preference) {
  .zr-on .zr-ranks li, .zr-on dl > div { animation: zr-in .45s ease-out backwards; animation-delay: calc(var(--i, 0) * 35ms); }
  @keyframes zr-in { from { opacity: 0; transform: translateY(10px); } }
}
@media (max-width: 575px) {
  .zr dl > div { grid-template-columns: 54px minmax(0, 1fr); gap: 10px; }
  .zr dt { font-size: 16px; line-height: 34px; }
  .zr dd span { min-width: 34px; height: 34px; font-size: 12px; }
  .zr-ranks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zr-pick.zr-years { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
}

/* The theme hides this button on phones only when it follows the old translate menu, which is gone. */
@media (max-width: 767px) { header .call-text + .header-button { display: none; } }

/* Announcements (src/lib/site/announcement.ts). The theme styles bare headings, so selectors are longer. */
.za, .za * { box-sizing: border-box; }
.za h2, .za h3, .za p { margin: 0; }
.za-text { display: grid; gap: 14px; justify-items: start; align-content: center; padding: 40px; }
.za .za-text h2 { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.15; color: var(--primary); text-wrap: balance; }
.za .za-text h3 { font-size: 21px; line-height: 1.3; color: var(--secondary); }
.za .za-text p { font-size: 17px; line-height: 1.55; color: #333; }
.za .za-text .btn { margin-top: 8px; }
.za-close { position: absolute; top: 12px; right: 12px; z-index: 1; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--white); color: var(--primary); font: 400 28px/1 sans-serif; cursor: pointer; box-shadow: 0 1px 6px rgb(0 0 0 / .25); }
.za-close:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; }
.za-pop { width: min(940px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); margin: auto; padding: 0; border: 0; border-radius: 28px; overflow: auto; background: var(--white); box-shadow: 0 20px 70px rgb(0 0 0 / .35); }
.za-pop::backdrop { background: rgb(2 6 40 / .6); }
.za-box { position: relative; }
.za[data-look="side"] .za-box:not(.za-plain) { display: grid; grid-template-columns: 42% 1fr; }
.za[data-look="side"] img { width: 100%; height: 100%; min-height: 420px; object-fit: cover; }
.za[data-look="top"], .za[data-look="words"] { width: min(600px, calc(100vw - 32px)); }
.za[data-look="top"] img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.za[data-look="words"] { background: var(--primary); }
.za[data-look="words"] .za-text { justify-items: center; text-align: center; padding: 64px 40px 56px; }
.za[data-look="words"] .za-text h2 { color: var(--yellow); }
.za[data-look="words"] .za-text h3, .za[data-look="words"] .za-text p { color: var(--white); }
.za[data-look="words"] .btn { background: var(--white); border-color: var(--white); color: var(--primary); }
.za-corner { position: fixed; z-index: 1000; left: 20px; bottom: 20px; width: min(340px, calc(100vw - 40px)); border-radius: 22px; overflow: hidden; background: var(--white); box-shadow: 0 10px 40px rgb(0 0 0 / .28); }
.za-corner[hidden] { display: none; }
.za-corner img { display: block; width: 100%; height: 150px; object-fit: cover; }
.za-corner .za-text { padding: 24px; gap: 10px; }
.za-corner .za-text h2 { font-size: 23px; padding-right: 36px; }
.za-corner .za-text p { font-size: 15px; }
.za-bar { position: fixed; inset: auto 0 0; z-index: 1000; background: var(--primary); color: var(--white); padding: 12px 60px 12px 20px; text-align: center; }
.za-bar p { font-size: 16px; line-height: 1.4; color: var(--white); }
.za-bar .za-link { color: var(--yellow); text-decoration: underline; }
.za-bar .za-close { top: 50%; right: 14px; translate: 0 -50%; width: 30px; height: 30px; font-size: 22px; }
@media (max-width: 700px) {
  .za[data-look="side"] .za-box:not(.za-plain) { grid-template-columns: 1fr; }
  .za[data-look="side"] img { height: auto; min-height: 0; aspect-ratio: 16 / 9; }
  .za-text { padding: 26px 22px 30px; }
  .za .za-text p { font-size: 16px; }
}

/* The portal's preview: the announcement alone on a plain page. */
.za-preview { margin: 0; min-height: 100vh; background: #dfe0ea; }
.za-preview .za-pop { position: absolute; inset: 0; display: block; height: fit-content; }
.za-preview .za-corner { position: absolute; }
