/* ============================================================
   Homepage layout — aligned news portal blocks
   ============================================================ */

:root {
  --home-section-pad: clamp(36px, 5vw, 56px);
  --home-section-pad-sm: clamp(28px, 4vw, 40px);
  --home-block-gap: clamp(20px, 2.5vw, 32px);
  --home-grid-gap: clamp(18px, 2.2vw, 26px);
}

/* Major bands (featured, latest, articles, utilities) */
.home-block.section {
  padding-block: var(--home-section-pad);
}

/* Category group wrapper */
.home-block.home-block--categories {
  padding-block: var(--home-section-pad-sm);
}

.home-block .sec-label {
  margin-bottom: clamp(22px, 2.8vw, 28px);
}

/* ── Featured ─────────────────────────────────────────────── */
.home-featured-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(20px, 2.5vw, 28px);
  align-items: stretch;
}

.home-featured-grid--solo {
  grid-template-columns: minmax(0, 1fr);
}

.home-featured-lead .home-news-card {
  height: 100%;
}

.home-featured-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.home-featured-side-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-card);
  transition: box-shadow var(--t-mid), border-color var(--t-mid);
  min-height: 0;
}

.home-featured-side-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: color-mix(in srgb, var(--red) 35%, var(--border));
}

.home-featured-side-thumb {
  display: block;
  border-radius: var(--r-sm);
  overflow: hidden;
  width: 100%;
}

.home-featured-side-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-featured-side-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.home-featured-side-title {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

.home-featured-side-title a {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  color: var(--text-main);
  text-decoration: none;
  transition: color var(--t-fast);
}

.home-featured-side-title a:hover {
  color: var(--red);
}

/* ── Uniform cards ────────────────────────────────────────── */
.home-news-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.home-news-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
}

.home-news-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  line-height: 1.45;
  min-height: calc(1.45em * 2);
}

.home-news-card--sm .home-news-card__title {
  -webkit-line-clamp: 2;
  min-height: calc(1.45em * 2);
  font-size: 14px;
}

.home-news-card__img {
  display: block;
  overflow: hidden;
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.home-news-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-news-card__author {
  margin-top: auto;
  padding-top: 2px;
}

.home-news-card__author-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  text-decoration: none;
  color: var(--text-muted);
  transition: color var(--t-fast);
}

.home-news-card__author-link:hover {
  color: var(--red);
}

.home-news-card__author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-section);
}

.home-news-card__author-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.home-featured-side-body .home-news-card__author {
  margin-top: 0;
  text-align: end;
}

.home-featured-side-body .home-news-card__author-name {
  font-size: 12px;
}

.card-h--latest-list .home-news-card__author {
  margin-top: 6px;
  text-align: end;
}

.card-h--latest-list .home-news-card__author-name {
  font-size: 12px;
}

.home-utils-news-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  --home-utils-card-h: 106px;
}

.home-utils-news-item {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  height: var(--home-utils-card-h);
  min-height: var(--home-utils-card-h);
  max-height: var(--home-utils-card-h);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-card);
  transition: box-shadow var(--t-mid), border-color var(--t-mid);
  overflow: hidden;
  min-height: 0;
}

.home-utils-news-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: color-mix(in srgb, var(--red) 35%, var(--border));
}

.home-utils-news-thumb {
  display: block;
  align-self: stretch;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  border-radius: 0;
}

.home-utils-news-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
}

.home-utils-news-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 10px 12px;
  justify-content: center;
  overflow: hidden;
}

.home-utils-news-title {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

.home-utils-news-title a {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  min-height: calc(1.4em * 2);
  max-height: calc(1.4em * 2);
  color: var(--text-main);
  text-decoration: none;
  transition: color var(--t-fast);
}

.home-utils-news-title a:hover {
  color: var(--red);
}

.home-utils-news-body .home-news-card__author {
  margin-top: 0;
  text-align: end;
}

.home-utils-news-body .home-news-card__author-name {
  font-size: 12px;
}

.home-news-pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--home-grid-gap);
  align-items: stretch;
}

.home-scroll-news {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--home-grid-gap);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(193, 11, 27, 0.55) transparent;
}

.home-scroll-news > .card,
.home-scroll-news > article.card {
  flex: 0 0 clamp(240px, 72vw, 280px);
  width: clamp(240px, 72vw, 280px);
  max-width: none;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.home-scroll-news::-webkit-scrollbar {
  height: 6px;
}

.home-scroll-news::-webkit-scrollbar-thumb {
  background: rgba(193, 11, 27, 0.55);
  border-radius: 999px;
}

.home-news-card--text-only {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
}

.home-news-card--text-only .home-news-card__body {
  padding: 14px 16px 16px;
}

.home-scroll-news > .home-news-card--text-only {
  flex: 0 0 clamp(220px, 68vw, 280px);
  width: clamp(220px, 68vw, 280px);
}

.home-block--breaking .home-news-card__title {
  -webkit-line-clamp: 4;
}

.home-block--breaking-stack {
  padding-block: clamp(12px, 2vw, 20px);
}

.home-block--breaking-stack .article-breaking-stack,
.home-block--breaking-stack .article-news-stack {
  max-width: 100%;
}

.home-block--all-news .sec-label,
.home-block--breaking .sec-label {
  margin-bottom: clamp(16px, 2vw, 22px);
}

.home-articles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--home-grid-gap);
  align-items: stretch;
}

@media (max-width: 992px) {
  .home-articles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(10px, 3vw, 16px);
  }
}

.news-list-view.home-latest-list {
  gap: var(--home-block-gap);
}

/* ── Category blocks ──────────────────────────────────────── */
.home-category-groups-label {
  margin-bottom: clamp(16px, 2vw, 24px);
}

.home-block--categories .home-cat-block.section {
  padding-block: var(--home-section-pad-sm);
}

.home-cat-block + .home-cat-block {
  margin-top: var(--home-block-gap);
}

.home-subcat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 clamp(18px, 2.2vw, 24px);
}

.home-subcat-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: border-color var(--t-fast), color var(--t-fast);
}

.home-subcat-pill:hover {
  border-color: var(--red);
  color: var(--red);
}

.home-cat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(20px, 2.5vw, 28px);
  align-items: start;
}

.home-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--home-grid-gap);
  align-items: stretch;
}

/* ── Utilities row ────────────────────────────────────────── */
.home-utils-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.2vw, 24px);
  align-items: stretch;
}

.home-block--latest .sec-label,
.home-block--diverse .sec-label,
.home-block--utilities .sec-label,
.home-block--breaking .sec-label {
  margin-bottom: clamp(18px, 2.2vw, 24px);
}

.home-utils-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.home-utils-panel-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.home-utils-panel-footer .btn {
  width: 100%;
  justify-content: center;
}

.home-utils-ranked {
  padding: 8px 12px 12px;
}

.home-utils-ranked-item.card-ranked {
  text-decoration: none;
  color: inherit;
}

.home-utils-ranked-item .card-ranked-thumb {
  display: block;
  aspect-ratio: 4 / 3;
  height: auto;
}

.home-utils-ranked-item .card-ranked-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-decoration: none;
  margin-bottom: 0;
}

.home-utils-ranked-item .home-news-card__author {
  margin-top: 6px;
}

.home-utils-ranked-item .home-news-card__author-name {
  font-size: 11px;
}

.home-utils-ranked-item .home-news-card__author-avatar {
  width: 26px;
  height: 26px;
}

.home-utils-ranked-item:hover .card-ranked-num,
.home-utils-ranked-item:hover .card-ranked-title {
  color: var(--red);
}

.home-utils-ranked-item:hover .card-ranked-thumb img {
  transform: scale(1.06);
}

/* ── Home widgets band (weather + exchange) ──────────────── */
.home-widgets-scroll {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 32px);
  width: 100%;
  max-width: 100%;
}

.home-widget-panel {
  color: var(--text-main);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.home-widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  margin-bottom: clamp(12px, 2vw, 16px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.home-widget-sec-label {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}

.home-widget-sec-label .sec-label-text {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

.home-widget-sec-label .sec-divider {
  min-width: 12px;
}

.home-widget-sec-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--t-fast);
}

.home-widget-sec-link:hover,
.home-widget-sec-link:focus-visible {
  color: var(--red);
  outline: none;
}

.home-widget-loc-wrap {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  max-width: min(46%, 168px);
}

.home-widget-loc {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 100%;
  max-width: 100%;
  padding-block: 5px;
  padding-inline: 10px 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  box-sizing: border-box;
}

.home-widget-loc:focus {
  outline: none;
  border-color: var(--text-muted);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text-main) 12%, transparent);
}

.home-widget-loc-icon {
  position: absolute;
  inset-inline-end: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: var(--text-main);
  pointer-events: none;
}

/* ── Home weather strip ───────────────────────────────────── */
.home-weather-strip {
  color: var(--text-main);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.home-weather-strip__body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.home-weather-days {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 100%;
}

.home-weather-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 4px;
  min-width: 0;
  overflow: hidden;
}

.home-weather-day + .home-weather-day::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 10%;
  bottom: 10%;
  width: 1px;
  background: var(--border-mid);
}

.home-weather-day__name {
  font-size: clamp(0.62rem, 2.8vw, 0.75rem);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: clamp(4px, 1vw, 8px);
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-weather-day__temp {
  font-size: clamp(1.1rem, 4.5vw, 1.65rem);
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
  margin-bottom: clamp(4px, 1vw, 8px);
  letter-spacing: -0.03em;
  max-width: 100%;
}

.home-weather-day__deg {
  font-size: 0.52em;
  font-weight: 700;
  letter-spacing: 0;
}

.home-weather-day__foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: auto;
  min-height: 24px;
  max-width: 100%;
}

.home-weather-day__min {
  font-size: clamp(0.65rem, 2.5vw, 0.78rem);
  font-weight: 600;
  color: var(--text-muted);
}

.home-weather-day__icon {
  width: clamp(22px, 6vw, 30px);
  height: clamp(22px, 6vw, 30px);
  object-fit: contain;
  flex-shrink: 0;
}

.weather-spinner--mono {
  border-color: var(--border);
  border-block-start-color: var(--text-main);
}

.home-weather-state {
  min-height: 72px;
}

.home-weather-strip .weather-state--error .btn {
  color: var(--text-main);
  border-color: var(--border-mid);
}

/* ── Home exchange strip (flat, matches weather) ─────────── */
.home-exchange-strip {
  color: var(--text-main);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.home-exchange-strip__body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.home-exchange-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 100%;
}

.home-exchange-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 4px;
  min-width: 0;
  overflow: hidden;
}

.home-exchange-col + .home-exchange-col::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 10%;
  bottom: 10%;
  width: 1px;
  background: var(--border-mid);
}

.home-exchange-col__name {
  font-size: clamp(0.62rem, 2.8vw, 0.75rem);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: clamp(4px, 1vw, 8px);
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-exchange-col__rate {
  font-size: clamp(0.95rem, 3.8vw, 1.35rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
  margin-bottom: clamp(4px, 1vw, 8px);
  letter-spacing: -0.02em;
  max-width: 100%;
  word-break: break-word;
}

.home-exchange-col__foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: auto;
  min-height: 24px;
  max-width: 100%;
}

.home-exchange-col__code {
  font-size: clamp(0.65rem, 2.5vw, 0.78rem);
  font-weight: 600;
  color: var(--text-muted);
}

.home-exchange-col__icon {
  font-size: clamp(0.95rem, 3vw, 1.15rem);
  flex-shrink: 0;
  color: var(--text-main);
}

.home-exchange-icon--lbp,
.home-exchange-icon--eur,
.home-exchange-icon--gbp,
.home-exchange-icon--sar,
.home-exchange-icon--usd,
.home-exchange-icon--aed,
.home-exchange-icon--try,
.home-exchange-icon--default {
  color: var(--text-main);
}

.home-exchange-state {
  min-height: 72px;
}

.home-exchange-strip .exchange-state--error .btn {
  color: var(--text-main);
  border-color: var(--border-mid);
}

.home-utils-grid--single {
  grid-template-columns: 1fr;
  max-width: 720px;
}

/* ── Tablet ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .home-featured-grid {
    grid-template-columns: 1fr;
  }

  .home-cat-layout {
    grid-template-columns: 1fr;
  }

  .home-utils-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Mobile: horizontal scroll via section-scroll-mobile.css ─ */
@media (max-width: 768px) {
  :root {
    --home-section-pad: clamp(20px, 5vw, 32px);
    --home-section-pad-sm: clamp(18px, 4vw, 26px);
    --home-block-gap: 18px;
    --home-grid-gap: 16px;
  }

  .home-block--featured {
    padding-bottom: 8px;
  }

  .home-block--featured + .home-block--articles {
    padding-top: 8px;
  }

  .home-block--articles .sec-label {
    margin-bottom: 12px;
  }

  .home-featured-side-item {
    grid-template-columns: 100px minmax(0, 1fr);
  }

  .home-block .sec-label {
    margin-bottom: 18px;
  }

  .home-cat-block + .home-cat-block {
    margin-top: 14px;
  }

  .home-utils-news-item {
    grid-template-columns: 132px minmax(0, 1fr);
  }

  .home-utils-news-list {
    --home-utils-card-h: 100px;
  }

  .home-news-pair-grid {
    gap: 14px;
  }

  .home-scroll-news {
    width: calc(100% + 2 * var(--gutter));
    max-width: none;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
  }

  .home-widgets-scroll {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding-bottom: 4px;
    scroll-padding-inline: var(--gutter);
  }

  .home-widget-panel {
    flex: 0 0 min(88vw, 420px);
    scroll-snap-align: start;
    min-width: min(88vw, 420px);
  }

  .home-widget-sec-label .sec-divider {
    display: none;
  }

  .home-widget-loc-wrap {
    max-width: min(44%, 150px);
  }

  .home-weather-day,
  .home-exchange-col {
    padding: 0 2px;
  }
}

@media (max-width: 390px) {
  .home-featured-side-item {
    grid-template-columns: 88px minmax(0, 1fr);
    padding: 8px 10px;
  }
}
