/**
 * @file
 * Awards & Certificates archive.
 *
 * Every colour, radius, gap and type step is a Dubai Design System token used
 * under its Figma name (`surface/on-surface` -> `--surface-on-surface`). The
 * tokens are NOT defined here — they live in the GDRFA host site's common.css,
 * which also carries the `.dark` overrides, so dark mode needs no rules of its
 * own in this file. Each var() carries the Figma-resolved light value as a
 * fallback so the page still renders correctly on a plain Drupal install.
 *
 * Direction: no physical left/right anywhere. Logical properties only, so the
 * Arabic (RTL) page mirrors without a second stylesheet and nothing is ever
 * pushed into the scrollable direction.
 */

.gdrfad-awards {
  --gdrfad-awards-max: 1160px;
  --gdrfad-awards-gutter: var(--padding-padding-xxl, 32px);
  /* Raised by the host theme when it has a sticky header of its own. */
  --gdrfad-awards-sticky-top: 0px;

  font-family: var(--font-family, DubaiFont), system-ui, sans-serif;
  color: var(--surface-on-surface, #000);
}

/* ---------------------------------------------------------------- hero ---- */

.gdrfad-awards__hero {
  max-width: var(--gdrfad-awards-max);
  margin-inline: auto;
  padding: var(--padding-padding-3xl, 64px) var(--gdrfad-awards-gutter) 0;
}

/* The page's <h1> is carried but not drawn. gdrfad_awards_block_access()
   suppresses the theme's page-title block on this route, so this is the only
   <h1> the page has — search engines and screen readers still need it even
   though the design no longer shows a heading. Clipped here rather than with
   core's `.visually-hidden`, which belongs to the theme and would leave this
   module depending on one being present. */
.gdrfad-awards__heading-sr {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.gdrfad-awards__intro {
  max-inline-size: 64ch;
  margin: 0 0 var(--gap-gap-xxl, 32px);
  font-size: var(--font-size-body, 16px);
  line-height: 1.62;
  color: var(--surface-on-surface-variant, #4a4545);
}

/* ------------------------------------------------------------- toolbar ---- */

/* Scrolls away with the page rather than pinning to the top. */
.gdrfad-awards__toolbar {
  margin-block-start: var(--gap-gap-xxl, 32px);
  border-block-end: 1px solid var(--surface-outline, #e4e2e6);
}

.gdrfad-awards__toolbar-inner {
  max-width: var(--gdrfad-awards-max);
  margin-inline: auto;
  padding: var(--padding-padding-lg, 16px) var(--gdrfad-awards-gutter);
}

/* One control row: search grows, the three compact controls sit beside it on a
   shared baseline, and everything wraps together instead of the search field
   claiming a line of its own. */
/* ------------------------------------------------------------- chip row ---- */

.gdrfad-awards__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-gap-sm, 8px);
  margin-block-start: var(--gap-gap-lg, 16px);
}

.gdrfad-awards__chip {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-gap-sm, 8px);
  padding: var(--padding-padding-sm, 8px) var(--padding-padding-md, 12px);
  border: 1px solid var(--surface-outline, #e4e2e6);
  border-radius: var(--radius-pill, 999px);
  background: var(--surface-surface, #fff);
  font-size: var(--font-size-body, 16px);
  line-height: 1;
  text-decoration: none;
  color: var(--surface-on-surface, #000);
}

.gdrfad-awards__chip:hover {
  border-color: var(--primary-primary, #8e343e);
  color: var(--primary-primary, #8e343e);
}

.gdrfad-awards__chip[aria-current] {
  border-color: var(--primary-primary, #8e343e);
  background: var(--primary-primary, #8e343e);
  color: var(--primary-on-primary, #fff);
}

.gdrfad-awards__chip-count {
  min-inline-size: 20px;
  padding: 2px var(--padding-padding-sm, 8px);
  border-radius: var(--radius-pill, 999px);
  background: var(--surface-surface-container, #efedf1);
  font-size: var(--font-size-small, 12px);
  text-align: center;
  color: var(--surface-on-surface-variant, #4a4545);
}

/* Darkening the chip rather than lightening it: a white-25% veil over the
   primary leaves the count at 4.34:1 against white text, which fails AA for
   text this small. A black-25% veil reads the same but clears 10:1, and it
   inverts correctly when the host's .dark palette flips primary to white. */
.gdrfad-awards__chip[aria-current] .gdrfad-awards__chip-count {
  background: var(--opacity-on-surface-opacity25, #0000003f);
  color: var(--primary-on-primary, #fff);
}

/* -------------------------------------------------------------- results ---- */

.gdrfad-awards__results {
  max-width: var(--gdrfad-awards-max);
  margin-inline: auto;
  padding: var(--padding-padding-xxl, 32px) var(--gdrfad-awards-gutter) var(--gap-footer, 80px);
}

.gdrfad-awards__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-gap-lg, 16px);
  margin-block-end: var(--gap-gap-xl, 24px);
}

.gdrfad-awards__range {
  margin: 0;
  font-size: var(--font-size-body, 16px);
  color: var(--surface-on-surface-variant, #4a4545);
}

.gdrfad-awards__clear,
.gdrfad-awards__empty-action {
  font-size: var(--font-size-body, 16px);
  color: var(--primary-primary, #8e343e);
}

.gdrfad-awards__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(325px, 1fr));
  gap: var(--gap-gap-xl, 24px);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --------------------------------------------------------------- cards ---- */

.gdrfad-award-card {
  display: flex;
  flex-direction: column;
  block-size: 100%;
  overflow: hidden;
  background: var(--surface-surface, #fff);
  border: 1px solid var(--surface-outline, #e4e2e6);
  border-radius: var(--radius-md, 16px);
  transition: box-shadow 0.2s, transform 0.2s;
}

.gdrfad-award-card:hover,
.gdrfad-award-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -18px var(--opacity-on-surface-opacity25, #0000003f);
}

/* Drupal renders the image field inside its own wrapper <div>, so the <img> is a
   grandchild of the media box, not a child, and its percentage block-size
   resolves against that wrapper. Left auto-height the percentage silently falls
   back to auto, the artwork runs past the box, and `overflow: hidden` chops it.
   The wrapper is given the box's own size so the image has a definite height to
   resolve against — see the `minmax(0, 1fr)` track on each media box for why the
   box's own height is definite in the first place. */
.gdrfad-award-card__media > *,
.gdrfad-award-row__media > * {
  display: block;
  margin: 0;
  inline-size: 100%;
  block-size: 100%;
  max-inline-size: 100%;
}

/* An explicit `minmax(0, 1fr)` track rather than the implicit auto one: an auto
   row is sized by its content, so the wrapper's 100% would resolve against the
   artwork's own height and the cap would never bite. */
.gdrfad-award-card__media {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-surface-container, #efedf1);
}

.gdrfad-award-card__media img {
  inline-size: 100%;
  block-size: 100%;
  padding: var(--padding-padding-md, 12px);
  object-fit: contain;
}

.gdrfad-award-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--padding-padding-xl, 24px);
}

.gdrfad-award-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-gap-md, 12px);
  margin: 0 0 var(--gap-gap-md, 12px);
}

.gdrfad-award-card__year,
.gdrfad-award__year {
  font-size: var(--font-size-h6, 20px);
  color: var(--secondary-secondary, #7b5809);
}

.gdrfad-award-card__title {
  margin: 0 0 var(--gap-gap-md, 12px);
  font-size: var(--font-size-h6, 20px);
  line-height: var(--line-height-h6, 28px);
  color: var(--surface-on-surface, #000);
}

.gdrfad-award-card__summary {
  flex: 1;
  margin: 0 0 var(--gap-gap-lg, 16px);
  font-size: var(--font-size-body, 16px);
  line-height: var(--line-height-body, 24px);
  color: var(--surface-on-surface-variant, #4a4545);
}

.gdrfad-award-card__link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--gap-gap-sm, 8px);
  font-size: var(--font-size-body, 16px);
  text-decoration: none;
  color: var(--primary-primary, #8e343e);
}

.gdrfad-award-card__link:hover { gap: var(--gap-gap-md, 12px); }

/* The arrow points at the reading direction, so it turns around under RTL. */
.gdrfad-arrow { display: inline-block; }
[dir="rtl"] .gdrfad-arrow { transform: scaleX(-1); }

/* ------------------------------------------------------------ timeline ---- */

.gdrfad-awards__era {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--gap-gap-xxl, 32px);
  align-items: start;
}

/* Both tracks are placed explicitly. With implicit placement a missing year
   heading silently drops the award list into the 130px year column, which
   squeezes every row down to one character per line. */
.gdrfad-awards__era-year {
  grid-column: 1;
  position: sticky;
  inset-block-start: var(--gdrfad-awards-sticky-top);
  margin: 0;
  padding-block-start: var(--padding-padding-xs, 4px);
  font-size: var(--font-size-h2, 40px);
  line-height: 1;
  color: var(--surface-on-surface, #000);
}

.gdrfad-awards__era-rule {
  display: block;
  inline-size: 34px;
  block-size: 3px;
  margin-block-start: var(--gap-gap-md, 12px);
  border-radius: 2px;
  background: var(--secondary-secondary, #7b5809);
}

.gdrfad-awards__era-list {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: var(--gap-gap-lg, 16px);
  margin: 0;
  padding: var(--padding-padding-xs, 4px) 0 var(--padding-padding-xxl, 32px);
  padding-inline-start: var(--padding-padding-xxl, 32px);
  border-inline-start: 1px solid var(--surface-outline, #e4e2e6);
  list-style: none;
}

.gdrfad-award-row {
  position: relative;
  display: flex;
  gap: var(--gap-gap-lg, 16px);
  padding: var(--padding-padding-lg, 16px);
  background: var(--surface-surface, #fff);
  border: 1px solid var(--surface-outline, #e4e2e6);
  border-radius: var(--radius-sm, 12px);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s;
}

.gdrfad-award-row:hover,
.gdrfad-award-row:focus-visible {
  transform: translateX(3px);
  box-shadow: 0 14px 32px -18px var(--opacity-on-surface-opacity25, #0000003f);
}

[dir="rtl"] .gdrfad-award-row:hover,
[dir="rtl"] .gdrfad-award-row:focus-visible { transform: translateX(-3px); }

/* The node on the timeline rail. Offset is logical, so it lands on the rail on
   both sides and never stretches the document in the scrollable direction. */
.gdrfad-award-row__dot {
  position: absolute;
  inset-inline-start: calc(-1 * var(--padding-padding-xxl, 32px) - 6px);
  inset-block-start: 24px;
  inline-size: 11px;
  block-size: 11px;
  border-radius: 50%;
  background: var(--primary-primary, #8e343e);
  box-shadow: 0 0 0 3px var(--surface-background-dim, #f5f3f7);
}

/* No panel behind the artwork: the award images are logos on their own white
   canvas, so a tinted container reads as a stray box floating on the row. */
/* Centred against the row rather than pinned to its top: the row's height is set
   by the summary text, which runs to three lines on some awards and one on
   others, so a top-aligned 78px thumbnail drifts further from centre the longer
   the text gets. `align-self` on the media alone — `align-items` on the row
   would stop the body stretching too. Harmless in the mobile column layout,
   where the media is full-width and has no cross-axis slack to move in. */
.gdrfad-award-row__media {
  flex: none;
  align-self: center;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  inline-size: 104px;
  block-size: 78px;
  overflow: hidden;
  border-radius: var(--radius-xs, 8px);
}

.gdrfad-award-row__media img {
  inline-size: 100%;
  block-size: 100%;
  padding: var(--padding-padding-xs, 4px);
  object-fit: contain;
}

.gdrfad-award-row__body {
  flex: 1;
  min-inline-size: 0;
}

.gdrfad-award-row__title {
  margin: var(--gap-gap-sm, 8px) 0 var(--gap-gap-xs, 4px);
  font-size: var(--font-size-h6, 20px);
  line-height: var(--line-height-h6, 28px);
  color: var(--surface-on-surface, #000);
}

.gdrfad-award-row__summary {
  margin: 0;
  font-size: var(--font-size-body, 16px);
  line-height: var(--line-height-body, 24px);
  color: var(--surface-on-surface-variant, #4a4545);
}

/* ----------------------------------------------------- category chips ---- */

/* Appearance lives in css/gdrfa-chips.css, which reproduces the design system's
   component verbatim. Only placement is set here, and only where the chip sits
   in a *block* parent: `.gdrfa-Chips` is `display: flex`, so it would otherwise
   stretch the full width of the row instead of hugging its label. The card's
   meta row is itself a flex container, so the chip already shrinks to content
   there — it is listed only so the two usages stay visibly parallel. */
.gdrfad-award-row__body > .gdrfa-Chips,
.gdrfad-award-card__meta > .gdrfa-Chips {
  inline-size: fit-content;
}

/* --------------------------------------------------------- empty state ---- */

.gdrfad-awards__empty {
  padding: var(--padding-padding-3xl, 64px) var(--padding-padding-xl, 24px);
  text-align: center;
  background: var(--surface-surface, #fff);
  border: 1px dashed var(--surface-outline, #e4e2e6);
  border-radius: var(--radius-lg, 24px);
}

.gdrfad-awards__empty-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: 56px;
  block-size: 56px;
  margin: 0 auto var(--gap-gap-xl, 24px);
  border: 2px solid var(--surface-outline, #e4e2e6);
  border-radius: 50%;
  font-size: var(--font-size-h5, 24px);
  color: var(--surface-on-surface-variant, #4a4545);
}

.gdrfad-awards__empty-title {
  margin: 0 0 var(--gap-gap-md, 12px);
  font-size: var(--font-size-h5, 24px);
  line-height: var(--line-height-h5, 32px);
}

.gdrfad-awards__empty-text {
  margin: 0 0 var(--gap-gap-xl, 24px);
  color: var(--surface-on-surface-variant, #4a4545);
}

.gdrfad-awards__empty-action {
  display: inline-block;
  padding: var(--padding-padding-lg, 16px) var(--padding-padding-xl, 24px);
  border-radius: var(--radius-sm, 12px);
  background: var(--primary-primary, #8e343e);
  color: var(--primary-on-primary, #fff);
  text-decoration: none;
}

/* --------------------------------------------------------------- focus ---- */

.gdrfad-awards a:focus-visible,
.gdrfad-awards input:focus-visible,
.gdrfad-awards select:focus-visible,
.gdrfad-awards button:focus-visible {
  outline: 2px solid var(--primary-primary, #8e343e);
  outline-offset: 2px;
}

/* --------------------------------------------------------- breakpoints ---- */

/* Tablet — the timeline year moves above its awards, since a 130px rail plus a
   card no longer fits comfortably. */
@media (max-width: 1024px) {
  .gdrfad-awards { --gdrfad-awards-gutter: var(--padding-padding-xl, 24px); }

  .gdrfad-awards__era {
    grid-template-columns: 1fr;
    gap: var(--gap-gap-md, 12px);
  }

  .gdrfad-awards__era-year,
  .gdrfad-awards__era-list { grid-column: 1; }

  .gdrfad-awards__era-year {
    position: static;
    display: flex;
    align-items: center;
    gap: var(--gap-gap-lg, 16px);
    font-size: var(--font-size-h3, 32px);
  }

  .gdrfad-awards__era-rule { margin-block-start: 0; }
}

/* Mobile — stack the toolbar, drop the timeline rail, let cards run full width. */
@media (max-width: 640px) {
  .gdrfad-awards { --gdrfad-awards-gutter: var(--padding-padding-lg, 16px); }

  .gdrfad-awards__hero { padding-block-start: var(--padding-padding-xxl, 32px); }

  .gdrfad-awards .gdrfad-awards__filters,
  

  

  .gdrfad-awards__grid { grid-template-columns: 1fr; }


  [dir="rtl"] .gdrfad-awards__years {
    mask-image: linear-gradient(to left, #000 85%, transparent 100%);
  }

  .gdrfad-awards__era-list {
    padding-inline-start: 0;
    border-inline-start: 0;
  }
  .gdrfad-award-row__dot { display: none; }
  .gdrfad-award-row { flex-direction: column; }
  .gdrfad-award-row__media { inline-size: 100%; block-size: 140px; }
}

/* ----------------------------------------------------------- motion ------- */

@media (prefers-reduced-motion: reduce) {
  .gdrfad-award-card,
  .gdrfad-award-row,
  .gdrfad-award-card__link { transition: none; }

  .gdrfad-award-card:hover,
  .gdrfad-award-card:focus-within,
  .gdrfad-award-row:hover,
  .gdrfad-award-row:focus-visible { transform: none; }
}
