/* System page layout. Colours, type, spacing, radii, elevation and motion are
   the pinned Warm Paper B token and Encore's family.css. Layout only. */

.top-in .es-appearance { margin-top: 0; }
.top { }
.secnav { border-top: 1px solid var(--es-line); background: var(--es-surface); }
.secnav-in {
  display: flex; gap: var(--es-space-1); overflow-x: auto; scrollbar-width: none;
  padding-top: var(--es-space-2); padding-bottom: var(--es-space-2);
  -webkit-overflow-scrolling: touch;
}
.secnav-in::-webkit-scrollbar { display: none; }
.secnav a {
  flex: none; display: inline-flex; align-items: center;
  min-height: 36px; padding: 0 var(--es-space-4);
  border-radius: var(--es-radius-pill);
  font-size: var(--es-fs-body-sm); font-weight: 500; text-decoration: none;
  color: var(--es-text-2); border: 1px solid transparent;
  transition: background-color var(--es-dur-state) var(--es-ease), color var(--es-dur-state) var(--es-ease);
}
.secnav a:hover { color: var(--es-text); }
.secnav a.on { background: var(--es-text); color: var(--es-bg); }

.sys-sec { padding: var(--es-space-8) 0 var(--es-space-2); scroll-margin-top: 112px; }
.sys-sec + .sys-sec { border-top: 1px solid var(--es-line); margin-top: var(--es-space-7); }
#overview { padding-top: var(--es-space-8); }
.sys-sec h1, .sys-sec h2 { margin: var(--es-space-2) 0 var(--es-space-3); text-wrap: balance; }
.sys-sec h1 em, .sys-sec h2 em { font-style: italic; font-weight: 400; color: var(--es-text-2); }
.lede { color: var(--es-text-2); max-width: 40em; text-wrap: pretty; margin: 0 0 var(--es-space-6); }
.sub { margin: var(--es-space-7) 0 var(--es-space-3); }
.note { color: var(--es-muted); max-width: 44em; margin: var(--es-space-4) 0 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.probe { display: none; }

/* Overview */
.rule-grid { display: grid; gap: var(--es-space-4); grid-template-columns: 1fr; }
.rule { display: flex; flex-direction: column; gap: var(--es-space-2); }
.rule h2 { margin: 0; }
.rule p { color: var(--es-text-2); margin: 0; }
.rule .es-label { color: var(--es-muted); }
.ver-row { display: grid; gap: var(--es-space-6); grid-template-columns: 1fr; margin-top: var(--es-space-7); }
.ver-num { margin: var(--es-space-1) 0; }
.pins { list-style: none; padding: 0; margin: var(--es-space-2) 0 0; display: grid; gap: var(--es-space-2); }
.pins li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--es-space-2) var(--es-space-3); }
.pin-name { font-weight: 600; font-size: var(--es-fs-body-sm); min-width: 15em; }
.pin-sha { color: var(--es-muted); }
.changelog { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border-top: 1px solid var(--es-line); }
.changelog li { display: grid; grid-template-columns: 6.5em 1fr; gap: 2px var(--es-space-4); padding: var(--es-space-3) 0; border-bottom: 1px solid var(--es-line); }
.cl-v { font-weight: 600; }
.cl-when { color: var(--es-muted); font-size: var(--es-fs-caption); grid-column: 1; }
.cl-text { grid-column: 2; grid-row: 1 / span 2; color: var(--es-text-2); }
@media (min-width: 720px) {
  .rule-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ver-row { grid-template-columns: 1fr 2fr; }
}

/* Colour */
.mode-pair { display: grid; gap: var(--es-space-4); grid-template-columns: 1fr; }
.mode-panel {
  background: var(--es-bg); color: var(--es-text);
  border: 1px solid var(--es-line); border-radius: var(--es-radius-card);
  padding: var(--es-space-5); min-width: 0;
}
.sw-list { display: grid; gap: 0; margin-top: var(--es-space-3); }
.sw {
  display: grid; align-items: center; gap: var(--es-space-3);
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  padding: var(--es-space-3) 0; border-top: 1px solid var(--es-line);
}
.sw:first-child { border-top: 0; }
.sw-chip { width: 44px; height: 44px; border-radius: var(--es-radius-control); border: 1px solid var(--es-line); box-shadow: var(--es-elev-1); }
.sw-meta { display: grid; min-width: 0; }
.sw-name { font-size: var(--es-fs-body-sm); font-weight: 600; }
.sw-var { color: var(--es-muted); font-size: 11px; overflow-wrap: anywhere; }
.sw-hex { color: var(--es-text-2); }
.sw-ratio { min-width: 5.2em; text-align: right; }
.ratio { font-weight: 600; letter-spacing: 0; }
.ratio.pass { color: var(--es-text); }
.ratio.low { color: var(--es-muted); border-style: dashed; }
@media (min-width: 900px) { .mode-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Accents */
.acc-grid { display: grid; gap: var(--es-space-4); grid-template-columns: 1fr; }
.acc { display: grid; gap: var(--es-space-4); align-content: start; }
.acc-head { display: flex; align-items: center; gap: var(--es-space-3); }
.acc-mark { width: 40px; height: 40px; border-radius: var(--es-radius-control); flex: none; object-fit: contain; }
.acc-name h4 { margin: 0; }
.acc-name p { margin: 0; }
.acc-pair { display: grid; gap: var(--es-space-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.acc-panel {
  background: var(--es-bg); color: var(--es-text);
  border: 1px solid var(--es-line); border-radius: var(--es-radius-control);
  padding: var(--es-space-3); display: grid; gap: var(--es-space-2); align-content: start; min-width: 0;
}
.acc-panel .es-btn { width: 100%; }
.acc-link { color: var(--es-accent-link); font-weight: 500; }
.acc-hex { margin: var(--es-space-1) 0 0; font-size: 11px; line-height: 1.5; }
.acc-hex code { font-size: 11px; }
.acc-ratios { display: grid; gap: var(--es-space-1); font-size: var(--es-fs-caption); }
.acc-r { display: flex; align-items: center; justify-content: space-between; gap: var(--es-space-2); }
@media (min-width: 640px) { .acc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .acc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Type */
.face-grid, .num-grid { display: grid; gap: var(--es-space-4); grid-template-columns: 1fr; }
.face .face-big { margin: var(--es-space-2) 0; font-size: var(--es-fs-title-1); line-height: 1.1; }
.face .display { font-family: var(--es-font-display); font-weight: 500; letter-spacing: -.02em; }
.face .display.it { font-style: italic; font-weight: 400; color: var(--es-text-2); font-size: var(--es-fs-title-2); }
.face .body { font-family: var(--es-font-body); font-weight: 500; font-size: var(--es-fs-title-3); }
.face .es-body-sm { color: var(--es-muted); overflow-wrap: anywhere; }
.scale { border-top: 1px solid var(--es-line); }
.scale-row { display: grid; gap: var(--es-space-2) var(--es-space-6); grid-template-columns: 1fr; align-items: baseline; padding: var(--es-space-4) 0; border-bottom: 1px solid var(--es-line); }
.scale-meta { display: flex; flex-wrap: wrap; gap: var(--es-space-1) var(--es-space-3); align-items: baseline; }
.scale-meta code { color: var(--es-muted); }
.scale-px { color: var(--es-text-2); font-size: var(--es-fs-caption); }
.scale-row > p { margin: 0; overflow-wrap: anywhere; }
.num-big { font-family: var(--es-font-display); font-size: var(--es-fs-title-1); font-weight: 500; letter-spacing: .02em; margin: var(--es-space-3) 0; }
.num-row { display: flex; flex-wrap: wrap; gap: var(--es-space-2) var(--es-space-5); font-family: var(--es-font-display); font-size: var(--es-fs-title-3); margin: 0 0 var(--es-space-3); }
.num .es-body-sm { color: var(--es-muted); overflow-wrap: anywhere; }
/* The one place old-style figures are shown, labelled, so the difference is visible. */
.oldstyle, .oldstyle * { font-variant-numeric: oldstyle-nums proportional-nums; font-feature-settings: "onum" 1, "lnum" 0, "pnum" 1, "tnum" 0; }
.num.old { background: transparent; box-shadow: none; border-style: dashed; }
@media (min-width: 720px) {
  .face-grid, .num-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scale-row { grid-template-columns: 15em 1fr; }
}

/* Spacing, radii, elevation, motion */
.space-list { display: grid; gap: var(--es-space-2); }
.space-row { display: grid; grid-template-columns: 6.5em 1fr 3.5em; align-items: center; gap: var(--es-space-3); }
.space-row code { color: var(--es-muted); }
.space-bar { height: 14px; max-width: 100%; border-radius: var(--es-radius-sm); background: var(--es-accent); opacity: .85; }
.radius-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--es-space-3); }
.radius-tile, .elev-tile {
  display: grid; gap: var(--es-space-1); align-content: end; min-height: 120px;
  padding: var(--es-space-4); background: var(--es-surface); border: 1px solid var(--es-line); min-width: 0;
}
.radius-tile code, .elev-tile code { color: var(--es-muted); font-size: 11px; overflow-wrap: anywhere; }
.elev-grid { display: grid; gap: var(--es-space-5); grid-template-columns: 1fr; }
.elev-tile { background: var(--es-elevated); border-radius: var(--es-radius-card); }
.motion { display: grid; gap: var(--es-space-4); justify-items: start; }
.tracks { display: grid; gap: var(--es-space-3); width: 100%; }
.track { display: grid; grid-template-columns: 4.5em 4.5em 1fr; align-items: center; gap: var(--es-space-3); }
.track code { color: var(--es-muted); }
.lane { position: relative; height: 28px; border-radius: var(--es-radius-pill); background: var(--es-surface); border: 1px solid var(--es-line); }
.dot {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--es-accent); transition-property: left; transition-timing-function: var(--es-ease);
}
.dot.go { left: calc(100% - 23px); }
@media (prefers-reduced-motion: reduce) { .dot { transition: none !important; } }
@media (min-width: 720px) {
  .radius-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .elev-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Components */
.comp-grid { display: grid; gap: var(--es-space-4); grid-template-columns: 1fr; }
.comp { display: grid; gap: var(--es-space-4); align-content: start; box-shadow: var(--es-elev-1); background: var(--es-elevated); min-width: 0; }
[data-theme="dark"] .comp { background: var(--es-surface); }
@media (prefers-color-scheme: dark) { [data-theme="system"] .comp { background: var(--es-surface); } }
.comp .es-label { margin: 0; }
.comp-row { display: flex; flex-wrap: wrap; gap: var(--es-space-2) var(--es-space-3); align-items: center; }
.comp-col { display: grid; gap: var(--es-space-3); }
.comp .es-appearance { margin-top: 0; max-width: 100%; }
.comp .es-card.inner { background: var(--es-surface); }
.comp .es-card.inner p { color: var(--es-text-2); margin: var(--es-space-2) 0 0; }
.chip-candidate { color: var(--es-muted); }
.chip-replace { color: var(--es-text-2); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--es-space-4); cursor: pointer; }
.es-sheet.inline { min-height: 0; border-radius: var(--es-radius-sheet); border: 1px solid var(--es-line); display: grid; gap: var(--es-space-3); max-width: 440px; }
.es-sheet.inline h3, .es-sheet.inline p { margin: 0; }
.es-sheet.inline p { color: var(--es-text-2); }
.menu-spec { max-width: 400px; display: grid; gap: var(--es-space-3); }
.menu-bar { display: flex; align-items: center; justify-content: space-between; }
.menu-word { display: inline-flex; align-items: center; gap: 9px; font-family: var(--es-font-display); font-size: var(--es-fs-title-2); font-weight: 500; }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--es-tap); height: var(--es-tap); padding: 0;
  border-radius: var(--es-radius-pill); border: 1px solid var(--es-line);
  background: var(--es-elevated); color: var(--es-text); cursor: pointer; box-shadow: var(--es-elev-1);
}
.menu-panel {
  background: var(--es-elevated); border: 1px solid var(--es-line); border-radius: var(--es-radius-card);
  box-shadow: var(--es-elev-2); padding: var(--es-space-4); display: grid; gap: var(--es-space-3);
}
[data-theme="dark"] .menu-panel { background: var(--es-surface); }
@media (prefers-color-scheme: dark) { [data-theme="system"] .menu-panel { background: var(--es-surface); } }
.menu-pills { display: flex; flex-wrap: wrap; gap: var(--es-space-2); }
.menu-panel .es-btn.pill { min-height: 36px; font-size: var(--es-fs-body-sm); padding: 0 var(--es-space-4); }
.menu-panel .es-appearance { margin-top: 0; }
.menu-about { color: var(--es-muted); margin: 0; border-top: 1px solid var(--es-line); padding-top: var(--es-space-3); }
@media (min-width: 720px) {
  .comp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comp.wide { grid-column: 1 / -1; }
}

/* Layouts */
.size-grid { display: grid; gap: var(--es-space-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.size { display: grid; gap: var(--es-space-3); align-content: start; }
.size-top { display: grid; gap: 2px; }
.size-top p { margin: 0; }
.skel { display: grid; gap: var(--es-space-1); grid-template-columns: repeat(var(--c, 1), minmax(0, 1fr)); }
.skel[data-cols="1"] { --c: 1; }
.skel[data-cols="2"] { --c: 2; }
.skel[data-cols="3"] { --c: 3; }
.skel-card { height: 34px; border-radius: var(--es-radius-sm); background: var(--es-bg); border: 1px solid var(--es-line); }
.size-bar { height: 6px; border-radius: var(--es-radius-pill); background: var(--es-line); overflow: hidden; }
.size-bar span { display: block; height: 100%; background: var(--es-text); border-radius: inherit; }
.size p.es-body-sm { color: var(--es-text-2); margin: 0; }
@media (min-width: 720px) { .size-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.shot-grid { display: grid; gap: var(--es-space-4); grid-template-columns: 1fr; margin: var(--es-space-3) 0; }
.shot { margin: 0; display: grid; gap: var(--es-space-2); align-content: start; min-width: 0; }
.shot-link { display: block; border: 1px solid var(--es-line); border-radius: var(--es-radius-card); overflow: hidden; background: var(--es-surface); box-shadow: var(--es-elev-1); }
.shot-link.tall { max-height: 560px; }
.shot img { display: block; width: 100%; height: auto; }
.shot-link.tall img { object-fit: cover; object-position: top; max-height: 560px; }
.shot figcaption { font-size: var(--es-fs-body-sm); color: var(--es-text-2); display: grid; gap: 2px; }
.shot figcaption .es-label { display: block; }
.shot.phone { max-width: 320px; }
.fold { margin: var(--es-space-4) 0; }
@media (min-width: 720px) { .shot-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Sound section sits inside the system page */
#sound .status { margin-top: 0; }
#sound .token-sec { padding-top: var(--es-space-4); }
#sound .grid-sec, #sound .beds-sec, #sound .dev-sec { margin-top: var(--es-space-6); }
.sound-credits { margin-top: var(--es-space-6); }
.sound-credits .credits-fold { margin: 0; }

@media (max-width: 520px) {
  .top-in { gap: var(--es-space-2); }
  .top-in .brand span { font-size: var(--es-fs-title-3); }
  .top-in .es-appearance button { padding: 7px 11px; font-size: 13px; min-width: 40px; }
}
.sys-sec { scroll-margin-top: 124px; }
