/* tem1pon — phone-first dark slate and copper skin; selectors use HTML structure. */
@font-face {
  font-family: "Tem1 Yekan";
  src: url("font/Yekan.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Tem1 Nazanin";
  src: url("font/B-NAZANIN.TTF") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Tem1 Titr";
  src: url("font/B%20Titr%20Bold_0.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  font-family: "Tem1 Yekan", Tahoma, Arial, sans-serif;
  font-synthesis: weight;
  text-rendering: optimizeLegibility;
  --font-ui: "Tem1 Yekan", Tahoma, Arial, sans-serif;
  --font-reading: "Tem1 Nazanin", "Tem1 Yekan", Tahoma, sans-serif;
  --font-display: "Tem1 Titr", "Tem1 Yekan", Tahoma, sans-serif;
  /* برای عوض‌کردن تم فقط همین چهار رنگ را تغییر بده. */
  --theme-background: #202a34;
  --theme-surface: #3b4752;
  --theme-accent: #d97542;
  --theme-foreground: #edf2f7;

  /* نقش‌های متن؛ هر سه را می‌توان مستقل با رنگ دلخواه جایگزین کرد. */
  --text-important: var(--theme-foreground);
  --text-normal: color-mix(in srgb, var(--theme-foreground) 90%, var(--theme-background));
  --text-subtle: color-mix(in srgb, var(--theme-foreground) 66%, var(--theme-background));

  /* Derived palette: keep component rules on these tokens, not raw colors. */
  --ink: var(--text-normal);
  --muted: var(--text-subtle);
  --page: var(--theme-background);
  --surface: color-mix(in srgb, var(--theme-background) 38%, var(--theme-surface));
  --surface-raised: color-mix(in srgb, var(--theme-surface) 72%, var(--theme-foreground));
  --surface-inset: color-mix(in srgb, var(--theme-background) 86%, black);
  --line: color-mix(in srgb, var(--theme-surface) 58%, var(--theme-foreground));
  --line-soft: color-mix(in srgb, var(--theme-foreground) 16%, transparent);
  --brand: var(--theme-accent);
  --brand-light: color-mix(in srgb, var(--theme-accent) 58%, var(--theme-foreground));
  --brand-dark: color-mix(in srgb, var(--theme-accent) 58%, var(--theme-background));
  --accent-mid: color-mix(in srgb, var(--theme-accent) 78%, var(--theme-background));
  --accent-deep: color-mix(in srgb, var(--theme-accent) 58%, var(--theme-background));
  --accent-bright: color-mix(in srgb, var(--theme-accent) 66%, var(--theme-foreground));
  --accent-pale: color-mix(in srgb, var(--theme-accent) 28%, var(--theme-foreground));
  --tone-950: color-mix(in srgb, var(--theme-background) 88%, var(--theme-surface));
  --tone-900: color-mix(in srgb, var(--theme-background) 72%, var(--theme-surface));
  --tone-850: color-mix(in srgb, var(--theme-background) 54%, var(--theme-surface));
  --tone-800: color-mix(in srgb, var(--theme-background) 36%, var(--theme-surface));
  --tone-750: color-mix(in srgb, var(--theme-surface) 84%, var(--theme-background));
  --tone-700: color-mix(in srgb, var(--theme-surface) 72%, var(--theme-foreground));
  --tone-600: color-mix(in srgb, var(--theme-surface) 48%, var(--theme-foreground));
  --tone-500: color-mix(in srgb, var(--theme-surface) 28%, var(--theme-foreground));
  --tone-400: color-mix(in srgb, var(--theme-foreground) 76%, var(--theme-surface));
  --tone-300: color-mix(in srgb, var(--theme-foreground) 88%, var(--theme-background));
  --tone-200: color-mix(in srgb, var(--theme-foreground) 94%, var(--theme-background));
  --info: hsl(from var(--theme-surface) h calc(s * 1.4) 48%);
  --success: hsl(from var(--theme-accent) calc(h + 112deg) 34% 48%);
  --warning: hsl(from var(--theme-accent) calc(h + 22deg) 50% 52%);
  --danger: hsl(from var(--theme-accent) calc(h - 10deg) 48% 50%);
  --info-dark: color-mix(in srgb, var(--info) 58%, var(--theme-background));
  --info-light: color-mix(in srgb, var(--info) 54%, var(--theme-foreground));
  --success-dark: color-mix(in srgb, var(--success) 58%, var(--theme-background));
  --success-light: color-mix(in srgb, var(--success) 54%, var(--theme-foreground));
  --warning-dark: color-mix(in srgb, var(--warning) 58%, var(--theme-background));
  --warning-light: color-mix(in srgb, var(--warning) 54%, var(--theme-foreground));
  --danger-dark: color-mix(in srgb, var(--danger) 58%, var(--theme-background));
  --danger-light: color-mix(in srgb, var(--danger) 54%, var(--theme-foreground));
  --info-soft: color-mix(in srgb, var(--info) 22%, transparent);
  --success-soft: color-mix(in srgb, var(--success) 22%, transparent);
  --warning-soft: color-mix(in srgb, var(--warning) 22%, transparent);
  --danger-soft: color-mix(in srgb, var(--danger) 22%, transparent);
  --radius-sm: .35rem;
  --radius: .65rem;
  --radius-lg: 1rem;
  --shadow-1: 0 2px 5px rgb(0 0 0 / 25%), inset 0 1px rgb(255 255 255 / 5%);
  --shadow-2: 0 8px 20px rgb(0 0 0 / 28%), inset 0 1px rgb(255 255 255 / 6%);
  --shadow-3: 0 16px 34px rgb(0 0 0 / 38%), inset 0 1px rgb(255 255 255 / 7%);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; background: var(--page); scrollbar-width: thin; scrollbar-color: var(--brand) var(--surface-inset); }
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { border-radius: 1rem; background: var(--surface-inset); }
*::-webkit-scrollbar-thumb { border: 1px solid var(--surface-inset); border-radius: 1rem; background: linear-gradient(180deg, var(--brand-light), var(--brand-dark)); }
*::-webkit-scrollbar-thumb:hover { background: var(--brand); }
*::-webkit-scrollbar-corner { background: var(--surface-inset); }
@media (max-width: 40rem) {
  *::-webkit-scrollbar { width: 5px; height: 5px; }
  *::-webkit-scrollbar-thumb { border-width: 1px; }
}
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 50% -20%, var(--tone-700) 0, var(--page) 58rem);
  font-size: 1rem;
  line-height: 1.7;
}

body > header, body > nav, body > main, body > footer,
body > section, body > article, body > aside {
  width: min(100% - 2.5rem, 76rem);
  margin-inline: auto;
}
body > header { padding-block: 2.5rem 1.25rem; }
body > header > p:first-child { color: var(--brand-light); font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
body > header > h1 { max-width: 48rem; margin-block: .4rem .8rem; font-size: clamp(2rem, 5vw, 3.4rem); }
body > header > p:last-child { max-width: 48rem; color: var(--muted); }
body > header > p:last-child, main > section > header > p:last-child { font-family: var(--font-reading); font-size: 1.08rem; line-height: 1.7; }
h1, h2 { font-family: var(--font-display); font-weight: 700; }
h1 { letter-spacing: 0; }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.8rem); }
main > section > section > figure > figcaption { font-family: var(--font-reading); font-size: .95rem; }
body > nav {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .55rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--surface-raised), var(--surface));
  box-shadow: var(--shadow-2);
}
body > nav > a > svg { display: block; width: 1.15rem; height: 1.15rem; flex: 0 0 auto; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: stroke-width .18s ease, filter .18s ease, transform .18s ease; }
body > nav > a[aria-current="page"] > svg { stroke-width: 2.15; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--brand-light) 38%, transparent)); }
body > main { padding-block: 1.5rem 3.5rem; }
body > footer {
  padding-block: 1.75rem 2.5rem;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
}

header, footer, nav, main, section, article, aside, figure, form, fieldset, details, summary { min-width: 0; }
header > :first-child, main > :first-child, section > :first-child, article > :first-child { margin-top: 0; }
h1, h2, h3, h4, h5, h6 { color: var(--text-important); line-height: 1.3; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { margin-block: 0 1rem; font-size: clamp(1.25rem, 2.5vw, 1.7rem); }
h3 { margin-block: 1.25rem .55rem; font-size: 1.05rem; }
p { margin-block: 0 1rem; }
small, figcaption, caption, time { color: var(--text-subtle); }
strong, b { color: var(--text-important); }
mark { padding: .08em .35em; border-radius: .25em; color: var(--accent-pale); background: var(--accent-deep); }
hr { height: 1px; margin-block: 1.5rem; border: 0; background: var(--line-soft); }
blockquote { margin: 1.25rem 0; padding: .25rem 1rem; border-inline-start: 3px solid var(--brand); color: var(--muted); }
q { color: var(--brand-light); }
abbr[title] { text-decoration: underline dotted; text-underline-offset: .2em; cursor: help; }
address { color: var(--muted); font-style: normal; }

a { color: var(--brand-light); text-decoration-thickness: .08em; text-underline-offset: .2em; }
a:hover { color: var(--accent-pale); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--brand-light); outline-offset: 3px; }
nav a { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.5rem; padding: .35rem .85rem; border-radius: var(--radius); color: var(--muted); text-decoration: none; transition: background .18s, color .18s, transform .18s; }
nav a:hover, nav a[aria-current="page"] { color: var(--theme-foreground); background: linear-gradient(180deg, var(--brand), var(--accent-deep)); box-shadow: var(--shadow-1); }

button, input, select, textarea { font: inherit; }
button, input[type="button"], input[type="submit"], input[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: .48rem .9rem;
  border: 1px solid var(--tone-500);
  border-radius: var(--radius);
  color: var(--ink);
  background: linear-gradient(180deg, var(--tone-750), var(--tone-800));
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: filter .18s, transform .18s, box-shadow .18s;
}
button:hover, input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover { filter: brightness(1.15); transform: translateY(-1px); }
button:active, input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active { transform: translateY(1px); box-shadow: inset 0 2px 5px rgb(0 0 0 / 32%); }
button[data-active="true"], input[type="button"][data-active="true"], button[aria-pressed="true"] { transform: translateY(1px); border-color: var(--accent-pale); color: var(--accent-pale); background: linear-gradient(145deg, var(--brand-light) 0%, var(--brand) 52%, var(--accent-deep) 100%); box-shadow: inset 1px 1px 1px rgb(255 255 255 / 36%), inset -1px -2px 2px color-mix(in srgb, var(--brand-dark) 42%, transparent), 0 2px 5px rgb(0 0 0 / 35%), 0 0 8px color-mix(in srgb, var(--brand) 18%, transparent); }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .48; cursor: not-allowed; transform: none; }
main button[type="submit"], main form button, main article button[aria-pressed="true"] { border-color: var(--brand-light); color: var(--tone-200); background: linear-gradient(180deg, var(--brand-light), var(--brand-dark)); }
header button { border-color: var(--brand-light); color: var(--theme-foreground); background: linear-gradient(180deg, var(--brand), var(--accent-deep)); }
nav button { min-height: 2.15rem; padding: .3rem .7rem; }
footer button { min-height: 2.25rem; color: var(--muted); background: var(--surface-inset); }
main > section > button, main > article > button { margin-inline-end: .4rem; }

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]), select, textarea {
  width: 100%;
  min-height: 2.65rem;
  padding: .55rem .75rem;
  border: 1px solid var(--tone-700);
  border-radius: var(--radius);
  color: var(--ink);
  background: linear-gradient(180deg, var(--tone-950), var(--tone-900));
  box-shadow: inset 0 2px 5px rgb(0 0 0 / 22%);
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-light); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 19%, transparent), inset 0 2px 5px rgb(0 0 0 / 18%); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
textarea { min-height: 7rem; resize: vertical; }
label { display: block; margin-block: .65rem .3rem; color: var(--text-normal); font-size: .92rem; font-weight: 650; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { display: inline-flex; align-items: center; gap: .65rem; min-height: 2rem; margin: .25rem .9rem .25rem 0; color: var(--text-normal); cursor: pointer; transition: color .16s ease; }
label:has(> input[type="checkbox"]:checked), label:has(> input[type="radio"]:checked) { color: var(--accent-pale); }
input[type="checkbox"], input[type="radio"] {
  flex: 0 0 1.3rem;
  width: 1.3rem;
  height: 1.3rem;
  margin: 0;
  padding: 0;
  appearance: none;
  border: 1px solid var(--tone-500);
  background: linear-gradient(145deg, var(--tone-750) 0%, var(--tone-800) 48%, var(--info-dark) 100%);
  box-shadow: inset 1px 1px 1px rgb(255 255 255 / 23%), inset -1px -1px 2px rgb(0 0 0 / 35%), 1px 2px 2px rgb(0 0 0 / 38%), 0 1px 0 rgb(255 255 255 / 9%);
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
input[type="checkbox"] { border-radius: .38rem; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--brand-light); filter: brightness(1.12); box-shadow: inset 1px 1px 1px rgb(255 255 255 / 28%), inset -1px -1px 2px rgb(0 0 0 / 35%), 1px 2px 3px rgb(0 0 0 / 42%), 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent); }
input[type="checkbox"]:checked { border-color: var(--accent-pale); background-color: var(--brand); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.4' d='m3 8 3.2 3.2L13 4.8'/%3E%3C/svg%3E"), linear-gradient(145deg, var(--brand-light) 0%, var(--brand) 48%, var(--brand) 100%); background-position: center; background-repeat: no-repeat; background-size: 76%, cover; box-shadow: inset 1px 1px 1px rgb(255 255 255 / 48%), inset -1px -2px 2px color-mix(in srgb, var(--accent-deep) 42%, transparent), 1px 2px 4px rgb(0 0 0 / 40%), 0 0 7px color-mix(in srgb, var(--brand) 22%, transparent); }
input[type="checkbox"]:indeterminate { border-color: var(--accent-pale); background-color: var(--brand); background-image: linear-gradient(var(--tone-200), var(--tone-200)), linear-gradient(145deg, var(--brand-light), var(--brand)); background-position: center, center; background-repeat: no-repeat; background-size: 55% 2px, cover; box-shadow: inset 1px 1px 1px rgb(255 255 255 / 42%), inset -1px -2px 2px color-mix(in srgb, var(--accent-deep) 42%, transparent), 1px 2px 4px rgb(0 0 0 / 38%); }
input[type="radio"]:checked { border-color: var(--accent-pale); background: radial-gradient(circle at 36% 31%, var(--accent-pale) 0 .08rem, var(--accent-pale) .09rem .17rem, var(--brand) .18rem .31rem, var(--brand) .32rem .39rem, transparent .4rem), linear-gradient(145deg, var(--brand-light) 0%, var(--brand) 48%, var(--accent-deep) 100%); box-shadow: inset 1px 1px 1px rgb(255 255 255 / 48%), inset -1px -2px 2px color-mix(in srgb, var(--accent-deep) 42%, transparent), 1px 2px 4px rgb(0 0 0 / 42%), 0 0 7px color-mix(in srgb, var(--brand) 20%, transparent); }
input[type="checkbox"]:active, input[type="radio"]:active { transform: translateY(1px); box-shadow: inset 1px 2px 3px rgb(0 0 0 / 36%), 0 1px 1px rgb(255 255 255 / 8%); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { border-color: var(--tone-700); background-color: var(--tone-800); box-shadow: none; cursor: not-allowed; opacity: .48; }
label:has(> input[type="checkbox"]:disabled), label:has(> input[type="radio"]:disabled) { cursor: not-allowed; opacity: .58; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible, input[type="range"]:focus-visible { outline: 2px solid var(--brand-light); outline-offset: 3px; }
input[type="range"] { width: 100%; max-width: 30rem; height: 1.5rem; padding: 0; border: 0; background: transparent; box-shadow: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: .38rem; border-radius: 1rem; background: linear-gradient(90deg, var(--brand), var(--tone-500)); }
input[type="range"]::-moz-range-track { height: .38rem; border-radius: 1rem; background: linear-gradient(90deg, var(--brand), var(--tone-500)); }
input[type="range"]::-webkit-slider-thumb { width: 1.1rem; height: 1.1rem; margin-top: -.36rem; appearance: none; border: 2px solid var(--accent-pale); border-radius: 50%; background: var(--brand); box-shadow: 0 2px 6px rgb(0 0 0 / 45%); }
input[type="range"]::-moz-range-thumb { width: .85rem; height: .85rem; border: 2px solid var(--accent-pale); border-radius: 50%; background: var(--brand); box-shadow: 0 2px 6px rgb(0 0 0 / 45%); }
input[type="color"] { width: 2.8rem; height: 2.8rem; padding: .2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-inset); cursor: pointer; }
input[type="file"] { padding: .35rem; color: var(--muted); }
input[type="file"]::file-selector-button { margin-inline-end: .75rem; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: linear-gradient(180deg, var(--tone-750), var(--tone-800)); cursor: pointer; }
input[type="file"]::file-selector-button:hover { border-color: var(--brand-light); }
input[type="search"] { appearance: none; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], input[type="week"] { color-scheme: dark; }
input[type="image"] { max-width: 100%; border-radius: var(--radius); cursor: pointer; }
::placeholder { color: var(--tone-500); opacity: 1; }
form, fieldset { padding: 1rem; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: linear-gradient(145deg, var(--surface-raised), var(--surface)); box-shadow: var(--shadow-1); }
fieldset fieldset { margin-block: 1rem; background: rgb(0 0 0 / 10%); }
legend { padding-inline: .45rem; color: var(--brand-light); font-weight: 750; }
output { color: var(--brand-light); font-weight: 750; }
progress, meter { display: inline-block; width: min(100%, 24rem); height: .72rem; vertical-align: middle; accent-color: var(--brand); }
progress { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 1rem; background: var(--surface-inset); }
progress::-webkit-progress-bar { border-radius: 1rem; background: var(--surface-inset); }
progress::-webkit-progress-value { border-radius: 1rem; background: linear-gradient(90deg, var(--brand-dark), var(--brand-light)); box-shadow: 0 0 10px color-mix(in srgb, var(--brand) 35%, transparent); transition: width .25s ease; }
progress::-moz-progress-bar { border-radius: 1rem; background: linear-gradient(90deg, var(--brand-dark), var(--brand-light)); box-shadow: 0 0 10px color-mix(in srgb, var(--brand) 35%, transparent); }
progress:indeterminate::-webkit-progress-bar { background: linear-gradient(90deg, var(--surface-inset), var(--brand-dark), var(--brand-light), var(--surface-inset)); background-size: 200% 100%; animation: progress-glide 1.5s linear infinite; }
progress:indeterminate::-moz-progress-bar { background: linear-gradient(90deg, var(--surface-inset), var(--brand-dark), var(--brand-light), var(--surface-inset)); background-size: 200% 100%; animation: progress-glide 1.5s linear infinite; }
meter { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 1rem; background: var(--surface-inset); }
meter::-webkit-meter-bar { border: 0; border-radius: 1rem; background: var(--surface-inset); }
meter::-webkit-meter-optimum-value { border-radius: 1rem; background: linear-gradient(90deg, var(--success), var(--success)); }
meter::-webkit-meter-suboptimum-value { border-radius: 1rem; background: linear-gradient(90deg, var(--brand-light), var(--brand-dark)); }
meter::-webkit-meter-even-less-good-value { border-radius: 1rem; background: linear-gradient(90deg, var(--danger), var(--danger)); }
meter::-moz-meter-bar { border-radius: 1rem; background: linear-gradient(90deg, var(--brand-dark), var(--brand-light)); }
@keyframes progress-glide { to { background-position: -200% 0; } }

main > section, main > article, main > aside, main > figure, main > form, main > details {
  margin-block: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, color-mix(in srgb, var(--tone-800) 96%, transparent), color-mix(in srgb, var(--tone-850) 98%, transparent));
  box-shadow: var(--shadow-2);
}
main > section > header, main > article > header { margin-block-end: 1rem; }
main > section > footer, main > article > footer { margin-block-start: 1rem; padding-block-start: .8rem; border-top: 1px solid var(--line-soft); }
main > section > section, main > article > section { min-width: 0; }
main > section > section + section, main > article > section + section { margin-block-start: 1.25rem; }
main > section > nav, main > article > nav { display: flex; flex-wrap: wrap; gap: .25rem; margin-block: .8rem; padding: .35rem; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-inset); }
main > section > nav a, main > article > nav a { min-height: 2.15rem; padding-inline: .7rem; }

ul, ol { padding-inline-start: 1.5rem; }
li::marker { color: var(--brand-light); }
dl { display: grid; grid-template-columns: minmax(7rem, .35fr) 1fr; gap: .4rem 1rem; }
dt { font-weight: 700; }
dd { margin: 0; color: var(--muted); }
figure { margin-inline: 0; }
img, video, canvas, svg, iframe, embed, object { max-width: 100%; }
img, video { height: auto; border-radius: var(--radius); }
figcaption { margin-top: .5rem; font-size: .9rem; }
audio { width: 100%; }
table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--radius); text-align: start; background: var(--surface-inset); }
caption { padding: .6rem; text-align: start; }
th, td { padding: .65rem .8rem; border-bottom: 1px solid var(--line-soft); }
th { color: var(--accent-pale); background: var(--tone-800); text-align: start; }
tbody tr:nth-child(even) { background: rgb(255 255 255 / 2.5%); }
tbody tr:hover { background: color-mix(in srgb, var(--brand) 9%, transparent); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
pre, code, kbd, samp { font-family: Consolas, "Courier New", monospace; }
code, kbd, samp { padding: .12em .35em; border: 1px solid var(--line-soft); border-radius: .3em; color: var(--accent-pale); background: var(--info-dark); }
pre { overflow: auto; padding: 1rem; border: 1px solid var(--line-soft); border-radius: var(--radius); color: var(--info-light); background: var(--info-dark); }
pre code { padding: 0; border: 0; color: inherit; background: transparent; }
details { padding: .8rem 1rem; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-inset); }
summary { color: var(--accent-pale); cursor: pointer; font-weight: 700; }
details[open] summary { margin-bottom: .6rem; }
dialog { max-width: min(90vw, 36rem); padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); background: var(--surface-raised); box-shadow: var(--shadow-3); }
dialog::backdrop { background: color-mix(in srgb, var(--info-dark) 72%, transparent); backdrop-filter: blur(4px); }
[role="alert"], [role="status"] { padding: .75rem 1rem; border: 1px solid var(--line-soft); border-inline-start: 3px solid var(--brand); border-radius: var(--radius); background: var(--surface-inset); box-shadow: var(--shadow-1); }
[role="alert"][aria-live="assertive"] { border-inline-start-color: var(--danger); }
[role="status"][aria-live="polite"] { border-inline-start-color: var(--info); }
[aria-current="step"] { color: var(--brand-light); font-weight: 800; }
[aria-selected="true"] { color: var(--theme-foreground); background: linear-gradient(180deg, var(--brand), var(--accent-deep)); }
::selection { color: var(--theme-foreground); background: var(--brand); }

@media (max-width: 40rem) {
  body > header, body > nav, body > main, body > footer,
  body > section, body > article, body > aside { width: min(100% - 1rem, 76rem); }
  body > header { padding-block-start: 1.5rem; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  dl { grid-template-columns: 1fr; gap: 0; }
  dd { margin-bottom: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Component board layout: semantic sections form the grid and their children form panels. */
body > header { padding-block: clamp(2rem, 6vw, 4.5rem) 2rem; }
body > header > p:first-child { display: inline-flex; align-items: center; gap: .55rem; margin-block-end: .75rem; padding: .3rem .7rem; border: 1px solid color-mix(in srgb, var(--brand-light) 28%, transparent); border-radius: 99px; background: color-mix(in srgb, var(--brand) 10%, transparent); }
body > header > h1 { max-width: 58rem; margin-block: .35rem .7rem; letter-spacing: -.035em; }
body > header > p:last-child { max-width: 46rem; font-size: 1.05rem; }
body > nav { position: sticky; z-index: 5; top: .65rem; width: min(100% - 2.5rem, 76rem); margin-block: 0 1rem; backdrop-filter: blur(14px); }
body > main { display: grid; gap: 1.25rem; padding-block: 1rem 3rem; }
main > section { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; gap: 1rem; margin: 0; padding: clamp(1rem, 2.5vw, 1.5rem); scroll-margin-top: 6rem; }
main > section > header { grid-column: 1 / -1; margin: 0; padding-block-end: .8rem; border-bottom: 1px solid var(--line-soft); }
main > section > header > p { margin-block-end: .3rem; color: var(--brand-light); font-size: .72rem; font-weight: 800; letter-spacing: .08em; }
main > section > header > h2 { margin: 0; }
main > section > section { grid-column: span 6; min-width: 0; height: 100%; margin: 0; padding: 1rem; border: 1px solid var(--line-soft); border-radius: var(--radius); background: linear-gradient(145deg, color-mix(in srgb, var(--info-dark) 72%, transparent), color-mix(in srgb, var(--info-dark) 88%, transparent)); box-shadow: var(--shadow-1); }
main > section > section > h3 { margin-block: 0 .85rem; color: var(--text-important); font-size: .82rem; letter-spacing: .035em; }
main > section > section > article { min-width: 0; margin-block: .55rem; padding: .75rem; border: 1px solid var(--line-soft); border-radius: var(--radius); background: linear-gradient(145deg, var(--tone-800), var(--tone-800)); box-shadow: var(--shadow-1); }
main > section > section > article > header { margin-block-end: .7rem; }
main > section > section > article > header h4 { margin: 0 0 .15rem; }
main > section > section > article > footer { margin-block-start: .65rem; padding-block-start: .6rem; border-top: 1px solid var(--line-soft); }
main > section > section > p:last-child, main > section > section > article > p:last-child { margin-block-end: 0; }
main > section > section > p > button + button { margin-inline-start: .35rem; }
main > section > section > p > button[data-variant="primary"], main > section > section > article button { border-color: var(--brand-light); color: var(--tone-200); background: linear-gradient(180deg, var(--brand), var(--accent-deep)); }
main > section > section > p > button[data-variant="quiet"] { color: var(--info-light); background: transparent; box-shadow: none; }
button[aria-busy="true"]::before { width: .75em; height: .75em; margin-inline-end: .5em; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; content: ""; animation: button-spin .8s linear infinite; }
@keyframes button-spin { to { transform: rotate(360deg); } }

/* Foundation swatches communicate their role through a data attribute. */
main > section > section > article[data-surface="base"] { background: var(--page); }
main > section > section > article[data-surface="raised"] { background: var(--surface-raised); }
main > section > section > article[data-surface="inset"] { background: var(--surface-inset); }
main > section > section > article[data-surface="brand"] { border-color: var(--brand-light); background: linear-gradient(145deg, var(--brand), var(--accent-deep)); }
main > section > section > article[data-elevation="1"] { box-shadow: var(--shadow-1); }
main > section > section > article[data-elevation="2"] { box-shadow: var(--shadow-2); }
main > section > section > article[data-elevation="3"] { box-shadow: var(--shadow-3); }
main > section > section > article[data-radius="small"] { border-radius: .3rem; }
main > section > section > article[data-radius="medium"] { border-radius: .7rem; }
main > section > section > article[data-radius="large"] { border-radius: 1.15rem; }
main > section > section > ol { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
main > section > section > ol li { flex: 1 1 4.5rem; padding: .5rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); color: var(--muted); background: var(--surface-inset); text-align: center; font-size: .78rem; }
main > section > section > ol li::before { display: block; height: .55rem; margin-block-end: .45rem; border-radius: 1rem; background: var(--brand); content: ""; }

/* Nested navigation patterns. */
main > section > section > nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin-block: .5rem; padding: .35rem; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-inset); }
main > section > section > nav ol { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0; padding: .2rem; list-style: none; }
main > section > section > nav ol li + li::before { margin-inline-end: .35rem; color: var(--tone-500); content: "/"; }
main > section > section > nav[aria-label="صفحه‌بندی"] { justify-content: center; }
main > section > section > nav[aria-label="صفحه‌بندی"] ol { gap: .25rem; }
main > section > section > nav[aria-label="صفحه‌بندی"] ol li + li::before { content: none; }
main > section > section > nav[aria-label="صفحه‌بندی"] a { min-width: 2.2rem; justify-content: center; padding-inline: .45rem; }
main > section > section > ol:has(> li[aria-current="step"]) { position: relative; display: flex; justify-content: space-between; gap: .35rem; margin: .8rem 0 0; padding: 0; list-style: none; }
main > section > section > ol:has(> li[aria-current="step"])::before { position: absolute; z-index: 0; inset: .58rem .7rem auto; height: 2px; background: var(--line); content: ""; }
main > section > section > ol:has(> li[aria-current="step"]) li { position: relative; z-index: 1; display: grid; justify-items: center; gap: .35rem; color: var(--muted); font-size: .75rem; }
main > section > section > ol:has(> li[aria-current="step"]) li::before { width: 1.2rem; height: 1.2rem; border: 2px solid var(--line); border-radius: 50%; background: var(--surface-inset); content: ""; }
main > section > section > ol:has(> li[aria-current="step"]) li[aria-current="step"]::before { border-color: var(--accent-pale); background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent); }

/* Data and feedback components. */
main > section > section > ul { margin: 0; padding: 0; list-style: none; }
main > section > section > ul li { padding: .65rem .25rem; border-bottom: 1px solid var(--line-soft); }
main > section > section > ul li:last-child { border-bottom: 0; }
main > section > section > p > mark { display: inline-block; margin: .15rem; border: 1px solid color-mix(in srgb, var(--brand-light) 25%, transparent); border-radius: 99px; color: var(--accent-pale); background: color-mix(in srgb, var(--brand) 14%, transparent); font-size: .76rem; }
main > section > section > p > span[aria-label="آواتار کاربر"] { display: inline-grid; width: 2.2rem; height: 2.2rem; margin-inline-end: -.35rem; place-items: center; border: 2px solid var(--surface-inset); border-radius: 50%; color: var(--theme-foreground); background: linear-gradient(145deg, var(--tone-600), var(--info-dark)); font-weight: 800; }
main > section > section > p > small[role="tooltip"] { display: inline-block; margin-inline-start: .5rem; padding: .3rem .55rem; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--info-dark); box-shadow: var(--shadow-2); }
main > section > section > p[role="status"], main > section > section > p[role="alert"] { margin-block: .55rem; }
main > section > section > p[role="status"][aria-live="polite"]:first-letter { color: var(--success); }
main > section > section > p[role="alert"] { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: linear-gradient(100deg, color-mix(in srgb, var(--danger) 24%, transparent), var(--surface-inset)); }
main > section > section > dialog[open] { position: static; display: block; width: 100%; max-width: none; margin: 0; }
main > section > section > dialog[open] h4 { margin-block: 0 .4rem; }
main > section > section > article[aria-busy="true"] p::before { display: inline-block; width: .65rem; height: .65rem; margin-inline-end: .45rem; border-radius: .15rem; background: var(--tone-500); content: ""; }
main > section > section > article[aria-busy="true"] progress { width: 100%; }
main > section > section > article[aria-busy="true"] ul { display: grid; gap: .6rem; margin: .8rem 0; padding: 0; list-style: none; }
main > section > section > article[aria-busy="true"] ul li { display: flex; align-items: center; gap: .6rem; padding: 0; border: 0; }
main > section > section > article[aria-busy="true"] ul li span:first-child { width: .75rem; height: .75rem; border-radius: .2rem; background: var(--tone-600); }
main > section > section > article[aria-busy="true"] ul li span:last-child { width: min(75%, 16rem); height: .45rem; border-radius: 1rem; background: linear-gradient(90deg, var(--tone-700), var(--tone-500), var(--tone-700)); background-size: 200% 100%; animation: progress-glide 1.8s linear infinite; }
main > section > section > article:has(> p[aria-hidden="true"]) { display: grid; justify-items: center; min-height: 10rem; text-align: center; }
main > section > section > article > p[aria-hidden="true"] { margin: 0; color: var(--tone-400); font-size: 3rem; line-height: 1; }
main > section > section > p > span[aria-hidden="true"] { display: inline-grid; width: 2rem; height: 2rem; margin-inline: .35rem .15rem; place-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--accent-pale); background: var(--surface-inset); font-size: 1.15rem; }
main > section > section > form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; padding: 0; border: 0; background: transparent; box-shadow: none; }
main > section > section > form > fieldset { min-width: 0; }
main > section > section > form > fieldset:first-child { grid-column: 1 / -1; }
main > section > section > label { margin-block: .55rem .25rem; }
main > section > section > label + progress { display: block; }
main > section > section > label > input[type="range"] { display: block; }
main > section > section > table { font-size: .84rem; }

@media (max-width: 48rem) {
  body > nav { position: static; }
  main > section { grid-template-columns: 1fr; }
  main > section > header, main > section > section { grid-column: 1; }
  main > section > section > form { grid-template-columns: 1fr; }
  main > section > section > form > fieldset:first-child { grid-column: auto; }
}
@media (forced-colors: active) {
  input[type="checkbox"], input[type="radio"] { appearance: auto; accent-color: Highlight; box-shadow: none; }
}

/* Canvas charts use a fixed-height figure so Chart.js can resize cleanly. */
main > section > section:has(> figure > canvas[data-chart]) { grid-column: span 6; }
main > section > section > figure:has(> canvas[data-chart]) { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 18rem; margin: 0; padding: .35rem .2rem 0; }
main > section > section > figure > canvas[data-chart] { display: block; width: 100% !important; height: 100% !important; min-height: 0; }
main > section > section > figure > figcaption { padding-block-start: .4rem; text-align: center; font-size: .78rem; }
main > section > section[data-chart-actions] { grid-column: 1 / -1; }
main > section > section[data-chart-actions] > p { display: flex; flex-wrap: wrap; gap: .45rem; margin-block: .5rem; }
main > section > section[data-chart-actions] > p > button { margin: 0; }
main > section > section[data-chart-actions] > output { display: block; min-height: 2rem; margin-block-start: .65rem; padding: .45rem .7rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); color: var(--muted); background: var(--surface-inset); font-size: .84rem; }
@media (max-width: 48rem) {
  main > section > section:has(> figure > canvas[data-chart]) { grid-column: 1; }
  main > section > section > figure:has(> canvas[data-chart]) { height: 16rem; }
}

/* Full-page startup cover. */
body > [data-page-loader][role="status"] {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  border: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--info-dark) 94%, transparent);
  box-shadow: none;
  backdrop-filter: blur(12px);
  opacity: 1;
  transition: opacity .28s ease, visibility .28s ease;
}
body > [data-page-loader][hidden] { display: none; }
body > [data-page-loader][data-state="closing"] { visibility: hidden; opacity: 0; pointer-events: none; }
body > [data-page-loader] > div {
  display: grid;
  justify-items: center;
  gap: .7rem;
  min-width: min(18rem, 100%);
  padding: 2rem 2.5rem;
  border: 1px solid var(--tone-600);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--tone-750), var(--info-dark));
  box-shadow: inset 0 1px rgb(255 255 255 / 9%), 0 22px 55px rgb(0 0 0 / 48%);
  text-align: center;
}
body > [data-page-loader] > div > span {
  width: 2.7rem;
  height: 2.7rem;
  margin-block-end: .4rem;
  border: 3px solid color-mix(in srgb, var(--brand-light) 20%, transparent);
  border-top-color: var(--brand-light);
  border-inline-end-color: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 18px color-mix(in srgb, var(--brand) 18%, transparent), inset 0 0 8px color-mix(in srgb, var(--brand) 12%, transparent);
  animation: page-loader-spin .85s linear infinite;
}
body > [data-page-loader] > div > strong { color: var(--accent-pale); font-size: 1.05rem; }
body > [data-page-loader] > div > small { color: var(--tone-300); }
@keyframes page-loader-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  body > [data-page-loader] > div > span { animation-duration: 2s; }
}

/* Phone navigation dock with room for the device safe area. */
@media (max-width: 40rem) {
  body { padding-block-end: calc(6.5rem + env(safe-area-inset-bottom, 0px)); }
  body > nav {
    position: fixed;
    z-index: 100;
    top: auto;
    right: auto;
    bottom: calc(.55rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    width: min(calc(100% - 1rem), 30rem);
    margin: 0;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: .12rem;
    padding: .35rem;
    border: 1px solid color-mix(in srgb, var(--info-light) 22%, transparent);
    border-radius: 1.2rem;
    background: color-mix(in srgb, var(--info-dark) 94%, transparent);
    box-shadow: 0 10px 30px rgb(0 0 0 / 48%), inset 0 1px rgb(255 255 255 / 9%);
    transform: translateX(-50%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  body > nav > a {
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    gap: .18rem;
    min-width: 0;
    min-height: 3.35rem;
    padding: .35rem .1rem;
    border-radius: .9rem;
    color: var(--tone-300);
    font-size: .62rem;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    -webkit-tap-highlight-color: transparent;
  }
  body > nav > a > svg { display: block; width: 1.35rem; height: 1.35rem; }
  body > nav > a[aria-current="page"] { color: var(--accent-pale); background: linear-gradient(155deg, var(--brand), var(--accent-deep)); box-shadow: inset 0 1px rgb(255 255 255 / 25%), 0 2px 7px rgb(0 0 0 / 28%); }
  body > nav > a:active { transform: scale(.95); }
}

/* Four tactile surface samples inspired by the raised/inset reference tiles. */
main > section > section[data-foundation="surfaces"] {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  gap: .65rem;
}
main > section > section[data-foundation="surfaces"] > h3 { grid-column: 1 / -1; margin-block-end: .1rem; }
main > section > section > article[data-surface] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 8.8rem;
  margin: 0;
  padding: .55rem .35rem .6rem;
  border: 1px solid var(--tone-600);
  border-radius: .72rem;
  text-align: center;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
main > section > section > article[data-surface]::before {
  display: grid;
  width: 2rem;
  height: 2rem;
  margin-block: .25rem .5rem;
  place-items: center;
  border-radius: .45rem;
  color: var(--info-light);
  content: "↓";
  font-size: 1rem;
  line-height: 1;
}
main > section > section > article[data-surface] > strong { display: block; color: var(--text-important); font-size: .74rem; line-height: 1.35; text-wrap: balance; }
main > section > section > article[data-surface] > p { margin: .25rem 0 0; color: var(--text-subtle); font-size: .58rem; line-height: 1.3; text-transform: uppercase; }
main > section > section > article[data-surface="base"] {
  border-color: var(--tone-600);
  background: linear-gradient(145deg, var(--tone-750) 0%, var(--tone-800) 55%, var(--tone-800) 100%);
  box-shadow: inset 1px 1px rgb(255 255 255 / 16%), inset -1px -1px rgb(0 0 0 / 20%), 0 4px 8px rgb(0 0 0 / 25%);
}
main > section > section > article[data-surface="raised"] {
  border-color: var(--tone-500);
  background: linear-gradient(145deg, var(--tone-700) 0%, var(--tone-750) 55%, var(--tone-800) 100%);
  box-shadow: inset 1px 1px 1px rgb(255 255 255 / 24%), inset -1px -1px 2px rgb(0 0 0 / 24%), 0 8px 15px rgb(0 0 0 / 40%), 0 2px 3px rgb(0 0 0 / 22%);
}
main > section > section > article[data-surface="inset"] {
  border-color: var(--info-dark);
  background: linear-gradient(145deg, var(--info-dark) 0%, var(--tone-850) 100%);
  box-shadow: inset 3px 4px 8px rgb(0 0 0 / 48%), inset -1px -1px 2px rgb(255 255 255 / 7%), 0 1px 0 rgb(255 255 255 / 5%);
}
main > section > section > article[data-surface="inset"]::before { color: var(--brand-light); box-shadow: inset 1px 1px 3px rgb(0 0 0 / 45%), 0 1px rgb(255 255 255 / 7%); }
main > section > section > article[data-surface="pressed"] {
  border-color: var(--info-dark);
  background: linear-gradient(145deg, var(--info-dark), var(--tone-850));
  box-shadow: inset 4px 5px 9px rgb(0 0 0 / 52%), inset -1px -1px 2px rgb(255 255 255 / 6%), 0 1px 0 rgb(255 255 255 / 5%);
}
main > section > section > article[data-surface="pressed"]::before { color: var(--brand); }
main > section > section > article[data-surface="brand"] {
  border-color: var(--brand-light);
  background: linear-gradient(145deg, var(--brand), var(--accent-deep));
  box-shadow: inset 1px 1px rgb(255 255 255 / 22%), 0 6px 12px rgb(0 0 0 / 32%);
}
main > section > section > article[data-surface="floating"] {
  border-color: var(--tone-400);
  background: linear-gradient(145deg, var(--tone-700), var(--tone-800));
  box-shadow: inset 1px 1px rgb(255 255 255 / 20%), 0 12px 20px rgb(0 0 0 / 42%), 0 3px 5px rgb(0 0 0 / 26%);
}
main > section > section > article[data-surface="outline"] {
  border: 1px solid var(--brand);
  background: linear-gradient(145deg, var(--tone-800), var(--tone-850));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 18%, transparent), 0 3px 7px rgb(0 0 0 / 20%);
}
main > section > section > article[data-surface="soft"] {
  border-color: var(--tone-700);
  background: linear-gradient(145deg, var(--tone-750), var(--tone-800));
  box-shadow: inset 1px 1px 2px rgb(255 255 255 / 10%), inset -2px -2px 4px rgb(0 0 0 / 18%);
}
main > section > section > article[data-surface="base"]:hover,
main > section > section > article[data-surface="raised"]:hover { transform: translateY(-2px); border-color: var(--tone-400); }
@media (max-width: 30rem) {
  main > section > section[data-foundation="surfaces"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main > section > section > article[data-surface] { min-height: 7.8rem; }
}

/* Border weight and corner-radius token samples. */
main > section > section[data-foundation="borders"] {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-content: start;
  gap: .55rem;
}
main > section > section[data-foundation="borders"] > h3 { grid-column: 1 / -1; }
main > section > section[data-foundation="borders"] > h4 { grid-column: 1 / -1; margin: .1rem 0 -.2rem; color: var(--text-normal); font-size: .63rem; font-weight: 700; letter-spacing: .04em; }
main > section > section[data-foundation="borders"] > article {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 5.35rem;
  margin: 0;
  padding: .2rem .05rem;
  border: 0;
  border-radius: .25rem;
  background: transparent;
  box-shadow: none;
  text-align: center;
}
main > section > section[data-foundation="borders"] > article > span {
  --frame-width: 1px;
  --frame-top: var(--tone-300);
  --frame-bottom: var(--tone-700);
  --frame-mid: var(--tone-750);
  position: relative;
  display: block;
  width: 2.55rem;
  height: 2.55rem;
  margin-block-end: .32rem;
  overflow: hidden;
  border-radius: .25rem;
  background: var(--info-dark);
  box-shadow: 0 1px 1px rgb(255 255 255 / 9%), 0 4px 7px rgb(0 0 0 / 48%);
  isolation: isolate;
}
main > section > section[data-foundation="borders"] > article > span::before,
main > section > section[data-foundation="borders"] > article > span::after {
  position: absolute;
  display: block;
  content: "";
  border-radius: inherit;
}
main > section > section[data-foundation="borders"] > article > span::before {
  z-index: -1;
  inset: 0;
  background: linear-gradient(145deg, var(--frame-top) 0%, var(--frame-mid) 48%, var(--frame-bottom) 100%);
  box-shadow: inset 1px 1px 1px rgb(255 255 255 / 34%), inset -1px -1px 2px rgb(0 0 0 / 48%);
}
main > section > section[data-foundation="borders"] > article > span::after {
  z-index: 0;
  inset: var(--frame-width);
  border-radius: max(0px, calc(.25rem - var(--frame-width)));
  background: linear-gradient(145deg, var(--tone-750), var(--tone-800) 68%, var(--tone-800));
  box-shadow: inset 1px 1px 2px rgb(255 255 255 / 24%), inset -2px -2px 3px rgb(0 0 0 / 43%), 0 0 0 1px rgb(0 0 0 / 18%);
}
main > section > section[data-foundation="borders"] > article[data-border="2"] > span {
  --frame-width: 2px;
  --frame-top: var(--tone-300);
  --frame-bottom: var(--tone-700);
}
main > section > section[data-foundation="borders"] > article[data-border="accent"] > span {
  --frame-width: 1px;
  --frame-top: var(--accent-pale);
  --frame-bottom: var(--accent-deep);
  --frame-mid: var(--brand);
  box-shadow: 0 0 7px color-mix(in srgb, var(--brand) 30%, transparent), 0 4px 7px rgb(0 0 0 / 48%);
}
main > section > section[data-foundation="borders"] > article[data-border="4"] > span {
  --frame-width: 4px;
  --frame-top: var(--accent-pale);
  --frame-bottom: var(--accent-deep);
  --frame-mid: var(--brand);
  box-shadow: 0 0 7px color-mix(in srgb, var(--brand) 34%, transparent), 0 4px 7px rgb(0 0 0 / 48%);
}
main > section > section[data-foundation="borders"] > article[data-border="8"] > span {
  --frame-width: 8px;
  --frame-top: var(--accent-pale);
  --frame-bottom: var(--accent-deep);
  --frame-mid: var(--brand);
  box-shadow: 0 0 9px color-mix(in srgb, var(--brand) 40%, transparent), 0 4px 7px rgb(0 0 0 / 48%);
}
main > section > section[data-foundation="borders"] > article[data-radius] > span {
  --frame-width: 2px;
  --frame-top: var(--tone-300);
  --frame-bottom: var(--tone-750);
  border-radius: var(--tile-radius, 4px);
}
main > section > section[data-foundation="borders"] > article[data-radius="4"] > span { --tile-radius: 4px; }
main > section > section[data-foundation="borders"] > article[data-radius="8"] > span { --tile-radius: 8px; }
main > section > section[data-foundation="borders"] > article[data-radius="12"] > span { --tile-radius: 12px; }
main > section > section[data-foundation="borders"] > article[data-radius="16"] > span { --tile-radius: 16px; }
main > section > section[data-foundation="borders"] > article[data-radius="24"] > span { --tile-radius: 24px; }
main > section > section[data-foundation="borders"] > article[data-radius="full"] > span { --tile-radius: 50%; }
main > section > section[data-foundation="borders"] > article[data-radius] > span::before,
main > section > section[data-foundation="borders"] > article[data-radius] > span::after {
  border-radius: inherit;
}
main > section > section[data-foundation="borders"] > article > p { margin: 0; color: var(--text-normal); font-size: .63rem; line-height: 1.25; }
main > section > section[data-foundation="borders"] > article > small { margin-block-start: .12rem; color: var(--text-subtle); font-size: .54rem; line-height: 1.2; }
@media (max-width: 40rem) {
  main > section > section[data-foundation="borders"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Standalone phone skin: keep the page in a narrow, single-column layout at every viewport width. */
html {
  width: 100%;
  min-width: 0;
  overflow-x: clip;
  scroll-padding-block-start: 1rem;
}
body {
  width: 100%;
  max-width: 30rem;
  min-width: 0;
  min-height: 100svh;
  margin-inline: auto;
  padding-block-end: calc(5.8rem + env(safe-area-inset-bottom, 0px));
  overflow-x: clip;
  font-size: 1rem;
}
body > header, body > nav, body > main, body > footer,
body > section, body > article, body > aside {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}
body > header { padding: 1.1rem 1rem .8rem; }
body > header > h1 { margin-block: .25rem .45rem; font-size: clamp(1.8rem, 8vw, 2.35rem); line-height: 1.2; }
body > header > p:last-child { margin-block-end: .25rem; font-size: .96rem; line-height: 1.65; }
body > main { display: grid; gap: .8rem; padding: .35rem .55rem 0; }
body > footer { padding: 1rem .8rem 1.2rem; font-size: .82rem; }
body > nav {
  position: fixed;
  z-index: 100;
  inset: auto auto calc(.5rem + env(safe-area-inset-bottom, 0px)) 50%;
  width: min(calc(100vw - 1rem), 28rem);
  max-width: calc(100vw - 1rem);
  margin: 0;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: .12rem;
  padding: .35rem;
  border-radius: 1.15rem;
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
body > nav > a {
  flex: 1 1 0;
  flex-direction: column;
  justify-content: center;
  gap: .16rem;
  min-width: 0;
  min-height: 3.2rem;
  padding: .3rem .08rem;
  font-size: .62rem;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
  -webkit-tap-highlight-color: transparent;
}
body > nav > a > svg { width: 1.3rem; height: 1.3rem; }
main > section,
main > section:has(> section),
main > section:has(> article) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .7rem;
  margin: 0;
  padding: .85rem;
  border-radius: 1.05rem;
  scroll-margin-top: .75rem;
}
main > section:has(> section) > h2,
main > section:has(> article) > h2,
main > section:has(> section) > header,
main > section:has(> article) > header { grid-column: 1 / -1; }
main > section > header { padding-block-end: .55rem; }
main > section > header > h2 { font-size: 1.3rem; }
main > section > header > p { font-size: .68rem; }
main > section > section {
  grid-column: 1 / -1;
  min-width: 0;
  height: auto;
  padding: .8rem;
  border-radius: .85rem;
}
main > section > section > h3 { margin-block-end: .65rem; font-size: .95rem; }
main > section > section > article { margin-block: .45rem; padding: .65rem; border-radius: .7rem; }
main > section > section > section { min-width: 0; }
main > section > section > form,
main > section > section > section > form { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
main > section > section > form > fieldset:first-child { grid-column: auto; }
main > section > section > p:has(> button) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
main > section > section > p > button,
main > section > section > p > input[type="button"],
main > section > section > p > input[type="submit"],
main > section > section > p > input[type="reset"] { min-width: 0; min-height: 2.75rem; margin: 0; padding-inline: .55rem; }
main > section > section > p > button + button { margin-inline-start: 0; }
button, input[type="button"], input[type="submit"], input[type="reset"], select,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]), textarea { min-height: 2.75rem; font-size: 1rem; }
label { margin-block-start: .5rem; }
input[type="checkbox"], input[type="radio"] { width: 1.4rem; height: 1.4rem; flex-basis: 1.4rem; }
input[type="range"] { min-height: 2.75rem; }
fieldset { min-width: 0; padding: .75rem; }
dl { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
dd { margin-block-end: .55rem; }
table { display: block; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; white-space: nowrap; }
th, td { padding: .55rem .65rem; }
pre { max-width: 100%; padding: .75rem; font-size: .82rem; }
dialog { width: calc(100% - 1rem); max-width: 28rem; max-height: calc(100svh - 2rem); margin: auto; padding: 1rem; overflow: auto; }
main > section > section:has(> figure > canvas[data-chart]) { grid-column: 1 / -1; }
main > section > section > figure:has(> canvas[data-chart]) { height: 14rem; }
main > section > section[data-chart-actions] { grid-column: 1 / -1; }
main > section > section[data-foundation="surfaces"] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
main > section > section > article[data-surface] { min-height: 7.3rem; padding: .45rem .25rem; }
main > section > section[data-foundation="borders"] { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; }
main > section > section[data-foundation="borders"] > article { min-height: 5.1rem; }
main > section > section[data-foundation="borders"] > article > span { width: 2.35rem; height: 2.35rem; }
main > section > section > nav { gap: .2rem; padding: .25rem; }
main > section > section > nav a { min-height: 2.6rem; padding-inline: .55rem; }
main > section > section > ol:has(> li[aria-current="step"]) li { min-width: 0; font-size: .65rem; }
main > section > section > ol:has(> li[aria-current="step"]) li::before { width: 1rem; height: 1rem; }
main > section > section > figure { max-width: 100%; }
img, video, canvas, iframe, embed, object { max-width: 100%; }
body > [data-page-loader] { padding: .75rem; }
body > [data-page-loader] > div { width: min(100%, 25rem); padding: 1.2rem; }
@media (max-width: 22rem) {
  body > nav > a { font-size: .56rem; }
  main > section { padding: .7rem; }
  main > section > section { padding: .65rem; }
  main > section > section > p:has(> button) { grid-template-columns: minmax(0, 1fr); }
}
