/* Jenny Hu — V3 career workbook.
   An original spreadsheet-style surface: green application chrome, a ribbon of
   real controls, name box + formula bar, column/row coordinates, one
   continuous sheet (Experience, Education, Skills in order) and sticky sheet
   tabs with a status bar. Everything is readable without script; the opening
   sequence is a progressive enhancement inside the identity cells only. */

:root {
  --chrome: #16513a;
  --chrome-2: #1d6347;
  --chrome-ink: #f1f6f2;
  --chrome-muted: #bfd8c8;

  --ribbon: #f6f7f4;
  --ribbon-line: #dbe0d8;
  --head: #eff2ed;
  --head-line: #c6cdc4;
  --grid: #e2e6df;
  --cell: #ffffff;
  --hover: #f5f8f4;
  --cap: #f1f7f2;
  --canvas: #e7ebe5;

  --sel: #1d7a4b;
  --sel-ink: #ffffff;
  --sel-tint: #e1f0e6;
  --sel-line: #a9d2b8;

  --ink: #17211b;
  --ink-2: #36423b;
  --muted: #57615a;
  --note: #ad441c;

  --sans: Aptos, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --rh: 3.25rem;            /* row-header width */
  --px: 0.875rem;           /* cell inline padding */
  --cell-h: 2.75rem;        /* 44px rows: every cell is a full touch target */

  /* A Organization · B Role · C Period · D Scope · E (empty) */
  --cols: minmax(0, 21fr) minmax(0, 24fr) minmax(0, 16fr) minmax(0, 31fr) minmax(0, 8fr);
  --x1: calc(var(--rh) + (100% - var(--rh)) * 0.21);
  --x2: calc(var(--rh) + (100% - var(--rh)) * 0.45);
  --x3: calc(var(--rh) + (100% - var(--rh)) * 0.61);
  --x4: calc(var(--rh) + (100% - var(--rh)) * 0.92);
  --gridlines: linear-gradient(90deg,
    transparent calc(var(--x1) - 1px), var(--grid) calc(var(--x1) - 1px), var(--grid) var(--x1), transparent var(--x1),
    transparent calc(var(--x2) - 1px), var(--grid) calc(var(--x2) - 1px), var(--grid) var(--x2), transparent var(--x2),
    transparent calc(var(--x3) - 1px), var(--grid) calc(var(--x3) - 1px), var(--grid) var(--x3), transparent var(--x3),
    transparent calc(var(--x4) - 1px), var(--grid) calc(var(--x4) - 1px), var(--grid) var(--x4), transparent var(--x4));

  /* Sticky offsets. workbook.js replaces these with measured values. */
  --sticky-top: 4.4rem;
  --sticky-bottom: 2.75rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  scroll-padding-top: calc(var(--sticky-top) + 0.75rem);
  scroll-padding-bottom: calc(var(--sticky-bottom) + 0.75rem);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

::selection { background: var(--sel-tint); color: var(--chrome); }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--sel);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Skip link ---------- */

.skip {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1rem;
  border-radius: 6px;
  background: var(--cell);
  color: var(--chrome);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 0 0 2px var(--chrome), 0 6px 18px rgb(0 0 0 / 0.18);
}
.skip:not(:focus) {
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Application frame ---------- */

.app {
  position: relative;
  background: var(--cell);
  overflow-x: clip;        /* selection handles never cause sideways scroll */
  box-shadow: 0 1px 0 var(--head-line);
}

/* ---------- Title bar ---------- */

.titlebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 1rem;
  padding: 0 0.375rem 0 1rem;
  background: var(--chrome);
  color: var(--chrome-ink);
}
.wb-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.75rem;
  font-size: 0.9375rem;
  line-height: 1.2;
}
.wb-glyph { flex: none; color: #a8e0bd; }
.wb-name { font-weight: 700; letter-spacing: 0.005em; }
.wb-file {
  position: relative;
  padding-left: 0.75rem;
  color: var(--chrome-muted);
}
.wb-file::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15em;
  bottom: 0.15em;
  border-left: 1px solid rgb(241 246 242 / 0.35);
}
.title-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.25rem;
}
.sitenav ul {
  display: flex;
  gap: 2px;
}
.tb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border-radius: 6px;
  color: var(--chrome-ink);
  font-size: 0.9375rem;
  text-decoration: none;
}
.tb:hover { background: rgb(255 255 255 / 0.12); text-decoration: underline; text-underline-offset: 0.2em; }
.tb[aria-current] {
  background: rgb(255 255 255 / 0.14);
  box-shadow: inset 0 -3px 0 #8fd6aa;
  font-weight: 700;
}
.tb-out {
  margin-left: 0.25rem;
  box-shadow: inset 0 0 0 1px rgb(241 246 242 / 0.35);
}
.titlebar :focus-visible { outline-color: #ffffff; outline-offset: -3px; }

/* ---------- Ribbon ---------- */

.ribbon {
  position: relative;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  padding: 0.5rem 0.5rem 0;
  background: var(--ribbon);
  border-bottom: 1px solid var(--ribbon-line);
}
.rgroup {
  display: flex;
  flex-direction: column;
  padding: 0 0.625rem;
  border-right: 1px solid var(--ribbon-line);
}
.rgroup-body,
.goto {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
}
.rgroup-label {
  margin-top: auto;
  padding: 0.3125rem 0 0.375rem;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--muted);
  text-align: center;
}

.goto li { display: flex; }
.goto-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 11.5rem;
  min-height: 4rem;
  padding: 0.5rem 1.125rem 0.5rem 0.875rem;
  border: 1px solid var(--ribbon-line);
  border-radius: 8px;
  background: var(--cell);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 1px 0 rgb(23 33 27 / 0.04);
}
.goto-icon { flex: none; color: var(--sel); }
.goto-text { display: flex; flex-direction: column; line-height: 1.2; }
.goto-name { font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.005em; }
.goto-range {
  margin-top: 0.1875rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.goto-link:hover { border-color: var(--sel-line); background: var(--sel-tint); }
.goto-link:hover .goto-name { text-decoration: underline; text-underline-offset: 0.18em; }
.goto-link[aria-current],
html:not(.js) body:has(#experience:target) .goto-link[href="#experience"],
html:not(.js) body:has(#education:target) .goto-link[href="#education"],
html:not(.js) body:has(#skills:target) .goto-link[href="#skills"] {
  border-color: var(--sel);
  box-shadow: inset 0 -3px 0 var(--sel);
}
.goto-link[aria-current] .goto-name { color: var(--chrome); }

.rbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 4.75rem;
  min-height: 4rem;
  padding: 0.375rem 0.625rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 0.8125rem;
  line-height: 1.15;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.rbtn svg { flex: none; color: var(--chrome-2); }
.rbtn:hover { background: #e9eee7; border-color: var(--ribbon-line); }
.rbtn:active { background: #dfe6dc; }
.rbtn[aria-pressed="true"] { background: var(--sel-tint); border-color: var(--sel-line); }
.rbtn[aria-pressed="true"]:hover { background: #d4eadb; }

/* Native disclosure for shortcut help */
.keys { position: relative; }
.keys > summary { list-style: none; }
.keys > summary::-webkit-details-marker { display: none; }
.keys[open] > summary { background: var(--sel-tint); border-color: var(--sel-line); }
.keys-panel {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  z-index: 40;
  width: 23rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0.875rem 1rem 1rem;
  border: 1px solid var(--head-line);
  border-radius: 8px;
  background: var(--cell);
  box-shadow: 0 12px 32px -12px rgb(22 81 58 / 0.35), 0 2px 6px rgb(0 0 0 / 0.06);
}
.keys-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 0.5rem;
}
.keys-list > div {
  display: grid;
  grid-template-columns: 7.75rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.4375rem 0;
  border-top: 1px solid var(--grid);
  font-size: 0.875rem;
}
.keys-list dd { color: var(--ink-2); }
kbd,
.kbd {
  display: inline-block;
  padding: 0.0625rem 0.375rem;
  border: 1px solid var(--head-line);
  border-radius: 4px;
  background: var(--ribbon);
  box-shadow: 0 1px 0 var(--head-line);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--ink);
  white-space: nowrap;
}
.keys-note {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--grid);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- Sheet head: name box, formula bar, column letters ---------- */

.sheethead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--cell);
  box-shadow: 0 1px 0 var(--head-line), 0 3px 8px -6px rgb(22 81 58 / 0.35);
}
.fbar-wrap {
  display: flex;
  align-items: stretch;
  min-height: 2.75rem;
  border-bottom: 1px solid var(--head-line);
}
.fbar {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 7.5rem auto minmax(0, 1fr) auto;
  align-items: stretch;
}
.namebox {
  display: flex;
  align-items: center;
  padding: 0 0.875rem;
  border-right: 1px solid var(--head-line);
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--chrome);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}
.fx {
  display: flex;
  align-items: center;
  padding: 0 0.875rem;
  border-right: 1px solid var(--head-line);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 0.9375rem;
  color: var(--muted);
}
.fvalue {
  align-self: center;
  min-width: 0;
  padding: 0 0.875rem;
  font-size: 0.9375rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.keycap {
  align-self: center;
  margin: 0 0.625rem;
  padding: 0.1875rem 0.5rem;
  min-width: 2.75rem;
  border: 1px solid var(--head-line);
  border-radius: 6px;
  background: var(--cell);
  box-shadow: 0 2px 0 var(--head-line);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  color: var(--ink-2);
  white-space: nowrap;
}
.keycap.is-pressed { animation: jh-press 280ms cubic-bezier(.2, .8, .2, 1) both; }

.skip-intro {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 0.875rem 0 1rem;
  border: 0;
  border-left: 1px solid var(--head-line);
  background: var(--chrome);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}
.skip-intro:hover { background: var(--chrome-2); text-decoration: underline; text-underline-offset: 0.2em; }
.skip-intro .kbd { background: rgb(255 255 255 / 0.12); border-color: rgb(255 255 255 / 0.4); box-shadow: none; color: #ffffff; }
.skip-intro:focus-visible { outline: 3px solid var(--chrome); outline-offset: -6px; box-shadow: inset 0 0 0 2px #ffffff; }

.colhead {
  position: relative;
  display: grid;
  grid-template-columns: var(--cols);
  padding-left: var(--rh);
  background: var(--head);
}
.corner {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--rh);
  border-right: 1px solid var(--head-line);
}
.corner::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  border-left: 0.5rem solid transparent;
  border-bottom: 0.5rem solid #b6beb4;
}
.col {
  padding: 0.3125rem 0;
  border-right: 1px solid var(--head-line);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: center;
  color: var(--muted);
}
.col-e { border-right: 0; }
.col.is-active {
  background: var(--sel-tint);
  color: var(--chrome);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--sel);
}

/* ---------- Sheet ---------- */

main {
  position: relative;
  display: block;
}
main:focus { outline: none; }
main:focus-visible { outline: 3px solid var(--sel); outline-offset: -3px; }
.sheet:focus:not(:focus-visible) { outline: none; }
.sheet:focus-visible { outline: 3px solid var(--sel); outline-offset: -3px; }

.row {
  position: relative;
  display: grid;
  grid-template-columns: var(--cols);
  min-height: var(--cell-h);
  padding-left: var(--rh);
  border-bottom: 1px solid var(--grid);
  background-image: var(--gridlines);
}
.row::before { /* row number */
  content: attr(data-row);
  content: attr(data-row) / "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--rh);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--head);
  border-right: 1px solid var(--head-line);
  box-shadow: 0 1px 0 var(--head-line);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  transition: background-color 160ms ease, color 160ms ease;
}
.row.is-active-row::before,
.row.is-lit::before {
  background: var(--sel-tint);
  color: var(--chrome);
  font-weight: 700;
  box-shadow: inset -2px 0 0 var(--sel), 0 1px 0 var(--head-line);
}

.row.cap {
  border-top: 2px solid var(--head-line);
  background-color: var(--cap);
}
.row.fields {
  min-height: 2.25rem;
  background-color: #fafbf9;
  border-bottom-color: var(--head-line);
}
.row.blank { min-height: 2.25rem; }
.row.blank:last-child { border-bottom: 0; }

.range-tag {
  position: absolute;
  top: 50%;
  right: 0;
  width: calc((100% - var(--rh)) * 0.08);
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

/* ---------- Cells ---------- */

.cell {
  position: relative;
  min-width: 0;
  min-height: var(--cell-h);
  padding: 0.6875rem var(--px);
  font-size: 1rem;
  line-height: 1.375rem;
  overflow-wrap: break-word;
}
[data-col="A"] { grid-column-start: 1; }
[data-col="B"] { grid-column-start: 2; }
[data-col="C"] { grid-column-start: 3; }
[data-col="D"] { grid-column-start: 4; }
[data-span="2"] { grid-column-end: span 2; }
[data-span="3"] { grid-column-end: span 3; }
[data-span="4"] { grid-column-end: span 4; }
.cell[data-span] { background-color: var(--cell); }  /* merged: hide inner gridlines */
.row.cap .cell[data-span] { background-color: var(--cap); }

.js .cell { cursor: cell; }
.js .cell:hover { background-color: var(--hover); }
.cell:focus { outline: none; }

/* Selection border + fill handle */
.cell.is-selected::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 2;
  border: 2px solid var(--sel);
  pointer-events: none;
}
.cell.is-selected::before {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -4px;
  z-index: 3;
  width: 8px;
  height: 8px;
  background: var(--sel);
  border: 1.5px solid var(--cell);
  pointer-events: none;
}
.cell.is-selected:focus-visible::after {
  border-width: 3px;
  box-shadow: 0 0 0 3px rgb(29 122 75 / 0.28);
}

/* ---------- Type roles ---------- */

.name {
  padding-top: 1.125rem;
  padding-bottom: 0.875rem;
  font-size: clamp(2.25rem, 1.55rem + 1.9vw, 3.375rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--chrome);
  --type-ink: var(--chrome);
}
.ident-role,
.ident-org {
  padding-top: 0.6875rem;
  padding-bottom: 0.6875rem;
  font-size: 1.25rem;
  line-height: 1.5rem;
}
.ident-role { font-weight: 600; color: var(--ink); }
.ident-org { color: var(--ink-2); --type-ink: var(--ink-2); }
.lede {
  padding-top: 0.75rem;
  padding-bottom: 0.875rem;
  font-size: 1.0625rem;
  line-height: 1.6rem;
  color: var(--ink-2);
  max-width: 100%;
  text-wrap: pretty;
}
.lede { padding-right: max(var(--px), calc(100% - 52rem)); }

.sheet-title {
  padding-top: 0.875rem;
  padding-bottom: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.75rem;
  letter-spacing: -0.01em;
  color: var(--chrome);
}
.fh {
  align-self: center;
  padding: 0.5rem var(--px);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.org {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
}
.role { color: var(--ink); }
.period,
.key {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.period { padding-top: 0.75rem; }
.key { padding-top: 0.75rem; }
.scope { color: var(--ink-2); }
.sublabel {
  padding-top: 0.875rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.area {
  color: var(--ink-2);
  box-shadow: inset 3px 0 0 var(--sel-line);
}
.skill { font-weight: 600; color: var(--ink); }
.record dd { color: var(--ink); }
.r-name,
.r-lede { background-image: none; }

/* Cell comment indicator */
.flag {
  position: absolute;
  top: 0;
  right: 0;
  border-top: 0.5625rem solid var(--note);
  border-left: 0.5625rem solid transparent;
}
.note {
  display: block;
  margin-top: 0.1875rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--note);
}

/* ---------- Opening sequence (script-driven; self-expiring by CSS) ----------
   Pending identity cells are concealed only by a 4-second animation with no
   fill, so the real text returns even if the script were to stop. The typing
   overlay is visible only while its own 4-second animation runs. */

.is-pending { animation: jh-conceal 4s step-end; }
.typed {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: inherit;
  color: var(--type-ink, var(--ink));
  visibility: hidden;
  pointer-events: none;
  animation: jh-overlay 4s step-end;
}
.caret,
.fvalue .caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.14em;
  background: var(--sel);
  animation: jh-blink 900ms step-end infinite;
}
.typed:not(.is-editing) .caret,
.typed.has-ac .caret { display: none; }
.typed-ac,
.fvalue .ac {
  background: var(--sel);
  color: var(--sel-ink);
}

.fill-range {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  border: 2px solid var(--sel);
  background: rgb(29 122 75 / 0.07);
}
.fill-range::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 8px;
  height: 8px;
  background: var(--sel);
  border: 1.5px solid var(--cell);
}
.fill-range.is-on { animation: jh-grow var(--grow, 480ms) cubic-bezier(.22, .8, .2, 1) both; }
.fill-range.is-out { opacity: 0; transition: opacity 180ms ease; }

@keyframes jh-conceal { 0%, 100% { color: transparent; } }
@keyframes jh-overlay { 0%, 100% { visibility: visible; } }
@keyframes jh-blink { 50% { opacity: 0; } }
@keyframes jh-grow { from { height: var(--h0, 2.75rem); } }
@keyframes jh-press {
  0% { opacity: 0; transform: translateY(-3px); }
  35% { opacity: 1; transform: translateY(2px); box-shadow: 0 0 0 var(--head-line); }
  100% { opacity: 1; transform: none; }
}

/* ---------- Sheet tabs + status bar ---------- */

.sheetbar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  min-height: 2.75rem;
  background: var(--head);
  border-top: 1px solid var(--head-line);
  box-shadow: 0 -3px 8px -6px rgb(22 81 58 / 0.3);
}
.tabs ul {
  display: flex;
  height: 100%;
  padding-left: var(--rh);
}
.tabs li { display: flex; }
.tabs a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border-right: 1px solid var(--head-line);
  color: var(--ink-2);
  font-size: 0.9375rem;
  text-decoration: none;
}
.tabs li:first-child a { border-left: 1px solid var(--head-line); }
.tabs a:hover { background: #e4e9e2; text-decoration: underline; text-underline-offset: 0.2em; }
.tabs a:focus-visible { outline-offset: -4px; }
.tabs a[aria-current],
html:not(.js) body:has(#experience:target) .tabs a[href="#experience"],
html:not(.js) body:has(#education:target) .tabs a[href="#education"],
html:not(.js) body:has(#skills:target) .tabs a[href="#skills"] {
  background: var(--cell);
  color: var(--chrome);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--sel);
}
.status {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.25rem;
  padding: 0 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}
.st-msg { font-weight: 700; color: var(--chrome); overflow: hidden; text-overflow: ellipsis; }
.st-info { display: inline-flex; gap: 0.625rem; min-width: 0; overflow: hidden; }
.st-cell { font-family: var(--mono); font-weight: 700; color: var(--chrome); }
.st-field { overflow: hidden; text-overflow: ellipsis; }
.st-mode { display: inline-flex; align-items: center; gap: 0.4375rem; font-family: var(--mono); }
.st-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--sel); }
.is-intro .st-dot { background: var(--note); }

/* ---------- Colophon ---------- */

.colophon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding: 0.75rem calc(var(--rh) + var(--px)) 1.25rem;
  font-size: 0.8125rem;
  color: var(--muted);
}
.colophon p { max-width: 60rem; }
.colophon a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--ink-2);
  text-underline-offset: 0.2em;
}

/* ---------- Gridlines off (View ▸ Gridlines) ---------- */

.no-grid .row { background-image: none; border-bottom-color: transparent; }
.no-grid .row.cap { border-bottom-color: var(--grid); }
.no-grid .row.fields { border-bottom-color: var(--grid); }
.no-grid .row::before { box-shadow: none; }
.no-grid .row.is-active-row::before { box-shadow: inset -2px 0 0 var(--sel); }

/* =========================================================
   Tablet and small laptop: grouped record, no column band
   ========================================================= */

@media (max-width: 63.99em) {
  :root {
    --rh: 2.75rem;
    --px: 0.875rem;
    --sticky-top: 2.75rem;
  }

  .colhead { display: none; }
  .range-tag { width: auto; right: var(--px); }

  /* Ribbon: section links share a full row; tools become compact */
  .ribbon { padding: 0.5rem; gap: 0.5rem; }
  .rgroup { padding: 0; border-right: 0; }
  .rgroup-goto { flex: 1 1 100%; }
  .goto { gap: 0.5rem; }
  .goto li { flex: 1 1 0; min-width: 0; }
  .goto-link { flex: 1; min-width: 0; min-height: 3.75rem; }
  .rgroup-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .rbtn {
    flex-direction: row;
    gap: 0.5rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0 0.75rem;
    border-color: var(--ribbon-line);
    background: var(--cell);
    font-size: 0.875rem;
  }
  .rbtn svg { width: 20px; height: 20px; }
  .keys { position: static; }
  .keys-panel { left: 0.5rem; right: 0.5rem; width: auto; max-width: 30rem; }

  .fbar { grid-template-columns: 5.5rem auto minmax(0, 1fr) auto; }

  /* Rows collapse to one grouped column */
  .row { grid-template-columns: minmax(0, 1fr); background-image: none; }
  .row > .cell[data-col] { grid-column: 1 / -1; }
  .r-ident { grid-template-columns: max-content minmax(0, 1fr); }
  .r-ident > .ident-role[data-col] { grid-column: 1; }
  .r-ident > .ident-org[data-col] { grid-column: 2; }
  .ident-role { box-shadow: inset -1px 0 0 var(--grid); }

  .row.job {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-bottom: 0.375rem;
  }
  .row.job > .org[data-col] { grid-column: 1; grid-row: 1; padding-bottom: 0.25rem; }
  .row.job > .role[data-col] { grid-column: 1; grid-row: 2; padding-top: 0; }
  .row.job > .period[data-col] { grid-column: 2; grid-row: 1 / span 2; text-align: right; max-width: 15rem; }
  .row.job > .scope[data-col] { grid-column: 1 / -1; grid-row: 3; padding-top: 0; color: var(--ink-2); }
  .period .flag { right: 0; }
  .org { font-size: 1.125rem; }

  .row.fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding-right: var(--px);
  }
  .row.fields .fh { padding: 0.5rem 0; }
  .row.fields .fh:first-child { padding-left: var(--px); }
  .row.fields .fh + .fh::before { content: "\00B7"; padding: 0 0.5rem; }

  .row.kv { grid-template-columns: 8rem minmax(0, 1fr); }
  .row.kv > .cell[data-col] { grid-column: 2; }
  .row.kv > .cell.key[data-col] { grid-column: 1; grid-row: 1 / span 2; box-shadow: inset -1px 0 0 var(--grid); }
  .row.kv > dd.cell + dd.cell { padding-top: 0; }

  .area { box-shadow: inset 3px 0 0 var(--sel-line); margin-left: var(--px); }
  .row.sub .sublabel { padding-left: calc(var(--px) * 2); }

  .lede { padding-right: var(--px); }
  .tabs ul { padding-left: 0; }
  .tabs li:first-child a { border-left: 0; }
}

/* =========================================================
   Phones: compact chrome, stacked employer / role / date groups
   ========================================================= */

@media (max-width: 37.49em) {
  :root {
    --rh: 2.25rem;
    --px: 0.75rem;
    --sticky-top: 0px;
  }

  .titlebar { padding: 0 0.25rem 0 0.75rem; }
  .title-links { margin-left: -0.5rem; padding-bottom: 0.125rem; }
  .tb { padding: 0 0.625rem; }

  /* Only the sheet tabs stick on phones */
  .sheethead { position: static; box-shadow: none; }
  .fbar { grid-template-columns: 3.75rem auto minmax(0, 1fr) auto; }
  .namebox { padding: 0 0.5rem; font-size: 0.8125rem; }
  .fx { padding: 0 0.5rem; }
  .fvalue { padding: 0 0.625rem; font-size: 0.875rem; }
  .keycap { margin: 0 0.375rem; min-width: 2rem; padding: 0.1875rem 0.375rem; }
  .skip-intro { padding: 0 0.625rem; }
  .skip-intro .kbd { display: none; }

  .ribbon { padding: 0.375rem; gap: 0.375rem; }
  .goto { gap: 0.375rem; }
  .goto-link {
    flex-direction: column;
    justify-content: center;
    gap: 0;
    min-height: 3.5rem;
    padding: 0.375rem 0.25rem;
    text-align: center;
  }
  .goto-icon { display: none; }
  .goto-text { align-items: center; }
  .goto-name { font-size: 1rem; }
  .goto-range { font-size: 0.6875rem; margin-top: 0.125rem; }
  .rgroup:not(.rgroup-goto) .rgroup-body { gap: 0.375rem; }
  .rbtn { padding: 0 0.625rem; font-size: 0.8125rem; }
  .keys-panel { left: 0.375rem; right: 0.375rem; }
  .keys-list > div { grid-template-columns: 6.5rem minmax(0, 1fr); }

  .row { padding-bottom: 0; }
  .r-ident { grid-template-columns: minmax(0, 1fr); }
  .r-ident > .cell[data-col] { grid-column: 1; }
  .r-ident > .ident-org[data-col] { padding-top: 0; }
  .ident-role { box-shadow: none; }
  .ident-role, .ident-org { font-size: 1.125rem; }
  .name { font-size: 2.25rem; padding-top: 0.875rem; padding-bottom: 0.625rem; }

  .row.job { grid-template-columns: minmax(0, 1fr); padding-bottom: 0.375rem; }
  .row.job > .cell[data-col] { grid-column: 1; grid-row: auto; text-align: left; max-width: none; }
  .row.job > .role[data-col],
  .row.job > .period[data-col],
  .row.job > .scope[data-col] { padding-top: 0; padding-bottom: 0.25rem; }
  .row.job > .period[data-col] { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.625rem; }
  .row.job > .period .note { margin-top: 0; }

  .row.kv { grid-template-columns: 6.25rem minmax(0, 1fr); }
  .key { font-size: 0.8125rem; }

  .sheet-title { font-size: 1.375rem; }
  .range-tag { font-size: 0.625rem; }

  .cell.is-selected::after { inset: 0; }
  .cell.is-selected::before { right: 0; bottom: 0; }

  .row.blank + .row.blank { display: none; }

  /* Tabs fill the bar; status details give way to the tabs */
  .tabs { flex: 1; }
  .tabs ul { width: 100%; }
  .tabs li { flex: 1 1 0; min-width: 0; }
  .tabs a { flex: 1; justify-content: center; padding: 0 0.375rem; }
  .tabs li:last-child a { border-right: 0; }
  .status { position: absolute; bottom: 100%; right: 0; left: 0; padding: 0; gap: 0; pointer-events: none; }
  .st-info, .st-mode { display: none !important; }
  .st-msg:not(:empty) {
    margin: 0 auto 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: 6px;
    background: var(--chrome);
    color: #ffffff;
    box-shadow: 0 6px 16px -8px rgb(0 0 0 / 0.5);
  }

  .colophon { padding: 0.75rem var(--px) 1.25rem; }
}

@media (max-width: 22.49em) {
  .tb { padding: 0 0.5rem; }
  .goto-name { font-size: 0.9375rem; }
  .goto-range { display: none; }
  .goto-link { min-height: 3rem; }
  .row.kv { grid-template-columns: 5.25rem minmax(0, 1fr); }
  .tabs a { font-size: 0.875rem; padding: 0 0.25rem; }
  .rbtn { padding: 0 0.5rem; }
  .rbtn svg { display: none; }
}

@media (hover: none) {
  .js .cell:hover { background-color: transparent; }
  .js .cell[data-span]:hover { background-color: var(--cell); }
}

/* ---------- Preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
  /* Nothing is ever concealed when motion is reduced. */
  .typed, .fill-range, .keycap { display: none !important; }
}

@media (prefers-contrast: more) {
  :root { --muted: #303832; --ink-2: #17211b; --grid: #aab2a7; --head-line: #6c7569; --ribbon-line: #8d978a; }
}

@media (forced-colors: active) {
  .cell.is-selected::after,
  .fill-range { border-color: Highlight; }
  .cell.is-selected::before,
  .fill-range::after,
  .caret { background: Highlight; }
  .row.is-active-row::before { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .goto-link[aria-current],
  .tabs a[aria-current],
  .tb[aria-current],
  .rbtn[aria-pressed="true"] { outline: 2px solid CanvasText; outline-offset: -4px; }
  .row.cap { border-top-color: CanvasText; }
  .skip, .skip-intro { border: 2px solid ButtonText; }
}

@media print {
  html, body { background: #fff; }
  .titlebar,
  .ribbon,
  .sheethead,
  .sheetbar,
  .fill-range,
  .row.blank { display: none !important; }
  .row { break-inside: avoid; }
  .app { box-shadow: none; }
}
