/*
 * Masthead theme docs (/masthead/docs/…). Loaded after style.css, only on these
 * pages. Typography, cards, buttons and the docs header come from style.css;
 * this adds the docs layout, the search, settings tables and preset cards.
 */

/* ─── Header ─── */
.md-header { padding: 40px 0 36px; }
.md-lead { max-width: 760px; }
.md-crumb-sep { margin: 0 8px; }
.md-version { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-muted); margin-top: 14px; }

/* ─── Layout: sidebar, article, "on this page" ─── */
.md-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; align-items: start; }
.md-aside { position: sticky; top: 96px; max-height: calc(100vh - 112px); overflow-y: auto; display: grid; gap: 16px; padding-bottom: 4px; }
.md-main { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 48px; align-items: start; min-width: 0; }
.md-main--wide { grid-template-columns: minmax(0, 1fr); }
.md-body { min-width: 0; max-width: 780px; }
.md-main--wide .md-body { max-width: 820px; }
.md-toc { position: sticky; top: 96px; max-height: calc(100vh - 112px); overflow-y: auto; }
.md-toc .docs-toc { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; border-left: 1px solid var(--border); }

.md-nav-panel { padding: 18px; }
.md-nav-group + .md-nav-group { margin-top: 18px; }
.md-nav-title { font-family: var(--font-mono); font-size: 11px; color: var(--fg-muted); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 10px; }
.md-nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.md-nav-toggle { display: none; }
.md-help { margin-top: 0; }
.md-help-btn { justify-content: center; height: 38px; font-size: 13.5px; }

@media (max-width: 1199px) {
  .md-main { grid-template-columns: minmax(0, 1fr); }
  .md-toc { display: none; }
}
@media (max-width: 991px) {
  .md-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .md-aside { position: static; max-height: none; overflow: visible; }
  .md-help { display: none; }
  .docs-layout { padding-top: 24px; padding-bottom: 72px; }
  /* With JavaScript the page list collapses behind a button. Without it, it stays open. */
  .md-js .md-nav-toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 13px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--fg); font: inherit; font-size: 14.5px; font-weight: 500; cursor: pointer; }
  .md-js .md-nav-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .md-js .md-nav-panel { display: none; }
  .md-js .md-nav-panel.is-open { display: block; }
}

/* ─── Search ─── */
.md-search { position: relative; display: none; }
.md-js .md-search { display: block; }
.md-search-icon { position: absolute; left: 14px; top: 15px; color: var(--fg-muted); pointer-events: none; }
.md-search-input { padding-left: 40px; }
.md-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.md-search--large { max-width: 560px; margin-top: 22px; }
.md-search--large .md-search-input { padding-top: 15px; padding-bottom: 15px; font-size: 16px; }
.md-search--large .md-search-icon { top: 18px; }
.md-search-results { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; min-width: min(420px, calc(100vw - 40px)); max-height: min(60vh, 460px); overflow-y: auto; list-style: none; margin: 0; padding: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.md-search-results a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--fg); }
.md-search-results a:hover, .md-search-results li.is-active a { background: var(--accent-soft); }
.md-search-title { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.md-search-title span { color: var(--fg-muted); font-weight: 400; }
.md-search-snippet { display: block; font-size: 13px; line-height: 1.45; color: var(--fg-muted); margin-top: 2px; }
.md-search-snippet mark, .md-search-title mark { background: #fff1b8; color: inherit; padding: 0 1px; border-radius: 2px; }
.md-search-empty { padding: 12px; font-size: 14px; color: var(--fg-muted); }

/* ─── Article furniture ─── */
.md-ui { font-weight: 600; color: var(--fg); }
.md-small { font-size: 14px; color: var(--fg-muted); }
.blog-content.md-body > p:first-of-type::first-letter { float: none; font-size: inherit; line-height: inherit; font-weight: inherit; margin: 0; color: inherit; font-family: inherit; }
.md-body .doc-callout p { margin: 0; font-size: 15px; line-height: 1.6; }
.md-body .doc-callout strong { color: inherit; }
.md-body h2, .md-body h3 { scroll-margin-top: 96px; }

.md-figure { margin: 24px 0 28px; }
.md-figure img { margin: 0; border: 1px solid var(--border); }
.md-figure figcaption { font-size: 13.5px; color: var(--fg-muted); margin-top: 8px; }
.md-shot { display: grid; place-items: center; width: 100%; max-height: 420px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg-soft); color: var(--fg-faint); font-family: var(--font-mono); font-size: 12.5px; }

.md-pager { display: flex; gap: 16px; margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--border); }
.blog-content .md-pager a { text-decoration: none; color: var(--fg); }
.md-pager-gap { flex: 1; }
.md-pager-label { display: block; font-size: 12px; color: var(--fg-muted); margin-bottom: 4px; }
.md-pager-title { display: block; font-weight: 600; line-height: 1.3; }
.docs-pager-next .md-pager-label { color: var(--accent); }
.docs-pager-next .md-pager-title { color: var(--accent-strong); }

/* ─── Settings tables ─── */
.md-table-wrap { margin: 20px 0 28px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.md-settings { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
.md-settings th, .md-settings td { padding: 12px 16px; text-align: left; vertical-align: top; border-top: 1px solid var(--border); }
.md-settings thead th { border-top: 0; background: var(--bg-soft); font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); }
.md-settings tbody th { width: 24%; font-weight: 400; }
.md-settings td:nth-child(2) { width: 30%; color: var(--fg-muted); font-size: 13.5px; }
.md-settings .md-settings-group th { width: auto; background: var(--bg-soft); font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--fg); }
.md-under { display: block; font-size: 12.5px; color: var(--fg-muted); }
.md-compare td { width: 25%; color: var(--fg); font-size: 14px; }
.md-compare td:nth-child(2) { width: 25%; color: var(--fg); font-size: 14px; }

@media (max-width: 700px) {
  .md-settings thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .md-settings, .md-settings tbody, .md-settings tr, .md-settings th, .md-settings td { display: block; width: auto; }
  .md-settings tbody th, .md-settings td:nth-child(2), .md-compare td { width: auto; }
  .md-settings tr { padding: 12px 14px; border-top: 1px solid var(--border); }
  .md-settings tr:first-child { border-top: 0; }
  .md-settings th, .md-settings td { padding: 0; border: 0; }
  .md-settings td { margin-top: 6px; }
  .md-settings td::before { content: attr(data-label); display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-faint); }
  .md-settings tr.md-settings-group { padding: 10px 14px; background: var(--bg-soft); }
}

/* ─── Presets ─── */
.md-preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 20px 0 28px; }
.md-preset, .blog-content a.md-preset { display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); color: var(--fg); text-decoration: none; transition: border-color .2s ease, box-shadow .2s ease; }
a.md-preset:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.md-preset-shot, .blog-content img.md-preset-shot { display: flex; flex-direction: column; justify-content: space-between; width: 100%; height: auto; aspect-ratio: 4 / 3; margin: 0 0 6px; padding: 16px; border-radius: var(--radius); border: 1px solid rgba(15, 18, 30, .08); object-fit: cover; overflow: hidden; }
img.md-preset-shot { padding: 0; }
.md-preset-word { font-family: Georgia, "Times New Roman", serif; font-size: clamp(22px, 2.4vw, 30px); line-height: 1; letter-spacing: -0.02em; }
.md-preset-shot--broadsheet .md-preset-word { font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0; }
.md-preset-rule { display: block; width: 36px; height: 3px; margin: 10px 0 auto; }
.md-preset-swatches { display: flex; gap: 6px; }
.md-preset-swatches span { position: relative; flex: 1; height: 26px; border-radius: 6px; border: 1px solid rgba(15, 18, 30, .14); }
.md-preset-swatches i { position: absolute; right: 5px; bottom: 5px; width: 7px; height: 7px; border-radius: 999px; }
.md-preset-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; padding: 0 4px; }
.md-preset-summary { font-size: 13.5px; line-height: 1.5; color: var(--fg-muted); padding: 0 4px; }

.md-schemes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 14px 0 10px; }
.md-scheme { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid rgba(15, 18, 30, .12); min-width: 0; }
.md-scheme-name { font-weight: 600; font-size: 13.5px; }
.md-scheme-dots { display: flex; gap: 5px; }
.md-scheme-dots i { width: 14px; height: 14px; border-radius: 999px; border: 1px solid rgba(127, 127, 127, .35); }
.md-scheme-hex { font-family: var(--font-mono); font-size: 10px; line-height: 1.4; opacity: .8; overflow-wrap: anywhere; }

@media (max-width: 767px) {
  .md-preset-grid { grid-template-columns: minmax(0, 1fr); }
  .md-schemes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ─── Docs home ─── */
.md-home { min-width: 0; }
.md-home .md-intro p:last-child { margin-bottom: 0; }
.md-home-heading { font-size: 26px; letter-spacing: -0.02em; line-height: 1.2; margin: 48px 0 8px; scroll-margin-top: 96px; }
.md-home-sub { color: var(--fg-muted); max-width: 720px; }
.md-home-sub a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 18px; }
.md-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); color: var(--fg); transition: border-color .2s ease, box-shadow .2s ease; }
.md-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.md-card-group { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.md-card-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.015em; line-height: 1.25; }
.md-card-text { font-size: 14px; line-height: 1.5; color: var(--fg-muted); }

@media (prefers-reduced-motion: reduce) {
  .md-card, .md-preset { transition: none; }
}

/* ─── Support form (/masthead/support/) ─── */
.ms-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
.ms-card { padding: 40px; }
.ms-form { display: grid; gap: 22px; }
.ms-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ms-form label { font-weight: 500; font-size: 14.5px; }
.ms-star { color: #b91c1c; }
.ms-optional { color: var(--fg-muted); font-weight: 400; }
.ms-required-note, .ms-hint, .ms-privacy { font-size: 13.5px; color: var(--fg-muted); margin: 0; }
.ms-form .alfa-textarea { min-height: 180px; resize: vertical; line-height: 1.55; }
.ms-form .alfa-input:focus, .ms-form .alfa-textarea:focus, .ms-form .alfa-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ms-form [aria-invalid="true"] { border-color: #b91c1c; }
.ms-file { width: 100%; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 12px; background: var(--bg-soft); font: inherit; font-size: 14px; color: var(--fg); }
.ms-file:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ms-error { margin: 0; font-size: 13.5px; font-weight: 500; color: #b91c1c; }
.ms-summary { margin-bottom: 28px; padding: 18px 22px; border: 1px solid #fca5a5; border-radius: 12px; background: #fef2f2; color: #7f1d1d; font-size: 15px; }
.ms-summary:focus { outline: 2px solid #b91c1c; outline-offset: 2px; }
.ms-summary p { margin: 0; }
.ms-summary ul { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.ms-summary p + p { margin-top: 10px; }
.ms-summary a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
/* The honeypot: out of sight and out of the tab order, but still a real field to a bot. */
.ms-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ms-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding-top: 4px; }
.ms-aside { display: grid; gap: 16px; }
.ms-side-card { padding: 22px; }
.ms-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14.5px; }
.ms-links a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.ms-last { margin-bottom: 0; }

.ms-sent { max-width: 720px; }
.ms-sent .ms-card p { margin-bottom: 14px; }
.ms-ticket-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 4px !important; }
.ms-ticket { font-family: var(--font-display); font-size: clamp(30px, 5vw, 44px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.ms-next-title { font-size: 20px; margin: 28px 0 12px; }
.ms-steps { margin: 0 0 28px; padding-left: 20px; display: grid; gap: 8px; color: var(--fg-muted); }
.ms-sent-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 991px) {
  .ms-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 600px) {
  .ms-card { padding: 24px 20px; }
  .ms-row { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .ms-actions .btn { width: 100%; justify-content: center; }
}
