/* HOME2 / HOME2R — platform `/` dense overview reusing shared day/month partials. */

.home2 {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 32px;
}

.home2-row {
  display: grid;
  gap: 16px;
  align-items: stretch;
}

.home2-hero-row {
  grid-template-columns: 1fr;
}

/* Day hero is a direct child of the hero row on Home.
   Override flagship `.desk-hero { grid-column: 1 / -1 }` so it sits in column 1. */
.home2-hero-row > .sheet.desk-hero {
  grid-column: auto;
  margin: 0;
  height: 100%;
  min-height: 0;
}

.home2-hero-row > .sheet.is-compact .daily-line,
.home2-hero-row > .sheet.is-compact .share-row {
  display: none;
}

/* —— Equal-height right rail (HOME2S) ——
   Four real blocks (hours, tiết khí, trực/sao, lễ). space-between pins
   first/last so trailing empty is gone; mid gaps stay ≤48 when leftover
   is modest. Never use margin-top:auto (that made a ~120px mid band). */
.home2-rail {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 5%, transparent);
  box-sizing: border-box;
}

.home2-rail-block {
  min-width: 0;
}

.home2-rail-holidays {
  margin-top: 0;
}

.home2-rail-title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-family: "Source Serif 4", "Be Vietnam Pro", Georgia, serif;
  font-weight: 600;
}

.home2-rail-title a {
  color: var(--ink);
  text-decoration: none;
}

.home2-rail-hours {
  margin: 0;
}

.home2-rail-term-name {
  margin: 0 0 6px;
  font-weight: 700;
}

.home2-rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.home2-rail-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.home2-rail-list li:last-child {
  border-bottom: 0;
}

.home2-rail-list a {
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.home2-rail-list small {
  color: var(--muted);
  flex: none;
  font-size: 0.8rem;
}

.home2-pair.desk-pair {
  margin: 0;
}

/* Fill highlights with the ±3 day strip on Home */
.home2-strip-title {
  margin: 14px 0 6px;
  font-size: 1rem;
}

.home2-score-strip {
  margin-top: 4px;
}

.home2-month {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 5%, transparent);
}

.home2-month-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.home2-month-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.home2-month-head a {
  color: var(--ink);
  text-decoration: none;
}

.home2-month-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--link, var(--seal));
  white-space: nowrap;
}

.home2-modules h2 {
  margin: 8px 0 4px;
  font-size: 1.35rem;
}

.home2-group {
  margin: 18px 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.home2-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
}

/* —— Card standard (see docs/ui/card-standard.md) —— */
.mod-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--ink) 5%, transparent);
}

.mod-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.mod-card-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--seal);
}

.mod-card-icon .ic {
  width: 22px;
  height: 22px;
  display: block;
  color: inherit;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mod-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-family: "Source Serif 4", "Be Vietnam Pro", Georgia, serif;
  font-weight: 600;
  min-width: 0;
}

.mod-card-title a {
  color: var(--ink);
  text-decoration: none;
}

.mod-card-more {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--link, var(--seal));
  text-decoration: none;
  white-space: nowrap;
}

.mod-card-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  flex: 1;
}

.mod-card-rows li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  font-size: 0.95rem;
  min-width: 0;
}

.mod-card-rows li:last-child {
  border-bottom: 0;
}

/* HOME2T: no ellipsis / line-clamp on card or rail data — wrap; copy stays short */
.mod-card,
.mod-card *,
.home2-rail,
.home2-rail * {
  text-overflow: clip;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

.mod-card-rows a,
.mod-card-rows span {
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mod-card-rows small {
  color: var(--muted);
  flex: 0 1 auto;
  max-width: 48%;
  font-size: 0.8rem;
  white-space: normal;
  text-align: right;
  padding-top: 2px;
  overflow-wrap: anywhere;
  text-overflow: clip;
}

.home2-rail-list a,
.home2-rail-list span,
.home2-rail-list small,
.home2-rail-term-name,
.home2-rail-title {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mod-card-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.mod-card-cta {
  margin: auto 0 0;
  padding-top: 4px;
}

.mod-card-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--seal) 55%, var(--line));
  background: color-mix(in srgb, var(--seal) 12%, var(--card));
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

/* HOME2S — Việc nên làm: stretch columns so card matches Nổi bật without a hollow band */
.home2 .home2-pair #viec.block {
  display: flex;
  flex-direction: column;
}

.home2 .home2-pair #viec .two {
  flex: 1;
  align-items: stretch;
}

.home2 .home2-pair #viec .good,
.home2 .home2-pair #viec .bad {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.home2 .home2-pair #viec .act-list {
  flex: 1;
}

.home2 .home2-pair #diem.block {
  display: flex;
  flex-direction: column;
}

.home2 .home2-pair #diem .home2-score-strip {
  margin-top: auto;
}

@media (min-width: 768px) {
  .home2-hero-row {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }
  .home2-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .home2-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .home2-rail {
    order: 2;
  }
  .home2-month .month-layout {
    grid-template-columns: 1fr;
  }
}
