/* Cone Check v2 core (Phase 1): one-row header, My cones chip, Job sheet, Light|Dark segments,
   result-shape lines, inline confirm, home / hub / My cones layouts, patterned blue.
   Loaded after cone-r8.css and cone-expand-r2.css on every page. Paper tokens unchanged. */

:root, html[data-theme="dark"] {
  --chip-bg: var(--raise);
  --chip-edge: var(--edge);
  --conf-good: var(--green);
  --conf-fair: var(--copper);
  --conf-guess: var(--red);
  --sheet-bg: var(--raise);
}
:root { --card-glass: rgba(255, 250, 243, 0.84); }
html[data-theme="dark"] { --card-glass: rgba(34, 28, 23, 0.74); }

/* Profile-dependent bits are decided before first paint (head script sets the class), so nothing shifts. */
html.cc-has-cones .when-no-cones, html.cc-no-cones .when-cones { display: none !important; }

/* The test keeps its one-screen layout while the plates are up; the footer shows on the intro and the result. */
body.test-app:not(.test-intro):not(.test-result) .site-footer { display: none; }

/* ---------- Header: one row ---------- */
.site-header.v2 {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-height: 56px;
  padding: 6px 8px;
  padding-left: max(8px, env(safe-area-inset-left));
  padding-right: max(8px, env(safe-area-inset-right));
  row-gap: 0;
  overflow: hidden;
}
.site-header.v2 > * { order: 0; }
.site-header.v2 .brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px 0 2px;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}
.cones-chip, .job-btn, .hub-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border: 1px solid var(--chip-edge);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
}
.cones-chip { margin-left: auto; flex: 0 0 auto; min-width: 44px; }
.cones-chip .chip-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chip-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
.cones-chip[data-state="unset"] .chip-icon { background: none; border-style: dashed; }
.cones-chip[data-state="typical"] .chip-icon { background: currentColor; }
.chip-glyph, .chip-phone { display: none; }
.job-btn { flex: 0 0 auto; cursor: pointer; }
.job-btn .job-caret { font-size: 0.75em; }
.hub-link { display: none; flex: 0 0 auto; border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: 0.18em; }
.cones-chip:hover, .job-btn:hover, .hub-link:hover { color: var(--copper); }

/* Light | Dark: two segments, sun and moon. Pressed = filled. */
.theme-seg {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  box-shadow: inset 0 0 0 1px var(--edge);
  border-radius: 999px;
  background: var(--raise);
}
.theme-seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  gap: 6px;
}
.theme-seg button svg { width: 20px; height: 20px; flex: 0 0 auto; }
/* Pressed state follows the attribute the head script sets before first paint (no flash). */
html[data-theme="light"] .theme-seg [data-theme-set="light"],
html[data-theme="dark"] .theme-seg [data-theme-set="dark"] { background: var(--ink); color: var(--bg); }
.theme-seg .seg-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Narrow phones (< 400px): the chip shortens to its icon plus the type glyph
   (P / D / T / RG / M / check, or "Set"). The full "My cones: ..." label stays in aria-label. */
@media (max-width: 399.98px) {
  .cones-chip { padding: 0 9px; gap: 5px; }
  .cones-chip .chip-pre, .cones-chip .chip-val { display: none; }
  .cones-chip .chip-glyph { display: inline; }
  .site-header.v2 .brand { font-size: 1.05rem; }
  .job-btn { padding: 0 10px; gap: 4px; }
}
@media (max-width: 349.98px) {
  .site-header.v2 { gap: 3px; padding-left: max(5px, env(safe-area-inset-left)); padding-right: max(5px, env(safe-area-inset-right)); }
  .site-header.v2 .brand { font-size: 0.98rem; padding: 0 2px 0 0; }
  .job-btn { padding: 0 8px; }
}
/* If the row still overflows: the job word shortens, then the chip goes to its icon only. */
.job-label .jl-tiny { display: none; }
.site-header.v2.is-tight .job-label .jl-full { display: none; }
.site-header.v2.is-tight .job-label .jl-tiny { display: inline; }
.site-header.v2.is-tighter .cones-chip .chip-pre,
.site-header.v2.is-tighter .cones-chip .chip-val,
.site-header.v2.is-tighter .cones-chip .chip-glyph { display: none; }

@media (min-width: 820px) {
  .site-header.v2 { min-height: 60px; gap: 8px; padding: 8px 1.25rem; }
  .site-header.v2 .brand { font-size: 1.35rem; padding-right: 8px; }
  .hub-link { display: inline-flex; }
  .theme-seg button { padding: 0 12px; }
  .theme-seg .seg-word { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
}

/* Skip link: truly 1px while hidden, 44px tall when focused. */
.skip:not(:focus) { padding: 0; border: 0; }
.skip:focus { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Job sheet ---------- */
dialog.sheet {
  width: min(28rem, calc(100% - 1rem));
  max-height: calc(100dvh - 1rem);
  margin: auto auto 0.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--sheet-bg);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: auto;
}
@media (min-width: 820px) { dialog.sheet { margin: 4.5rem 1.25rem auto auto; } }
dialog.sheet::backdrop { background: rgba(20, 16, 12, 0.45); }
dialog.sheet[open] { animation: sheet-in 150ms ease-out; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sheet-body { padding: 0.5rem 0.75rem 0.75rem; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.25rem 0.25rem 0.35rem 0.5rem; }
.sheet-top h2 { margin: 0; font-size: 1.3rem; }
.sheet-close {
  min-height: 44px; min-width: 44px; width: 44px; padding: 0;
  background: transparent; color: var(--ink); border: 1px solid var(--edge); font-size: 1.4rem;
}
.sheet-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sheet-row {
  display: flex; align-items: center;
  min-height: 48px; padding: 0 0.85rem;
  border-radius: 14px; text-decoration: none; font-weight: 650;
}
.sheet-row:hover { background: var(--bg); color: var(--ink); }
.sheet-row[aria-current="page"] { background: var(--ink); color: var(--bg); }
.sheet-row[aria-current="page"]::after { content: "\00a0\2713"; }
.sheet-div { border: 0; border-top: 1px solid var(--line); margin: 0.4rem 0.5rem; }

/* ---------- Footer nav: Home · All tools · My cones (44px, centred labels) ---------- */
.site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 0 0.6rem; }
.site-footer .mode-line[hidden] { display: none; }

/* ---------- Patterned blue (horizontal lines), matching Charts' blue hatch ---------- */
.cone-blue, #blue-cones, .cone-slider-blue { --pat-blue: repeating-linear-gradient(0deg, var(--blue) 0 4px, var(--raise) 4px 6px); }
.cone-blue .track span { background: var(--pat-blue); }

/* ---------- Cone sliders (ported from cone-camera-r3.css; used on /camera and /cones) ---------- */
.sliders { display: grid; gap: 1.6rem; margin-top: 0.4rem; }
.slider { display: grid; gap: 0.15rem; min-height: 44px; }
.slider label { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 44px; font-size: 1.25rem; font-weight: 700; line-height: 1.3; }
.slider output { display: inline-block; box-sizing: content-box; min-width: 5ch; text-align: right; font-size: 1.6rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.slider-scale { display: flex; justify-content: space-between; gap: 1rem; margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.3; }
.slider input[type="range"] {
  --thumb: 44px; --track: 14px; --v: 0;
  --fillw: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--v));
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 48px; margin: 0.2rem 0 0; padding: 0;
  background: transparent; cursor: pointer; touch-action: pan-y; -webkit-tap-highlight-color: transparent; border-radius: 12px;
}
.slider input[type="range"]:focus { outline: none; }
.slider input[type="range"]:focus-visible { outline: 3px solid var(--copper); outline-offset: 2px; }
#red-cones { --pat: repeating-linear-gradient(135deg, var(--red) 0 6px, var(--raise) 6px 9px); }
#green-cones { --pat: radial-gradient(circle at 4px 4px, var(--raise) 1.6px, transparent 2px) 0 0 / 8px 8px, var(--green); }
#blue-cones { --pat: var(--pat-blue); }
.slider input[type="range"]::-webkit-slider-runnable-track {
  box-sizing: border-box; height: var(--track); border: 2px solid var(--edge); border-radius: 999px;
  background: linear-gradient(90deg, transparent var(--fillw), var(--bg) var(--fillw)), var(--pat);
}
.slider input[type="range"]::-moz-range-track {
  box-sizing: border-box; height: var(--track); border: 2px solid var(--edge); border-radius: 999px;
  background: linear-gradient(90deg, transparent var(--fillw), var(--bg) var(--fillw)), var(--pat);
}
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; box-sizing: border-box; width: var(--thumb); height: var(--thumb);
  margin-top: calc((var(--track) - var(--thumb)) / 2); border: 0; border-radius: 50%;
  background: radial-gradient(circle at center, var(--ink) 0 5px, var(--bg) 5.5px 11.5px, var(--ink) 12px 16px, var(--bg) 16.5px 18.5px, transparent 19px);
}
.slider input[type="range"]::-moz-range-thumb {
  box-sizing: border-box; width: var(--thumb); height: var(--thumb); border: 0; border-radius: 50%;
  background: radial-gradient(circle at center, var(--ink) 0 5px, var(--bg) 5.5px 11.5px, var(--ink) 12px 16px, var(--bg) 16.5px 18.5px, transparent 19px);
}
.slider input[type="range"]:focus-visible::-webkit-slider-thumb {
  background: radial-gradient(circle at center, var(--ink) 0 5px, var(--bg) 5.5px 11.5px, var(--ink) 12px 16px, var(--bg) 16.5px 18.5px, var(--copper) 19px 22px);
}

/* ---------- Inline confirm ---------- */
.inline-confirm { margin: 0.6rem 0; padding: 0.8rem 0.9rem; border: 1px solid var(--edge); border-radius: 16px; background: var(--raise); }
.inline-confirm p { margin: 0 0 0.55rem; font-weight: 650; }
.confirm-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---------- Result shape lines (shared) ---------- */
.rs-lines { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.7rem; margin: 0; }
.rs-lines dt { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding-top: 0.15rem; }
.rs-lines dd { margin: 0; font-size: 1rem; }
.conf-icon { display: inline-block; width: 1.1em; text-align: center; }
.conf-good .conf-icon { color: var(--conf-good); }
.conf-fair .conf-icon { color: var(--conf-fair); }
.conf-guess .conf-icon { color: var(--conf-guess); }

/* ---------- Home: job first ---------- */
.home-v2 h1 { max-width: 15em; }
.home-v2 .lede { margin-bottom: 1rem; }
.job-list { display: grid; gap: 0.7rem; margin: 0 0 1rem; }
.job-list .btn { min-height: 56px; width: 100%; justify-content: center; text-align: center; padding: 0.7rem 1.2rem; font-size: 1.1rem; flex-direction: column; align-items: center; }
.job-list .btn.primary-job { font-size: 1.2rem; }
.job-list .btn .job-sub { font-size: 0.88rem; font-weight: 500; opacity: 0.9; }
.job-list .btn.secondary:hover { color: var(--copper); border-color: var(--ink); }
@media (min-width: 820px) {
  .job-list { grid-template-columns: 1fr 1fr; }
  .job-list .primary-job { grid-column: 1 / -1; }
}
.small-jobs { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; margin: 0 0 0.6rem; padding: 0; list-style: none; }
.small-jobs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.3rem; font-weight: 650; }
.home-v2 .fine { margin: 0 0 1.4rem; color: var(--muted); font-size: 0.95rem; }

/* ---------- Hub ---------- */
.hub-cones { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; margin: 0 0 1.6rem; }
.hub-cones p { margin: 0; }
.hub-cones a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; }
.pair-row.is-yours p strong::after { content: ""; }
.data-list { margin: 0 0 0.6rem; padding-left: 1.2rem; }
.resource-list a { display: inline-flex; align-items: center; min-height: 44px; }
.inline-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; }

/* ---------- My cones page ---------- */
.cones-state { margin: 0 0 1rem; }
.cones-state .result-lead { font-size: 1.12rem; margin: 0 0 0.6rem; }
.cones-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 1rem 0; }
.cones-actions > * { flex: 1 1 12rem; }
.manual { margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 18px; background: var(--raise); }
.manual fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.manual legend { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.4rem; }
.choice { display: flex; align-items: center; gap: 0.6rem; min-height: 48px; padding: 0 0.8rem; margin: 0 0 0.35rem; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); cursor: pointer; font-weight: 600; }
.choice input { width: 1.25rem; height: 1.25rem; accent-color: var(--ink); flex: 0 0 auto; }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.strength-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
.strength-row .choice { justify-content: center; margin: 0; }
.fine-tune-toggle { margin: 0 0 0.8rem; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; margin: 0 0 0.4rem; }

/* ---------- Test additions ---------- */
.save-cones { display: grid; gap: 0.5rem; }
.save-cones .note { margin: 0; }
.eye-exam { font-weight: 650; }

/* ---------- Charts / tools small bits ---------- */
.set-cones-line { margin: 0.2rem 0 0.4rem; color: var(--muted); }
.set-cones-line a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  dialog.sheet[open] { animation: none; }
}
@media print {
  .site-header.v2, dialog.sheet { display: none !important; }
}

/* No scale on press (motion rule): the test keypad keeps its colour change only. */
.key:active { transform: none; }
