/* SPDX-License-Identifier: AGPL-3.0-or-later */
/* The look of the family: Catppuccin, Mauve as the only accent, square, no
   motion, monospace. Mocha is the default; the other three flavors and the
   accessibility settings are attributes on <html>, set by pre.js before the
   first paint. */

@font-face { font-family:"JetBrains Mono"; src:url("/static/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:"JetBrains Mono"; src:url("/static/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight:700; font-style:normal; font-display:swap; }

:root, [data-flavor="mocha"] {
  --green:#a6e3a1; --blue:#89b4fa;
  --crust:#11111b; --mantle:#181825; --base:#1e1e2e;
  --surface0:#313244; --surface1:#45475a; --surface2:#585b70;
  --overlay0:#6c7086; --overlay1:#7f849c;
  --subtext0:#a6adc8; --subtext1:#bac2de; --text:#cdd6f4;
  --mauve:#cba6f7; --peach:#fab387; --red:#f38ba8;
  --on-accent:var(--crust); color-scheme:dark;
}
[data-flavor="macchiato"] {
  --green:#a6da95; --blue:#8aadf4;
  --crust:#181926; --mantle:#1e2030; --base:#24273a;
  --surface0:#363a4f; --surface1:#494d64; --surface2:#5b6078;
  --overlay0:#6e738d; --overlay1:#8087a2;
  --subtext0:#a5adcb; --subtext1:#b8c0e0; --text:#cad3f5;
  --mauve:#c6a0f6; --peach:#f5a97f; --red:#ed8796;
  --on-accent:var(--crust); color-scheme:dark;
}
[data-flavor="frappe"] {
  --green:#a6d189; --blue:#8caaee;
  --crust:#232634; --mantle:#292c3c; --base:#303446;
  --surface0:#414559; --surface1:#51576d; --surface2:#626880;
  --overlay0:#737994; --overlay1:#838ba7;
  --subtext0:#a5adce; --subtext1:#b5bfe2; --text:#c6d0f5;
  --mauve:#ca9ee6; --peach:#ef9f76; --red:#e78284;
  --on-accent:var(--crust); color-scheme:dark;
}
[data-flavor="latte"] {
  --green:#40a02b; --blue:#1e66f5;
  --crust:#dce0e8; --mantle:#e6e9ef; --base:#eff1f5;
  --surface0:#ccd0da; --surface1:#bcc0cc; --surface2:#acb0be;
  --overlay0:#9ca0b0; --overlay1:#8c8fa1;
  --subtext0:#6c6f85; --subtext1:#5c5f77; --text:#4c4f69;
  --mauve:#8839ef; --peach:#fe640b; --red:#d20f39;
  --on-accent:var(--base); color-scheme:light;
}

/* The roles the page uses. Secondary text is Subtext 0, never an Overlay:
   the overlays fall below 4.5:1 on Latte. High contrast lifts every role to
   Text and draws the lines in Overlay 0. */
:root {
  --fg:var(--text); --fg2:var(--subtext1); --muted:var(--subtext0); --line:var(--surface0);
  --accent:var(--mauve); --warn:var(--peach);
  --scale:1; --lh:1.6; --ls:0; --ws:0; --gap:0.8em;
  --font:"JetBrains Mono","JetBrainsMono Nerd Font",ui-monospace,monospace;
}
/* Latte: Subtext 0 is 4.37:1 on Base, so secondary text takes Subtext 1;
   Mauve is 4.45:1 on Mantle and 4.09:1 on Crust, so the project blocks, the
   covers and the diagram stay on Base. */
[data-flavor="latte"] { --muted:var(--subtext1); --block:var(--base); --block-line:var(--surface0); --well:var(--base); }
[data-contrast="high"] { --fg2:var(--text); --muted:var(--text); --line:var(--overlay0); }
[data-flavor="latte"][data-contrast="high"] { --fg:#1e1f2e; --fg2:#1e1f2e; --muted:#1e1f2e; --accent:#6a1fc9; }
[data-size="2"] { --scale:1.15; }
[data-size="3"] { --scale:1.3; }
[data-size="4"] { --scale:1.5; }
/* WCAG 1.4.12: line height 1.5 and more, paragraphs 2 em apart, letters
   0.12 em, words 0.16 em. */
[data-spacing="wide"] { --lh:1.9; --ls:0.12em; --ws:0.16em; --gap:2em; }
[data-font="plain"] { --font:system-ui,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,sans-serif; }

* { box-sizing:border-box; margin:0; padding:0; border-radius:0; }
/* one size for the whole page, growing with a wide window and with the
   reader's own browser setting, times the size chosen in the panel */
html { background:var(--base); font-size:calc(clamp(0.875rem, 0.62rem + 0.42vw, 1.125rem) * var(--scale)); }
body { color:var(--fg); font-family:var(--font); font-size:1rem; line-height:var(--lh);
  letter-spacing:var(--ls); word-spacing:var(--ws); min-height:100vh; display:flex; flex-direction:column; }
button, input, select { font:inherit; color:inherit; letter-spacing:inherit; }
button { background:none; border:0; cursor:pointer; }
a { color:var(--accent); text-decoration:none; }
a:hover { text-decoration:underline; }
/* links inside running text are underlined, so they never depend on color */
.block a, .lead a, .hero p a, .points a, .src a, .legal a, .note a { text-decoration:underline; text-underline-offset:0.18em; }
[data-underline="1"] a { text-decoration:underline; text-underline-offset:0.18em; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
[hidden] { display:none !important; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.quiet { color:var(--muted); }
code { font-family:"JetBrains Mono",ui-monospace,monospace; color:var(--fg2); }

.skip { position:absolute; left:0.5rem; top:-10rem; background:var(--accent); color:var(--on-accent);
  padding:0.4rem 0.8rem; font-weight:700; z-index:5; }
.skip:focus { top:0.5rem; }

/* the bar: the brand, the tabs, then the language, the flavor and the
   accessibility button */
.bar { display:flex; align-items:stretch; flex-wrap:wrap; min-height:2.6rem; background:var(--mantle); }
[data-flavor="latte"] .bar { background:var(--base); box-shadow:inset 0 -1px 0 var(--surface0); }
.bar .brand { display:flex; align-items:center; padding:0 1.1rem; color:var(--accent); font-weight:700;
  border-left:2px solid var(--accent); text-decoration:none; }
.bar .tabs { display:flex; align-items:stretch; }
.bar .tab { display:flex; align-items:center; padding:0 1.1rem; color:var(--muted); text-decoration:none; }
.bar .tab:hover { color:var(--fg); background:var(--surface0); }
.bar .tab.on { background:var(--accent); color:var(--on-accent); font-weight:700; }
.bar .spacer { flex:1; }
.bar .tools { display:flex; align-items:center; gap:0.5rem; padding:0 0.8rem; }
.bar .langswitch { color:var(--fg2); padding:0.2rem 0.5rem; font-weight:700; }
.bar .langswitch:hover { background:var(--surface0); text-decoration:none; }
.bar select { background:var(--surface0); border:0; padding:0.2rem 0.45rem; color:var(--fg); }
.a11y-btn { display:flex; align-items:center; justify-content:center; width:2.1rem; height:2.1rem; color:var(--fg2); }
.a11y-btn:hover, .a11y-btn[aria-expanded="true"] { background:var(--accent); color:var(--on-accent); }
.a11y-btn svg { width:1.35rem; height:1.35rem; }

/* the accessibility panel floats under the bar on the right; it is the one
   framed thing on the page */
.panel { position:absolute; right:0.8rem; top:3rem; width:24rem; max-width:calc(100% - 1.6rem); z-index:3;
  background:var(--base); outline:1px solid var(--accent); padding:0.9rem 1rem; }
.panel-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:0.6rem; }
.panel h2 { font-size:1.05rem; color:var(--accent); }
.panel fieldset { border:0; display:flex; flex-wrap:wrap; gap:0.25rem 0.9rem; padding:0.45rem 0; border-top:1px solid var(--line); }
.panel legend { float:left; width:100%; color:var(--muted); font-size:0.92rem; margin-bottom:0.15rem; }
.panel label { display:inline-flex; align-items:center; gap:0.4rem; cursor:pointer; }
.panel input { accent-color:var(--accent); width:1rem; height:1rem; }
.panel-foot { display:flex; justify-content:flex-end; padding-top:0.6rem; border-top:1px solid var(--line); }

.btn { display:inline-flex; align-items:center; padding:0.5rem 0.9rem; background:var(--surface0); color:var(--fg); }
.btn:hover { background:var(--surface1); }
.btn.sm { padding:0.2rem 0.6rem; font-size:0.92rem; }

/* the page */
main { flex:1; width:100%; max-width:62rem; margin:0 auto; padding:1.4rem 1.2rem 2rem; }
main:focus { outline:none; }
.hero { margin:0.6rem 0 1.6rem; }
.hero p:last-child { margin-bottom:0; }
.hero .prompt { color:var(--muted); }
.hero h1 { font-size:2rem; line-height:1.25; color:var(--accent); margin:0.2rem 0 0.4rem; }
.lead { font-size:1.12rem; color:var(--fg); font-weight:700; margin-bottom:var(--gap); }
.hero p { max-width:70ch; margin-bottom:var(--gap); color:var(--fg2); }
.page-title { font-size:1.5rem; line-height:1.3; margin:0.4rem 0 1rem; }
.page-title .counter { color:var(--accent); font-weight:400; font-size:1rem; }
.block { max-width:72ch; margin:0.4rem 0 var(--gap); color:var(--fg2); }
.lead.block { color:var(--fg); }

/* the heading of a section: the name, the rule and a link at the end */
.sec { display:flex; gap:0.7rem; align-items:baseline; margin:1.6rem 0 0.6rem; font-size:1rem; font-weight:400; color:var(--muted); }
.sec b { color:var(--fg); }
.sec .rule { flex:1; height:1px; background:var(--line); align-self:center; }
.sec .more { font-size:0.92rem; }

/* the projects: one block each, the name, the language and the state */
.projects { list-style:none; display:grid; gap:2px; }
.project { background:var(--block, var(--mantle)); box-shadow:inset 0 0 0 1px var(--block-line, transparent); padding:0.8rem 1rem; }
.p-head { display:flex; flex-wrap:wrap; align-items:baseline; gap:0.4rem 0.9rem; margin-bottom:0.25rem; }
.p-head h2, .p-head h3 { font-size:1.08rem; }
.p-head h2 a, .p-head h3 a { color:var(--fg); }
.p-head h2 a:hover, .p-head h3 a:hover { color:var(--accent); }
.tag { color:var(--accent); font-size:0.92rem; }
.status { color:var(--muted); font-size:0.92rem; }
.status::before { content:"· "; }
.project > p { color:var(--fg2); max-width:72ch; }
.points { margin:0.4rem 0 0 0; padding-left:1.4rem; color:var(--fg2); max-width:72ch; }
.points li::marker { color:var(--accent); }
.src { margin-top:0.4rem; font-size:0.92rem; }

/* the introduction: the text and the rack beside it */
.hero { display:grid; grid-template-columns:minmax(0,1fr) 15rem; gap:2.4rem; align-items:center; }
.hero-art { justify-self:end; width:100%; }
.rack { display:block; width:100%; height:auto; }
.r-frame { fill:var(--mantle); stroke:var(--line); stroke-width:2; }
.r-rail { fill:var(--surface0); }
.r-unit { fill:var(--base); stroke:var(--surface1); stroke-width:1.5; }
.r-port { fill:var(--surface0); }
.r-port.lit { fill:var(--green); }
.r-vent { stroke:var(--surface1); stroke-width:2; }
.r-bays rect { fill:var(--mantle); stroke:var(--surface1); }
.r-led.ok { fill:var(--green); } .r-led.acc { fill:var(--accent); } .r-led.warn { fill:var(--peach); }

/* the pictures of the projects: a screenshot or brand art, or a cover in
   the flavor for a project without one */
.project.card, .project.wide { display:grid; gap:1rem 1.4rem; align-items:start; }
.project.card { grid-template-columns:14rem minmax(0,1fr); }
.project.wide { grid-template-columns:22rem minmax(0,1fr); }
.shot { display:block; line-height:0; outline:1px solid var(--line); }
.shot:hover { outline-color:var(--accent); }
.shot img { width:100%; height:auto; aspect-ratio:auto; }
.cover { display:flex; flex-direction:column; justify-content:flex-end; aspect-ratio:2/1; padding:0.8rem 1rem;
  background:var(--well, var(--crust)); outline:1px solid var(--line); position:relative; overflow:hidden; }
.cover .c-mark { position:absolute; right:0.4rem; top:0.2rem; width:6rem; height:6rem; fill:none; stroke:var(--surface0); stroke-width:3; stroke-linecap:square; }
.cover .c-name { font-weight:700; font-size:1.2rem; color:var(--accent); position:relative; }
.cover .c-lang { color:var(--muted); font-size:0.92rem; position:relative; }

/* the diagram of the homelab: the same classes for every flavor, so it
   changes with the page */
.diagram { margin:1rem 0 1.4rem; }
.d-scroll { overflow-x:auto; background:var(--well, var(--crust)); outline:1px solid var(--line); }
.diagram svg { display:block; width:100%; min-width:40rem; height:auto; font-family:var(--font); }
.diagram figcaption { color:var(--muted); font-size:0.92rem; margin-top:0.4rem; }
.d-zone { fill:none; stroke:var(--surface1); stroke-width:1.5; stroke-dasharray:6 5; }
.d-zlabel { fill:var(--muted); font-size:13px; }
.d-box { fill:var(--mantle); stroke:var(--surface1); stroke-width:1.5; }
.d-box.acc { stroke:var(--accent); }
.d-glyph { fill:var(--base); stroke:var(--surface1); }
.d-led { fill:var(--green); }
.d-t { fill:var(--fg); font-size:14px; font-weight:700; text-anchor:middle; }
.d-t.acc { fill:var(--accent); }
.d-note { fill:var(--muted); font-size:12px; }
.d-note.mid { text-anchor:middle; }
.d-link { fill:none; stroke:var(--fg2); stroke-width:1.5; }
.d-mesh { fill:none; stroke:var(--accent); stroke-width:2.5; stroke-dasharray:8 6; }
.d-head { fill:var(--fg2); } .d-head.acc { fill:var(--accent); }
.d-seg .s1 { fill:var(--accent); } .d-seg .s2 { fill:var(--green); } .d-seg .s3 { fill:var(--blue); }
.d-seg .s4 { fill:var(--peach); } .d-seg .s5 { fill:var(--red); }

/* the homelab: lines with a mark in the accent */
.lines { list-style:none; max-width:72ch; margin-bottom:var(--gap); }
.lines li { position:relative; padding-left:1.4rem; margin:0.25rem 0; color:var(--fg2); }
.lines li::before { content:"›"; position:absolute; left:0.2rem; color:var(--accent); font-weight:700; }

/* the legal pages */
.legal address { font-style:normal; color:var(--fg); }
.legal .note { background:var(--block, var(--mantle)); box-shadow:inset 0 0 0 1px var(--block-line, transparent); color:var(--fg2); padding:0.6rem 0.9rem; margin-bottom:1rem; max-width:72ch; }
.missing { color:var(--red); font-weight:700; }

footer { display:flex; flex-wrap:wrap; gap:0.4rem 1.2rem; padding:0.8rem 1.2rem; background:var(--mantle);
  color:var(--muted); font-size:0.92rem; }
footer a { color:var(--fg2); }

@media (max-width: 58rem) {
  .project.wide { grid-template-columns:16rem minmax(0,1fr); }
}
@media (max-width: 46rem) {
  .hero { grid-template-columns:1fr; }
  .hero-art { display:none; }
  .project.card, .project.wide { grid-template-columns:1fr; }
  .bar .brand { order:1; min-height:2.6rem; }
  .bar .spacer { order:2; }
  .bar .tools { order:3; }
  .bar .tabs { order:4; width:100%; overflow-x:auto; border-top:1px solid var(--base); }
  .bar .tab { min-height:2.4rem; }
  .panel { top:5.2rem; }
  .hero h1 { font-size:1.6rem; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior:auto !important; } }
@media print {
  .bar, .panel, footer, .skip { display:none !important; }
  html { background:#fff; } body { color:#000; }
}
