/* ==========================================================================
   Workspace — the site as a Hyprland desktop.
   Four theme colors come from each theme's colors.toml (set by site.js);
   everything else is derived, so any theme resolves as a complete set.
   ========================================================================== */
:root {
  --bg:     #1a1b26;
  --fg:     #a9b1d6;
  --accent: #7aa2f7;
  --green:  #9ece6a;

  --surface: color-mix(in srgb, var(--bg), var(--fg) 4%);
  --raised:  color-mix(in srgb, var(--bg), var(--fg) 8%);
  --border:  color-mix(in srgb, var(--bg), var(--fg) 16%);
  --muted:   color-mix(in srgb, var(--fg), var(--bg) 42%);
  --strong:  color-mix(in srgb, var(--fg), white 30%);
  --on-accent: var(--bg);

  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs: clamp(0.8125rem, 0.72rem + 0.32vw, 0.9375rem);
  --gap: 0.5rem;
  --pad: clamp(1rem, 2.4vw, 1.75rem);
  --ease: 0.18s cubic-bezier(0.33, 1, 0.68, 1);
}
:root[data-light="1"] { --strong: var(--fg); }

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs);
  font-weight: 300;
  line-height: 1.55;
  min-height: 100dvh;
  transition: background var(--ease), color var(--ease);
}
a { color: var(--accent); text-decoration: none; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }
strong, b { font-weight: 700; }
em, i { font-style: italic; }
img { max-width: 100%; height: auto; }
kbd {
  font: inherit; font-weight: 500; font-size: 0.9em;
  color: var(--strong);
  background: var(--raised);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 0.4em;
  white-space: nowrap;
}
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.pill { display: inline-block; font-size: 0.8em; font-weight: 500; color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 40%, transparent); padding: 0 0.5em; border-radius: 3px; }

/* --------------------------------------------------------------- waybar -- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem var(--pad);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  font-size: 0.82em;
  font-weight: 500;
}
.bar__left, .bar__right { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.bar__right { justify-content: flex-end; }
.bar__brand { color: var(--green); font-weight: 700; letter-spacing: 0.02em; }
.bar__brand small { color: var(--muted); font-weight: 500; margin-left: 0.5ch; }
.ws { display: flex; gap: 0.15rem; }
.ws a, .ws button {
  font: inherit; cursor: pointer;
  color: var(--muted);
  background: none;
  padding: 0.1rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 3px;
}
.ws a:hover, .ws button:hover { color: var(--fg); text-decoration: none; }
.ws .is-active { color: var(--strong); border-color: var(--border); background: var(--raised); }
.ws span { display: none; }
@media (min-width: 80em) { .ws span { display: inline; } }
.bar__clock { color: var(--strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.theme-chip {
  display: inline-flex; align-items: center; gap: 0.6ch;
  color: var(--strong);
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.15rem 0.6rem;
  font: inherit; cursor: pointer;
  white-space: nowrap;
}
.theme-chip:hover { border-color: var(--accent); }
.theme-chip i { width: 0.7em; height: 0.7em; border-radius: 50%; background: var(--accent); display: inline-block; }
.bar__hint { color: var(--muted); white-space: nowrap; }
@media (max-width: 64em) {
  .bar { grid-template-columns: auto 1fr; }
  .bar__clock, .bar__hint { display: none; }
}

/* Notification line: home only. */
.notice { display: none; }
body[data-type="home"] .notice {
  display: block;
  text-align: center;
  padding: 0.45rem var(--pad);
  background: color-mix(in srgb, var(--accent) 16%, var(--bg));
  border-bottom: 1px solid var(--border);
  color: var(--strong);
  font-size: 0.85em; font-weight: 500;
}

/* ----------------------------------------------------------------- desk -- */
.desk {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
  padding: var(--gap);
  max-width: 96rem;
  margin-inline: auto;
}
.win {
  grid-column: span 12;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: var(--pad);
  display: flex; flex-direction: column; gap: 1rem;
  min-width: 0;
  transition: border-color var(--ease), background var(--ease);
}
.win:hover, .win:focus-within { border-color: var(--accent); }
.win__title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  color: var(--muted);
  font-size: 0.8em; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.win__title a { color: var(--muted); }
.win__title a:hover { color: var(--accent); }
.win h2 { font-size: 1.25em; font-weight: 700; color: var(--strong); margin: 0; text-wrap: balance; }
.win > p { margin: 0; max-width: 62ch; text-wrap: pretty; }

/* Home tiling. Order is visual only; the DOM keeps reading order. */
@media (min-width: 64em) {
  .desk--home .win--hero    { grid-column: span 7; order: 1; }
  .desk--home .win--install { grid-column: span 5; order: 2; }
  .desk--home .win--inside  { grid-column: span 5; order: 3; }
  .desk--home .win--keys    { grid-column: span 3; order: 4; }
  .desk--home .win--community { grid-column: span 4; order: 5; }
  .desk--home .win--watch   { grid-column: span 12; order: 6; }
  .desk--home .win--themes  { grid-column: span 12; order: 7; }
  .desk--home .win--news    { grid-column: span 7; order: 8; }
  .desk--home .win--project { grid-column: span 5; order: 9; }
}

/* Reading pages: one centered window. */
.desk--page .win, .desk--news-post .win, .desk--news-index .win, .desk--manual-toc .win {
  grid-column: 2 / span 10;
  max-width: 62rem;
  width: 100%;
  margin-inline: auto;
}
@media (max-width: 64em) {
  .desk--page .win, .desk--news-post .win, .desk--news-index .win, .desk--manual-toc .win { grid-column: span 12; }
}

/* Manual: toc window + content window. */
.desk--manual-chapter { align-items: start; }
@media (min-width: 64em) {
  .desk--manual-chapter .win--toc { grid-column: span 3; position: sticky; top: 3.4rem; max-height: calc(100dvh - 4.2rem); overflow: auto; }
  .desk--manual-chapter .win--content { grid-column: span 9; max-width: 62rem; }
}
.win--toc { font-size: 0.88em; }
.win--toc ol { list-style: none; margin: 0; padding: 0; counter-reset: ch; }
.win--toc li { counter-increment: ch; }
.win--toc a {
  display: flex; gap: 0.6ch; align-items: baseline;
  color: var(--fg); padding: 0.16rem 0.4rem; border-radius: 3px;
}
.win--toc a::before { content: counter(ch, decimal-leading-zero); color: var(--muted); font-size: 0.8em; }
.win--toc a:hover { background: var(--raised); text-decoration: none; color: var(--strong); }
.win--toc a[aria-current="page"] { background: var(--raised); color: var(--strong); box-shadow: inset 2px 0 0 var(--accent); }

/* ----------------------------------------------------------------- hero -- */
.win--hero { justify-content: center; gap: 1.4rem; }
.logo { display: block; width: 100%; max-width: 36rem; height: auto; fill: var(--green); transition: fill var(--ease); }
.logo-o { width: 3.25rem; height: auto; fill: var(--green); margin-top: 0.2rem; }
.hero__eyebrow { margin: 0; color: var(--muted); font-weight: 500; letter-spacing: 0.18em; font-size: 0.8em; }
.hero__h1 {
  font-size: clamp(1.35rem, 1rem + 1.6vw, 2.1rem);
  font-weight: 700; line-height: 1.2;
  color: var(--strong);
  margin: 0; text-wrap: balance; max-width: 24ch;
}
.hero__sub { font-style: italic; font-size: 1.05em; max-width: 52ch; margin: 0; }
.hero__mission { margin: 0; color: var(--green); font-weight: 700; }
.hero__mission::before { content: "$ "; color: var(--muted); font-weight: 300; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; color: var(--muted); font-size: 0.85em; }
.hero__meta b { color: var(--fg); font-weight: 500; }

/* -------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.8ch;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.85em 1.2em;
  border: 1px solid transparent; border-radius: 3px;
  cursor: pointer;
  transition: filter var(--ease);
}
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn svg { width: 1.2em; height: 1.2em; }
.btn small { font-weight: 500; opacity: 0.75; text-transform: none; letter-spacing: 0; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--strong); filter: none; }
.install__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; font-size: 0.9em; }
.facts li { display: grid; grid-template-columns: 1.5ch 1fr; gap: 0.5ch; }
.facts li::before { content: "▸"; color: var(--green); }

/* ---------------------------------------------------------------- fetch -- */
.fetch { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: start; }
.fetch dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 1.25rem; font-size: 0.92em; }
.fetch dt { color: var(--accent); font-weight: 700; }
.fetch dd { margin: 0; }
.fetch dd a { color: inherit; text-decoration: underline; text-decoration-color: var(--border); }
.fetch dd a:hover { text-decoration-color: var(--accent); }
.fetch__user { grid-column: 1 / -1; color: var(--strong); font-weight: 700; }
.fetch__user::after { content: ""; display: block; height: 1px; background: var(--border); margin-top: 0.3rem; }
.swatches { grid-column: 1 / -1; display: flex; gap: 0.3rem; margin-top: 0.4rem; }
.swatches i { width: 1.4em; height: 0.8em; display: block; }
@media (max-width: 40em) { .fetch { grid-template-columns: 1fr; } .fetch .logo-o { display: none; } }

.keys { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; font-size: 0.9em; }
.keys li { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.keys li span:last-child { color: var(--muted); text-align: right; }

/* ---------------------------------------------------------------- video -- */
/* The fragment is one featured .video plus a .video--grid of four more. */
.videos { display: grid; gap: var(--gap); align-items: start; }
.videos .video { min-width: 0; }
.video--grid { display: grid; gap: var(--gap); grid-template-columns: 1fr 1fr; }
@media (min-width: 64em) { .videos { grid-template-columns: 1fr 1fr; } }
.video__facade {
  position: relative; display: block; width: 100%;
  aspect-ratio: 16 / 9; overflow: hidden;
  border: 1px solid var(--border); border-radius: 0;
  background: var(--bg); padding: 0; cursor: pointer;
}
.video__facade img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--ease); }
.video__facade:hover img { transform: scale(1.02); }
.video__play { position: absolute; inset: 0; display: grid; place-items: center; }
.video__play svg { width: min(16%, 4.5rem); filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5)); }

/* --------------------------------------------------------- theme chips --- */
.win--themes .win__head { display: grid; gap: 0.75rem; }
@media (min-width: 64em) { .win--themes .win__head { grid-template-columns: 1.2fr 1fr; align-items: start; gap: 2rem; } }
.win--themes .win__head p { margin: 0; }
.themes-grid { list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: var(--gap); }
.theme-btn {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.75rem;
  width: 100%; text-align: left;
  font: inherit; font-weight: 500;
  background: var(--tbg); border: 1px solid var(--border);
  padding: 0.6rem 0.75rem; cursor: pointer;
  transition: border-color var(--ease), transform var(--ease);
}
.theme-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.theme-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-btn .dots { display: grid; grid-template-columns: repeat(2, 0.75em); gap: 2px; }
.theme-btn .dots i { width: 0.75em; height: 0.75em; display: block; }
.theme-btn .name { color: var(--tfg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-btn .name small { display: block; color: var(--tacc); font-size: 0.78em; font-weight: 500; }

/* ------------------------------------------------------------ post list -- */
.post-list { list-style: none; margin: 0; padding: 0; display: grid; }
.post-list li { display: grid; grid-template-columns: 5.5ch 1fr; gap: 1rem; padding: 0.55rem 0; border-top: 1px solid var(--border); }
.post-list li:first-child { border-top: 0; padding-top: 0; }
.post-list time { color: var(--muted); font-size: 0.85em; font-variant-numeric: tabular-nums; padding-top: 0.15em; }
.post-list a { color: var(--strong); font-weight: 500; }

.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.links li { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: baseline; }
.links a { color: var(--strong); font-weight: 500; }
.links span { color: var(--muted); font-size: 0.85em; text-align: right; }

/* ---------------------------------------------------------------- prose -- */
.page-head h1, .post-head h1, .prose h1 {
  font-size: clamp(1.3rem, 1rem + 1.2vw, 1.8rem);
  font-weight: 700; line-height: 1.25; color: var(--strong);
  margin: 0; text-wrap: balance;
}
.page-head, .post-head { display: grid; gap: 0.4rem; }
.post-head p { margin: 0; }
.header__subtext { font-style: italic; color: var(--muted); margin: 0; max-width: 60ch; }

.prose { display: block; max-width: 70ch; }
.win--page .prose, .win--newsindex .prose { max-width: none; }
.prose h2 { font-size: 1.15em; font-weight: 700; color: var(--strong); margin: 1.6em 0 0.5em; }
.prose h3 { font-size: 1em; font-weight: 700; color: var(--strong); margin: 1.4em 0 0.4em; }
.prose p { margin: 0.8em 0; text-wrap: pretty; }
.prose ul, .prose ol { margin: 0.8em 0; padding-left: 1.5em; }
.prose li { margin: 0.25em 0; }
.prose li::marker { color: var(--green); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
.prose blockquote { margin: 1em 0; padding: 0.2em 1em; border-left: 2px solid var(--accent); color: var(--muted); }
.prose img { border: 1px solid var(--border); display: block; }
.prose figure { margin: 1.2em 0; }
.prose figcaption { color: var(--muted); font-size: 0.85em; margin-top: 0.4em; }
.prose code {
  font-family: inherit; font-size: 0.92em;
  color: var(--strong);
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.05em 0.35em;
}
.prose pre {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  line-height: 1.5;
  margin: 1em 0;
}
.prose pre code { background: none; border: 0; padding: 0; color: var(--fg); }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.92em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.4em 0.7em; text-align: left; }
.prose th { color: var(--strong); background: var(--raised); }
.prose iframe, .prose video { max-width: 100%; border: 1px solid var(--border); }

/* The manual chapter's own h1 sits inside the fragment. */
.prose > h1:first-child { margin-bottom: 0.6em; }

/* Manual pagination (comes inside the fragment). */
.manual__pagination {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 1.6em; padding-top: 0.9em;
  font-size: 0.9em; font-weight: 500;
}
.prose .manual__pagination:first-child, .prose > .manual__pagination:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; border-bottom: 1px solid var(--border); padding-bottom: 0.9em; margin-bottom: 1.4em; }
.manual__pagination-contents { color: var(--muted); }

/* ---------------------------------------------- original content families - */
/* news index */
.news-card { border-top: 1px solid var(--border); padding: 1rem 0; }
.news-card:first-child { border-top: 0; padding-top: 0; }
.news-card__title { margin: 0 0 0.2em; font-size: 1.05em; }
.news-card__title a { color: var(--strong); font-weight: 700; }
.news-meta, .news-date, .news-byline { color: var(--muted); font-size: 0.85em; }

/* community themes gallery */
.themes__intro { max-width: 70ch; }
.themes__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: var(--gap); margin-top: 1rem; }
.themes__theme { margin: 0; }
.themes__theme img { border: 1px solid var(--border); width: 100%; transition: border-color var(--ease); }
.themes__theme a:hover img { border-color: var(--accent); }
.themes__theme figcaption { font-size: 0.85em; font-weight: 500; margin-top: 0.3rem; }

/* workstations */
.workstations__images { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--gap); }
.workstations__image { border: 0; background: none; padding: 0; cursor: zoom-in; }
.workstations__image figure { margin: 0; }
.workstations__image img { border: 1px solid var(--border); display: block; width: 100%; }
.workstations__image:hover img { border-color: var(--accent); }

/* teams */
.team { margin: 0 0 2rem; }
.team__header h2 { margin: 0 0 0.2em; }
.team__members { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: var(--gap); margin-top: 1rem; }
.member { border: 1px solid var(--border); padding: 0.9rem; display: grid; gap: 0.3rem; font-size: 0.9em; }
.member img { border: 1px solid var(--border); width: 100%; }
.member h3, .member strong { color: var(--strong); font-size: 1em; margin: 0; }

/* AIR residents */
.air__lede { font-style: italic; font-size: 1.05em; max-width: 60ch; }
.resident { display: grid; grid-template-columns: 6rem 1fr; gap: 0.5rem 1.25rem; align-items: start; margin: 1.5rem 0; }
.resident > * { grid-column: 2; margin: 0; }
.resident__avatar { grid-column: 1; grid-row: 1 / span 4; border: 1px solid var(--border); width: 100%; }
.resident__name { margin: 0; }
@media (max-width: 40em) { .resident { grid-template-columns: 1fr; } .resident__avatar { max-width: 8rem; } }

/* sponsorships */
.sponsorship { border-top: 1px solid var(--border); padding: 1.5rem 0; max-width: 70ch; }
.sponsorship:first-child { border-top: 0; padding-top: 0; }
.sponsorship__logo img { max-height: 3.5rem; width: auto; max-width: 14rem; }
.sponsorship__name { margin: 0.6em 0 0; }
.sponsorship__terms { color: var(--green); font-weight: 700; text-transform: uppercase; font-size: 0.8em; letter-spacing: 0.08em; margin: 0.1em 0 0; }

/* brand */
.brand__section { margin: 0 0 2rem; }
.brand__figure { background: #ffffff; border: 1px solid var(--border); padding: 2rem; display: grid; place-items: center; }
.brand__figure img { max-width: 24rem; border: 0; }
.brand__files { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1.5rem; font-size: 0.9em; }
.brand__hint { color: var(--muted); }

/* generic figures elsewhere keep borders via .prose img */

/* ------------------------------------------------------------- launcher -- */
.launcher { border: 0; padding: 0; background: none; max-width: none; }
.launcher::backdrop { background: color-mix(in srgb, #000 55%, transparent); backdrop-filter: blur(4px); }
.launcher__box {
  width: min(44rem, 92vw);
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--fg);
  font-family: var(--font);
  padding: 1rem;
  display: grid; gap: 0.9rem;
}
.launcher__head { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8em; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.launcher .nav { display: grid; gap: 0.9rem; }
.launcher .nav__buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: var(--gap); }
.launcher .button {
  display: flex; align-items: center; gap: 0.8ch;
  color: var(--strong); font-weight: 500;
  background: var(--raised);
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  border-radius: 3px;
}
.launcher .button:hover { border-color: var(--accent); text-decoration: none; }
.launcher .button svg { width: 1.1em; height: 1.1em; fill: currentColor; flex: none; }

/* ----------------------------------------------------------------- foot -- */
.foot {
  max-width: 96rem; margin-inline: auto;
  padding: 1.25rem var(--pad) 3rem;
  display: flex; flex-wrap: wrap; gap: 0.75rem 2rem;
  color: var(--muted); font-size: 0.85em;
}
.foot a { color: var(--fg); }
.foot a:hover { color: var(--strong); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Etch reveal for the wordmark (see site.js). */
.logo.etch rect { opacity: 0; animation: etch-in 0.45s ease-out forwards; }
@keyframes etch-in { 0% { opacity: 0; fill: #fff; } 30% { opacity: 1; fill: #fff; } 100% { opacity: 1; fill: var(--green); } }
.etch-beam {
  position: absolute; top: -12%; bottom: -12%; left: 0; width: 3px;
  background: #fff; box-shadow: 0 0 14px 4px color-mix(in srgb, var(--green) 70%, #fff), 0 0 40px 10px color-mix(in srgb, var(--green) 45%, transparent);
  pointer-events: none; opacity: 0.95;
  animation: etch-beam linear forwards;
}
@keyframes etch-beam { 0% { left: 0; opacity: 0.95; } 85% { opacity: 0.95; } 100% { left: 100%; opacity: 0; } }

.win--hero { position: relative; }

/* Brand hover etch: the small nav wordmark/text uses the same keyframes. */
.nav__brand .etch-text, .nav__brand .logo.etch { cursor: pointer; }
.brand-word.etch-text .etch-ch { display: inline-block; }
.etch-beam { display: none; }
