/* Hermes concept gallery — shell styles only (component Q1).
   System fonts, no external assets, light/dark via prefers-color-scheme,
   WCAG 2.2 AA contrast in both schemes, reduced motion respected. */

:root {
  color-scheme: light dark;

  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #e9e6dd;
  --text: #1a1a1a;
  --muted: #474747;
  --border: #6f6f6f;
  --border-soft: #b8b4aa;
  --accent: #0b5b8a;
  --accent-text: #ffffff;
  --selected-bg: #1a1a1a;
  --selected-text: #ffffff;
  --notice-bg: #f5e3ad;
  --notice-text: #2f2300;
  --focus: #0b5b8a;
  --error-bg: #f9dcd8;
  --error-text: #5a1208;
  --link: #0b5b8a;

  --frame-top: 24rem;
  --radius: 0.25rem;
  --gap: 0.75rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --surface: #1c1f23;
    --surface-2: #272b31;
    --text: #ececec;
    --muted: #c9c9c9;
    --border: #9a9fa6;
    --border-soft: #4c5158;
    --accent: #8ec8ff;
    --accent-text: #0b1620;
    --selected-bg: #ececec;
    --selected-text: #121416;
    --notice-bg: #3a2f0f;
    --notice-text: #ffe9a8;
    --focus: #8ec8ff;
    --error-bg: #4a1a14;
    --error-text: #ffd7d0;
    --link: #8ec8ff;
  }
}

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

html {
  font-family: var(--font);
  font-size: 100%;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

/* Focus: continuous 3 px ring with a 2 px offset so both adjacent colours are the page background */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

button,
select {
  font: inherit;
  color: inherit;
}

code {
  font-family: var(--mono);
  font-size: 0.95em;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip link: first focusable, visible on focus, never obscured */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -100%;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--selected-bg);
  color: var(--selected-text);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0.5rem;
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}

.notice {
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--notice-bg);
  color: var(--notice-text);
  border-bottom: 1px solid var(--border-soft);
  font-size: 1rem;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap) 2rem;
  align-items: flex-start;
  padding: 1rem 1rem 0.5rem;
}

.masthead-copy {
  flex: 1 1 32rem;
  min-width: 0;
}

.masthead h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.masthead-lede {
  margin: 0;
  color: var(--muted);
  max-width: 62rem;
}

.gallery-status {
  flex: 1 1 100%;
  margin: 0;
  font-size: 1rem;
}

.gallery-status:empty {
  display: none;
}

.gallery-status.is-error {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--border);
}

/* ---------- Personality navigation ---------- */

.persona-nav {
  padding: 0.5rem 1rem 0.75rem;
}

.tablist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 100ms linear, color 100ms linear;
}

.tab-name {
  font-weight: 700;
  line-height: 1.3;
}

.tab-thesis {
  display: none;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--muted);
}

.tab-thesis:empty {
  display: none;
}

.tab[aria-selected="true"] {
  background: var(--selected-bg);
  color: var(--selected-text);
  border-color: var(--selected-bg);
}

.tab[aria-selected="true"] .tab-thesis {
  color: var(--selected-text);
}

.tab[aria-selected="true"] .tab-name::before {
  content: "\25B8\00a0"; /* small right-pointing triangle: state is visible without colour */
}

.tab:hover {
  background: var(--surface-2);
}

.tab[aria-selected="true"]:hover {
  background: var(--selected-bg);
}

/* Show the one-line thesis inside each tab from 64rem up (five columns, two rows). */
@media (min-width: 64rem) {
  .tablist {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .tab-thesis {
    display: block;
  }

  .tab-thesis:empty {
    display: none;
  }
}

/* Below 48rem: native select + previous/next replace the tablist. Both exist in the DOM. */
.select-nav {
  display: none;
}

@media (max-width: 47.99rem) {
  .tablist-wrap {
    display: none;
  }

  .select-nav {
    display: block;
  }
}

.select-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.select-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.persona-select {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.nav-step,
.subtab,
.tool-button,
.tool-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0.5rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 100ms linear, color 100ms linear;
}

.nav-step {
  flex: 0 0 auto;
}

.nav-step:hover,
.subtab:hover,
.tool-button:hover,
.tool-link:hover {
  background: var(--surface-2);
}

.tool-link {
  text-decoration: underline;
  text-underline-offset: 0.15em;
  color: var(--link);
}

/* No-JS: static ordered list of the ten standalone pages; the JS controls are hidden. */
html:not(.js) .js-only {
  display: none !important;
}

.static-list-wrap {
  display: none;
}

html:not(.js) .static-list-wrap,
.static-list-wrap.is-visible {
  display: block;
  margin-top: 0.5rem;
}

.static-list-note {
  margin: 0 0 0.25rem;
  color: var(--muted);
}

.static-list {
  margin: 0;
  padding-left: 1.5rem;
  columns: 14rem auto;
  column-gap: 2rem;
}

.static-list li {
  break-inside: avoid;
  padding: 0.25rem 0;
}

.static-list a {
  display: inline-block;
  padding: 0.35rem 0;
  min-height: 44px;
  line-height: 1.5;
}

/* ---------- Main: stage + persona panel ---------- */

main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.stage-layout {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
}

@media (min-width: 68rem) {
  .stage-layout {
    grid-template-columns: minmax(0, 64fr) minmax(0, 36fr);
    align-items: start;
  }
}

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.75rem;
}

.stage-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.subtab[aria-pressed="true"] {
  background: var(--selected-bg);
  color: var(--selected-text);
  border-color: var(--selected-bg);
}

.subtab[aria-pressed="true"]::before {
  content: "\2713\00a0"; /* check mark: pressed state visible without colour */
}

.subtab-flag {
  font-size: 0.875rem;
  opacity: 1;
}

.stage-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.frame-wrap {
  min-width: 0;
  border: 2px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.stage-frame {
  display: block;
  width: 100%;
  border: 0;
  background: #ffffff;
  min-height: 70vh;
  height: max(70vh, calc(100vh - var(--frame-top) - 1rem));
}

.catalog-note {
  padding: 1rem 1.25rem;
  border: 2px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 12rem;
}

.catalog-note p {
  margin: 0 0 0.75rem;
  max-width: 60rem;
}

.catalog-note p:last-child {
  margin-bottom: 0;
}

.catalog-note-title {
  font-size: 1.125rem;
}

/* Persona panel */

.persona-panel {
  min-width: 0;
}

.panel-details {
  border: 2px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-summary {
  cursor: pointer;
  padding: 0.75rem 1rem;
  min-height: 44px;
  font-weight: 600;
  list-style-position: inside;
}

.panel-details[open] .panel-summary {
  border-bottom: 1px solid var(--border-soft);
}

.panel-body {
  padding: 0.75rem 1rem 1rem;
}

.panel-heading {
  margin: 0 0 0.35rem;
  font-size: 1.375rem;
  line-height: 1.25;
}

.panel-id {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.875rem;
  padding: 0.05rem 0.4rem;
  margin-right: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  vertical-align: 0.2em;
}

.panel-thesis {
  margin: 0 0 0.75rem;
  font-size: 1.0625rem;
}

.panel-thesis:empty {
  display: none;
}

.panel-sections h3 {
  margin: 1rem 0 0.25rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.panel-sections p {
  margin: 0;
}

.panel-values {
  margin: 0;
  padding-left: 1.5rem;
}

.panel-signature {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.2rem 0.75rem;
}

.panel-signature dt {
  font-weight: 600;
}

.panel-signature dd {
  margin: 0 0 0.35rem;
  overflow-wrap: anywhere;
}

/* Two-column code/description grid once the panel is wide enough for it. */
@media (min-width: 30rem) {
  .panel-signature {
    grid-template-columns: fit-content(11rem) minmax(0, 1fr);
  }

  .panel-signature dd {
    margin: 0;
  }
}

.panel-signature .axis-code {
  font-family: var(--mono);
  font-weight: 600;
}

.panel-source {
  margin-top: 1rem !important;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.9375rem;
}

.panel-fallback {
  margin: 0;
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 1rem;
  background: var(--surface);
  color: var(--muted);
}

.footer-line {
  margin: 0 0 0.25rem;
}

.footer-line:last-child {
  margin-bottom: 0;
}

/* ---------- Motion ---------- */

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

/* ---------- Forced colours ---------- */

@media (forced-colors: active) {
  .tab[aria-selected="true"],
  .subtab[aria-pressed="true"] {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }
}
