/* EXAMIND Memory. The neutral palette, the radius and the system font stack
   are the ones Feedback Machines uses (its theme tokens, light and dark), so
   the two look like one company's. Colors follow the reader's light or dark
   setting.

   Every text color here is at least 4.5:1 against the surface it sits on, and
   every control's border and the focus ring at least 3:1. The theme's own
   border color is too faint to mark a control's edge, so it is kept for
   dividers and controls get a stronger one. EXAMIND's light blue is 2.8:1 on
   white: it colors the logo and decoration in light, and carries text only in
   dark, where it is 7:1. */

:root {
  --background: hsl(0 0% 100%);
  --foreground: hsl(222.2 84% 4.9%);
  --muted-foreground: hsl(215.4 16.3% 40%);
  --divider: hsl(214.3 31.8% 91.4%);
  --control-border: hsl(215 16% 47%);
  --primary: hsl(0 0% 0%);
  --primary-foreground: hsl(0 0% 100%);
  --hover: hsl(210 40% 96%);
  --ring: hsl(221.2 83.2% 53.3%);
  --error: hsl(0 72.2% 45%);
  --link: #3050a1;
  --brand: #2ba3dd;
  --logo-arm: #3050a1;
  --radius: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: hsl(222.2 84% 4.9%);
    --foreground: hsl(210 40% 98%);
    --muted-foreground: hsl(215 20.2% 70%);
    --divider: hsl(217.2 32.6% 17.5%);
    --control-border: hsl(215 20% 58%);
    --primary: hsl(0 0% 100%);
    --primary-foreground: hsl(0 0% 0%);
    --hover: hsl(217.2 32.6% 17.5%);
    --ring: hsl(213 94% 68%);
    --error: hsl(0 91% 76%);
    --link: #2ba3dd;
    --logo-arm: hsl(210 40% 98%);
  }
}

/* An element with a layout of its own would otherwise ignore `hidden`. */
[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 1rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
    "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Read by a screen reader and not drawn. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sprite {
  position: absolute;
}

.logo-dot {
  fill: var(--brand);
}

.logo-arm {
  fill: var(--logo-arm);
}

.logomark {
  flex: none;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0 0 0.25rem;
}

h2 {
  font-size: 1.125rem;
  margin: 0 0 0.5rem;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--link);
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 0.9em;
}

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

/* A heading takes focus when its view or its panel appears, so a keyboard and
   a screen reader land there. It is not a control, so it shows no ring. */
h1:focus,
h2:focus {
  outline: none;
}

/* --- Signed out: the logo and the way in --- */

.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 24rem;
  margin: 0 auto;
  padding: 20vh 1rem 2rem;
  text-align: center;
}

.welcome h1 {
  margin: 0 0 0.5rem;
}

/* --- The bar across the top --- */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
  padding: 0.5rem max(1rem, calc((100vw - 46rem) / 2));
  border-bottom: 1px solid var(--divider);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  color: var(--foreground);
  font-size: 1.125rem;
  font-weight: 600;
  text-decoration: none;
}

.top nav {
  display: flex;
  gap: 0.25rem;
  margin-right: auto;
}

/* The page you are on is told apart by weight and by a bar under it, and to a
   screen reader by `aria-current`. */
.top nav a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--muted-foreground);
  text-decoration: none;
}

.top nav a:hover {
  background: var(--hover);
  color: var(--foreground);
}

.top nav a[aria-current="page"] {
  border-bottom-color: var(--brand);
  color: var(--foreground);
  font-weight: 600;
}

.account {
  position: relative;
}

.account summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  max-width: 16rem;
  padding: 0 0.75rem;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
}

.account summary::-webkit-details-marker {
  display: none;
}

.account summary:hover {
  background: var(--hover);
}

#who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A small arrow that turns over when the menu is open. */
.account summary::after {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  margin-top: -0.2rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.account[open] summary::after {
  margin-top: 0.2rem;
  transform: rotate(225deg);
}

.menu {
  position: absolute;
  right: 0;
  z-index: 1;
  width: max-content;
  max-width: calc(100vw - 2rem);
  margin-top: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--background);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}

.menu p {
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}

/* --- The page under the bar --- */

#signed-in main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.lede {
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
}

#calendar-heading {
  margin-bottom: 1rem;
}

.field,
fieldset {
  margin: 0 0 1.25rem;
}

label,
legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

legend {
  padding: 0;
}

fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}

input[type="text"],
input[type="url"],
input[type="date"],
textarea {
  display: block;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
}

input[type="date"] {
  width: auto;
  min-width: 12rem;
}

textarea {
  resize: vertical;
}

textarea[readonly] {
  color: var(--muted-foreground);
}

input[type="file"] {
  display: block;
  max-width: 100%;
  color: var(--foreground);
  font: inherit;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  font-weight: 400;
  margin: 0;
}

.choice input {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  accent-color: var(--primary);
}

.hint {
  color: var(--muted-foreground);
  margin: 0.35rem 0 0;
}

/* An error is a sentence that appears beside its control, so it is told apart
   by being there and by its weight, and the color only adds to that. */
.error {
  color: var(--error);
  font-weight: 600;
  margin: 0.35rem 0 0;
}

/* --- The box you add to --- */

.drop {
  padding: 1rem;
  border: 1px dashed var(--control-border);
  border-radius: var(--radius);
}

/* A file held over the box: the edge turns solid and heavier, and a line of
   text says what letting go will do. */
.drop.over {
  border-style: solid;
  outline: 2px solid var(--ring);
  outline-offset: -1px;
  background: var(--hover);
}

.drop-cue {
  font-weight: 600;
  margin: 0.5rem 0 0;
}

.file {
  margin-top: 1rem;
}

.file label {
  font-weight: 400;
}

#file-note {
  color: var(--muted-foreground);
  margin: 0.35rem 0 0;
}

#file-note:empty {
  display: none;
}

#questions,
#saved {
  margin: 1.5rem 0 0;
}

#saved {
  margin: 0 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--control-border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
}

#saved p:last-child {
  margin-bottom: 0;
}

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 0 0 1rem;
}

dt {
  color: var(--muted-foreground);
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

#reading {
  color: var(--muted-foreground);
  margin: 1rem 0 0;
}

/* What became of sending the recorder. It is the answer the person is waiting
   for, so it has the weight of an error and the color of plain text. */
#recorder-result {
  font-weight: 600;
  margin: 1rem 0 0;
}

#reading:empty,
#recorder-result:empty {
  display: none;
}

/* The main action is the last thing in the form, at the right. */
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

#add-error,
#recorder-error {
  text-align: right;
}

button {
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--hover);
}

button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}

button.primary:hover {
  opacity: 0.88;
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

dialog {
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 1.25rem;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.6);
}

dialog form {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* On a narrow screen the bar takes two rows: who you are stays beside the
   name, and the two destinations go underneath. */
@media (max-width: 34rem) {
  .brand {
    margin-right: auto;
  }

  .top nav {
    order: 3;
    width: 100%;
    margin-right: 0;
  }

  .account summary {
    max-width: 11rem;
  }
}
