/* What every /automation page shares so it works by keyboard, with a screen reader, in a Windows contrast theme and
   with reduced motion: WCAG 2.2 AA, checked with axe-core on every cell. Loaded after the page's own styles, which it
   builds on; the colours themselves (--text-mute, --line-control) are set in each page's :root. */

/* the page is dark to the browser too: its scroll bars and form controls */
:root{color-scheme:dark;}

/* the first thing Tab reaches: a jump past the top bar to the page, shown only while it has focus */
.skip{
  position:fixed; top:8px; left:8px; z-index:100; padding:8px 14px; border-radius:6px;
  background:var(--teal); color:var(--bg); font-family:var(--font-mono); font-size:13px; font-weight:600; text-decoration:none;
  transform:translateY(-160%);
}
.skip:focus{transform:none; outline:2px solid var(--text); outline-offset:2px;}

/* read out by a screen reader, not drawn */
.sr-only{position:absolute; width:1px; height:1px; margin:-1px; padding:0; border:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap;}

/* a control reached by Tab, or a link to something on the page, stops below the top bar and the steps bar, not
   under them (2.4.11 Focus not obscured) */
html{scroll-padding-top:128px; scroll-padding-bottom:24px;}

/* no smooth scrolling for those who ask for less motion */
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto;}
}

/* a cell's state is in its label's mark as well as its colour (1.4.1), and a screen reader says it in words */
.prompt.need::after{content:"○"; content:"○" / "waits for you";}
.prompt.ok::after{content:"✓"; content:"✓" / "done";}
.prompt.busy::after{content:"●"; content:"●" / "running";}
.prompt.go::after{content:"▶"; content:"▶" / "ready";}   /* Build, ready to press */

/* Those marks, on a cell's label and on its tab in the steps bar (steps.css), drawn as shapes in the label's colour
   rather than set as glyphs: the fonts draw ○ as a small o on the line and ✓, ● and ▶ at sizes of their own. Each
   is the same box, centred on the label's text; the glyph stays as the content, at no size, so a screen reader
   still hears the words. */
:is(.prompt, .steps-tab):is(.need, .ok, .busy, .go)::after{
  display:inline-block; box-sizing:border-box; width:9px; height:9px; vertical-align:middle;
  font-size:0; line-height:0; overflow:hidden; position:relative; top:-1px;
  background:currentColor; -webkit-mask:var(--mark) center / contain no-repeat; mask:var(--mark) center / contain no-repeat;
}
.steps-tab:is(.need, .ok, .busy, .go)::after{align-self:center; top:0;}       /* the tab is a row on its baseline */
/* waits for you: a ring */
:is(.prompt, .steps-tab).need::after{
  --mark:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='3.9' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E");
}
/* done: a tick */
:is(.prompt, .steps-tab).ok::after{
  width:10px;
  --mark:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.4 5.3 4 7.8 8.7 2.3' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* running: a dot */
:is(.prompt, .steps-tab).busy::after{
  --mark:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='3.6'/%3E%3C/svg%3E");
}
/* ready to press: a play triangle */
:is(.prompt, .steps-tab).go::after{
  --mark:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.3 1.3 8.6 5 2.3 8.7Z' stroke='black' stroke-width='.8' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* what is pressed is at least 24 px each way, however small it is drawn (2.5.8 Target size): the × that removes a
   file or an answer, a fold's title, preview and open chat ↗ (their lines kept as they were), /yearly's zoom › */
.x{display:inline-grid; place-items:center; min-width:24px; min-height:24px;}
summary{padding-block:2.5px;}
button.link{min-height:24px;}
button.preview-btn{padding-block:3px; margin-block:-3px;}
.chat-link{display:inline-block; padding-block:3px; margin-block:-3px;}
.legend button.zoomable{min-width:24px;}

/* the kernel's state, hidden on a phone to save room, is still read out */
@media(max-width:640px){
  html{scroll-padding-top:124px;}                     /* the steps bar is a line taller there: Step 2 of 5 under its tabs */
  .kernel{position:relative; width:30px; padding:0;}   /* the dot alone: a circle */
  .kernel .ktext{display:block; position:absolute; width:1px; min-width:0; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap;}
}

/* Windows contrast themes replace every colour with the theme's own, and drop backgrounds and shadows: what showed
   a state by those alone shows it by an edge or the theme's highlight instead */
@media (forced-colors:active){
  .btn{border:1px solid ButtonText;}
  .btn:disabled{color:GrayText; border-color:GrayText;}
  .bar{border:1px solid CanvasText;}
  .bar i{forced-color-adjust:none; background:Highlight;}
  .steps-tab[aria-selected="true"], .xl-tab[aria-selected="true"], .seg label:has(input:checked){
    forced-color-adjust:none; background:Highlight; color:HighlightText; border-color:Highlight;
  }
  .pick:focus-within{outline:2px solid Highlight;}
  .steps-go.glow{border:2px solid Highlight;}           /* on to OUT once built: its glow and strokes are dropped */
  /* the drawn marks keep the theme's text colour as their fill, not its background */
  :is(.prompt, .steps-tab):is(.need, .ok, .busy, .go)::after{forced-color-adjust:none;}
  .drop:hover, .drop.over{border-style:solid;}
}

/* a <select>'s list drawn by the page (drop.js), under it, in place of the browser's: the walkthrough can point at
   an option in it. Over the page, under the walkthrough's pointer and captions (.tour, z-index 50). */
.drop-list{
  position:fixed; z-index:40; box-sizing:border-box; overflow-y:auto; padding:4px 0; max-width:calc(100vw - 16px);
  background:var(--bg); border:1px solid var(--teal); border-radius:6px; box-shadow:0 10px 28px rgba(0,0,0,.5);
  font-family:var(--font-mono); font-size:13.5px; color:var(--text); outline:none;
}
.drop-list[hidden]{display:none;}
.drop-opt{padding:8px 11px; white-space:nowrap; cursor:pointer;}
.drop-opt[aria-selected="true"]{color:var(--teal);}
.drop-opt.on{background:var(--cell-hover, #182036);}
.drop-opt[aria-disabled="true"]{color:var(--text-mute); cursor:default;}
.drop-opt.tour-hold, .drop-opt.tour-on{outline-offset:-3px; border-radius:4px;}
.drop-opt.tour-on{animation-name:tour-pulse-row;}
@media (forced-colors:active){
  .drop-list{border:1px solid CanvasText;}
  .drop-opt.on{forced-color-adjust:none; background:Highlight; color:HighlightText;}
}
