/*
 * Currency pages /eur ... /rub (web-spec W03). Colours only as token variables.
 * Parts: .cur-panel (cobalt panel with the tiles), .cur-t (bank table), .cur-bnm (official rate and chart),
 * .cur-seo (EUR text), .cur-other (tiles of the other currencies).
 * The hidden attribute (Numerar / Card tiles and notes) wins over these display rules through [hidden] in base.css.
 */

/* ---------------------------------------------------------------------------------------------------- */
/* Cobalt panel: crumbs, H1, name and stamp, rate type switch | two tiles, notes, BNM link                 */
/* ---------------------------------------------------------------------------------------------------- */

.cur-panel {
  display: flex;
  gap: 24px;
  min-height: 336px;
}

.cur-panel__main {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-width: 0;
}

.cur-panel__h1 {
  margin: 12px 0 0;
}

.cur-panel__sub {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  color: var(--on-hero-label);
}

.cur-panel__seg {
  margin-top: auto;
  padding-top: 24px;
}

.cur-panel__side {
  display: flex;
  flex: 0 1 690px;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.cur-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.cur-tile {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 200px;
  padding: 24px;
  border-radius: 24px;
  background: var(--hero-control);
}

.cur-tile__label {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  color: var(--on-hero-label);
}

.cur-tile__value {
  margin: auto 0 0;
  font-size: 52px;
  line-height: 62px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.cur-tile__sub {
  margin: 0;
  font-size: 14px;
  line-height: 18px;
  font-weight: 500;
  color: var(--on-hero-note);
}

/* Currencies only BNM publishes: one tile with the sentence instead of the two rates. */
.cur-tile--empty {
  grid-column: 1 / -1;
  height: auto;
  min-height: 112px;
  justify-content: center;
}

.cur-tile__empty {
  margin: 0;
  font-size: 22px;
  line-height: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cur-panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  line-height: 18px;
}

.cur-panel__notes {
  min-width: 0;
}

.cur-panel__note {
  margin: 0;
  color: var(--on-hero-note);
}

.cur-panel__bnm {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  min-height: 44px;
  margin: -13px 0;
  margin-left: auto;
  color: var(--on-hero);
  font-weight: 500;
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.cur-panel__bnm:hover {
  text-decoration-line: underline;
}

@media (max-width: 1023px) {
  .cur-panel {
    flex-direction: column;
    min-height: 0;
  }

  .cur-panel__side {
    flex: none;
  }

  .cur-panel__seg {
    padding-top: 20px;
  }
}

@media (max-width: 767px) {
  .cur-panel {
    gap: 20px;
  }

  .cur-panel__h1 {
    margin-top: 8px;
  }

  .cur-tiles {
    gap: 12px;
  }

  .cur-tile {
    height: auto;
    min-height: 148px;
    padding: 16px;
    border-radius: 20px;
  }

  .cur-tile__value {
    padding-top: 12px;
    font-size: 40px;
    line-height: 48px;
  }

  .cur-tile__empty {
    font-size: 17px;
    line-height: 24px;
  }

  .cur-panel__foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .cur-panel__bnm {
    margin: 0;
  }
}

@media (max-width: 380px) {
  .cur-tile__value {
    font-size: 32px;
    line-height: 40px;
  }
}

/* ---------------------------------------------------------------------------------------------------- */
/* Table of banks                                                                                          */
/* ---------------------------------------------------------------------------------------------------- */

.cur-fresh {
  margin-top: 24px;
}

.cur-banks__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.cur-banks__head .section-title {
  margin: 0;
}

/* The table is 24 wider than the container so the hover background of a row can reach 12 beyond the text. */
.cur-t__scroll {
  margin: 24px -12px 0;
}

.cur-t {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
}

.cur-t__col-bank {
  width: 348px;
}

.cur-t col[data-col] {
  width: 164px; /* the artboard's 144 cannot hold 62 + badge 83 + padding when a best rate is in the cell */
}

/* 1024-1199: the container is narrower than 1200, so the bank column gives up the difference and the four rate columns
   still fit without a sideways scroll (348 + 4 x 164 = 1004 is wider than the 984 the table gets at 1024). */
@media (min-width: 1024px) and (max-width: 1199px) {
  .cur-t__col-bank {
    width: 320px;
  }
}

.cur-t th {
  font-weight: inherit;
  text-align: left;
}

.cur-t__groups {
  height: 18px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
}

.cur-t__type {
  padding: 0 0 0 12px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
}

.cur-t__bankh {
  padding: 0 0 0 12px;
  height: 36px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
  color: var(--text-secondary);
}

.cur-t__sorth {
  height: 36px;
  padding: 0 0 0 12px;
  vertical-align: middle;
}

.cur-t__sorth .c-sort {
  margin: -4px 0;
}

.cur-t__row {
  position: relative;
  height: 60px;
  white-space: nowrap;
  transition: background-color var(--transition);
}

.cur-t__row > * {
  padding: 0 0 0 12px;
  vertical-align: middle;
  transition: background-color var(--transition);
}

.cur-t__row:hover > *,
.cur-t__row:active > * {
  background: var(--row-hover);
}

.cur-t__row:active > * {
  background: var(--line);
}

.cur-t__row > :first-child {
  border-radius: 16px 0 0 16px;
}

.cur-t__row > :last-child {
  border-radius: 0 16px 16px 0;
}

.cur-t__bankin {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* The link covers the whole row (spec 4.4: the row is the link). */
.cur-t__link {
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cur-t__link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
}

.cur-t__link:focus-visible {
  outline: none;
}

.cur-t__link:focus-visible::after {
  outline: 2px solid var(--focus-color);
  outline-offset: -2px;
}

.cur-t__cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cur-t__n {
  display: inline-block;
  min-width: 62px;
  text-align: right;
}

.cur-t__cell--best {
  color: var(--accent-text);
  font-weight: 700;
}

.cur-t__none {
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* Group «Fără curs de azi»: no badges, text-secondary. */
.cur-t__grouphead {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 48px;
  padding: 0;
  font-size: 13px;
  line-height: 18px;
}

.cur-t__grouptitle {
  font-weight: 700;
}

.cur-t__groupsub {
  font-weight: 400;
  color: var(--text-secondary);
}

.cur-t__row--stale {
  color: var(--text-secondary);
}

.cur-t__row--stale .cur-t__link {
  color: var(--text-secondary);
}

.cur-t__who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cur-t__when {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}

.cur-t__stale {
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  white-space: normal;
}

.cur-t__fill {
  padding: 0;
}

.cur-banks__note {
  margin: 12px 0 0;
}

.cur-banks__note2 {
  margin: 0;
}

/* Below 1024 only the selected rate type is shown (the switch in the panel decides). */
@media (max-width: 1023px) {
  .cur-t[data-type='cash'] [data-col='card'],
  .cur-t[data-type='card'] [data-col='cash'] {
    display: none;
  }

  .cur-t__col-bank {
    width: auto;
  }

  .cur-t col[data-col] {
    width: 180px;
  }

  .cur-t__col-fill {
    width: 12px;
  }
}

@media (max-width: 767px) {
  .cur-t__scroll {
    margin-inline: -4px;
  }

  .cur-t col[data-col] {
    width: 102px;
  }

  .cur-t__col-fill {
    width: 4px;
  }

  .cur-t__row {
    height: 64px;
  }

  .cur-t__row > * {
    padding-left: 4px;
  }

  .cur-t__bankin {
    gap: 10px;
  }

  .cur-t__bankin .c-avatar {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .cur-t__link {
    font-size: 16px;
  }

  .cur-t__bankh,
  .cur-t__type {
    padding-left: 4px;
  }

  .cur-t__sorth {
    padding-left: 4px;
  }

  /* The badge goes under the number: two columns of 86 cannot hold both on a phone. */
  .cur-t__cell {
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding-right: 4px;
  }

  .cur-t__n {
    min-width: 0;
  }

  .cur-t__sorth .c-sort {
    justify-content: flex-end;
    width: 100%;
    text-align: right;
  }

  .cur-t__type {
    text-align: right;
    padding-right: 4px;
  }

  .cur-t__grouphead {
    padding-left: 4px;
  }

  .cur-t__stale {
    font-size: 12px;
    line-height: 16px;
  }
}

/* ---------------------------------------------------------------------------------------------------- */
/* Official rate, chart, SEO text                                                                          */
/* ---------------------------------------------------------------------------------------------------- */

.cur-bnm {
  display: flex;
  gap: 24px;
}

.cur-bnm__main {
  flex: 0 1 690px;
  min-width: 0;
}

.cur-bnm__main .section-title,
.cur-seo .section-title {
  margin: 0;
}

.cur-bnm__value {
  margin: 8px 0 0;
  font-size: 44px;
  line-height: 52px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.cur-bnm__meta {
  margin: 0;
  font-size: 14px;
  line-height: 18px;
  font-weight: 500;
  color: var(--text-secondary);
}

.cur-bnm .c-chart {
  margin-top: 16px;
}

.cur-bnm__more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
}

.cur-seo {
  flex: 1 1 0;
  min-width: 0;
}

.cur-seo .text-body {
  margin: 12px 0 0;
}

@media (max-width: 1023px) {
  .cur-bnm {
    flex-direction: column;
    gap: 40px;
  }

  .cur-bnm__main {
    flex: none;
  }
}

@media (max-width: 767px) {
  .cur-bnm__value {
    font-size: 36px;
    line-height: 44px;
  }
}

/* Narrow phones: the bank name needs the room of the decorative letter circle («Moldindconbank» is 119 px at 16/600),
   otherwise it would be cut. */
@media (max-width: 419px) {
  .cur-t__bankin .c-avatar {
    display: none;
  }

  /* 100 still holds the 83 px badge under the number; the 4 px go to the bank name at 360. */
  .cur-t col[data-col] {
    width: 100px;
  }
}

/* ---------------------------------------------------------------------------------------------------- */
/* Other currencies                                                                                        */
/* ---------------------------------------------------------------------------------------------------- */

.cur-other {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.cur-other__tile {
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  height: 100%;
  min-height: 72px;
  padding: 12px 16px;
  border-radius: 20px;
  background: var(--surface-muted);
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--transition);
}

.cur-other__tile:hover {
  background: var(--surface-muted-hover);
}

.cur-other__body {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-width: 0;
}

.cur-other__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.cur-other__code {
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
}

.cur-other__count {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Longer names (RU «Швейцарский франк») take a second line instead of being cut; the tiles of a row grow together. */
.cur-other__name {
  font-size: 13px;
  line-height: 18px;
  color: var(--text-secondary);
}

@media (max-width: 767px) {
  .cur-other {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .cur-other__tile {
    padding: 12px;
  }
}
