/* Capability-slice pages (honua-site#218), in the site's one world.
 *
 * Loaded after learning-hub.css and remodel.css; the page body carries
 * `h-site`, so type, tokens, collar and footer come from the world and this
 * file only shapes the slice components on those tokens.
 *
 * The two tab groups are deliberately different controls: Set it up gets
 * cell tabs, Use it gets underlined tabs on a rule. Panels in a group share
 * one grid cell so the group is as tall as its tallest panel and switching a
 * tab never moves the page.
 */

.h-site .slice-page .hub-section,
.h-site .slice-index .hub-section {
  padding-block: 54px;
}

.h-site .slice-hero {
  padding-bottom: 34px;
}

/* Keep long configuration names and shell blocks inside the hero grid. */
.h-site .slice-hero > * {
  min-width: 0;
}

.h-site .slice-hero code {
  overflow-wrap: anywhere;
}

.h-site .slice-hero pre {
  overflow-x: auto;
}

.h-site .slice-hero h1 {
  font-size: var(--h-h1-doc);
  overflow-wrap: anywhere;
}

.h-site .slice-page h2,
.h-site .slice-page h3,
.h-site .slice-index h2,
.h-site .slice-index h3 {
  overflow-wrap: anywhere;
}

.h-site .slice-hero .lede {
  max-width: 62ch;
  color: var(--h-muted);
  font-size: 17px;
  line-height: 1.6;
}

/* The page's designation under its title: what kind of page this is, then its release label. */
.h-site .slice-kind {
  margin: 0 0 14px;
  color: var(--h-muted);
  font: 500 11px var(--h-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.h-site .slice-label {
  display: inline-block;
  margin: 0 12px 18px 0;
  padding: 4px 9px;
  border: 1px solid var(--h-rule);
  color: var(--h-accent);
  font: 500 11px var(--h-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.h-site .slice-panel {
  border-top: 1px solid var(--h-line);
  overflow-wrap: anywhere;
}

.h-site .slice-panel .section-head {
  margin-bottom: 22px;
}

.h-site .slice-panel .section-head h2 {
  font-size: var(--h-h2-hub);
}

.h-site .slice-panel p {
  max-width: 70ch;
  color: var(--h-muted);
  font-size: 15px;
  line-height: 1.7;
}

.h-site .slice-panel p strong {
  color: var(--h-ink);
  font-weight: 500;
}

.h-site .slice-panel code {
  font: 500 13px var(--h-mono);
  color: var(--h-accent);
  overflow-wrap: anywhere;
}

.h-site .slice-list {
  max-width: 70ch;
  margin: 0;
  padding-left: 18px;
  color: var(--h-muted);
  font-size: 15px;
  line-height: 1.8;
}

/* The sample panel. honua-samples#40 has not published the pinned per-sample
 * embed route, so the hero links out to the running demo instead of framing a
 * URL that is not a contract yet. */
.h-site .slice-sample {
  padding: 22px;
  border: 1px solid var(--h-rule);
  background: var(--h-surface);
}

.h-site .slice-sample p {
  margin: 0;
}

.h-site .slice-sample a {
  color: var(--h-accent);
  font-weight: 500;
  text-underline-offset: 3px;
}

/* The honest-gap component: one sentence, one issue link, no apology. */
.h-site .slice-panel p.slice-gap {
  position: relative;
  max-width: 70ch;
  margin: 0 0 16px;
  padding: 13px 15px 13px 40px;
  border: 1px solid var(--h-line);
  border-left-color: var(--h-amber);
  background: var(--h-surface);
  color: var(--h-ink);
  font-size: 14px;
}

.h-site .slice-gap-mark {
  position: absolute;
  left: 15px;
  top: 16px;
  color: var(--h-amber);
  font: 500 13px var(--h-mono);
}

.h-site .slice-gap a {
  color: var(--h-accent);
  text-underline-offset: 3px;
}

/* --- tab groups ---------------------------------------------------------- */

.h-site .slice-tabs {
  margin-top: 6px;
}

.h-site .slice-tabs .tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.h-site .slice-tabs button[role="tab"] {
  border: 1px solid var(--h-rule);
  color: var(--h-muted);
  background: transparent;
  font: 500 12px var(--h-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}

.h-site .slice-tabs button[role="tab"]:hover {
  color: var(--h-ink);
  border-color: var(--h-ink);
}

.h-site .slice-tabs button[role="tab"]:focus-visible {
  outline: 2px solid var(--h-focus);
  outline-offset: 2px;
}

@media (forced-colors: active) {
  .h-site .slice-tabs button[role="tab"][aria-selected="true"] {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
  }
}

.h-site .tabs-pill .tablist {
  margin-bottom: 18px;
}

.h-site .tabs-pill button[role="tab"] {
  min-height: 40px;
  padding: 0 15px;
}

.h-site .tabs-pill button[role="tab"][aria-selected="true"] {
  border-color: var(--h-accent);
  color: var(--honua-on-accent);
  background: var(--h-accent);
}

.h-site .tabs-rule .tablist {
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--h-line);
}

.h-site .tabs-rule button[role="tab"] {
  padding: 10px 16px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.h-site .tabs-rule button[role="tab"]:hover {
  border-bottom-color: var(--h-rule);
}

.h-site .tabs-rule button[role="tab"][aria-selected="true"] {
  border-bottom-color: var(--h-accent);
  color: var(--h-ink);
}

/* Every panel shares one grid cell, so the group reserves the height of its
 * tallest panel and a tab switch cannot move the page under the reader. */
.h-site .tabpanels {
  display: grid;
}

.h-site .tabpanels > [role="tabpanel"] {
  grid-area: 1 / 1;
  visibility: hidden;
  min-width: 0;
}

.h-site .tabpanels > [role="tabpanel"][aria-hidden="false"] {
  visibility: visible;
}

.h-site .tabpanels > [role="tabpanel"]:focus-visible {
  outline: 2px solid var(--h-focus);
  outline-offset: 4px;
}

.h-site .tab-heading {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: -.01em;
}

.h-site .tabs-pill .tab-heading,
.h-site .tabs-rule .tab-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.h-site .slice-subpanel + .slice-subpanel {
  margin-top: 22px;
}

/* --- code cards ---------------------------------------------------------- */

/* A code block is an object: language, copy affordance, contained scroll.
 * It never widens the page: the block scrolls instead. */
.h-site .code-card {
  min-width: 0;
  max-width: 900px;
  margin: 0 0 14px;
  border: 1px solid var(--h-rule);
  background: var(--h-bg);
}

.h-site .code-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--h-line);
}

.h-site .code-lang {
  color: var(--h-muted);
  font: 500 11px var(--h-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.h-site .code-copy {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--h-rule);
  color: var(--h-ink);
  background: transparent;
  font: 500 11px var(--h-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}

.h-site .code-copy:hover {
  border-color: var(--h-ink);
}

.h-site .code-copy:focus-visible {
  outline: 2px solid var(--h-focus);
  outline-offset: 2px;
}

.h-site .code-card pre {
  max-height: 42em;
  max-width: 100%;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  color: var(--h-ink);
  font: 400 12.5px/1.75 var(--h-mono);
  tab-size: 2;
}

.h-site .code-card pre code {
  font: inherit;
  color: inherit;
  padding: 0;
  background: none;
}

.h-site .code-card pre:focus-visible {
  outline: 2px solid var(--h-focus);
  outline-offset: -3px;
}

/* The one line you are meant to change. */
.h-site .code-editable {
  display: inline-block;
  width: 100%;
  border-left: 1px solid var(--h-amber);
  padding-left: 9px;
  margin-left: -10px;
  background: var(--h-surface);
}

/* --- panel 6, recessive fine print --------------------------------------- */

.h-site .slice-underneath {
  color: var(--h-muted);
}

.h-site .slice-underneath .section-head h2 {
  font-size: clamp(22px, 2.4vw, 30px);
}

.h-site .slice-underneath p {
  font-size: 14px;
}

.h-site .slice-underneath code {
  font: 500 12px var(--h-mono);
}

@media (max-width: 650px) {
  .h-site .tabs-rule button[role="tab"] {
    padding-inline: 10px;
  }
}

/* Paper has no scroll controls; retain complete, readable command blocks. */
@media print {
  .h-site { --h-bg: #fff; --h-surface: #fff; }
  .h-site .skip-link, .h-site .code-copy { display: none !important; }
  .h-site .slice-page pre {
    max-height: none;
    overflow: visible;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}
