/* SPDX-License-Identifier: GPL-3.0-or-later OR LGPL-3.0-or-later
   topology.css -- one stylesheet, three treatments (classic, console,
   cards), light and dark, and a still mode for people who ask for less
   motion.  A treatment is a data-treatment attribute on <html>; nothing
   else changes between them, so every treatment reads the same page. */

/* The default palette is egad's (css/egad.css): black on white, or white on
   black, at AAA for text.  data-palette="original" on <html> brings back the
   first palette (warm paper and dark olive).  Tokens used below:
   --control is the edge of an input or button (WCAG 1.4.11, 3:1);
   --focus is the keyboard focus ring (3:1 against what it sits on). */
:root {
  --bg: var(--egad-canvas); --fg: var(--egad-text); --muted: var(--egad-text-dim); --rule: var(--egad-border-divider);
  --link: var(--egad-link); --visited: var(--egad-priority); --accent: var(--egad-link); --accent-fg: var(--egad-canvas);
  --panel: var(--egad-canvas-dim); --warn: var(--egad-signal-warning);
  --control: var(--egad-border-control); --focus: var(--egad-focus-ring);
  --mono: var(--egad-font-fixed);
  --serif: Georgia, "DejaVu Serif", "Times New Roman", serif;
  --sans: var(--egad-font-variable);
  --body: var(--egad-font-variable); --radius: var(--egad-radius-1); --gap: var(--egad-space-4);
}
:root[data-palette="original"] {
  --bg: #fdfcf8; --fg: #1d1d1b; --muted: #55564f; --rule: #d8d5c8;
  --link: #1446a0; --visited: #6a2c8f; --accent: #0b6e4f; --accent-fg: #fff;
  --panel: #f3f1e8; --warn: #8a4b00; --control: #55564f; --focus: #0b6e4f;
  --mono: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --sans: system-ui, "DejaVu Sans", "Segoe UI", sans-serif;
  --body: var(--serif); --radius: 2px; --gap: 1rem;
}
@media (prefers-color-scheme: dark) {
  :root:where([data-palette="original"]):not([data-theme="light"]) {
    --bg: #161714; --fg: #e9e7df; --muted: #adaba0; --rule: #3a3b35; --link: #8fb4ff; --visited: #d1a3ef;
    --accent: #4fc79a; --accent-fg: #0b1a14; --panel: #20211d; --warn: #f0b060; --control: #adaba0; --focus: #4fc79a;
  }
}
:root:where([data-palette="original"])[data-theme="dark"] {
  --bg: #161714; --fg: #e9e7df; --muted: #adaba0; --rule: #3a3b35; --link: #8fb4ff;
  --visited: #d1a3ef; --accent: #4fc79a; --accent-fg: #0b1a14; --panel: #20211d; --warn: #f0b060; --control: #adaba0; --focus: #4fc79a;
}
:root[data-treatment="console"] {
  --bg: #0c0f0c; --fg: #c8f5c8; --muted: #7fb07f; --rule: #234023; --link: #9fe89f; --visited: #c3a6ff;
  --accent: #39ff88; --accent-fg: #021; --panel: #111811; --warn: #f0c060; --control: #7fb07f; --focus: #39ff88;
  --body: var(--mono); --radius: 0;
}
:root[data-treatment="cards"] { --body: var(--sans); --radius: 10px; --panel: color-mix(in srgb, var(--bg) 88%, var(--accent)); }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 17px/1.55 var(--body); padding: 0 16px; }
.wrap { max-width: 46rem; margin: 0 auto; }
.wide { max-width: 96rem; margin: 0 auto; padding: 0 1rem; }
a { color: var(--link); } a:visited { color: var(--visited); }
a:focus-visible, button:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible,
pre:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

h1, h2, h3 { line-height: 1.2; font-weight: 600; }
h1 { font-size: 2rem; margin: .2em 0 .1em; }
h2 { font-size: 1.3rem; border-bottom: 1px solid var(--rule); padding-bottom: .2em; margin-top: 2em; }
code, pre, kbd { font-family: var(--mono); font-size: .9em; }
pre { background: var(--panel); padding: .8em; overflow-x: auto; border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .95em; }
th, td { text-align: left; padding: .35em .5em; border-bottom: 1px solid var(--rule); vertical-align: top; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--bg); color: var(--fg); padding: .5em .8em; border: 2px solid var(--focus); }

/* the classic masthead: name, tagline, a plain row of links */
header.mast { border-bottom: 3px double var(--rule); padding: 1.2rem 0 .6rem; }
header.mast .name { font-family: var(--mono); font-size: 2.2rem; font-weight: 700; letter-spacing: -.02em; }
nav.top { display: flex; flex-wrap: wrap; gap: .2em 1.1em; margin-top: .4em; font-family: var(--sans); font-size: .95rem; }
footer { border-top: 1px solid var(--rule); margin: 3rem 0 2rem; padding-top: .8rem; font-size: .9rem; color: var(--muted); }

/* the two ways in */
.ways { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin: 1.5rem 0; }
@media (max-width: 34rem) { .ways { grid-template-columns: 1fr; } }
.way { border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; background: var(--panel); }
.way p { margin: .4em 0 .8em; font-size: .95rem; }
.btn { display: inline-block; font: 600 1rem/1.2 var(--sans); padding: .7em 1.1em; border-radius: var(--radius);
  border: 2px solid var(--accent); background: var(--accent); color: var(--accent-fg); text-decoration: none; cursor: pointer; }
.btn:visited { color: var(--accent-fg); }
.btn.quiet { background: transparent; color: var(--fg); border-color: var(--control); }
.btn.quiet:visited { color: var(--fg); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

details.more { border-top: 1px solid var(--rule); margin-top: 1.5rem; }
details.more > summary { cursor: pointer; padding: .7em 0; font-family: var(--sans); font-weight: 600; }
.recipe-note { font-size: .85rem; color: var(--muted); font-family: var(--sans); }
.recipe-note::before { content: "\2192\00a0"; }

/* the app */
/* The drawing takes the whole width; the settings are one click above it, closed until asked for. */
.app { display: grid; grid-template-columns: 1fr; gap: var(--gap); min-height: 80vh; padding: 1rem 0; }
.settings > summary { cursor: pointer; font: .95rem var(--sans); padding: .4rem 0; min-height: 24px; }
.settings-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--gap); padding-top: .5rem; }
.side section { border: 1px solid var(--rule); border-radius: var(--radius); padding: .7rem; margin-bottom: .8rem; background: var(--panel); }
.side h2 { margin: 0 0 .4em; font-size: 1rem; border: 0; }
.side label { display: block; font: .9rem var(--sans); margin: .3em 0; }
.side select, .side input[type=url], .side input[type=text] { width: 100%; font: .95rem var(--sans); padding: .3em; background: var(--bg); color: var(--fg); border: 1px solid var(--control); }
.canvas { border: 1px solid var(--rule); border-radius: var(--radius); min-height: 70vh; display: flex; flex-direction: column; }
.canvas iframe { flex: 1; border: 0; width: 100%; min-height: 80vh; background: #fff; }
.acts { display: flex; flex-wrap: wrap; gap: .5rem; padding: .5rem; border-bottom: 1px solid var(--rule); font-family: var(--sans); }
.status { font: .9rem var(--sans); padding: .4rem .6rem; min-height: 1.6em; }
.kept { color: var(--warn); font-family: var(--sans); font-size: .9rem; }

/* the upgrade wizard */
.wizard { border: 2px solid var(--accent); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; background: var(--panel); }
.wizard .stepno { font: .85rem var(--sans); color: var(--muted); }
.wizard .row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; align-items: center; }
.tree ul { list-style: none; padding-left: 1.1rem; border-left: 1px dashed var(--rule); margin: .2em 0; }
.tree > ul { border: 0; padding-left: 0; }
.tree .cat { font: 600 .8rem var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tree .tension { font-size: .85rem; color: var(--muted); }
.tag { font: .75rem var(--sans); border: 1px solid var(--control); border-radius: 999px; padding: 0 .5em; margin-left: .3em; }

/* less motion: asked for by the system, or by the box in the app */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) { .btn { border: 2px solid ButtonText; } }
@media (prefers-reduced-motion: no-preference) {
  html:not([data-still]) .way { transition: transform .2s ease, box-shadow .2s ease; }
  html:not([data-still]) .way:hover { transform: translateY(-2px); box-shadow: 0 4px 0 var(--rule); }
}

/* small helpers (these replace inline style attributes) */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.way-title { margin-top: 0; border: 0; }
.small { font-size: .85rem; }
header.mast-app { padding: .6rem 0 .4rem; }
header.mast-app .name { font-size: 1.4rem; text-decoration: none; color: inherit; }
.add { margin-top: .5em; }
.skip2:focus { top: 3.2rem; }
.acts [hidden] { display: none; }
