/* ==========================================================================================
   Results page.

   Palette and badge shapes come from the official result posters (brand red on near-black),
   applied to the light page body the rest of the site uses. Each section keeps the background
   of the poster it is drawn from, so the dark blocks are the ones that were dark on the poster.
   ========================================================================================== */

:root {
  --r-red: #ED1C24;
  --r-red-dark: #B3151B;
  --r-red-deep: #8E1015;
  --r-ink: #141414;
  --r-ink-soft: #1F1F1F;
  --r-ink-line: rgba(255, 255, 255, .12);
  --r-paper: #ffffff;
  --r-paper-alt: #f5f5f6;
  --r-text: #1a1a1a;
  --r-muted: #6b6b6b;
  --r-gold: #b8860b;
  --r-radius: 18px;
}

body.resultsPage {
  font-family: "Inter", "Outfit", sans-serif;
  color: var(--r-text);
  background: var(--r-paper);
}

.r-sinhala {
  font-family: "Noto Sans Sinhala", "Inter", sans-serif;
  line-height: 1.75;
}

.r-display {
  font-family: "Anton", "Inter", sans-serif;
  font-weight: 400;
  letter-spacing: .01em;
  line-height: .92;
}

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

.r-section {
  padding: clamp(2.75rem, 6vw, 5rem) 0;
}

.r-section--dark {
  background: var(--r-ink);
  color: #fff;
}

.r-section--alt {
  background: var(--r-paper-alt);
}

.r-section--red {
  background: linear-gradient(135deg, var(--r-red) 0%, var(--r-red-deep) 100%);
  color: #fff;
}

.r-eyebrow {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--r-red);
  background: rgba(237, 28, 36, .1);
  border-radius: 999px;
  padding: .35rem .85rem;
  margin-bottom: 1rem;
}

.r-section--dark .r-eyebrow,
.r-section--red .r-eyebrow {
  color: #fff;
  background: rgba(255, 255, 255, .14);
}

.r-heading {
  font-size: clamp(1.6rem, 3.6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 .5rem;
}

.r-sub {
  color: var(--r-muted);
  max-width: 62ch;
  margin: 0;
}

.r-section--dark .r-sub,
.r-section--red .r-sub {
  color: rgba(255, 255, 255, .72);
}

/* Hero ----------------------------------------------------------------------------------- */

.r-hero {
  position: relative;
  overflow: hidden;
  background: var(--r-ink);
  color: #fff;
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem);
}

.r-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 90% at 12% 0%, rgba(237, 28, 36, .38) 0%, transparent 60%),
    radial-gradient(50% 80% at 95% 100%, rgba(237, 28, 36, .22) 0%, transparent 65%);
  pointer-events: none;
}

.r-hero > .container {
  position: relative;
  z-index: 1;
}

.r-hero__year {
  font-size: clamp(3.2rem, 12vw, 7rem);
  color: #fff;
}

.r-hero__year small {
  display: block;
  font-family: "Inter", sans-serif;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--r-red);
  margin-bottom: .4rem;
}

.r-hero__lead {
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  color: rgba(255, 255, 255, .8);
  max-width: 46ch;
}

.r-breadcrumb {
  font-size: .85rem;
}

.r-breadcrumb a {
  color: rgba(255, 255, 255, .65);
  text-decoration: none;
}

.r-breadcrumb a:hover {
  color: #fff;
}

/* Headline stat tiles -------------------------------------------------------------------- */

.r-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .9rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.r-stat {
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--r-ink-line);
  border-radius: var(--r-radius);
  padding: 1.15rem 1.25rem;
  transition: transform .25s ease, border-color .25s ease, background .25s ease;
}

.r-stat:hover {
  transform: translateY(-4px);
  border-color: rgba(237, 28, 36, .6);
  background: rgba(237, 28, 36, .1);
}

.r-stat__value {
  display: block;
  font-size: clamp(2.4rem, 5.5vw, 3.4rem);
  color: var(--r-red);
}

.r-stat__label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .82);
  margin-top: .3rem;
}

/* The Sinhala face is only right for Sinhala; Latin sub-labels look loose in it. */
.r-stat__label span {
  display: block;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  color: rgba(255, 255, 255, .5);
}

/* Light-surface variants, used by the summary block on the home page ---------------------- */

.r-stats--light {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.r-stats--light .r-stat {
  background: #fff;
  border-color: rgba(0, 0, 0, .07);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .05);
  padding: .9rem 1rem;
}

.r-stats--light .r-stat:hover {
  background: #fff;
}

.r-stats--light .r-stat__value {
  font-size: clamp(1.9rem, 4.5vw, 2.5rem);
}

.r-stats--light .r-stat__label {
  color: var(--r-text);
  font-size: .76rem;
}

.r-stats--light .r-stat__label span {
  color: var(--r-muted);
}

.r-paper .r-rank__name {
  color: var(--r-text);
}

.r-magic--light {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
}

.r-magic--light .r-magic__card {
  background: #fff;
  border-color: rgba(0, 0, 0, .07);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .05);
  padding: .85rem .5rem;
}

.r-magic--light .r-magic__jump {
  font-size: 1.1rem;
  color: var(--r-text);
  margin-bottom: .2rem;
}

.r-magic--light .r-magic__count {
  font-size: clamp(1.7rem, 5vw, 2.2rem);
  color: var(--r-red);
}

.r-magic--light .r-magic__unit {
  font-size: .72rem;
  color: var(--r-muted);
}

/* Island rank spotlight ------------------------------------------------------------------ */

.r-island {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(1.25rem, 4vw, 3rem);
  background: linear-gradient(135deg, var(--r-red) 0%, var(--r-red-deep) 100%);
  border-radius: 28px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  color: #fff;
  box-shadow: 0 24px 60px rgba(237, 28, 36, .28);
}

.r-island--compact {
  gap: 1rem;
  border-radius: 20px;
  padding: 1rem 1.25rem;
  box-shadow: 0 12px 30px rgba(237, 28, 36, .22);
}

.r-island--compact .r-island__badge {
  width: 96px;
}

.r-island--compact .r-island__badge b {
  font-size: 2.4rem;
}

.r-island--compact .r-island__name {
  font-size: 1.25rem;
}

.r-island--compact .r-island__meta {
  margin-top: .4rem;
  font-size: .78rem;
}

.r-island__badge {
  position: relative;
  flex: 0 0 auto;
  width: clamp(140px, 30vw, 190px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #fff;
}

.r-island__badge svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.r-island__badge b {
  position: relative;
  font-family: "Anton", sans-serif;
  font-weight: 400;
  font-size: clamp(3.2rem, 8vw, 4.6rem);
  line-height: 1;
}

.r-island__badge em {
  position: absolute;
  top: 14%;
  font-style: normal;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: .85;
}

.r-island__name {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0;
}

.r-island__meta {
  list-style: none;
  padding: 0;
  margin: .75rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  font-size: .9rem;
}

.r-island__meta li {
  background: rgba(0, 0, 0, .22);
  border-radius: 999px;
  padding: .3rem .8rem;
}

/* District rank badges ------------------------------------------------------------------- */

.r-ranks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 1.25rem .5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.r-ranks--hero {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  max-width: 900px;
}

.r-rank {
  text-align: center;
}

.r-rank__badge {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 130px;
  margin: 0 auto;
  aspect-ratio: 1;
  color: currentColor;
  transition: transform .25s ease;
}

.r-ranks--hero .r-rank__badge {
  max-width: 150px;
}

.r-rank:hover .r-rank__badge {
  transform: translateY(-5px) scale(1.03);
}

.r-rank__badge svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.r-rank__no {
  position: relative;
  font-family: "Anton", sans-serif;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  line-height: 1;
}

.r-ranks--hero .r-rank__no {
  font-size: clamp(2.4rem, 6vw, 3.2rem);
}

.r-rank__eyebrow {
  position: absolute;
  top: 12%;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .8;
}

/* Two lines reserved so index numbers stay on a common baseline when a name wraps. */
.r-rank__name {
  display: block;
  min-height: 2.6em;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  margin-top: .25rem;
  line-height: 1.3;
}

.r-rank__index {
  display: block;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  opacity: .6;
}

.r-section--dark .r-rank,
.r-hero .r-rank {
  color: #fff;
}

.r-section--alt .r-rank__badge,
.r-paper .r-rank__badge {
  color: var(--r-red);
}

.r-section--alt .r-rank__name {
  color: var(--r-text);
}

/* Grade improvements --------------------------------------------------------------------- */

.r-magic {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.r-magic__card {
  background: rgba(0, 0, 0, .28);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--r-radius);
  padding: 1.25rem;
  text-align: center;
}

.r-magic__jump {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-family: "Anton", sans-serif;
  font-size: 1.6rem;
  margin-bottom: .5rem;
}

.r-magic__jump i {
  font-size: .9rem;
  opacity: .7;
}

.r-magic__count {
  display: block;
  font-family: "Anton", sans-serif;
  font-size: clamp(2.4rem, 6vw, 3.2rem);
  line-height: 1;
}

.r-magic__unit {
  display: block;
  font-size: .85rem;
  color: rgba(255, 255, 255, .8);
}

/* Honour roll ---------------------------------------------------------------------------- */

.r-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.75rem;
}

.r-search {
  position: relative;
  flex: 1 1 260px;
  max-width: 380px;
}

.r-search input {
  width: 100%;
  border: 1px solid #dcdcdc;
  border-radius: 999px;
  padding: .6rem 1rem .6rem 2.5rem;
  font-size: .95rem;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.r-search input:focus {
  outline: none;
  border-color: var(--r-red);
  box-shadow: 0 0 0 3px rgba(237, 28, 36, .15);
}

.r-search i {
  position: absolute;
  left: .95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--r-muted);
  font-size: .9rem;
}

.r-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.r-filter {
  border: 1px solid #dcdcdc;
  background: #fff;
  border-radius: 999px;
  padding: .5rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--r-text);
  cursor: pointer;
  transition: all .2s ease;
}

.r-filter:hover {
  border-color: var(--r-red);
  color: var(--r-red);
}

.r-filter[aria-pressed="true"] {
  background: var(--r-red);
  border-color: var(--r-red);
  color: #fff;
}

.r-filter small {
  opacity: .7;
  font-weight: 500;
}

.r-roll {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 1.5rem .5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.r-roll__item {
  text-align: center;
}

.r-roll__item[hidden] {
  display: none;
}

.r-shield {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 92px;
  margin: 0 auto .35rem;
  aspect-ratio: 1;
  color: var(--r-red);
  transition: transform .2s ease, filter .2s ease;
}

.r-shield[data-grade="B"] {
  color: var(--r-red-dark);
}

.r-roll__item:hover .r-shield {
  transform: translateY(-4px);
  filter: drop-shadow(0 8px 14px rgba(237, 28, 36, .35));
}

.r-shield svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.r-shield b {
  position: relative;
  font-family: "Anton", sans-serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  color: #fff;
  line-height: 1;
  margin-top: -8%;
}

.r-roll__name {
  display: block;
  min-height: 2.6em;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: uppercase;
  line-height: 1.3;
}

.r-roll__index {
  display: block;
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
  color: var(--r-muted);
}

.r-roll__rank {
  display: inline-block;
  margin-top: .2rem;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--r-gold);
  background: rgba(184, 134, 11, .12);
  border-radius: 999px;
  padding: .1rem .45rem;
}

.r-empty {
  padding: 2.5rem 0;
  text-align: center;
  color: var(--r-muted);
}

/* Posters -------------------------------------------------------------------------------- */

.r-posters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.r-poster {
  display: block;
  border-radius: var(--r-radius);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .1);
  transition: transform .25s ease, box-shadow .25s ease;
}

.r-poster:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .18);
}

.r-poster img {
  display: block;
  width: 100%;
  height: auto;
}

.r-poster figcaption {
  padding: .7rem .9rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--r-text);
}

/* Timetable ------------------------------------------------------------------------------ */

.r-timetable {
  width: 100%;
  border-collapse: collapse;
  color: #fff;
}

.r-timetable th,
.r-timetable td {
  padding: .8rem .75rem;
  border-bottom: 1px solid var(--r-ink-line);
  text-align: left;
  vertical-align: top;
}

.r-timetable thead th {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
}

.r-timetable tbody tr:hover {
  background: rgba(255, 255, 255, .04);
}

.r-batch {
  font-family: "Anton", sans-serif;
  font-size: 1.15rem;
  color: var(--r-red);
}

/* Buttons -------------------------------------------------------------------------------- */

.r-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border-radius: 999px;
  padding: .7rem 1.5rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all .2s ease;
}

.r-btn--primary {
  background: var(--r-red);
  color: #fff;
}

.r-btn--primary:hover {
  background: #fff;
  color: var(--r-red);
  transform: translateY(-2px);
}

.r-btn--ghost {
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
}

.r-btn--ghost:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, .1);
  transform: translateY(-2px);
}

@media (max-width: 575.98px) {
  .r-roll {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }

  .r-ranks {
    grid-template-columns: repeat(auto-fill, minmax(106px, 1fr));
  }
}

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