/* Jenny Hu — V2 career workbook */

:root {
  --page: #e8e4d3;
  --surface: #fffdf7;
  --band: #efecdf;
  --band-hover: #e4e0cc;
  --band-soft: #f5f3ea;
  --line: #e3dece;
  --line-strong: #c8c1a7;
  --freeze: #a59d80;

  --green: #1e6b45;
  --green-deep: #15402c;
  --green-tint: #dcebd9;

  --ink: #1c2921;
  --ink-2: #3a473e;
  --muted: #535a4d;

  --note: #b04a22;
  --note-bg: #fbf5e2;
  --note-line: #dccb9c;

  --sans: Calibri, Carlito, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --edge: clamp(0px, 3vw, 2.5rem);
  --g: 3.25rem;
  --pad-x: 0.875rem;
  --line-box: 1.434rem; /* 1.0625rem × 1.35, shared so mixed type sizes align */
  --cols: minmax(0, 24fr) minmax(0, 27fr) minmax(0, 17fr) minmax(0, 32fr);

  /* Vertical gridlines at the column boundaries, measured from the row's left edge */
  --x1: calc(var(--g) + (100% - var(--g)) * 0.24);
  --x2: calc(var(--g) + (100% - var(--g)) * 0.51);
  --x3: calc(var(--g) + (100% - var(--g)) * 0.68);
  --gridlines: linear-gradient(90deg,
    transparent calc(var(--x1) - 1px), var(--line) calc(var(--x1) - 1px), var(--line) var(--x1),
    transparent var(--x1), transparent calc(var(--x2) - 1px), var(--line) calc(var(--x2) - 1px), var(--line) var(--x2),
    transparent var(--x2), transparent calc(var(--x3) - 1px), var(--line) calc(var(--x3) - 1px), var(--line) var(--x3),
    transparent var(--x3));
}

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

[hidden] { display: none !important; }

html {
  scroll-padding-block: 12px 64px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

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

::selection { background: var(--green-tint); color: var(--green-deep); }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--green);
  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: 20;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1rem;
  border-radius: 6px;
  background: var(--green-deep);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.skip:not(:focus) {
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus-visible { outline-color: var(--surface); outline-offset: -5px; }

/* ---------- Workbook window ---------- */

.workbook {
  width: min(84rem, calc(100% - 2 * var(--edge)));
  margin: var(--edge) auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgb(21 64 44 / 0.06), 0 18px 40px -20px rgb(21 64 44 / 0.28);
}

/* Title bar */
.titlebar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.75rem;
  padding: 0.375rem 1rem;
  border-radius: 9px 9px 0 0;
  background: var(--green-deep);
  color: #f3efdf;
}
.glyph { flex: none; color: #b9d3bb; }
.doc-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.75rem;
  font-size: 0.9375rem;
}
.doc-title strong { font-weight: 700; letter-spacing: 0.01em; }
.doc-sub {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: #c3d3c0;
}

/* Ribbon: only real links */
.ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  padding: 0.375rem 0.5rem 0;
  background: var(--band);
  border-bottom: 1px solid var(--line-strong);
}
.ribbon-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0.75rem;
  border-right: 1px solid var(--line-strong);
}
.ribbon-version {
  margin-left: auto;
  border-right: 0;
  border-left: 1px solid var(--line-strong);
}
.rb-set { display: flex; gap: 0.125rem; }
.rb {
  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(--ink);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: background-color 120ms ease;
}
.rb:hover { background: var(--band-hover); }
.rb[aria-current] {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 -2px 0 var(--green);
  color: var(--green);
  font-weight: 700;
}
.rb-icon { color: var(--green); }
.ribbon-caption {
  padding: 0.0625rem 0 0.375rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* ---------- Main sheet area ---------- */

main:focus { outline: none; }
main:focus-visible { outline: 3px solid var(--green); outline-offset: -3px; }

/* Formula bar (shown by JS) */
.formula {
  display: grid;
  grid-template-columns: 5.5rem auto minmax(0, 1fr);
  min-height: 2.75rem;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
}
.namebox,
.fx {
  display: flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.8125rem;
  border-right: 1px solid var(--line-strong);
}
.namebox {
  justify-content: flex-start;
  padding: 0 0.75rem;
  background: var(--band-soft);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.fx {
  padding: 0 0.875rem;
  color: var(--muted);
  font-style: italic;
}
.formula-value {
  padding: 0.6875rem var(--pad-x);
  font-size: 1rem;
  line-height: 1.35;
  white-space: pre-line;
  overflow-wrap: break-word;
  color: var(--ink);
}

/* Column letters */
.colband {
  position: relative;
  display: grid;
  grid-template-columns: var(--cols);
  padding-left: var(--g);
  background: var(--band);
  border-bottom: 1px solid var(--line-strong);
}
.colband::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--g);
  border-right: 1px solid var(--line-strong);
}
.colband::after { /* select-all corner mark */
  content: "";
  position: absolute;
  left: calc(var(--g) - 0.6875rem);
  bottom: 0.25rem;
  border-left: 0.4375rem solid transparent;
  border-bottom: 0.4375rem solid var(--line-strong);
}
.colband span {
  padding: 0.3125rem 0;
  border-right: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: center;
  color: var(--muted);
}
.colband span:last-child { border-right: 0; }
.colband .is-active {
  background: var(--green-tint);
  color: var(--green-deep);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--green);
}

/* Rows */
.row {
  position: relative;
  display: grid;
  grid-template-columns: var(--cols);
  min-height: 2.75rem;
  padding-left: var(--g);
  border-bottom: 1px solid var(--line);
  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(--g);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--band);
  border-right: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.row.is-active-row::before {
  background: var(--green-tint);
  color: var(--green-deep);
  font-weight: 700;
  box-shadow: inset -2px 0 0 var(--green);
}
.row.freeze { border-bottom: 2px solid var(--freeze); }
.row.fields {
  min-height: 2.25rem;
  background-color: var(--band-soft);
  border-bottom-color: var(--line-strong);
}

/* Cells */
.cell {
  position: relative;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.6875rem var(--pad-x);
  font-size: 1.0625rem;
  line-height: var(--line-box);
  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; }

/* Each cell repaints its own right edge so hover fills and merged cells keep gridlines */
.cell { box-shadow: inset -1px 0 0 var(--line); }
.cell[data-span] { background-color: var(--surface); } /* merged: hides inner gridlines */
time { white-space: nowrap; }

.js .cell { cursor: cell; }
.js .cell:hover { background-color: #f7f6ec; }
.cell:focus { outline: none; }

/* Selection, fill handle */
.cell.is-selected::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 2;
  border: 2px solid var(--green);
  pointer-events: none;
}
.cell.is-selected::before {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -4px;
  z-index: 3;
  width: 8px;
  height: 8px;
  background: var(--green);
  border: 1.5px solid var(--surface);
  pointer-events: none;
}
.cell.is-selected:focus-visible::after {
  border-width: 3px;
  box-shadow: 0 0 0 3px rgb(30 107 69 / 0.22);
}

/* Type roles */
.name {
  padding: clamp(2rem, 1rem + 4vw, 4rem) var(--pad-x) clamp(0.875rem, 0.5rem + 1vw, 1.375rem);
  font-size: clamp(3rem, 1.6rem + 5.4vw, 6.75rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--green-deep);
}
.lede {
  padding-top: 0.875rem;
  padding-bottom: 1.375rem;
  font-size: clamp(1.125rem, 1rem + 0.45vw, 1.4375rem);
  line-height: 1.4;
  color: var(--ink-2);
  text-wrap: pretty;
}
.sheet-title {
  padding-top: 1.375rem;
  padding-bottom: 0.5rem;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--green-deep);
}
.fh {
  align-self: center;
  padding: 0.5rem var(--pad-x);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.org {
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}
.role { color: var(--ink); }
.period,
.key {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: var(--line-box);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.scope { font-size: 1rem; color: var(--ink-2); }
.area {
  font-size: 1rem;
  color: var(--ink-2);
  box-shadow: inset 3px 0 0 var(--green-tint), inset -1px 0 0 var(--line);
}
.skill { font-weight: 700; color: var(--ink); }
.record dd { color: var(--ink); }

.row.blank { min-height: 2.25rem; }

/* Cell comment */
.flag {
  position: absolute;
  top: 0;
  right: 0;
  border-top: 0.5625rem solid var(--note);
  border-left: 0.5625rem solid transparent;
}
.note {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.has-note:hover .note,
.has-note.is-selected .note {
  top: -1px;
  left: calc(100% + 0.625rem);
  z-index: 5;
  width: max-content;
  max-width: 12rem;
  height: auto;
  padding: 0.5rem 0.75rem;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  background: var(--note-bg);
  border: 1px solid var(--note-line);
  box-shadow: 0 6px 16px -8px rgb(21 64 44 / 0.35);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.3;
  color: var(--ink);
  cursor: default;
}
.has-note:hover .note::before,
.has-note.is-selected .note::before { /* leader to the marker */
  content: "";
  position: absolute;
  top: 0.4375rem;
  right: 100%;
  width: 0.625rem;
  border-top: 1px solid var(--note-line);
}

/* Sheet tabs */
.sheetbar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--line-strong);
  border-radius: 0 0 9px 9px;
  background: var(--band);
}
.tabs ul {
  display: flex;
  flex-wrap: wrap;
  padding-left: var(--g);
}
.tabs a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1.125rem;
  border-right: 1px solid var(--line-strong);
  color: var(--ink-2);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: background-color 120ms ease;
}
.tabs li:first-child a { border-left: 1px solid var(--line-strong); }
.tabs a:hover { background: var(--band-hover); }
.tabs a[aria-current] {
  background: var(--surface);
  color: var(--green);
  box-shadow: inset 0 -3px 0 var(--green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  text-decoration-color: transparent;
}
.tabs a:focus-visible { outline-offset: -3px; }
.sheetbar .hint {
  align-self: center;
  margin-left: auto;
  padding: 0 1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Without JS: every sheet stacked, separated ---------- */
.sheet + .sheet .row.cap { border-top: 2px solid var(--freeze); }
.js .sheet + .sheet .row.cap { border-top: 0; }

/* ---------- Tablet ---------- */
@media (max-width: 63.99em) {
  :root {
    --g: 2.75rem;
    --pad-x: 0.75rem;
    --cols: minmax(0, 25fr) minmax(0, 27fr) minmax(0, 20fr) minmax(0, 28fr);
    --x1: calc(var(--g) + (100% - var(--g)) * 0.25);
    --x2: calc(var(--g) + (100% - var(--g)) * 0.52);
    --x3: calc(var(--g) + (100% - var(--g)) * 0.72);
  }
}

/* ---------- Phone: one column, stacked cells ---------- */
@media (max-width: 44.99em) {
  :root { --g: 2.5rem; --edge: 0px; }

  .workbook { border: 0; border-radius: 0; box-shadow: none; }
  .titlebar,
  .sheetbar { border-radius: 0; }

  .ribbon { padding-inline: 0.25rem; }
  .ribbon-group { padding: 0 0.375rem; }
  .rb { padding: 0 0.625rem; }

  .formula { grid-template-columns: 4rem auto minmax(0, 1fr); }
  .fx { padding: 0 0.625rem; }

  .colband,
  .row.fields { display: none; }

  .row {
    grid-template-columns: minmax(0, 1fr);
    background-image: none;
  }
  .row .cell[data-col] { grid-column: 1 / -1; }
  .row > .cell + .cell { padding-top: 0.25rem; }
  .row > .cell:not(:last-child) { padding-bottom: 0.25rem; }
  .row .cell[data-col] { box-shadow: none; }
  /* Keep the selection affordance inside the edge on narrow screens. */
  .cell.is-selected::after { inset: 0; }
  .cell.is-selected::before { right: 0; bottom: 0; }
  .row .cell.area { box-shadow: inset 3px 0 0 var(--green-tint); }

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

  .has-note:hover .note,
  .has-note.is-selected .note {
    position: relative;
    top: auto;
    left: auto;
    display: block;
    margin-top: 0.5rem;
    max-width: 100%;
  }
  .has-note:hover .note::before,
  .has-note.is-selected .note::before { display: none; }

  .tabs ul { padding-left: 0; }
  .tabs li:first-child a { border-left: 0; }
  .tabs a { padding: 0 0.875rem; }
  .sheetbar .hint { display: none; }
}

@media (hover: none) {
  .sheetbar .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .cell.is-selected::after { border-color: Highlight; }
  .cell.is-selected::before { background: Highlight; }
  .tabs a[aria-current] { text-decoration-color: currentColor; }
  .rb[aria-current] { outline: 1px solid currentColor; }
}

@media print {
  body { background: #fff; }
  .workbook { width: auto; margin: 0; border: 0; box-shadow: none; }
  .ribbon,
  .formula,
  .colband,
  .sheetbar { display: none !important; }
  .sheet[hidden] { display: block !important; }
  .row { break-inside: avoid; }
}
