/* Style-page chrome only. Nothing in here ships to the site.
   Everything visible inside a specimen is styled by ../css/pe.css. */

.sg-shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
@media (min-width: 1024px) { .sg-shell { grid-template-columns: 240px minmax(0, 1fr); } }

/* Top bar */
.sg-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; padding: 0 24px; background: var(--pe-teal-900); color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); }
.sg-bar__brand { display: flex; align-items: center; gap: 14px; }
.sg-bar__brand img { height: 28px; width: auto; }
.sg-bar__title { font-family: var(--pe-font-body); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--pe-teal-200); font-weight: 700; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.18); }
.sg-bar__motion { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.6); }
.sg-bar__motion button { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.2); color: #fff; font-family: var(--pe-font-display); font-weight: 500; font-size: 13px; }
.sg-bar__motion button[aria-pressed="true"] { background: var(--pe-teal-200); color: var(--pe-teal-900); border-color: transparent; }
.sg-bar__motion button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 767px) {
  .sg-bar { padding: 0 16px; }
  .sg-bar__title { display: none; }
  .sg-bar__motion span { display: none; }
  .sg-bar__motion button { padding: 0 10px; }
}

/* Side nav */
.sg-side { display: none; }
@media (min-width: 1024px) {
  .sg-side { display: block; border-right: 1px solid var(--pe-line); background: #fff; }
  .sg-side__inner { position: sticky; top: 64px; padding: 32px 24px; max-height: calc(100vh - 64px); overflow: auto; }
}
.sg-side .pe-anchor-nav { position: static; }
.sg-side .pe-anchor-nav a { font-size: 14px; padding: 6px 0 6px 16px; }
.sg-side .pe-anchor-nav a span { color: var(--pe-text-muted); font-size: 11px; font-weight: 700; letter-spacing: .1em; margin-right: 8px; font-variant-numeric: tabular-nums; }
.sg-side .pe-anchor-nav a.is-current span { color: var(--pe-teal-500); }

/* Sections */
.sg-main { min-width: 0; }
.sg-section { padding: 72px 0 24px; border-top: 1px solid var(--pe-line); scroll-margin-top: 64px; }
.sg-section:first-child { border-top: 0; }
.sg-section__head { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 16px; align-items: baseline; margin-bottom: 40px; }
.sg-section__num { font-family: var(--pe-font-display); font-weight: 300; font-size: 44px; line-height: 1; color: var(--pe-teal-300); font-variant-numeric: tabular-nums; }
.sg-section__title { font-family: var(--pe-font-display); font-weight: 600; font-size: 28px; color: var(--pe-ink); letter-spacing: -.01em; }
.sg-section__intro { max-width: 60ch; margin-top: 10px; color: var(--pe-text-body); font-size: 15px; line-height: 1.6; }

/* Specimen frame */
.sg-spec { margin: 0 0 40px; min-width: 0; }
.sg-spec__label { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--pe-text-muted); }
.sg-spec__label em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--pe-text-muted); }
.sg-spec__frame { border: 1px solid var(--pe-line); border-radius: 6px; overflow: hidden; }
/* Unlayered chrome beats layered kit CSS, so only paint white where no kit surface class is present */
.sg-spec__frame:not(.pe-on-dark):not(.pe-section--subtle):not(.pe-section--dark):not(.pe-section--silver) { background: #fff; }
.sg-spec__frame--bleed { border: 0; border-radius: 0; margin-inline: calc(var(--pe-gutter) * -1); }
.sg-spec__frame--pad { padding: 32px; }
.sg-spec__frame--dark { background: var(--pe-teal-900); }
.sg-spec__frame--cloud { background: var(--pe-cloud); }
.sg-note { margin-top: 12px; font-size: 13px; color: var(--pe-text-body); max-width: 72ch; line-height: 1.55; }
.sg-note strong { color: var(--pe-ink); }
.sg-note code, .sg-token { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; background: var(--pe-cloud); padding: 1px 6px; border-radius: 4px; color: var(--pe-teal-900); }

/* Swatches */
.sg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sg-swatch { border: 1px solid var(--pe-line); border-radius: 6px; overflow: hidden; background: #fff; }
.sg-swatch__chip { height: 88px; }
.sg-swatch__meta { padding: 10px 12px; font-size: 12px; line-height: 1.5; }
.sg-swatch__meta b { display: block; font-family: var(--pe-font-display); font-weight: 600; font-size: 13px; color: var(--pe-ink); }
.sg-swatch__meta span { color: var(--pe-text-muted); }
.sg-role-table, .sg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sg-table th, .sg-table td { padding: 10px 12px; border-bottom: 1px solid var(--pe-line); text-align: left; vertical-align: top; }
.sg-table th { font-family: var(--pe-font-display); font-weight: 600; color: var(--pe-ink); background: var(--pe-cloud); }
.sg-table .pass { color: var(--pe-success); font-weight: 700; }
.sg-table .large { color: var(--pe-teal-600); font-weight: 700; }
.sg-table .fail { color: var(--pe-error); font-weight: 700; }
.sg-dot { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; border: 1px solid rgba(0,0,0,.08); }

/* Type specimen */
.sg-type { display: grid; gap: 0; }
.sg-type__row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 18px 0; border-bottom: 1px solid var(--pe-line); align-items: baseline; }
@media (min-width: 768px) { .sg-type__row { grid-template-columns: 180px 1fr; gap: 24px; } }
.sg-type__meta { font-size: 12px; color: var(--pe-text-muted); line-height: 1.5; }
.sg-type__meta b { display: block; color: var(--pe-ink); font-family: var(--pe-font-display); font-weight: 600; font-size: 13px; }

/* Grid overlay */
.sg-grid { position: relative; padding-block: 24px; }
.sg-grid__cols { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: var(--pe-gap); }
.sg-grid__col { height: 120px; background: rgba(73,165,184,.14); border: 1px dashed rgba(58,124,138,.4); border-radius: 3px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 11px; color: var(--pe-teal-600); font-weight: 700; }
.sg-grid__edge { position: absolute; inset-block: 0; width: 0; border-left: 1px solid var(--pe-orange); }
.sg-grid__tag { position: absolute; top: 0; font-size: 11px; font-weight: 700; color: var(--pe-orange); letter-spacing: .1em; text-transform: uppercase; }
.sg-measure { background: repeating-linear-gradient(90deg, rgba(73,165,184,.10) 0 1ch, transparent 1ch 2ch); border: 1px dashed rgba(58,124,138,.4); padding: 16px; }

/* Spacing */
.sg-space { display: grid; gap: 10px; }
.sg-space__row { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 16px; font-size: 12px; color: var(--pe-text-muted); }
.sg-space__row b { color: var(--pe-ink); font-family: var(--pe-font-display); }
.sg-space__bar { height: 14px; background: var(--pe-teal-500); border-radius: 2px; }
.sg-rhythm { background: var(--pe-cloud); }
.sg-rhythm__section { background: #fff; border: 1px dashed var(--pe-line-strong); text-align: center; font-size: 12px; color: var(--pe-text-muted); padding: 14px; }
.sg-rhythm__gap { text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--pe-orange); display: flex; align-items: center; justify-content: center; }

/* States helpers — replicate pseudo-states for the matrix */
.sg-states { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; align-items: start; }
.sg-state { display: grid; gap: 10px; justify-items: start; }
.sg-state__label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--pe-text-muted); }
.sg-hover .pe-btn { background: var(--pe-primary-hover); }
.sg-hover .pe-btn--accent { background: var(--pe-accent-hover); }
.sg-hover .pe-btn--secondary { background: transparent; color: var(--pe-primary-hover); border-color: var(--pe-primary); }
.sg-hover .pe-btn--inverse { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.4); }
.sg-active .pe-btn { background: var(--pe-primary-active); }
.sg-active .pe-btn--accent { background: var(--pe-accent-active); }
.sg-active .pe-btn--secondary { background: var(--pe-cloud); color: var(--pe-primary-hover); border-color: var(--pe-primary); }
.sg-focus .pe-btn, .sg-focus .pe-filter__chip, .sg-focus .pe-link { outline: 2px solid var(--pe-focus); outline-offset: 3px; border-radius: 10px; }
.sg-focus .pe-link { border-radius: 2px; }
.sg-focus .pe-spec__row { outline: 2px solid var(--pe-focus); outline-offset: 3px; border-radius: 4px; }
.sg-focus.pe-on-dark .pe-btn { outline-color: #fff; }
.sg-hover .pe-link { color: var(--pe-link-hover); background-size: 100% 1.5px; }
.sg-hover .pe-filter__chip { border-color: var(--pe-teal-500); color: var(--pe-teal-900); }
.sg-hover .pe-field__control { border-color: var(--pe-teal-500); }
.sg-focus .pe-field__control { border-color: var(--pe-teal-500); box-shadow: 0 0 0 3px rgba(73,165,184,.30); }
.sg-hover .pe-card--interactive { transform: translateY(-4px); border-color: var(--pe-teal-500); box-shadow: var(--pe-shadow-card); }
.sg-hover .pe-spec__row, .sg-hover .pe-list__row, .sg-hover .pe-story-row, .sg-hover .pe-job, .sg-hover .pe-tindex__link, .sg-hover .pe-routes a { border-bottom-color: var(--pe-teal-500); box-shadow: 0 -1px 0 0 var(--pe-teal-500); }

/* Icon grid */
.sg-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.sg-icon { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 8px; border: 1px solid var(--pe-line); border-radius: 6px; font-size: 11px; color: var(--pe-text-muted); text-align: center; word-break: break-all; }

/* Responsive frames */
.sg-frames { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .sg-frames { grid-template-columns: 390px 1fr; } }
.sg-frame { border: 1px solid var(--pe-line); border-radius: 8px; overflow: hidden; background: var(--pe-cloud); }
.sg-frame__bar { display: flex; justify-content: space-between; padding: 8px 12px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--pe-text-muted); background: #fff; border-bottom: 1px solid var(--pe-line); }
.sg-frame iframe { display: block; border: 0; background: #fff; }
.sg-frame--phone { overflow: auto; }
.sg-frame--phone iframe { width: 390px; max-width: 100%; height: 760px; }
.sg-frame--tablet { overflow: auto; }
.sg-frame--tablet iframe { width: 768px; height: 760px; }
.sg-frame--desktop { overflow: auto; }
.sg-frame--desktop iframe { width: 1440px; height: 900px; transform-origin: 0 0; }
.sg-frame--desktop .sg-frame__scale { width: 100%; height: 0; padding-bottom: 62.5%; position: relative; overflow: hidden; }
.sg-frame--desktop .sg-frame__scale iframe { position: absolute; inset: 0; }

/* Motion demo */
.sg-motion-stage { position: relative; height: 320px; overflow: hidden; background: var(--pe-teal-900); background-image: var(--pe-gradient-dark); border-radius: 6px; }
.sg-timing { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.sg-timing__item { padding: 14px 16px; border: 1px solid var(--pe-line); border-radius: 6px; font-size: 12px; color: var(--pe-text-muted); }
.sg-timing__item b { display: block; font-family: var(--pe-font-display); font-weight: 600; font-size: 14px; color: var(--pe-ink); margin-bottom: 4px; }
.sg-timing__item code { font-family: ui-monospace, Menlo, monospace; color: var(--pe-teal-900); }

/* Sample flag: render a discreet marker on sample content when the page
   has ?samples in the URL (dev aid, never on the site). */
.sg-show-samples [data-pe-sample] { outline: 1px dashed var(--pe-orange); outline-offset: 2px; }
.sg-approval { font-size: 12px; color: var(--pe-text-muted); }
.sg-approval b { color: var(--pe-orange-700); }
