/* cu-access.css — /child-custody/ section 6 (src/components/custody/Access.astro), on top of the UNCHANGED
   dp-consultant.css (the 離婚手續 consultant shell: deep green, the ground switch, the cut-out rise, the
   focus pin + cover runway). This file adds the right column's switch, panels and example week, and
   decides the pin (FIX 1 R2, J ruling):
   - compact first: the three boxes stay one row down to 1024 wide, spacing tightens at <= 800 tall;
   - the section pins (dp-consultant.css: top 0, 2.3-screen runway, the next section covers it) ONLY
     when it fits in the viewport. Taller than the viewport, cu-access.js sets [data-cu-acc-unpinned]
     on the runway and the section scrolls normally: a pinned section taller than the screen kept its
     heading above the view for the whole hold (1366x768 top -159, 1024x768 -405). The light reveal
     on entry (dp-consultant.js's ground switch) is unchanged either way.
   - the three panels share one grid cell at >= 1024 (the tallest reserves the height), so switching
     never changes the section height, so never flips the pin decision. */

/* the section BEFORE this one lets the ground show through (dp-consultant.css does this for
   離婚手續's .dpp-section), and its heading follows the light on the same class and clock */
.cu-orders.dp-steps { background: transparent; }
.cu-orders .dp-steps-head .h2, .cu-orders .dp-steps-head .lead, .cu-orders .dp-steps-head .eyebrow { transition: color .8s cubic-bezier(.22, 1, .36, 1); }
html.dpc-ground-on .cu-orders .dp-steps-head .h2 { color: var(--paper); }
html.dpc-ground-on .cu-orders .dp-steps-head .lead, html.dpc-ground-on .cu-orders .dp-steps-head .eyebrow { color: var(--mute-d); }
@media (prefers-reduced-motion: reduce) { .cu-orders .dp-steps-head .h2, .cu-orders .dp-steps-head .lead, .cu-orders .dp-steps-head .eyebrow { transition: none; } }

.cu-access .cu-acc-copy .lead { max-width: 36em; }
/* FIX 1 R8: the cut-out file itself now ends at the figure's feet (cu-access-a2.webp, floor cropped), so
   the image box bottom IS the painted bottom: no offset here, dp-consultant.css's bottom:0 lands it. */

/* ---- the 3-way switch (role=tablist), 44px targets; only shown once cu-access.js arms it ---- */
.cu-access .cu-acc-tabs { display: none; gap: 6px; margin-top: 24px; padding: 4px; border-radius: 999px; background: rgba(242,243,238,.08); border: 1px solid rgba(242,243,238,.22); width: max-content; max-width: 100%; }
.cu-access[data-cu-acc-armed] .cu-acc-tabs { display: flex; }
.cu-access .cu-acc-tab { min-height: 44px; min-width: 44px; padding: 0 18px; border-radius: 999px; color: var(--mute-d); font-size: 15px; font-weight: 500; white-space: nowrap; transition: background-color .25s ease, color .25s ease; }
.cu-access .cu-acc-tab[aria-selected="true"] { background: var(--paper); color: var(--green); }
.cu-access .cu-acc-tab:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---- panels: stacked with their own titles by default (no JS) ---- */
.cu-access .cu-acc-panels { margin-top: 20px; }
.cu-access .cu-acc-panel + .cu-acc-panel { margin-top: 28px; }
.cu-access .cu-acc-ptitle { margin: 0 0 10px; font-family: var(--serif); font-size: 20px; font-weight: 500; color: var(--paper); }
.cu-access[data-cu-acc-armed] .cu-acc-ptitle { display: none; }
.cu-access[data-cu-acc-armed] .cu-acc-panel + .cu-acc-panel { margin-top: 0; }
.cu-access[data-cu-acc-armed] .cu-acc-panel:not(.is-on) { display: none; }
@media (min-width: 1024px) {
  .cu-access[data-cu-acc-armed] .cu-acc-panels { display: grid; }
  .cu-access[data-cu-acc-armed] .cu-acc-panel { grid-area: 1 / 1; }
  .cu-access[data-cu-acc-armed] .cu-acc-panel:not(.is-on) { display: block; visibility: hidden; }
}
.cu-access .cu-acc-panel.is-on { animation: cu-acc-in .35s cubic-bezier(.22, 1, .36, 1); }
@keyframes cu-acc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* the three boxes, in the consultant's box style (dpc-cards), three across on desktop */
.cu-access .cu-acc-boxes { margin-top: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cu-access .cu-acc-boxes article { padding: 14px 16px; }
.cu-access .cu-acc-boxes h3 { font-size: 15px; font-family: var(--sans); font-weight: 500; letter-spacing: .06em; color: var(--amber); }
.cu-access .cu-acc-boxes p { margin-top: 6px; font-size: 14px; line-height: 1.6; color: var(--paper); }

/* ---- the example week (有界定 panel) ---- */
.cu-access .cu-week { margin-top: 14px; padding: 16px; border-radius: var(--r-sm); background: rgba(242,243,238,.08); border: 1px solid rgba(242,243,238,.4); }
.cu-access .cu-week-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; }
.cu-access .cu-week-title { font-family: var(--serif); font-size: 17px; font-weight: 500; color: var(--paper); }
.cu-access .cu-week-cap { font-size: 13px; color: var(--mute-d); }
.cu-access .cu-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.cu-access .cu-day { min-height: 44px; min-width: 0; border-radius: 10px; border: 1px solid rgba(242,243,238,.3); color: var(--paper); font-size: 15px; font-weight: 500; transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
.cu-access .cu-day.is-visit { border-color: var(--amber); color: var(--amber); }
.cu-access .cu-day.is-sel { background: var(--paper); border-color: var(--paper); color: var(--green); }
.cu-access .cu-day.is-visit.is-sel { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.cu-access .cu-day:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.cu-access .cu-day-note { margin: 10px 0 0; min-height: 1.6em; font-size: 14px; color: var(--paper); }
.cu-access .cu-day-note b { margin-right: 8px; font-weight: 500; color: var(--amber); }
.cu-access .cu-hols { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.cu-access .cu-hols-label { font-size: 13px; color: var(--mute-d); margin-right: 4px; }
.cu-access .cu-hol { padding: 3px 11px; border-radius: 999px; border: 1px solid rgba(242,243,238,.3); font-size: 13px; color: var(--paper); white-space: nowrap; }

/* ---- the 3-fact strip + the close ---- */
.cu-access .cu-acc-strip { margin-top: 22px; padding-top: 16px; }
.cu-access .cu-acc-end { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 20px; }
.cu-access .cu-acc-end .dpc-cta { margin-top: 0; }
.cu-access .cu-acc-foot { margin: 0; font-size: 14px; color: var(--mute-d); }
.cu-access .cu-acc-foot a { color: var(--paper); text-decoration: underline; text-underline-offset: 4px; }

/* ---- desktop: a tighter column than 離婚手續's (this one is taller) ---- */
@media (min-width: 1024px) {
  .cu-access .dpc-grid { --dpc-top-pad: calc(var(--nav-h) + 32px); }
  .cu-access .dpc-copy { padding-bottom: 40px; }
  .cu-access .dpc-cards { margin-bottom: 0; }
  .cu-access .cu-acc-copy .lead { margin-top: 12px; }
  .cu-access .cu-acc-tabs { margin-top: 18px; }
  .cu-access .cu-acc-panels { margin-top: 14px; }
  .cu-access .cu-acc-boxes article { padding: 12px 14px; }
  .cu-access .cu-acc-boxes p { margin-top: 4px; line-height: 1.55; }
  .cu-access .cu-week { margin-top: 10px; padding: 12px 14px; }
  .cu-access .cu-days { margin-top: 8px; }
  .cu-access .cu-day-note { margin-top: 6px; }
  .cu-access .cu-hols { margin-top: 6px; }
  .cu-access .cu-acc-strip { margin-top: auto; padding-top: 14px; }
  .cu-access .cu-acc-end { margin-top: 16px; }
  /* not pinned (taller than the viewport, cu-access.js): plain flow, no runway, no cover overlap */
  .dpc-runway.cu-access-runway[data-cu-acc-unpinned] { min-height: 0; margin-bottom: 0; }
  .dpc-runway.cu-access-runway[data-cu-acc-unpinned] > .dpc-section.cu-access { position: relative; top: auto; }
}
/* short desktop screens: the same column, tighter (FIX 1 R2) */
@media (min-width: 1024px) and (max-height: 800px) {
  .cu-access .dpc-grid { --dpc-top-pad: calc(var(--nav-h) + 12px); }
  .cu-access .dpc-copy { padding-bottom: 28px; }
  .cu-access .cu-acc-copy .h2 { margin-bottom: 0; }
  .cu-access .cu-acc-copy .lead { margin-top: 8px; line-height: 1.6; }
  .cu-access .cu-acc-tabs { margin-top: 12px; }
  .cu-access .cu-acc-panels { margin-top: 10px; }
  .cu-access .cu-acc-strip { padding-top: 10px; gap: 10px; }
  .cu-access .dpc-strip span { font-size: 12.5px; line-height: 1.5; }
  .cu-access .cu-acc-end { margin-top: 12px; }
}
/* the three boxes stay ONE row down to 1024 wide (FIX 1 R2); one column only on the stacked layout */
@media (max-width: 1023px) {
  .cu-access .cu-acc-boxes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .cu-access .cu-acc-tabs { margin-inline: auto; }
  .cu-access .cu-acc-copy { text-align: left; }
  .cu-access .cu-acc-copy > .eyebrow, .cu-access .cu-acc-copy > .h2, .cu-access .cu-acc-copy > .lead { text-align: center; }
  .cu-access .cu-acc-copy > .lead { margin-inline: auto; }
  .cu-access .cu-acc-end { justify-content: center; text-align: center; }
}
@media (max-width: 420px) {
  .cu-access .cu-acc-tabs { width: 100%; }
  .cu-access .cu-acc-tab { flex: 1 1 0; padding: 0 8px; font-size: 14px; }
  .cu-access .cu-days { gap: 4px; }
  .cu-access .cu-week { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .cu-access .cu-acc-panel.is-on { animation: none; }
  .cu-access .cu-acc-tab, .cu-access .cu-day { transition: none; }
}
