/* Close Cycle Benchmark: builds on /styles.css tokens and /tools/shared/learn.css */

/* Hero */
.cc-hero { padding-bottom: clamp(88px, 10vw, 140px); }
.cc-back { margin-bottom: 28px; }
.cc-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.cc-meta .chip { background: rgba(255, 255, 255, .85); }

/* Shell */
.cc { background: var(--bg-2); padding: clamp(56px, 7vw, 100px) 0 clamp(64px, 8vw, 110px); scroll-margin-top: 64px; }
.cc-head h2 { margin-top: 14px; font-size: clamp(28px, 3.2vw, 42px); max-width: 20ch; }
.cc-head > p:not(.mono) { margin-top: 14px; max-width: 36em; color: var(--text); }
.cc-head--sub { margin-top: clamp(40px, 5vw, 60px); }
.cc-card { background: #fff; border: 1px solid var(--line); padding: clamp(20px, 2.4vw, 32px); min-width: 0; }
.cc-card h3 { margin-top: 10px; font-size: clamp(22px, 2vw, 28px); }
.cc-sub { margin-top: 8px; font-size: 16px; color: var(--text); max-width: 46em; }
.cc-print-head { display: none; }
.cc-empty { padding: 24px; border: 1px dashed #c9ccd2; color: var(--text); background: #fff; }
.cc-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cc-sample { margin-left: 8px; padding: 2px 6px; font-size: 10.5px; color: var(--soft); border: 1px solid var(--line); }

/* Controls */
.cc-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cc-field > span, .cc-deps legend { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); display: flex; justify-content: space-between; gap: 8px; }
.cc-field small { font-size: 14px; line-height: 1.4; color: var(--soft); }
.cc-field input[type="number"], .cc-field select, .cc-ph__name {
  width: 100%; min-height: 44px; padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #c9ccd2; border-radius: 0; transition: border-color .2s ease, box-shadow .2s ease; }
.cc-field select { appearance: none; -webkit-appearance: none; padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%230d2463' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; }
.cc-field input:hover, .cc-field select:hover { border-color: #9aa0aa; }
.cc-field input:focus, .cc-field select:focus, .cc-ph__name:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.cc-field input[type="range"] { width: 100%; height: 44px; accent-color: var(--blue); cursor: pointer; }
.cc-val { color: var(--blue); font-family: var(--mono); font-weight: 500; }
.cc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 18px; font-size: 15px; font-weight: 500; color: var(--ink); box-shadow: inset 0 0 0 1px #c9ccd2; background: #fff; transition: background-color .25s ease, transform .2s var(--ease); }
.cc-btn--blue { background: var(--blue); color: #fff; box-shadow: none; }
.cc-btn--blue:hover { background: var(--blue-deep); }
.cc-btn:active { transform: scale(.98); }
.cc-link { min-height: 44px; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); text-decoration: underline; text-underline-offset: 4px; }
.cc-link:hover { color: var(--blue); }

/* Layout */
.cc-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.cc-summary { position: sticky; top: 88px; }
.cc-context { margin-top: 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 18px 20px; background: #fff; border: 1px solid var(--line); }
.cc-help { margin-top: 20px; display: grid; gap: 8px; }
.cc-help .lx-why { margin-top: 0; }

/* Phase cards */
.cc-list { margin-top: 20px; display: grid; gap: 14px; }
.cc-ph { background: #fff; border: 1px solid var(--line); padding: 14px clamp(14px, 2vw, 22px) 16px; animation: ccIn .5s var(--ease) both; }
@keyframes ccIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.cc-ph__head { display: flex; align-items: center; gap: 10px; }
.cc-ph__n { flex: none; color: var(--blue); font-size: 12px; }
.cc-ph__name { flex: 1 1 auto; min-width: 0; font-size: 18px !important; font-weight: 500; border-color: transparent !important; padding: 0 8px !important; }
.cc-ph__name:hover { border-color: #c9ccd2 !important; }
.cc-ph__name:focus { border-color: var(--blue) !important; }
.cc-ph__tag, .cc-badge { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.cc-ph__tag.is-crit, .cc-badge.is-crit { background: var(--blue); color: #fff; }
.cc-ph__tag.is-slack, .cc-badge.is-slack { background: var(--bg-2); color: var(--soft); box-shadow: inset 0 0 0 1px var(--line); }
.cc-x { flex: none; width: 44px; height: 44px; display: grid; place-items: center; color: var(--soft); }
.cc-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.cc-x:hover { color: var(--blue); background: #f3f5ff; }
.cc-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.cc-field--wide { grid-column: 1 / -1; }
.cc-span2 { grid-column: span 2; }
.cc-deps { border: 0; padding: 0; margin: 0; min-width: 0; }
.cc-deps legend { padding: 0; margin-bottom: 6px; }
.cc-deps__in { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-deps__none { font-size: 14px; color: var(--soft); }
.cc-dep { position: relative; display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; }
.cc-dep input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cc-dep span { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; font-size: 14px; color: var(--text); box-shadow: inset 0 0 0 1px #c9ccd2; transition: background-color .2s ease, color .2s ease; }
.cc-dep span::before { content: ""; width: 12px; height: 12px; box-shadow: inset 0 0 0 1.5px #9aa0aa; }
.cc-dep input:checked + span { background: #f3f5ff; color: var(--navy); box-shadow: inset 0 0 0 1px var(--blue); }
.cc-dep input:checked + span::before { background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.3l2.4 2.4 4.6-5' fill='none' stroke='%23fff' stroke-width='1.8'/%3E%3C/svg%3E") center / 10px no-repeat; box-shadow: none; }
.cc-dep input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.cc-ph__sched { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 15px; color: var(--text); }
.cc-add { margin-top: 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

/* Summary */
.cc-totals { border-top: 3px solid var(--blue); }
.cc-totals > .mono { color: var(--navy); }
.cc-kpis { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.cc-kpi { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.cc-kpi:nth-child(even) { padding-right: 12px; }
.cc-kpi--main { grid-column: 1 / -1; }
.cc-kpi .mono { color: var(--soft); font-size: 12px; }
.cc-kpi b { font-size: 24px; font-weight: 500; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.cc-kpi--main b { font-size: clamp(44px, 4.4vw, 60px); color: var(--blue); line-height: 1.05; }
.cc-flag { position: relative; display: block; margin-top: 14px; padding: 10px 14px 10px 38px; font-size: 15px; background: var(--bg-2); border-left: 3px solid #c9ccd2; }
.cc-flag > span { position: absolute; left: 14px; top: 10px; font-weight: 700; width: 1em; text-align: center; }
.cc-flag.is-ok { border-color: #1a7f4b; background: #eef7f1; } .cc-flag.is-ok > span { color: #1a7f4b; }
.cc-flag.is-warn { border-color: #a15c00; background: #fff6e8; } .cc-flag.is-warn > span { color: #a15c00; }
.cc-flag.is-over { border-color: #b3261e; background: #fdeeed; } .cc-flag.is-over > span { color: #b3261e; }
.cc-rail { margin-top: 18px; }
.cc-bneck-mini { margin-top: 18px; font-size: 15px; color: var(--ink); }
.cc-bneck-mini .mono { display: block; font-size: 11px; color: var(--soft); margin-bottom: 2px; }

/* Gantt */
.cc-gantt-card { margin: clamp(32px, 4vw, 48px) 0 0; }
.cc-card__head { display: flex; justify-content: space-between; align-items: end; gap: 16px 24px; flex-wrap: wrap; }
.cc-key { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text); }
.cc-key li { display: inline-flex; align-items: center; gap: 6px; }
.cc-key i { width: 14px; height: 10px; display: inline-block; }
.k-crit { background: var(--blue); }
.k-other { background: #fff; box-shadow: inset 0 0 0 1.5px var(--navy); }
.k-wait { background: repeating-linear-gradient(45deg, #b9c6ff 0 2px, #f3f5ff 2px 5px); }
.k-target { height: 0 !important; border-top: 2px dashed #b3261e; }
.k-man { background: var(--navy); }
.k-sys { background: #b9c6ff; }
.cc-gantt { margin-top: 20px; width: 100%; overflow: hidden; }
.cc-gantt svg { display: block; font-family: var(--sans); }
.cc-g-tick { font-family: var(--mono); font-size: 11px; fill: var(--soft); }
.cc-g-lab { font-size: 13.5px; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.cc-g-lab.is-crit { fill: var(--blue); font-weight: 600; }
.cc-g-bar.is-crit { fill: var(--blue); }
.cc-g-bar.is-slack { fill: #fff; stroke: var(--navy); stroke-width: 1.5; }
.cc-g-dur { font-family: var(--mono); font-size: 11px; fill: var(--navy); pointer-events: none; }
.cc-g-dur.is-crit { fill: #fff; }
.cc-g-link { fill: none; stroke: var(--blue); stroke-width: 1.5; }
.cc-g-target { stroke: #b3261e; stroke-width: 2; stroke-dasharray: 5 4; }
.cc-g-close { stroke: var(--navy); stroke-width: 2; }
.cc-g-scen { stroke: var(--blue); stroke-width: 2; stroke-dasharray: 2 3; }
.cc-g-mark { font-family: var(--mono); font-size: 11px; fill: #b3261e; text-transform: uppercase; }
.cc-g-mark.is-close { fill: var(--navy); }
.cc-gantt.is-anim .cc-g-bar { transform-box: fill-box; transform-origin: left; animation: ccGrow .8s var(--ease) both; animation-delay: var(--d); }
@keyframes ccGrow { from { transform: scaleX(0); } }

/* Result rows */
.cc-row { margin-top: clamp(20px, 2.4vw, 28px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 2.4vw, 28px); align-items: start; }
.cc-bneck { border-top: 3px solid var(--navy); }
.cc-bneck__big { margin-top: 10px; font-size: 17px; color: var(--text); }
.cc-bneck__big b { font-size: 44px; font-weight: 500; letter-spacing: -.03em; color: var(--blue); margin-right: 6px; }
.cc-chain__label { margin-top: 18px; font-size: 11px; color: var(--soft); }
.cc-chain { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: ch; }
.cc-chain li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 14px; background: #f3f5ff; color: var(--navy); }
.cc-chain li span { font-family: var(--mono); font-size: 11px; color: var(--soft); }
.cc-chain li.is-b { background: var(--blue); color: #fff; }
.cc-chain li.is-b span { color: #dfe5ff; }
.cc-chain li + li::before { content: "→"; color: var(--soft); margin-right: 2px; }
.cc-chain li.is-b + li::before, .cc-chain li + li.is-b::before { color: inherit; }
.cc-scen { border-top: 3px solid var(--blue); }
.cc-scen__ctl { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.cc-scen__out { margin-top: 12px; display: grid; gap: 8px; }
.cc-scen__out .cc-flag { margin-top: 0; }
.cc-scen__big { font-size: 18px; color: var(--text); }
.cc-scen__big b { font-size: 40px; font-weight: 500; letter-spacing: -.03em; color: var(--blue); }
.cc-scen__big span { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--soft); margin-left: 6px; }

/* Hours chart */
.cc-key--hours { margin-top: 14px; }
.cc-hbars { margin-top: 16px; display: grid; gap: 12px; }
.cc-hbar { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: 14px; }
.cc-hbar__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.cc-hbar__track { height: 16px; background: var(--bg-2); }
.cc-hbar__all { display: block; height: 100%; background: #b9c6ff; transition: width .6s var(--ease); }
.cc-hbar__man { display: block; height: 100%; background: var(--navy); transition: width .6s var(--ease); }
.cc-hbar__v { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cc-hbar__v small { display: block; font-size: 12px; color: var(--soft); }

/* Ranking */
.cc-rank__list { margin-top: 18px; display: grid; gap: 0; border-top: 1px solid var(--line); }
.cc-ri { padding: 14px 0; border-bottom: 1px solid var(--line); }
.cc-ri__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-ri__head b { font-weight: 500; font-size: 16px; }
.cc-ri__n { width: 26px; height: 26px; display: grid; place-items: center; font-size: 12px; background: var(--bg-2); color: var(--navy); }
.cc-ri.is-first .cc-ri__n { background: var(--blue); color: #fff; }
.cc-ri__bar { margin-top: 10px; height: 6px; background: var(--bg-2); }
.cc-ri__bar span { display: block; height: 100%; background: var(--blue); transition: width .6s var(--ease); }
.cc-ri__f { margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--soft); }
.cc-ri__f b { color: var(--blue); font-weight: 500; }
.cc-ri__g { margin-top: 8px; font-size: 14.5px; color: var(--text); }
.cc-ri__p { display: block; margin-top: 4px; color: var(--navy); font-weight: 500; }
.cc-ri__p::before { content: "Person in the loop · "; font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: .05em; text-transform: uppercase; color: var(--soft); }

/* Means */
.cc-means { margin-top: clamp(20px, 2.4vw, 28px); border-left: 3px solid var(--blue); }
.cc-means__head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.cc-means__body { margin-top: 14px; display: grid; gap: 10px; max-width: 62em; }
.cc-means__body p { color: var(--text); }
.cc-means__body b { color: var(--ink); font-weight: 600; }
.cc-means__body .cc-lead { font-size: clamp(19px, 1.6vw, 22px); color: var(--ink); letter-spacing: -.01em; }
.cc-row--end { align-items: stretch; }
.cc-myth { margin: 0; }

/* Responsive */
@media (max-width: 1020px) {
  .cc-layout, .cc-row { grid-template-columns: minmax(0, 1fr); }
  .cc-summary { position: static; order: -1; }
}
@media (max-width: 640px) {
  .cc-context { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 16px; }
  .cc-context .cc-field:first-child { grid-column: 1 / -1; }
  .cc-context small { display: none; }
  .cc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .cc-span2 { grid-column: 1 / -1; }
  .cc-ph__head { flex-wrap: wrap; }
  .cc-ph__name { flex-basis: calc(100% - 80px); }
  .cc-ph__tag { order: 3; margin-left: 30px; }
  .cc-scen__ctl { grid-template-columns: minmax(0, 1fr); }
  .cc-hbar { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .cc-hbar__name { grid-column: 1 / -1; }
  .cc-means__head .lx-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cc-ph, .cc-gantt.is-anim .cc-g-bar { animation: none; }
  .cc-hbar__all, .cc-hbar__man, .cc-ri__bar span { transition: none; }
}

/* Print */
@media print {
  .cc-hero, .cc-help, .cc-add, .cc-x, .lx-actions, .lx-why, .lx-guide, .cta, .nav, .foot, .cc-scen__ctl { display: none !important; }
  .cc { background: #fff; padding: 0; }
  .cc-print-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .cc-layout, .cc-row { grid-template-columns: 1fr; }
  .cc-summary { position: static; }
  .cc-card, .cc-ph { break-inside: avoid; }
}
