/* ==========================================================================
   Home page — key dates (NSFAS deadline and NSC exam timetable)
   Page-specific, like study-techniques.css: loaded only by index.html.
   ========================================================================== */

.kd-section { padding-top: 3rem; }
/* key-dates.js retires passed items with [hidden]; the display rules below
   (inline-flex badges, block rows on phones) would otherwise win over it. */
.kd-section [hidden], .kd-section[hidden] { display: none !important; }
.kd-section .section-head { margin-bottom: 2rem; }

.kd-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.kd-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand-500);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.6rem;
  box-shadow: var(--shadow);
}
.kd-card--nsfas { border-top-color: var(--warning); }
.kd-card h3 { font-size: 1.25rem; margin-bottom: 0.35rem; }
.kd-card p { color: var(--ink-2); }

.kd-card__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.kd-card__kicker {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.kd-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--brand-50);
  color: var(--brand-700);
}
.kd-status--urgent { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.kd-status--closed { background: #f1f5f9; color: var(--ink-3); }

.kd-facts {
  display: grid;
  gap: 0.55rem;
  padding: 0.9rem 1rem;
  background: var(--bg);
  border-radius: var(--radius);
}
.kd-facts > div {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 0.75rem;
}
.kd-facts dt { font-size: 0.85rem; color: var(--ink-3); }
.kd-facts dd { font-weight: 600; color: var(--ink); }
.kd-caveat { font-weight: 400; color: var(--ink-3); font-size: 0.85rem; }

.kd-card__action { align-self: flex-start; margin-top: auto; }

.kd-source { font-size: 0.8rem; color: var(--ink-3); }
.kd-source a { text-decoration: underline; text-underline-offset: 2px; }

/* ---- Timetable ---- */
.kd-timetable-wrap {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.6rem;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 5rem;
}
.kd-timetable-wrap h3 { font-size: 1.15rem; margin-bottom: 0.3rem; }
.kd-timetable-wrap > .kd-source { margin-bottom: 1rem; }

.kd-timetable { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.kd-timetable caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.kd-timetable thead th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 0.9rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.kd-timetable tbody th,
.kd-timetable td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink-2);
}
.kd-timetable tbody th { width: 11rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.kd-timetable tbody tr:last-child > * { border-bottom: none; }

.kd-break > * { background: var(--bg); color: var(--ink-3) !important; font-style: italic; }
.kd-break th { font-style: normal; }

.kd-timetable tr.is-next > * { background: var(--brand-50); }
.kd-timetable tr.is-next th { box-shadow: inset 4px 0 0 var(--brand-600); }
.kd-next {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--brand-600);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: 0.1em;
}

@media (max-width: 900px) {
  .kd-grid { grid-template-columns: 1fr; }
}

/* Phones: each exam day becomes a stacked block with its own session labels,
   so nothing scrolls sideways and no subject name is squeezed into a column. */
@media (max-width: 640px) {
  .kd-section { padding-top: 2rem; }
  .kd-card, .kd-timetable-wrap { padding: 1.15rem 1rem; }
  .kd-facts > div { grid-template-columns: 1fr; gap: 0.1rem; }
  .kd-card__action { align-self: stretch; text-align: center; }

  .kd-timetable thead { display: none; }
  .kd-timetable,
  .kd-timetable tbody,
  .kd-timetable tr,
  .kd-timetable tbody th,
  .kd-timetable td { display: block; width: auto; }
  .kd-timetable tr { border-bottom: 1px solid var(--border); padding: 0.7rem 0.75rem; }
  .kd-timetable tbody tr:last-child { border-bottom: none; }
  .kd-timetable tbody th,
  .kd-timetable td { border-bottom: none; padding: 0.15rem 0; white-space: normal; }
  .kd-timetable tbody th { margin-bottom: 0.2rem; }
  .kd-timetable td::before {
    display: inline-block;
    min-width: 3.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ink-3);
  }
  .kd-timetable td:nth-of-type(1)::before { content: "09:00"; }
  .kd-timetable td:nth-of-type(2)::before { content: "14:00"; }
  .kd-break td:nth-of-type(1)::before { content: none; }
  .kd-timetable tr.is-next > * { background: transparent; }
  .kd-timetable tr.is-next { background: var(--brand-50); box-shadow: inset 4px 0 0 var(--brand-600); }
  .kd-timetable tr.is-next th { box-shadow: none; }
  .kd-break { background: var(--bg); }
  .kd-break > * { background: transparent; }
}
