/* The front door, third edition: the header's View control and one storey, the hero's call to action,
   pictures for the doors, the item page's side list, the accessibility section and its table, the pages with a
   side list (accessibility, handoff, browsers), Start here's three ways in, and the templates page.
   Loaded after site.css; the register cascade (--r-*) and the tokens come from docs.css. */

/* ── the header: one storey. The View control holds register, theme and language ── */
.bar .src { min-height: 44px; display: inline-flex; align-items: center; }
.view { display: block; margin-left: auto; flex: none; }
.view-btn {
  font: 500 14px/1 var(--body); letter-spacing: 0.02em; color: var(--ink); background: transparent;
  border: 1.5px solid var(--ink); border-radius: var(--r-pill); min-height: 44px; min-width: 44px; padding: 0 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background-color var(--r-dur), color var(--r-dur), transform var(--r-dur) var(--r-ease);
}
[data-register="quiet"] .view-btn { border-width: 1px; }
.view-btn::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.view-btn:hover, .view-btn:active { background: var(--ink); color: var(--paper); }
.view-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.view-btn[aria-expanded="true"] { background: var(--ink); color: var(--paper); }

.view-panel { width: min(21.5rem, calc(100vw - 32px)); max-height: min(82dvh, 44rem); overflow: auto; box-sizing: border-box; padding: 16px 18px 18px; color: var(--ink); }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.view-title { font-family: var(--display); font-size: 21px; line-height: 1.15; margin: 0; }
.view-close { font: 500 13.5px/1 var(--body); color: var(--ink-2); background: transparent; border: 1px solid var(--rule-strong); border-radius: var(--r-pill); min-height: 44px; padding: 0 14px; cursor: pointer; }
.view-close:hover { color: var(--ink); border-color: var(--ink); }
.view-nojs { display: none; margin: 10px 0 0; font-size: 14.5px; color: var(--ink-2); }
html:not(.js) .view-nojs { display: block; }
html:not(.js) .prefs { display: none; }
.view-group { border: 0; margin: 14px 0 0; padding: 0; min-width: 0; }
.view-group legend, .view-legend { padding: 0; margin: 0 0 2px; font: 600 11.5px/1.3 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.view-intro { margin: 0 0 4px; font-size: 14px; color: var(--ink-2); }
.view-opt { display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; align-items: start; min-height: 44px; padding: 9px 8px; border-radius: 6px; cursor: pointer; }
.view-opt:hover { background: color-mix(in oklab, var(--ink) 6%, transparent); }
.view-opt input { grid-row: 1 / span 2; margin: 2px 0 0; width: 20px; height: 20px; accent-color: var(--ink); cursor: pointer; }
.view-opt:has(input:checked) { background: color-mix(in oklab, var(--accent-fill) 11%, transparent); }
.view-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.view-opt-name { font-size: 15.5px; font-weight: 500; line-height: 1.3; }
.view-opt-hint { font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.view-store { margin: 12px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); padding-left: 10px; border-left: 2px solid var(--sg-mango, var(--rule-strong)); }
.view-lang { border-top: 1px solid var(--rule); padding-top: 12px; }
.view-lang sg-lang a { min-height: 44px; }
.view-draft { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }

/* one storey on a phone: brand, GitHub and View on one line, the sections in a strip that scrolls inside itself */
@media (max-width: 760px) {
  .bar-in { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "brand src view" "nav nav nav"; gap: 0 10px; padding-block: 6px 4px; align-items: center; }
  .brand { grid-area: brand; font-size: 24px; }
  .bar .src { grid-area: src; }
  .view { grid-area: view; margin-left: 0; }
  .nav {
    grid-area: nav; gap: 2px 0; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: clamp(16px, 4vw, 56px);
    margin-inline: calc(clamp(16px, 4vw, 56px) * -1); padding-inline: clamp(16px, 4vw, 56px);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { display: inline-flex; align-items: center; min-height: 36px; padding-inline: 0; margin-right: 18px; scroll-snap-align: start; }
}

/* ── the hero: a call to action; on a phone the picture comes first ── */
.btn-lg { font-size: 16px; padding: 13px 22px 12px; min-height: 48px; display: inline-flex; align-items: center; text-decoration: none; }
.btn-lg.btn:not(.btn-solid) { color: var(--ink); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 0; }
.hero-install { margin-top: 18px; max-width: 60ch; }
.hero-install-lead { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.hero-install .install { margin: 6px 0 0; }
.npm-note { margin: 8px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-3); max-width: 60ch; }
.npm-note code { font-size: 0.95em; }
@media (max-width: 860px) {
  .mast-art { order: -1; }
  .mast { padding-top: 20px; gap: 18px; }
}

/* ── what is inside: pictures, two across ── */
.doors { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px clamp(18px, 3vw, 40px); }
.door-art, .door-art:has(> picture:only-child) { display: block; aspect-ratio: 16 / 10; grid-template-columns: none; align-content: normal; }
.door-art picture { display: block; height: 100%; }
.door-art img { height: 100%; aspect-ratio: auto; object-fit: cover; object-position: center; }
.door-title { font-size: 28px; }
.door-line { font-size: 16px; max-width: 46ch; }
.door-toy { margin: 8px 0 0; position: relative; z-index: 1; font-size: 15px; }
.door-toy a { color: var(--accent); text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 44px; }
.door-small { grid-column: 1 / -1; }
@media (max-width: 620px) {
  .doors { grid-template-columns: 1fr; gap: 26px; }
  .door-title { font-size: 24px; }
  .door-line { font-size: 15px; }
}

/* ── newest: generated, three across; six on a phone ── */
.new-meta { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
@media (max-width: 860px) { .new-list .new-item:nth-child(n + 7) { display: none; } }

/* ── the footer rule runs the width of the content column, not of the page ── */
.foot { border-top: 0; padding-top: 0; }
.foot::before { content: ""; flex: 1 0 100%; height: 0; border-top: var(--r-rule) solid var(--ink); margin-bottom: 16px; }
.foot-links a { color: inherit; }

/* ── an item's page: the poster rides along, with a list of what is on the page ── */
.item-page { max-width: none; }
.item-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); grid-template-areas: "head side" "body side"; gap: 0 clamp(24px, 4vw, 56px); align-items: start; }
.item-head { grid-area: head; min-width: 0; display: block; }
.item-side { grid-area: side; min-width: 0; align-self: stretch; }
.item-side-in { position: sticky; top: 16px; display: grid; gap: 22px; }
.item-body { grid-area: body; min-width: 0; }
.item-body > .fold { max-width: 74ch; margin-top: 26px; }
.item-body .prose { max-width: 78ch; }
.toc { border-top: 1px solid var(--rule); padding-top: 12px; }
.toc-title { font: 600 11.5px/1.3 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 6px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a { display: flex; align-items: center; min-height: 36px; font-size: 15px; color: var(--ink-2); text-decoration: none; border-left: 2px solid var(--rule); padding-left: 12px; }
.toc a:hover { color: var(--ink); border-left-color: var(--accent-fill); }
@media (max-width: 860px) {
  .item-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "side" "body"; }
  .item-side-in { position: static; }
  .item-poster { max-width: 26rem; }
  .toc ul { display: flex; flex-wrap: wrap; gap: 0 18px; }
  .toc a { border-left: 0; padding-left: 0; text-decoration: underline; text-underline-offset: 3px; }
}

/* long snippets wrap rather than clip (the use-this-scene box, install lines) */
.use-code { white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: visible; }
.install code { overflow-wrap: anywhere; }

/* ── the accessibility section: the conformance table, plainly ── */
.prose .a11y { margin-top: 34px; padding-top: 6px; border-top: 1px solid var(--rule); scroll-margin-top: 16px; }
.a11y h2 { margin-top: 18px; }
.a11y-intro { max-width: 62ch; }
.a11y-counts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 0; padding: 0; }
.a11y-counts li { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--ink-2); }
.a11y-counts b { font-weight: 600; color: var(--ink); }
.status { display: inline-block; font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; line-height: 1; padding: 5px 9px 4px; border-radius: var(--r-pill); border: 1px solid var(--rule-strong); color: var(--ink); white-space: nowrap; }
.status-meets { border-color: color-mix(in oklab, var(--sg-paddy, #3d6b3d) 70%, var(--ink)); }
.status-meets::before { content: "\2713\00a0"; }
.status-author { border-style: dashed; }
.status-author::before { content: "\2192\00a0"; }
.status-na { color: var(--ink-2); border-color: var(--rule); }
.status-gap { border-width: 2px; border-color: var(--accent); color: var(--accent); }
.status-gap::before { content: "!\00a0"; }
.a11y-table { max-width: 100%; }
.a11y-table table { width: 100%; }
.a11y-table td:first-child { min-width: 9em; color: var(--ink); }
.a11y-table .status-cell { white-space: nowrap; }
.a11y-more { margin-top: 16px; }
.a11y h3 { margin-top: 26px; }
@media (max-width: 620px) {
  .a11y-table { overflow: visible; }
  .a11y-table table, .a11y-table tbody, .a11y-table tr, .a11y-table td { display: block; width: 100%; }
  .a11y-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .a11y-table tr { border-bottom: 1px solid var(--rule-strong); padding: 10px 0; }
  .a11y-table td { border: 0; padding: 2px 0; }
  .a11y-table td::before { content: attr(data-label); display: block; font: 600 11px/1.4 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
  .a11y-table td:first-child::before { display: none; }
  .a11y-table td:first-child { font-weight: 600; }
  .a11y-table .status-cell { white-space: normal; }
}

/* ── the pages with a side list: accessibility, handoff, browsers ── */
.side-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 15rem); gap: 0 clamp(24px, 4vw, 56px); align-items: start; margin-top: 8px; }
.side-aside { position: sticky; top: 16px; order: 2; }
.side-main { min-width: 0; max-width: 78ch; }
.side-main.prose { margin-top: 18px; }
.side-main section { margin-top: 28px; scroll-margin-top: 16px; }
.trust .count { font-family: var(--r-hand); font-size: 0.7em; color: var(--r-number); }
.summary { width: 100%; }
.summary th[scope="row"] { font-weight: 500; white-space: nowrap; }
.summary .num { text-align: center; font-variant-numeric: tabular-nums; }
.summary .none { color: var(--ink-3); font-size: 0.85em; }
@media (max-width: 860px) {
  .side-layout { grid-template-columns: minmax(0, 1fr); }
  .side-aside { position: static; order: -1; }
  .side-aside .toc ul { display: flex; flex-wrap: wrap; gap: 0 18px; }
  .side-aside .toc a { border-left: 0; padding-left: 0; text-decoration: underline; text-underline-offset: 3px; }
}
@media (max-width: 620px) {
  .summary, .summary tbody { display: block; }
  .summary thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .summary tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; border-bottom: 1px solid var(--rule); padding: 8px 0; }
  .summary th { flex: 1 0 100%; border: 0 !important; padding: 0 !important; text-align: left !important; }
  .summary td { display: inline; border: 0 !important; padding: 0 !important; text-align: left !important; font-size: 13.5px; }
  .summary td::before { content: attr(data-label) " "; color: var(--ink-3); }
  .summary td[data-label="Kind of component"] { display: none; }
  .summary td:has(.none) { display: none; }
}

/* ── Start here: three ways in ── */
.paths { list-style: none; margin: 22px 0 8px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px clamp(18px, 2.5vw, 32px); }
.path { min-width: 0; border-top: var(--r-rule) solid var(--ink); padding-top: 14px; display: flex; flex-direction: column; }
.path-title { font-family: var(--display); font-weight: 400; font-size: 25px; line-height: 1.15; }
.path p { color: var(--ink-2); font-size: 15.5px; line-height: 1.55; margin: 10px 0 0; }
.path .install { display: flex; margin: 10px 0 0; }
.path .install code { flex: 1 1 14em; }
.path-lead { margin-top: 14px !important; }
.path-note { font-size: 14px !important; color: var(--ink-3) !important; }
.path-links { display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: auto !important; padding-top: 12px; }
.path-links a { color: var(--ink); text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 44px; }
.walk-lede { color: var(--ink-2); max-width: 60ch; }
#walk { scroll-margin-top: 16px; margin-top: 36px; border-top: var(--r-rule) solid var(--ink); }
#walk h3 { font-family: var(--display); font-weight: 400; font-size: 22px; margin: 26px 0 0; }
@media (max-width: 980px) { .paths { grid-template-columns: minmax(0, 1fr); } }

/* ── the templates page: the event page running, and a marigold for a name ── */
.live, .toy { border-top: var(--r-rule) solid var(--ink); padding-block: 24px 8px; margin-top: 28px; scroll-margin-top: 16px; }
.live-tools { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 24px; margin-top: 16px; }
.live-open { color: var(--ink); text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 44px; }
.live-frame { margin-top: 12px; border: 1px solid var(--rule-strong); border-radius: 3px; box-shadow: var(--r-lift); background: var(--mount); overflow: hidden; }
.live-frame iframe { display: block; width: 100%; height: min(78dvh, 760px); min-height: 480px; border: 0; background: var(--mount); }
.live-note { margin: 10px 0 0; font-size: 14px; color: var(--ink-3); }
.live-konkani { margin: 4px 0 0; display: flex; gap: 0 18px; }
.live-konkani a { color: var(--ink); display: inline-flex; align-items: center; min-height: 44px; }
.toy-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); gap: 20px clamp(24px, 4vw, 56px); align-items: start; margin-top: 16px; }
.toy-form { display: grid; gap: 8px; align-content: start; }
.toy-form label { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.toy-form input { font: inherit; font-size: 17px; min-height: 48px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--rule-strong); background: var(--mount); color: var(--ink); width: 100%; box-sizing: border-box; }
.toy-form input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.toy-private { margin: 0; font-size: 13.5px; color: var(--ink-3); }
.toy-buttons { margin-top: 6px; }
.toy-buttons .btn { min-height: 48px; padding-inline: 22px; font-size: 16px; }
.toy-status { min-height: 1.6em; margin: 0; font-size: 14.5px; color: var(--ink-2); }
.toy-card { margin: 0; }
.toy-card canvas { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; border: 1px solid var(--rule); border-radius: 3px; box-shadow: var(--r-lift); background: #f3ebdc; }
@media (max-width: 760px) { .toy-cols { grid-template-columns: minmax(0, 1fr); } .toy-card { max-width: 20rem; } }
.door .door-art.door-art-plain { display: none; }

/* a long path or address in running text breaks rather than widening a phone */
.prose code, .prose a, .prose li, .prose td, .prose th { overflow-wrap: anywhere; }

/* the install box takes less room now that its lines wrap instead of scroll */
.scene-use { margin-top: 14px; padding-top: 10px; }
.scene-use .use-title { margin-top: 10px; }
.scene-use .use-code { padding: 9px 12px; font-size: 12px; line-height: 1.45; margin-bottom: 8px; }
.scene-use .use-note { margin-bottom: 8px; }

/* the draft note on every Konkani page: Konkani first, then the English, so it never depends on the line it warns about */
.draft-note { margin: 18px 0 0; padding: 10px 14px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); border-left: 3px solid var(--sg-mango, var(--rule-strong)); background: color-mix(in oklab, var(--ink) 4%, transparent); max-width: 70ch; }
.draft-note span + span { display: block; margin-top: 2px; color: var(--ink-3); }

/* ── a phone: the Trust door sits on the first line, the lede gives way, and the language links stay on one row ── */
.bar-trust { display: none; }
@media (max-width: 760px) {
  .bar-in { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "brand trust view" "nav nav nav"; }
  .bar-trust { grid-area: trust; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: 14px; color: var(--ink); text-decoration: none; border: 1px solid var(--rule-strong); border-radius: var(--r-pill); white-space: nowrap; }
  .bar .src { display: none; }
}
/* on a phone the order is picture, title, call to action, then the paragraph */
@media (max-width: 620px) {
  .mast-text { display: flex; flex-direction: column; }
  .mast-text .kicker { order: 1; }
  .mast-text h1 { order: 2; }
  .mast-text .gloss { order: 3; }
  .mast-text .cta { order: 4; margin-top: 18px; }
  .mast-text .hero-install { order: 5; }
  .mast-text .lede { order: 6; }
}
.view-lang sg-lang ul { gap: 0; flex-wrap: nowrap; }
.view-lang sg-lang a { padding-inline: 10px; white-space: nowrap; }

/* the component counts on a phone: one tight line each, in short words */
@media (max-width: 620px) {
  .summary tr { padding: 5px 0; gap: 0 12px; align-items: center; }
  .summary th { flex: 1 1 auto !important; min-width: 0; }
  .summary th a { display: inline-flex; align-items: center; min-height: 36px; }
  .summary td::before { content: attr(data-short) " "; }
}
