/*! tux.css v0.4.0 | MIT License | github.com/elee1766/tuxcss */

/* -- tokens -- */
:root {
  --tux-font: "Cousine", "JetBrains Mono", "IBM Plex Mono",
    "Fira Code", "Source Code Pro", ui-monospace, monospace;
  --tux-text-xs: 0.75rem;
  --tux-text-sm: 0.875rem;
  --tux-text-micro: 10px;
  --tux-radius-sm: 2px;
}

/* light (default) -- jellybeans-inspired */
:root, [data-theme="light"] {
  --tux-bg-base: #ebebeb;
  --tux-bg-surface: #f5f5f5;
  --tux-bg-raised: #e0e0e0;
  --tux-bg-muted: #d0d0d0;
  --tux-bg-overlay: #151515;
  --tux-text: #303030;
  --tux-text-secondary: #404040;
  --tux-text-tertiary: #606060;
  --tux-text-muted: #777777;
  --tux-text-faint: #b0b0b0;
  --tux-text-inverse: #f5f5f5;
  --tux-border: #cfcfcf;
  --tux-border-subtle: #e0e0e0;
  --tux-border-strong: #a0a0a0;
  --tux-primary: #3d7a8a;
  --tux-primary-hover: #42717b;
  --tux-primary-strong: #345f6a;
  --tux-primary-soft: #5a949f;
  --tux-primary-subtle: #e0ecef;
  --tux-success: #4a7030;
  --tux-success-soft: #578d3b;
  --tux-success-subtle: #e4edda;
  --tux-success-muted: #578d3b;
  --tux-warning: #c07018;
  --tux-warning-soft: #e2a959;
  --tux-warning-subtle: #f2ebdd;
  --tux-warning-muted: #9a5510;
  --tux-error: #b83030;
  --tux-error-soft: #d43131;
  --tux-error-hover: #982020;
  --tux-error-subtle: #f2e0e0;
  --tux-interactive: #505050;
  --tux-interactive-hover: #353535;
  --tux-interactive-soft: #6d878d;
  color-scheme: light;
}

/* dark -- jellybeans terminal palette */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --tux-bg-base: #181818;
  --tux-bg-surface: #1c1c1c;
  --tux-bg-raised: #252525;
  --tux-bg-muted: #353535;
  --tux-bg-overlay: #101010;
  --tux-text: #e0d8e0;
  --tux-text-secondary: #c8c0c0;
  --tux-text-tertiary: #908888;
  --tux-text-muted: #6d6060;
  --tux-text-faint: #403838;
  --tux-text-inverse: #181818;
  --tux-border: #353535;
  --tux-border-subtle: #282828;
  --tux-border-strong: #505050;
  --tux-primary: #7dc1cf;
  --tux-primary-hover: #4e9fb1;
  --tux-primary-strong: #42717b;
  --tux-primary-soft: #7dc1cf;
  --tux-primary-subtle: #1a2a30;
  --tux-success: #b8d68c;
  --tux-success-soft: #578d3b;
  --tux-success-subtle: #1e2818;
  --tux-success-muted: #578d3b;
  --tux-warning: #e2a959;
  --tux-warning-soft: #f39713;
  --tux-warning-subtle: #2a2218;
  --tux-warning-muted: #f39713;
  --tux-error: #e84f4f;
  --tux-error-soft: #d43131;
  --tux-error-hover: #ff5555;
  --tux-error-subtle: #2a1818;
  --tux-interactive: #908888;
  --tux-interactive-hover: #c8c0c0;
  --tux-interactive-soft: #6d878d;
  color-scheme: dark;
}}

[data-theme="dark"] {
  --tux-bg-base: #181818;
  --tux-bg-surface: #1c1c1c;
  --tux-bg-raised: #252525;
  --tux-bg-muted: #353535;
  --tux-bg-overlay: #101010;
  --tux-text: #e0d8e0;
  --tux-text-secondary: #c8c0c0;
  --tux-text-tertiary: #908888;
  --tux-text-muted: #6d6060;
  --tux-text-faint: #403838;
  --tux-text-inverse: #181818;
  --tux-border: #353535;
  --tux-border-subtle: #282828;
  --tux-border-strong: #505050;
  --tux-primary: #7dc1cf;
  --tux-primary-hover: #4e9fb1;
  --tux-primary-strong: #42717b;
  --tux-primary-soft: #7dc1cf;
  --tux-primary-subtle: #1a2a30;
  --tux-success: #b8d68c;
  --tux-success-soft: #578d3b;
  --tux-success-subtle: #1e2818;
  --tux-success-muted: #578d3b;
  --tux-warning: #e2a959;
  --tux-warning-soft: #f39713;
  --tux-warning-subtle: #2a2218;
  --tux-warning-muted: #f39713;
  --tux-error: #e84f4f;
  --tux-error-soft: #d43131;
  --tux-error-hover: #ff5555;
  --tux-error-subtle: #2a1818;
  --tux-interactive: #908888;
  --tux-interactive-hover: #c8c0c0;
  --tux-interactive-soft: #6d878d;
  color-scheme: dark;
}

/* -- reset -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; scroll-behavior: smooth; }

body {
  font-family: var(--tux-font);
  font-size: var(--tux-text-xs);
  line-height: 1.5;
  color: var(--tux-text);
  background: var(--tux-bg-base);
  min-height: 100vh;
}

/* -- typography -- */
:is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--tux-font);
  font-weight: 600;
  color: var(--tux-text);
  line-height: 1.3;
  text-transform: lowercase;
  &:first-child { margin-top: 0; }
}

h1 { font-size: 1.5rem; margin: 1.5rem 0 0.75rem; }
h2 { font-size: 1.25rem; margin: 1.25rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }
h4 { font-size: var(--tux-text-sm); margin: 0.75rem 0 0.25rem; }
h5 { font-size: var(--tux-text-xs); color: var(--tux-text-secondary); margin-bottom: 0.25rem; }
h6 { font-size: var(--tux-text-xs); color: var(--tux-text-tertiary); margin-bottom: 0.25rem; }

p { margin-bottom: 0.5rem; color: var(--tux-text-secondary); }
small { font-size: var(--tux-text-micro); color: var(--tux-text-muted); }
strong, b { font-weight: 700; }

/* -- links -- */
a {
  color: var(--tux-primary);
  text-decoration: none;
  cursor: pointer;
  &:hover { color: var(--tux-primary-strong); text-decoration: underline; }
}

/* -- layout -- */
body > header {
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.75rem;
  background: var(--tux-bg-surface);
  border-bottom: 1px solid var(--tux-border);
  font-size: var(--tux-text-xs);
  line-height: 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
  user-select: none;

  & a {
    color: var(--tux-text-muted);
    text-decoration: none;
    padding: 0;
    &:hover { color: var(--tux-text-secondary); text-decoration: none; background: none; }
  }
}

main { padding: 1rem 0.75rem; }

body > footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--tux-border);
  color: var(--tux-text-muted);
  font-size: var(--tux-text-xs);
}

nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--tux-text-xs);

  & a {
    color: var(--tux-text-muted);
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    &:hover { background: var(--tux-bg-raised); color: var(--tux-text-secondary); text-decoration: none; }
    &:is([aria-current="page"], .active) { color: var(--tux-text); }
  }
}

/* -- cards (section, article, aside) -- */
:is(section, article, aside) {
  background: var(--tux-bg-surface);
  border: 1px solid var(--tux-border);
  margin-bottom: 0.75rem;

  & > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    background: var(--tux-bg-raised);
    border-bottom: 1px solid var(--tux-border-subtle);
    color: var(--tux-text-tertiary);
    font-size: var(--tux-text-xs);
  }

  & > :not(header):not(table):not(details) { padding: 0.5rem; }
  & > table { border: none; }
  & pre { border: none; background: var(--tux-bg-raised); margin: 0; }

  /* nested cards */
  & :is(section, article, aside) { margin: 0.5rem; }
}

/* -- tables -- */
table { width: 100%; border-collapse: collapse; font-size: var(--tux-text-xs); }
thead tr { background: var(--tux-bg-muted); }
th { text-align: left; padding: 0.25rem 0.5rem; color: var(--tux-text-tertiary); font-weight: 400; white-space: nowrap; }
td { padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--tux-border-subtle); }
tbody tr:hover { background: var(--tux-bg-raised); }
:is(th, td)[data-align="right"] { text-align: right; }

/* -- forms -- */
label { display: block; font-size: var(--tux-text-xs); color: var(--tux-text-tertiary); margin-bottom: 0.125rem; }

input:is([type="text"], [type="email"], [type="password"], [type="number"],
  [type="url"], [type="search"], [type="tel"], [type="date"],
  [type="datetime-local"]),
textarea,
select {
  font-family: var(--tux-font);
  font-size: var(--tux-text-xs);
  padding: 0.5rem;
  border: 1px solid var(--tux-border-strong);
  border-radius: 0;
  background: var(--tux-bg-surface);
  color: var(--tux-text);
  width: 100%;
  outline: none;
  appearance: none;
  line-height: normal;
}

:is(input, textarea, select):focus {
  border-color: var(--tux-primary);
  outline: 1px solid var(--tux-primary);
  outline-offset: -1px;
}

input:is([type="checkbox"], [type="radio"]) {
  accent-color: var(--tux-primary);
  margin-right: 0.25rem;
  vertical-align: middle;
}

textarea { resize: vertical; min-height: 4rem; line-height: 1.8; }

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.5rem;
}

fieldset { border: 1px solid var(--tux-border); padding: 0.5rem; margin-bottom: 0.5rem; }
legend { font-size: var(--tux-text-xs); color: var(--tux-text-tertiary); padding: 0 0.25rem; }

/* -- buttons -- */
:is(button, input:is([type="submit"], [type="reset"], [type="button"])) {
  font-family: var(--tux-font);
  font-size: var(--tux-text-xs);
  padding: 0.375rem 0.5rem;
  cursor: pointer;
  border: none;
  background: var(--tux-primary);
  color: var(--tux-text-inverse);
  text-transform: lowercase;
  line-height: normal;
}

:is(button, input[type="submit"], input[type="button"]):hover { background: var(--tux-primary-hover); }
:is(button, input):disabled { opacity: 0.5; cursor: not-allowed; }

input[type="reset"] {
  background: var(--tux-interactive-soft);
  color: var(--tux-text-inverse);
  &:hover { background: var(--tux-interactive); }
}

button[data-variant="ghost"] {
  background: transparent; color: var(--tux-text-tertiary);
  &:hover { background: var(--tux-bg-raised); }
}
button[data-variant="danger"] {
  background: var(--tux-error);
  &:hover { background: var(--tux-error-hover); }
}
button[data-variant="soft"] {
  background: var(--tux-interactive-soft);
  &:hover { background: var(--tux-interactive); }
}

/* -- code -- */
code { font-family: var(--tux-font); font-size: inherit; background: var(--tux-bg-raised); padding: 0.1875rem 0.25rem 0.0625rem; color: var(--tux-text-secondary); }
pre { background: var(--tux-bg-surface); border: 1px solid var(--tux-border); padding: 0.5rem; overflow-x: auto; margin-bottom: 0.5rem; font-size: var(--tux-text-xs); line-height: 1.5; }
pre code { background: none; padding: 0; }
kbd { font-family: var(--tux-font); font-size: var(--tux-text-micro); padding: 0.0625rem 0.25rem; border: 1px solid var(--tux-border-strong); background: var(--tux-bg-raised); color: var(--tux-text-secondary); }
samp { font-family: var(--tux-font); color: var(--tux-text-tertiary); }

/* -- lists -- */
:is(ul, ol) { padding-left: 1.25rem; margin-bottom: 0.5rem; color: var(--tux-text-secondary); }
li { margin-bottom: 0.125rem; }
li::marker { color: var(--tux-text-muted); }
dl { margin-bottom: 0.5rem; }
dt { color: var(--tux-text-tertiary); font-weight: 400; }
dd { color: var(--tux-text); margin-bottom: 0.25rem; margin-left: 0; }

/* -- details -- */
details {
  border: 1px solid var(--tux-border);
  margin-bottom: 0.5rem;
  & > :not(summary) { padding: 0.5rem; }
}

summary {
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  background: var(--tux-bg-raised);
  color: var(--tux-text-tertiary);
  font-size: var(--tux-text-xs);
  list-style: none;
  user-select: none;
  &::-webkit-details-marker { display: none; }
  &::before { content: "\25b6\00a0"; font-size: 0.5em; vertical-align: middle; display: inline-block; transition: transform 0.1s; }
}

details[open] > summary {
  border-bottom: 1px solid var(--tux-border-subtle);
  &::before { transform: rotate(90deg); }
}

/* -- alerts -- */
:is([role="alert"], [data-alert]) {
  font-size: var(--tux-text-xs);
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.5rem;
  background: var(--tux-primary-subtle);
  color: var(--tux-primary);
  border: 1px solid transparent;
}

[data-alert="error"]   { background: var(--tux-error-subtle);   color: var(--tux-error);   border-color: var(--tux-error-soft); }
[data-alert="success"] { background: var(--tux-success-subtle); color: var(--tux-success); border-color: var(--tux-success-muted); }
[data-alert="warning"] { background: var(--tux-warning-subtle); color: var(--tux-warning); border-color: var(--tux-warning-soft); }
[data-alert="info"]    { background: var(--tux-primary-subtle); color: var(--tux-primary); border-color: var(--tux-primary-soft); }

/* -- progress & meter -- */
progress {
  appearance: none; width: 100%; height: 6px;
  border: none; border-radius: var(--tux-radius-sm);
  overflow: hidden; background: var(--tux-bg-muted);
  &::-webkit-progress-bar { background: var(--tux-bg-muted); border-radius: var(--tux-radius-sm); }
  &::-webkit-progress-value { background: var(--tux-primary-soft); border-radius: var(--tux-radius-sm); }
  &::-moz-progress-bar { background: var(--tux-primary-soft); border-radius: var(--tux-radius-sm); }
}

meter {
  appearance: none; width: 100%; height: 6px;
  border: none; border-radius: var(--tux-radius-sm);
  overflow: hidden; background: var(--tux-bg-muted);
  &::-webkit-meter-bar { background: var(--tux-bg-muted); border-radius: var(--tux-radius-sm); border: none; }
  &::-webkit-meter-optimum-value { background: var(--tux-success-soft); }
  &::-webkit-meter-suboptimum-value { background: var(--tux-warning-soft); }
  &::-webkit-meter-even-less-good-value { background: var(--tux-error-soft); }
}

/* -- misc elements -- */
hr { border: none; border-top: 1px solid var(--tux-border); margin: 0.75rem 0; }
blockquote { border-left: 2px solid var(--tux-border-strong); padding: 0.25rem 0.5rem; margin-bottom: 0.5rem; color: var(--tux-text-secondary); font-style: italic; }
:is(img, video, canvas, svg) { max-width: 100%; height: auto; display: block; }
figure { margin-bottom: 0.5rem; }
figcaption { font-size: var(--tux-text-micro); color: var(--tux-text-muted); margin-top: 0.25rem; }
mark { background: var(--tux-warning-subtle); color: var(--tux-warning-muted); padding: 0 0.125rem; }
del { color: var(--tux-error); text-decoration: line-through; }
ins { color: var(--tux-success); text-decoration: none; border-bottom: 1px solid var(--tux-success); }

/* -- dialog -- */
dialog {
  font-family: var(--tux-font);
  font-size: var(--tux-text-xs);
  color: var(--tux-text);
  background: var(--tux-bg-surface);
  border: 1px solid var(--tux-border);
  padding: 0;
  max-width: 28rem;
  width: calc(100% - 2rem);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  &::backdrop { background: rgba(0, 0, 0, 0.5); }
  & > header { padding: 0.5rem 1rem; border-bottom: 1px solid var(--tux-border-subtle); background: var(--tux-bg-raised); font-size: var(--tux-text-sm); font-weight: 600; }
  & > footer { padding: 0.5rem 1rem; border-top: 1px solid var(--tux-border-subtle); display: flex; justify-content: flex-end; gap: 0.5rem; }
  & > :not(header):not(footer) { padding: 1rem; }
}

/* -- grid -- */
[data-grid] { display: grid; gap: 0.5rem; }
[data-grid="2"] { grid-template-columns: repeat(2, 1fr); }
[data-grid="3"] { grid-template-columns: repeat(3, 1fr); }
[data-grid="4"] { grid-template-columns: repeat(4, 1fr); }

/* -- layout -- */
[data-layout] { display: grid; gap: 0.75rem; min-height: 0; }
[data-layout="sidebar-left"]  { grid-template-columns: 14rem 1fr; }
[data-layout="sidebar-right"] { grid-template-columns: 1fr 14rem; }
[data-layout="two-column"]    { grid-template-columns: 1fr 1fr; }
[data-layout="three-column"]  { grid-template-columns: 1fr 1fr 1fr; }

/* -- tabs (ARIA) -- */
[role="tablist"] {
  display: flex;
  border-bottom: 1px solid var(--tux-border);
  font-size: var(--tux-text-xs);
}

[role="tab"] {
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--tux-text-tertiary);
  font-family: var(--tux-font);
  font-size: var(--tux-text-xs);
  text-transform: lowercase;
  margin-bottom: -1px;
  &:hover { background: var(--tux-bg-raised); color: var(--tux-text-secondary); }
  &[aria-selected="true"] {
    background: var(--tux-bg-surface);
    color: var(--tux-text);
    border-color: var(--tux-border);
    border-bottom-color: var(--tux-bg-surface);
  }
  &:focus-visible { outline-offset: -2px; }
}

[role="tabpanel"] {
  border: 1px solid var(--tux-border);
  border-top: none;
  padding: 0.5rem;
  background: var(--tux-bg-surface);
  &[hidden] { display: none; }
}

/* -- toolbar (ARIA) -- */
[role="toolbar"] {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--tux-border);
  background: var(--tux-bg-raised);
  font-size: var(--tux-text-xs);

  & button {
    padding: 0.25rem 0.5rem;
    background: var(--tux-bg-surface);
    color: var(--tux-text);
    border: 1px solid var(--tux-border);
    &:hover { background: var(--tux-bg-muted); }
  }

  & [aria-pressed="true"] {
    background: var(--tux-interactive);
    color: var(--tux-text-inverse);
    border-color: var(--tux-interactive);
  }
}

/* -- toggle switch -- */
[data-switch] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: var(--tux-text-xs);
  color: var(--tux-text);
  user-select: none;

  & input[type="checkbox"] {
    appearance: none;
    position: relative;
    width: 1.75rem;
    height: 1rem;
    background: var(--tux-bg-muted);
    border: 1px solid var(--tux-border-strong);
    border-radius: 0;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    transition: background 0.15s;

    &::after {
      content: "";
      position: absolute;
      top: 1px;
      left: 1px;
      width: 0.625rem;
      height: 0.625rem;
      background: var(--tux-text-muted);
      transition: transform 0.15s;
    }

    &:checked {
      background: var(--tux-primary);
      border-color: var(--tux-primary);
      &::after { background: var(--tux-text-inverse); transform: translateX(0.75rem); }
    }
  }
}

/* -- chips / badges -- */
[data-chip] {
  display: inline-block;
  font-size: var(--tux-text-micro);
  font-family: var(--tux-font);
  padding: 0.0625rem 0.375rem;
  font-weight: 600;
  background: var(--tux-bg-muted);
  color: var(--tux-text-secondary);
}

[data-chip="info"]    { background: var(--tux-primary-subtle); color: var(--tux-primary); }
[data-chip="success"] { background: var(--tux-success-subtle); color: var(--tux-success); }
[data-chip="warning"] { background: var(--tux-warning-subtle); color: var(--tux-warning); }
[data-chip="error"]   { background: var(--tux-error-subtle);   color: var(--tux-error); }

/* -- flex -- */
[data-flex]              { display: flex; gap: 0.5rem; }
[data-flex~="inline"]    { display: inline-flex; }
[data-flex~="row"]       { flex-direction: row; }
[data-flex~="column"]    { flex-direction: column; }
[data-flex~="wrap"]      { flex-wrap: wrap; }
[data-flex~="center"]    { align-items: center; }
[data-flex~="baseline"]  { align-items: baseline; }
[data-flex~="stretch"]   { align-items: stretch; }
[data-flex~="start"]     { justify-content: flex-start; }
[data-flex~="end"]       { justify-content: flex-end; }
[data-flex~="between"]   { justify-content: space-between; }
[data-flex~="around"]    { justify-content: space-around; }
[data-flex~="evenly"]    { justify-content: space-evenly; }
[data-flex~="gap-0"]     { gap: 0; }
[data-flex~="gap-sm"]    { gap: 0.25rem; }
[data-flex~="gap-lg"]    { gap: 1rem; }
[data-flex~="grow"] > *  { flex: 1 1 0%; }

/* -- ARIA states -- */
[href="#main"] {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  padding: 0.5rem; background: var(--tux-primary); color: var(--tux-text-inverse);
  &:focus { left: 0; }
}

[data-visually-hidden], .visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

[aria-busy="true"]     { opacity: 0.6; cursor: wait; }
[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

[aria-invalid="true"] {
  border-color: var(--tux-error) !important;
  outline: 1px solid var(--tux-error);
  outline-offset: -1px;
}

label:has(+ [aria-required="true"])::after { content: " *"; color: var(--tux-error); }

/* aria-errormessage: shown when paired with aria-invalid */
[aria-errormessage] + [id] { font-size: var(--tux-text-xs); color: var(--tux-text-muted); display: none; }
[aria-invalid="true"] ~ [id] { display: block; color: var(--tux-error); }

/* custom progressbar: <div role="progressbar" aria-valuenow="60" aria-valuemax="100"> */
[role="progressbar"] {
  height: 6px;
  background: var(--tux-bg-muted);
  border-radius: var(--tux-radius-sm);
  overflow: hidden;
  &::before {
    content: "";
    display: block;
    height: 100%;
    background: var(--tux-primary-soft);
    width: calc(100% * var(--progress, 0));
  }
}

/* role=separator */
[role="separator"] {
  border: none;
  border-top: 1px solid var(--tux-border);
  margin: 0.75rem 0;
}

/* role=search */
[role="search"] {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

[role="status"] { font-size: var(--tux-text-xs); color: var(--tux-text-tertiary); padding: 0.25rem 0.5rem; }
[role="log"]    { max-height: 15rem; overflow-y: auto; font-size: var(--tux-text-xs); }

[aria-current="step"] { font-weight: 700; color: var(--tux-primary); }
[aria-current="date"] { font-weight: 700; background: var(--tux-primary-subtle); }
[aria-current="true"] { font-weight: 700; }

[aria-expanded="false"]::before { content: "\25b6\00a0"; font-size: 0.5em; }
[aria-expanded="true"]::before  { content: "\25bc\00a0"; font-size: 0.5em; }

th[aria-sort="ascending"]::after  { content: " \2191"; color: var(--tux-text-muted); }
th[aria-sort="descending"]::after { content: " \2193"; color: var(--tux-text-muted); }

/* -- a11y -- */
:focus-visible { outline: 2px solid var(--tux-primary); outline-offset: 1px; }
::selection { background: var(--tux-primary-subtle); color: var(--tux-primary-strong); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* -- responsive -- */
@media (max-width: 640px) {
  main { padding: 0.5rem; }
  body > header { padding: 0 0.5rem; }
  nav { gap: 0.25rem; & a { padding: 0.25rem 0.375rem; } }
  :is([data-grid="2"], [data-grid="3"], [data-grid="4"]) { grid-template-columns: 1fr; }
  [data-layout] { grid-template-columns: 1fr; }
  :is(section, article, aside) > :not(header):not(table):not(details) { padding: 0.375rem; }
  table { display: block; overflow-x: auto; }
  dialog { width: calc(100% - 1rem); }
}

@media (min-width: 641px) and (max-width: 1024px) {
  :is([data-grid="3"], [data-grid="4"]) { grid-template-columns: repeat(2, 1fr); }
  [data-layout="three-column"] { grid-template-columns: 1fr 1fr; }
}

/* -- print -- */
@media print {
  body { background: #fff; color: #000; font-size: 10pt; }
  :is(body > header, body > footer, nav) { display: none; }
  main { max-width: 100%; padding: 0; }
  :is(section, article, aside) { border-color: #ccc; break-inside: avoid; }
  a[href]::after { content: " (" attr(href) ")"; color: #666; font-size: 0.8em; }
  a[href^="#"]::after, a[href^="javascript"]::after { content: none; }
  abbr[title]::after { content: " (" attr(title) ")"; color: #666; font-size: 0.8em; }
  details { border: 1px solid #ccc; }
  details > summary { list-style: none; &::before { content: none; } }
  details:not([open]) > :not(summary) { display: block; padding: 0.5rem; }
}
