/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--paper);
  color: var(--ink);
  font: var(--step-0) / 1.5 var(--sans);
  overflow: hidden;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  color: var(--ink-soft);
  font-size: var(--step--1);
}
.mark { color: var(--ink); font-weight: 600; letter-spacing: 0.01em; }
#clock { font-variant-numeric: tabular-nums; }

main {
  align-self: center;
  justify-self: center;
  width: min(640px, 100% - 32px);
  margin-top: -6vh;
  text-align: center;
}

h1 {
  margin: 0 0 28px;
  font: italic 400 var(--step-4) / 1.05 var(--serif);
  letter-spacing: -0.02em;
  animation: arrive var(--calm) var(--ease) both;
}

#q {
  width: 100%;
  padding: 14px 4px 12px;
  border: 0;
  border-bottom: 1.5px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font: 400 var(--step-1) / 1.3 var(--sans);
  text-align: center;
  transition: border-color var(--quick) var(--ease);
}
#q::placeholder { color: var(--ink-soft); opacity: 0.8; }
#q:focus { outline: none; border-bottom-color: var(--accent); }

#links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 22px;
  margin-top: 22px;
}
#links a, #links button {
  color: var(--ink-soft);
  font: 400 var(--step-0) / 1.4 var(--serif);
  text-decoration: none;
  border: 0;
  background: none;
  padding: 2px 0;
  cursor: pointer;
  transition: color var(--quick) var(--ease);
}
#links a:hover, #links button:hover { color: var(--ink); }

footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  align-items: end;
  padding: 0 28px 24px;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
#status { margin: 0; max-width: 62ch; }
#status strong { color: var(--ink); font-weight: 600; }
.actions { margin: 0; display: flex; gap: 8px; }

button {
  font: 500 var(--step--1) / 1 var(--sans);
  color: var(--ink);
  background: var(--fill);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--quick) var(--ease), border-color var(--quick) var(--ease);
}
button:hover { border-color: var(--ink-soft); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* The one decorative thing: a soft pool of colour at the bottom edge. */
.pool {
  position: fixed;
  inset: auto -10vw -28vh;
  height: 58vh;
  background: radial-gradient(60% 60% at 30% 40%, var(--pool-a), transparent 70%),
    radial-gradient(50% 55% at 72% 50%, var(--pool-b), transparent 70%);
  filter: blur(36px);
  pointer-events: none;
}
body.tor .pool {
  background: radial-gradient(60% 60% at 50% 40%, color-mix(in srgb, var(--tor) 45%, var(--paper)), transparent 70%);
}
body.tor h1 { color: var(--tor); }

dialog {
  width: min(460px, 100% - 32px);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 24px;
  background: var(--paper-raised);
  color: var(--ink);
}
dialog::backdrop { background: rgb(0 0 0 / 0.25); }
dialog h2 { margin: 0 0 16px; font: italic 400 var(--step-2) / 1.1 var(--serif); }
[hidden] { display: none !important; }
dialog label { display: grid; gap: 6px; margin-bottom: 14px; font-size: var(--step--1); color: var(--ink-soft); }
dialog select, dialog input, dialog textarea {
  font: 400 var(--step-0) / 1.4 var(--sans);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 8px 10px;
}
dialog textarea { resize: vertical; font-size: var(--step--1); }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin: 6px 0 0; }
.dialog-actions .start { margin-inline-end: auto; }

#features { width: min(520px, 100% - 32px); max-height: calc(100vh - 48px); }
#features .note { margin: -6px 0 18px; font-size: var(--step--1); color: var(--ink-soft); }
.feature { padding: 14px 0; border-top: 1px solid var(--rule); }
.feature p { margin: 4px 0 0 28px; font-size: var(--step--1); color: var(--ink-soft); }
.feature a { color: inherit; }
.feature > label:not(.switch) { margin: 0; }
dialog label.switch { display: flex; align-items: center; gap: 10px; margin: 0; font-size: var(--step-0); color: var(--ink); }
dialog label.switch input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.feature .sub { margin: 10px 0 0 28px; }
.feature .sub p { margin-left: 0; }
.feature .sub .switch { font-size: var(--step--1); }
.feature .actions { margin-top: 8px; }
.feature .progress:empty { display: none; }
.feature .progress.error { color: var(--accent-text); }

@keyframes arrive {
  from { opacity: 0; transform: translateY(6px); }
}

@media (max-width: 560px) {
  footer { flex-direction: column; align-items: start; }
}
.feature button.remove {
  padding: 2px 10px;
  font-size: var(--step--1);
}
.portable { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
#portable-note { font-size: var(--step--1); color: var(--ink-soft); }
#import-urls { max-height: 40vh; overflow: auto; margin: 8px 0 0; padding-inline-start: 1.4em; font-size: var(--step--1); overflow-wrap: anywhere; }
#import-summary, #import-result { font-size: var(--step--1); }

/* Parts only some styles show (see styles/). */
#desktop { position: fixed; inset: 0; width: 100%; height: 100%; }
.retro-title, .retro-logo, #retro-go, #term-log, #term-prompt { display: none; }
:root[data-style="retrofind"] .retro-title, :root[data-style="retrofind"] #retro-go { display: revert; }
:root[data-style="retrofind"] .retro-title { display: flex; }
:root[data-style="retrofind"] .retro-logo { display: block; }
:root[data-style="terminal"] #term-log, :root[data-style="terminal"] #term-prompt { display: revert; }
:root[data-style="terminal"] #term-log { display: block; }
header.bar, main, footer { position: relative; z-index: 1; }
