/* =========================================================
   KEMHOW — components for the Programs sub-pages.
   Builds on the tokens and patterns in the original site CSS
   (paper ground, navy/maroon, 2px corners, ruled rows).
   ========================================================= */

/* -------------------- clickable program cards -------------------- */
a.program--link{
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.3s ease, padding-left 0.3s ease;
}
a.program--link:hover{ background: rgba(178,31,36,0.04); padding-left: 0.9rem; }
a.program--link:focus-visible{ outline-offset: -3px; }
.program-cta{
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.2rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--maroon);
}
.program-cta svg{ transition: transform 0.25s cubic-bezier(.16,.8,.3,1); }
a.program--link:hover .program-cta svg{ transform: translateX(5px); }

/* -------------------- year picker (Sessions) -------------------- */
.pick{
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(15,22,56,0.6);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.pick.is-open{ opacity: 1; visibility: visible; }
.pick__card{
  position: relative;
  width: min(560px, 100%);
  background: var(--paper);
  border-top: 4px solid var(--maroon);
  border-radius: 2px;
  padding: 2.2rem 2rem 2rem;
  box-shadow: 0 30px 60px -20px rgba(15,22,56,0.6);
  transform: translateY(16px);
  transition: transform 0.35s cubic-bezier(.16,.8,.3,1);
}
.pick.is-open .pick__card{ transform: none; }
.pick__card h2{ font-size: 1.6rem; margin-bottom: 0.4rem; padding-right: 2rem; }
.pick__card > p{ margin-bottom: 1.5rem; }
.pick__x{
  position: absolute; right: 0.8rem; top: 0.8rem;
  background: none; border: 0; padding: 0.45rem; line-height: 0;
  color: var(--muted); cursor: pointer; border-radius: 2px;
}
.pick__x:hover{ color: var(--navy-ink); }
.year-opts{ display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.year-opt{
  display: block;
  background: var(--white);
  border: 1px solid rgba(28,27,24,0.16);
  border-radius: 2px;
  padding: 1.3rem 1.3rem 1.2rem;
  color: var(--navy-ink);
  transition: transform 0.25s cubic-bezier(.16,.8,.3,1), border-color 0.2s ease, box-shadow 0.25s ease;
}
.year-opt:hover{ transform: translateY(-4px); border-color: var(--navy); box-shadow: 0 16px 30px -18px var(--shadow-navy); }
.year-opt .yr{
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 2.3rem;
  line-height: 1;
  color: var(--maroon);
  margin-bottom: 0.7rem;
}
.year-opt strong{ display: block; font-family: var(--serif); font-size: 1.12rem; font-weight: 600; }
@media (max-width: 520px){ .year-opts{ grid-template-columns: 1fr; } .pick__card{ padding: 1.8rem 1.4rem 1.5rem; } }

/* -------------------- breadcrumb + toolbar -------------------- */
.crumb{
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.9rem; font-weight: 600; color: var(--muted);
  margin-bottom: 1.6rem;
  transition: color 0.15s ease;
}
.crumb svg{ transition: transform 0.2s ease; }
.crumb:hover{ color: var(--maroon); }
.crumb:hover svg{ transform: translateX(-4px); }

.toolbar{ display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; justify-content: space-between; margin-bottom: 1.8rem; }
.search{ position: relative; flex: 1 1 260px; max-width: 380px; }
.search svg{ position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search input{
  width: 100%;
  border: 1px solid rgba(28,27,24,0.28);
  background: var(--white);
  padding: 0.7rem 0.85rem 0.7rem 2.5rem;
  font: inherit; font-size: 0.95rem;
  border-radius: 2px; color: var(--ink);
  transition: border-color 0.2s ease;
}
.search input:hover{ border-color: rgba(28,27,24,0.5); }
.chips{ display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip{
  font: inherit; font-size: 0.82rem; font-weight: 600;
  background: transparent; color: var(--navy);
  border: 1px solid rgba(40,56,141,0.35);
  padding: 0.35rem 0.8rem; border-radius: 2px; cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.chip:hover{ background: rgba(40,56,141,0.08); }
.chip[aria-pressed="true"]{ background: var(--navy); color: var(--white); border-color: var(--navy); }

/* -------------------- year tabs -------------------- */
.tabs{ display: flex; gap: 2rem; border-bottom: 1px solid rgba(28,27,24,0.14); margin-bottom: 0.5rem; }
.tabs a{
  position: relative; padding: 0.7rem 0; font-weight: 600; font-size: 0.95rem; color: var(--muted);
  transition: color 0.15s ease;
}
.tabs a::after{ content: ""; position: absolute; left: 0; right: 100%; bottom: -1px; height: 2px; background: var(--red); transition: right 0.25s ease; }
.tabs a:hover{ color: var(--navy-ink); }
.tabs a[aria-current="page"]{ color: var(--navy-ink); }
.tabs a[aria-current="page"]::after{ right: 0; }

/* -------------------- publications grid -------------------- */
.pubs{ display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.25rem; }
.pub{
  display: flex; flex-direction: column; gap: 0.6rem;
  background: var(--white);
  border: 1px solid rgba(28,27,24,0.12);
  border-radius: 2px;
  padding: 1.5rem 1.5rem 1.3rem;
  color: inherit;
  transition: transform 0.3s cubic-bezier(.16,.8,.3,1), box-shadow 0.3s ease, border-color 0.2s ease;
}
.pub:hover{ transform: translateY(-5px); border-color: rgba(40,56,141,0.45); box-shadow: 0 18px 34px -20px var(--shadow-navy); }
.pub__top{ display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.pub__top .tag{
  font-size: 0.75rem; font-weight: 600; color: var(--navy);
  border: 1px solid rgba(40,56,141,0.35); padding: 0.2rem 0.6rem; border-radius: 2px;
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background 0.3s ease, color 0.3s ease;
}
.pub:hover .tag{ background: var(--navy); color: var(--white); }
.pub h3{ font-size: 1.2rem; margin: 0.2rem 0 0; }
.pub p{
  margin: 0; font-size: 0.94rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.pub__foot{
  margin-top: auto; padding-top: 0.9rem;
  border-top: 1px solid rgba(28,27,24,0.1);
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  font-size: 0.82rem; color: var(--muted);
}
.pub__open{ display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; color: var(--maroon); }

/* -------------------- ruled directory rows -------------------- */
.rows{ border-top: 1px solid rgba(28,27,24,0.14); }
.row{
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.7rem 0;
  border-bottom: 1px solid rgba(28,27,24,0.14);
  color: inherit;
  transition: background 0.3s ease, padding-left 0.3s ease;
}
.row:hover{ background: rgba(178,31,36,0.04); padding-left: 0.7rem; }
.row__icon{ display: flex; justify-content: center; transition: transform 0.4s cubic-bezier(.34,1.56,.64,1); }
.row:hover .row__icon{ transform: scale(1.1) rotate(-4deg); }
.row h3{ font-size: 1.25rem; margin-bottom: 0.3rem; }
.row p{
  margin: 0; font-size: 0.95rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row__meta{ text-align: right; font-size: 0.85rem; color: var(--muted); line-height: 1.5; white-space: nowrap; }
.row__meta b{ display: block; font-weight: 600; color: var(--navy); }
@media (max-width: 640px){
  .row{ grid-template-columns: 52px minmax(0, 1fr); gap: 1rem; }
  .row__meta{ grid-column: 2; text-align: left; }
  .row__meta b{ display: inline; margin-right: 0.6rem; }
}

/* -------------------- detail layout + prose -------------------- */
.detail{ display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 3rem; margin-bottom: 3.5rem; }
.detail dl{ margin: 0; }
.detail dt{ font-size: 0.78rem; font-weight: 600; color: var(--maroon); margin-top: 1.1rem; }
.detail dt:first-child{ margin-top: 0; }
.detail dd{ margin: 0.2rem 0 0; color: var(--ink); }
.prose{ font-family: var(--serif); font-size: 1.14rem; line-height: 1.78; color: var(--ink); }
.prose p{ max-width: 66ch; color: var(--ink); margin: 0 0 1.15em; }
.prose p:first-child{ font-size: 1.28rem; font-style: italic; color: var(--navy-ink); }
@media (max-width: 760px){ .detail{ grid-template-columns: 1fr; gap: 1.5rem; } }

.gallery-head{
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  border-bottom: 1px solid rgba(28,27,24,0.14); padding-bottom: 0.8rem; margin-bottom: 1.4rem;
}
.gallery-head h2{ font-size: 1.5rem; margin: 0; }
.gallery-head span{ font-size: 0.88rem; color: var(--muted); }

/* -------------------- empty / error states + skeletons -------------------- */
.state{ text-align: center; padding: 4.5rem 1rem 4rem; border: 1px dashed rgba(28,27,24,0.22); border-radius: 2px; background: rgba(255,255,255,0.45); }
.state__icon{ display: flex; justify-content: center; margin-bottom: 1rem; opacity: 0.9; }
.state h3{ font-size: 1.35rem; margin-bottom: 0.4rem; }
.state p{ margin: 0 auto 1.2rem; }
.state .btn{ margin-top: 0.4rem; }
.state--error h3{ color: var(--maroon); }

.skel{ position: relative; }
.skel i, .skel b{
  display: block; border-radius: 2px;
  background: linear-gradient(110deg, #E7DFC9 30%, #F3EEDF 50%, #E7DFC9 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.skel--card{ background: var(--white); border: 1px solid rgba(28,27,24,0.1); padding: 1.5rem; border-radius: 2px; }
.skel--card i{ width: 44px; height: 44px; margin-bottom: 1rem; }
.skel--card b{ height: 12px; margin-bottom: 10px; }
.skel--card b.short{ width: 55%; }
.skel--row{ display: grid; grid-template-columns: 72px 1fr; gap: 1.5rem; align-items: center; padding: 1.7rem 0; border-bottom: 1px solid rgba(28,27,24,0.14); }
.skel--row i{ width: 44px; height: 44px; margin: 0 auto; }
.skel--row b{ height: 14px; margin-bottom: 10px; max-width: 520px; }
.skel--row b.short{ width: 40%; margin-bottom: 0; }
@media (prefers-reduced-motion: reduce){
  .skel i, .skel b, .gal__item, .lb__spin{ animation: none; }
}

.noscript-note{ padding: 1rem 1.2rem; border: 1px solid rgba(178,31,36,0.35); background: rgba(178,31,36,0.06); color: var(--maroon); border-radius: 2px; }

/* =========================================================
   LAYOUT BALANCE (linked on every page, after the page's own CSS)
   Fixes text that stopped short of its column and left a
   dead strip on the right on desktop. Mobile is unchanged.
   ========================================================= */

/* Section intro (kicker + heading on the left, lede on the right):
   the lede used to stop at ~46ch inside a much wider column. */
.section-head{
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
}
.section-head .lede{
  max-width: none;
  font-size: clamp(1.1rem, 0.95rem + 0.55vw, 1.32rem);
  line-height: 1.65;
}
@media (max-width: 760px){
  .section-head{ grid-template-columns: 1fr; gap: 1rem; }
}

/* Numbered lists (Objectives): the body copy now runs the full width of its
   column instead of stopping short of the right edge. */
.objective-row p{ max-width: none; }

/* Single-column reading sections (About: "The name"): use the whole narrow
   container, with a slightly larger, more open setting for the longer lines. */
.section-inner[style*="max-width"] > p{
  max-width: none;
  font-size: 1.06rem;
  line-height: 1.78;
}

/* Programs: on alternating rows the figure moves to the right, but the 300px
   column stayed on the left, squeezing the text into it. The columns now swap too. */
@media (min-width: 761px){
  .program:nth-child(even){ grid-template-columns: 1fr 300px; }
}
.program p{ max-width: min(100%, 70ch); }

/* =========================================================
   VIDEO (YouTube embed on session + event pages)
   ========================================================= */
.video{ max-width: 960px; margin: 0 0 3rem; }
.video__frame{
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--navy-ink);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 24px 44px -28px var(--shadow-navy);
}
.video__frame iframe{ position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__bar{ display: flex; justify-content: flex-end; margin-top: 0.7rem; }
.video__link{
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.86rem; font-weight: 600; color: var(--muted);
  padding: 0.3rem 0; border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.video__link:hover{ color: var(--maroon); border-bottom-color: var(--maroon); }
@media (max-width: 520px){ .video__bar{ justify-content: flex-start; } }

/* Several videos: two per row on wide screens, one per row on small ones. */
.videos{ margin: 0 0 3rem; display: grid; gap: 2rem; }
.videos .video{ margin: 0; max-width: none; }
.video{ width: 100%; }
.videos:not(.videos--many){ max-width: 960px; }
.videos--many{ grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
