/*
 * The /harness-model page. Loaded by its template as <link precedence>, outside Tailwind, and kept in the document
 * after the reader leaves the route: every rule sits under .hm. Colours are site tokens only.
 */

.hm {
  --hexop: 0.1;
  position: relative;
  background: var(--surface-page);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: initial;
  text-rendering: optimizeLegibility;
}
:root[data-theme="dark"] .hm { --hexop: 0.16; }
.hm *, .hm *::before, .hm *::after { box-sizing: border-box; }
.hm p, .hm h1, .hm h2, .hm h3, .hm h4, .hm ul, .hm ol, .hm blockquote { margin: 0; }
.hm ul, .hm ol { padding: 0; list-style: none; }
.hm h1, .hm h2, .hm h3, .hm h4 { color: var(--color-heading); }

/* The site's gutter and page column, as band.tsx and layout.tsx draw them */
.hm .wrap { box-sizing: content-box; max-width: var(--container-page); margin: 0 auto; padding: 0 1.25rem; }
@media (min-width: 40rem) { .hm .wrap { padding: 0 2rem; } }
@media (min-width: 64rem) { .hm .wrap { padding: 0 3.5rem; } }
.hm .cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 3rem; }
@media (min-width: 60rem) {
  .hm .cols { grid-template-columns: minmax(0, 16rem) minmax(0, 43rem); }
  .hm .opening .side { grid-column: 1 / -1; }
  .hm .opening .main { grid-column: 2; }
}
.hm .main > * + * { margin-top: 1.1rem; }
.hm section, .hm footer { scroll-margin-top: 1rem; }
.hm [id] { scroll-margin-top: 1rem; }
.hm a { color: var(--color-primary); text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.hm a:hover { text-decoration-thickness: 2px; }
.hm :focus-visible { outline: 3px solid var(--color-primary); outline-offset: 3px; border-radius: 2px; }
.hm [hidden] { display: none !important; }

/* Model text: the signed words, in serif */
.hm .model { font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.6; color: var(--color-text); }
.hm .model p + p { margin-top: 0.9em; }
.hm .stage-name, .hm .cluster-name, .hm .aspect-name, .hm .principle-name, .hm .model-label, .hm .title {
  font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.005em;
}

/* Opening */
.hm .opening { padding: 4.5rem 0 3.5rem; border-bottom: 1px solid var(--color-accent); }
.hm .opening .main > * + * { margin-top: 1.4rem; }
.hm .title { font-size: clamp(2.6rem, 7vw, 4.25rem); line-height: 1.02; font-weight: 600; }
.hm .eyebrow { margin-top: 0.75rem !important; font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-text-light); font-weight: 600; }
.hm .question { margin-top: 2.25rem !important; font-size: clamp(1.5rem, 3.6vw, 2rem); line-height: 1.25;
  font-weight: 650; letter-spacing: -0.01em; }
.hm .scenario { color: var(--color-text-light); font-size: 1.125rem; }
.hm .model.thesis { font-size: clamp(1.25rem, 2.6vw, 1.5rem); line-height: 1.5; padding-top: 1.4rem;
  border-top: 1px solid var(--color-accent); margin-top: 2rem !important; }
.hm .shape { font-weight: 600; }
.hm .who { color: var(--color-text-light); }
.hm .forward { margin-top: 2.5rem !important; padding-top: 1.5rem; border-top: 1px solid var(--color-accent); }
.hm .forward-title { font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-light);
  font-weight: 600; }
.hm .note-box { margin-top: 0.85rem; background: var(--color-surface-card); border: 1px solid var(--color-accent); border-radius: 6px;
  padding: 1rem 1.15rem; }
.hm .note-box p + p { margin-top: 0.6rem; }
.hm .url { font-size: 0.9375rem; color: var(--color-text-light); overflow-wrap: anywhere; }
.hm .copy-row { margin-top: 0.85rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.hm .status { font-size: 0.9375rem; color: var(--color-text-light); min-height: 1.5em; }
.hm .jump { margin-top: 2.5rem !important; display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; }
.hm .jump a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: none;
  border-bottom: 1px solid currentColor; line-height: 1.3; padding: 0.35rem 0 0.15rem; }
.hm .jump a::after { content: "\2193"; margin-left: 0.4em; font-weight: 400; }

/* Buttons */
.hm button { font: inherit; letter-spacing: normal; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.hm .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--color-primary); border-radius: 6px; color: var(--color-primary); font-weight: 600; font-size: 1rem;
  text-decoration: none; background: none; }
.hm .btn:hover { background: var(--color-bg-tint); }
.hm .btn.solid { background: var(--color-primary); color: var(--color-on-primary); }
.hm .btn.solid:hover { filter: brightness(1.08); }
.hm .disclosure { display: inline-flex; align-items: center; gap: 0.55rem; min-height: 44px; color: var(--color-primary);
  font-weight: 600; font-size: 1rem; text-align: left; }
.hm .disclosure.small { font-size: 0.9375rem; }
.hm .disclosure:hover span { text-decoration: underline; text-underline-offset: 0.18em; }
.hm .disclosure::before, .hm .row-toggle::after {
  content: ""; flex: none; width: 0.5em; height: 0.5em; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: translateY(-0.15em) rotate(45deg);
}
.hm .disclosure[aria-expanded="true"]::before, .hm .row-toggle[aria-expanded="true"]::after {
  transform: translateY(0.1em) rotate(-135deg);
}
.hm .row-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 44px; padding: 0.35rem 0; text-align: left; font-family: inherit; font-weight: inherit; }
.hm .row-toggle::after { color: var(--cc, var(--color-primary)); margin-right: 0.35rem; }
.hm .row-toggle:hover span { color: var(--color-primary); }

/* Sections */
.hm .stages, .hm .aspects, .hm .principles, .hm .team, .hm .feedback { padding: 4.5rem 0; border-bottom: 1px solid var(--color-accent); }
.hm .section-title { font-size: clamp(1.6rem, 3.2vw, 1.85rem); line-height: 1.2; font-weight: 650; letter-spacing: -0.01em;
  margin-bottom: 1.25rem; }
@media (min-width: 60rem) { .hm .section-title { margin-bottom: 0; padding-top: 0.1rem; } }
.hm .prompt { font-weight: 600; }
.hm .aside, .hm .hint { color: var(--color-text-light); font-size: 0.9375rem; }
.hm .panel > div > * + *, .hm div.panel:not(.aspect-panel) > * + * { margin-top: 0.9rem; }
.hm .explain { margin-top: 1.25rem; }
.hm .explain .panel { padding: 0.25rem 0 0.5rem 1.05rem; }

/* Stage path: an ordered reading list, not a progress bar */
.hm .main > .stage-path { margin-top: 2.5rem; }
.hm .stage { position: relative; padding: 0 0 2.25rem 2.25rem; }
.hm .stage::before { content: ""; position: absolute; left: 0.4rem; top: 0.55rem; bottom: -0.55rem;
  border-left: 1.5px solid var(--color-accent); }
.hm .stage::after { content: ""; position: absolute; left: 0; top: 0.42rem; width: 0.85rem; height: 0.85rem;
  border-radius: 50%; background: var(--surface-page); border: 1.5px solid var(--color-field-border); }
.hm .stage.reserved { padding-bottom: 0; }
.hm .stage.reserved::before { display: none; }
.hm .stage.reserved::after { border-style: dashed; }
.hm .stage:nth-last-child(2)::before { border-left-style: dashed; }
.hm .stage-name { font-size: 1.375rem; line-height: 1.3; }
.hm .stage .model.leader { margin-top: 0.5rem; }
.hm .stage .disclosure { margin-top: 0.35rem; }
.hm .stage .panel { padding: 0.25rem 0 0.25rem 1.05rem; }
.hm .stage .panel .model { color: var(--color-text); font-size: 1.0625rem; }
.hm .stage.reserved .stage-name { color: var(--color-text-light); font-weight: 500; }
.hm .reserved-note { color: var(--color-text-light); margin-top: 0.25rem; }

/* Aspect directory: clusters with side heads */
.hm .cluster { margin-top: 3rem; }
.hm .cluster > .side { padding-top: 1.5rem; border-top: 1px solid var(--color-accent); margin-bottom: 1.25rem; }
@media (min-width: 60rem) { .hm .cluster > .main { padding-top: 1.5rem; border-top: 1px solid var(--color-accent); }
  .hm .cluster > .side { margin-bottom: 0; } }
.hm .cluster-name { font-size: 1.5rem; line-height: 1.25; }
.hm .model.cluster-intro { margin-top: 0.6rem; font-size: 1rem; color: var(--color-text-light); }
.hm .cl-people { --cc: var(--hm-cluster-people); }
.hm .cl-governance { --cc: var(--hm-cluster-governance); }
.hm .cl-sdlc { --cc: var(--hm-cluster-sdlc); }
.hm .cl-flow { --cc: var(--hm-cluster-flow); }
.hm .hexagon { fill: var(--cc); fill-opacity: var(--hexop); stroke: var(--cc); stroke-width: 3.5; stroke-linejoin: round; }
.hm .glyph { fill: none; stroke: var(--cc); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; }
.hm .glyph .dot { fill: var(--cc); stroke: none; }
.hm .cluster-emblem { display: none; margin-top: 1.75rem; }
.hm .cluster-emblem svg { display: block; width: 9.5rem; height: 9.5rem; }
.hm .emblem-sm { display: inline; width: 1.9rem; height: 1.9rem; vertical-align: -0.4rem; margin-right: 0.55rem; }
.hm .emblem-sm .hexagon { stroke-width: 9; }
.hm .emblem-sm .glyph { stroke-width: 13; }
@media (min-width: 60rem) {
  .hm .cluster-emblem { display: block; }
  .hm .emblem-sm { display: none; }
  .hm .cluster-sticky { position: sticky; top: 1.25rem; }
}
.hm .aspect { border-bottom: 1px solid var(--color-accent); padding: 0.4rem 0 1.15rem; }
.hm .aspect:first-child { padding-top: 0; }
.hm .aspect-name { font-size: 1.3125rem; line-height: 1.3; }
.hm .model.first { font-size: 1.0625rem; color: var(--color-text-light); }
.hm .aspect-panel { margin-top: 1.1rem; padding-left: 1.05rem; border-left: 2px solid var(--cc, var(--color-accent)); }
.hm .team-link-top a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 0.9375rem; }
.hm .aspect-panel > div > * + *, .hm .aspect-panel > * + * { margin-top: 0.9rem; }
.hm .aspect-panel .disclosure { margin-top: 0.4rem; }
.hm .model.more { color: var(--color-text); }
.hm .aspect-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.hm .aspect-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 0.9375rem; }

/* Principles */
.hm .principle-list { margin-top: 1.75rem; border-top: 1px solid var(--color-accent); }
.hm .principle { border-bottom: 1px solid var(--color-accent); padding: 0.5rem 0 1.15rem; }
.hm .principle-name { font-size: 1.25rem; line-height: 1.3; }
.hm .principle .panel { margin-top: 0.9rem; padding-left: 1.05rem; border-left: 1.5px solid var(--color-accent); }

/* Team use and feedback */
.hm .model-label { font-size: 1.125rem; margin-top: 1.75rem; }
.hm .model-label + .model { margin-top: 0.35rem; }
.hm .main > .model-label:first-child { margin-top: 0.2rem; }
.hm .team-note { margin-top: 2.25rem !important; padding-top: 1.5rem; border-top: 1px solid var(--color-accent); scroll-margin-top: 1rem; }
.hm .team-note-for { font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-light);
  font-weight: 600; }
.hm .team-note-for:focus { outline: none; }
.hm .team-note-for:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 3px; }
.hm .team-box { margin-top: 0.85rem; }
.hm .team-box p + p { margin-top: 0.7rem; }
.hm .note-quote { font-family: var(--font-serif); font-size: 1.0625rem; }
.hm .team-send { flex-basis: 100%; color: var(--color-text-light); font-size: 0.9375rem; }
.hm .team-back a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 0.9375rem; }
.hm .team-back a::before { content: "\2190"; margin-right: 0.4em; font-weight: 400; }
.hm .btn[disabled] { opacity: 0.6; cursor: progress; }
.hm .lead { font-size: 1.1875rem; line-height: 1.55; }
.hm .optional-prompts { margin-top: 1.1rem; }
.hm .optional-prompts li { position: relative; padding-left: 1.25rem; }
.hm .optional-prompts li + li { margin-top: 0.5rem; }
.hm .optional-prompts li::before { content: ""; position: absolute; left: 0.1rem; top: 0.72em; width: 0.45rem;
  border-top: 1.5px solid var(--color-text-light); }
.hm .address { overflow-wrap: anywhere; }

/* About */
.hm .about { padding: 3rem 0 4rem; font-size: 0.9375rem; color: var(--color-text-light); }
.hm .about .main > * + * { margin-top: 0.85rem; }
.hm .about .section-title { color: var(--color-heading); font-size: 1.25rem; }
.hm .facts li + li { margin-top: 0.15rem; }
.hm .fragment q { font-family: var(--font-serif); font-size: 1.0625rem; color: var(--color-text); quotes: none; }
.hm .fragment q::before { content: "\201C\2026"; }
.hm .fragment q::after { content: "\201D"; }

/* Names with an explanation: a tap or click opens the note's first sentence */
.hm a.term { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--color-field-border);
  text-decoration-thickness: 1.5px; text-underline-offset: 0.22em; cursor: pointer; border-radius: 2px; }
.hm a.term:hover { text-decoration-style: solid; text-decoration-color: currentColor; }
.hm a.term[aria-expanded="true"] { background: var(--color-bg-tint); text-decoration-style: solid; text-decoration-color: currentColor; }
.hm .term-layer { position: absolute; z-index: 30; width: min(25rem, calc(100% - 2rem)); top: 0; left: 1rem; }
.hm .term-def { position: relative; background: var(--color-surface-card); color: var(--color-text); border: 1px solid var(--color-accent);
  border-radius: 8px; box-shadow: var(--hm-shadow-panel); padding: 0.85rem 3rem 1rem 1.05rem; }
.hm .term-def-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.0625rem; line-height: 1.3; }
.hm .term-def-status { margin-top: 0.3rem; display: inline-block; font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-light); border: 1px solid var(--color-accent);
  border-radius: 4px; padding: 0 0.35rem; }
.hm .term-def-text { margin-top: 0.4rem; font-size: 1rem; line-height: 1.5; }
.hm .term-close { position: absolute; top: 0.2rem; right: 0.2rem; width: 2.75rem; height: 2.75rem; border-radius: 6px; }
.hm .term-close::before, .hm .term-close::after { content: ""; position: absolute; left: 50%; top: 50%; width: 1rem;
  border-top: 2px solid var(--color-text-light); }
.hm .term-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.hm .term-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.hm .term-close:hover { background: var(--color-bg-tint); }
@media (max-width: 40rem) {
  .hm .term-layer { position: fixed; top: auto !important; left: 0 !important; right: 0; bottom: 0; width: auto; }
  .hm .term-def { border-radius: 12px 12px 0 0; border-bottom: 0; max-height: 60vh; overflow: auto;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); box-shadow: var(--hm-shadow-sheet); }
}

@media (max-width: 30rem) {
  .hm { font-size: 1rem; }
  .hm .opening { padding-top: 3rem; }
  .hm .model { font-size: 1.0625rem; }
  .hm .stages, .hm .aspects, .hm .principles, .hm .team, .hm .feedback { padding: 3rem 0; }
  .hm .stage { padding-left: 1.85rem; }
}
