:root {
  line-height: 1.4rem;
  --line-length: 23rem;
  --big: 2rem;
}

a.brand {
  color: var(--fg);
  text-decoration: none;
  background-image: url("/logo.png");
  background-size: contain;
  background-repeat: no-repeat;
  display: inline-block;
}

a.brand:hover {
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  a.brand {
    background-image: url("/logo-light.png");
  }
}

.brand h1 {
  margin: 0;
  padding: 0;
  color: transparent;
}

.wide {
  --line-length: 42rem;
}

#totals,
#links {
  --density: 0.33;
}

header {
  border: none;
}

/* The entrance, for as long as a guardian is standing in the stage.
 *
 * A door looks nothing like the place behind it: one element centred in an
 * empty stage, which is nothing the place itself would ever ask for. That
 * used to be a stylesheet of its own, named by an element the guardian and
 * the symbiont exchanged as the place changed hands. Following the
 * entrance instead, it needs no exchanging and leaves when the entrance
 * does -- and a cosymbiont's door, which renews its document rather than
 * handing it on, never wears it at all. */

#entrance {
  text-align: center;
}

#entrance #gate {
  gap: var(--gap);
}

body:has(#entrance) header nav {
  display: flex;
  justify-content: center;
}
.todos li {
  margin: var(--gap) 0;
  padding: var(--gap);
  border: 1px solid var(--bg);
}

.todos li.selected {
  background: var(--box-bg);
  border-radius: var(--border-radius);
  background: var(--box-bg);
  border: 1px solid var(--graphical-fg);
  overflow: clip;
}

#console {
  padding: 1rem 0 0;
}

#explanation {
  position: absolute;
  max-width: calc(var(--line-length) - 2rem);
  padding: 1rem;
  background: var(--box-bg);
  z-index: 1;
}

#console textarea:focus-visible {
  outline: none;
}

#explanation small {
  text-align: right;
  color: var(--fg-faded);
}

#input {
  resize: none;
  width: 100%;
  font-size: 1.4rem;
  padding: 0.5rem;
  border-bottom: 0.125rem solid var(--fg) !important;
  transition: height 250ms ease;
}

#focus {
  user-select: none;
  -webkit-user-select: none; /* Safari */
  touch-action: none;
}

.pressed {
  background-color: var(--lime-1);
}

/* The console, kept at the top of a phone's screen.
 *
 * The explanation, with the button that confirms it, hangs under the input,
 * and a soft keyboard takes the lower half of the screen. A console that
 * scrolls away with the header leaves that button wherever the page was
 * last left, so on a phone it stays where the eye already is.
 *
 * Sticky holds an element inside its parent, and the parent here is the
 * header, barely taller than the console: pinned there, it would scroll off
 * with the header. So the header gives up its own box, which makes the body
 * the console's parent, and what that box gave -- the room above the nav
 * and the room below the console -- goes to those two instead. Pinning the
 * header itself would hold three times as much of the screen. The input is
 * held to four lines, so a long one cannot push the button back down.
 *
 * Pinned is not yet at the top: at rest the console sits under the nav.
 * So the nav gives way while the console has focus, and the console is the
 * top of the screen for as long as it is in use. It comes back a moment
 * after focus leaves, not at once, so that a tap which leaves the console
 * cannot have the page move from under it between the press and the
 * release. */

@media (max-width: 720px) {
  header:has(> #console) {
    display: contents;
  }

  header:has(> #console) > nav {
    padding-top: var(--rhythm);
    max-height: 12rem;
    overflow: hidden;
    transition: max-height 0s 300ms, padding-top 0s 300ms, visibility 0s 300ms;
  }

  header:has(> #console:focus-within) > nav {
    padding-top: 0;
    max-height: 0;
    visibility: hidden;
    transition-delay: 0s;
  }

  #console {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg);
    margin-bottom: calc(var(--rhythm) + 2 * var(--gap));
  }

  #input {
    font-size: 1rem;
    padding: 0.25rem;
    max-height: calc(4 * var(--rhythm) + 0.5rem + 0.1875rem);
    overflow-y: auto;
  }
}

.season-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.season-duration {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.season-summary {
  color: var(--fg-faded);
  margin-top: -0.4rem;
}

.season-projects {
  list-style: none;
  margin: 0;
  padding: 0;
}

.season-project {
  display: grid;
  grid-template-columns: minmax(4rem, 1fr) auto minmax(11rem, 1.6fr) auto;
  align-items: baseline;
  gap: 0.1rem 0.8rem;
  padding: 0.2rem 0;
}

.season-project-name,
.season-project-duration {
  font-variant-numeric: tabular-nums;
}

.season-rhythm {
  width: 154px;
  height: 27px;
  overflow: visible;
}

.season-rhythm text {
  fill: var(--fg-faded);
  font-size: 8px;
}

.season-rhythm-cell.unspent { fill: #795548; }
.season-rhythm-cell.negrido { fill: #4d5358; }
.season-rhythm-cell.albedo { fill: #d9e2df; }
.season-rhythm-cell.citrinas { fill: #d69a3a; }
.season-rhythm-cell.rubedo { fill: #a4423b; }

@media (max-width: 720px) {
  .season-project {
    grid-template-columns: minmax(4rem, 1fr) auto;
  }

  .season-project-sittings,
  .season-rhythm {
    grid-column: 1 / -1;
  }

  .track-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.season-week > summary,
.season-month > summary,
.current-week > summary {
  cursor: pointer;
}

.season-body {
  padding-top: 0.35rem;
}

.track-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  align-items: baseline;
  margin: 0.75rem 0 1rem;
}

.track-totals div {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}

.track-totals span {
  color: var(--fg-faded);
}

.track-totals strong {
  font-variant-numeric: tabular-nums;
}

.current-week-summary {
  font-size: 1.25rem;
  font-weight: bold;
}

.track-note {
  background: #fff;
}

.current-week > table {
  margin-top: 0.5rem;
}
