/* styles.css stays the design's byte for byte, this loads after it and takes back what RunApp lays out differently */

:root {
  --page: #353679;
  --panel: #1C1C46;
  --bg: #0E0E27;
  --fg: #DDDDE3;
  --text: #B6B6D4;
  --head: rgba(255, 255, 255, 0.747);
  --edge: #A3A3CC;
  --line: #393972;
  --accent: #FCC200;
  --accent-ink: #0E0E27;
  --ring: #BE7DFE;
  --good: #6FD08C;
  --bad: #FF8A80;
  color-scheme: dark;
}

body {
  display: block;
  padding: 12px 16px 40px;
  color: var(--fg);
  font-size: 16px;
  line-height: 1.5;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.top {
  display: grid;
  gap: 2px;
  justify-items: center;
  text-align: center;
  background: var(--panel);
  border: 2px solid var(--edge);
  box-shadow: 0 0 0 4px var(--panel);
  padding: 15px 40px;
  margin: 30px 0;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--head);
}

.top .eyebrow {
  color: var(--text);
}

h1 {
  line-height: 1.15;
  text-wrap: balance;
}

/* ---------------------------------------------------------------- the tabs */

.tabs {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-bottom-color: var(--line);
  box-shadow: 0 0 0 2px var(--panel);
  padding: 0 10px;
}

/* Log out is a button_to form, contents lets its button take a column like the links */
.tabs form {
  display: contents;
}

.tabs .tab,
.tabs .tab:visited {
  display: block;
  position: relative;
  width: 100%;
  margin: 0;
  padding: 11px 4px 10px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.03em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  color: var(--text);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.tabs .tab:hover {
  color: var(--accent);
}

.tabs .tab[aria-current="page"] {
  color: var(--head);
}

.tabs .tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent);
}

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

/* ---------------------------------------------------------------- the panels */

.pane {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--edge);
  box-shadow: 0 0 0 2px var(--panel);
  padding: 22px 30px 26px;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 2px;
}

.panel-head h2 {
  margin: 0 auto 0 0;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--head);
}

h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  color: var(--head);
}

.entry {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.entry:last-of-type {
  border-bottom: 0;
}

.empty {
  font-size: 14px;
  padding: 6px 0;
}

.badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0 6px;
  margin-left: 4px;
  border: 1px solid var(--good);
  color: var(--good);
  vertical-align: 1px;
}

.trix-content {
  color: var(--fg);
}

#main img {
  max-width: 100%;
  height: auto;
}

.more,
.more:visited {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.more.danger {
  color: var(--bad);
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* A form's own 16px line sat its 13px button lower than the link beside it, contents puts the button in the row */
.actions .button_to {
  display: contents;
}

.entry .button_to {
  display: inline;
}

/* ---------------------------------------------------------------- the paper */

/* Case Repository's case reader, opencase public/explore.css .paper */
.hint {
  font-size: 13px;
  color: var(--text);
}

.paper {
  background: #f7f3e8;
  color: #1c1a16;
  border: 1px solid var(--edge);
  padding: 48px 64px 40px;
  font-family: "Century Schoolbook", "C059", Georgia, "Times New Roman", serif;
  font-size: 16.5px;
  line-height: 1.62;
}

/* styles.css paints every p lavender and every link gold, both vanish on the paper */
.paper p,
.paper li,
.paper .trix-content {
  color: #1c1a16;
}

.paper a,
.paper a:visited {
  color: #8b2c2c;
}

.paper .courtline {
  text-align: center;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  font-size: 15px;
}

.paper .caption {
  text-align: center;
  font-size: 21px;
  font-weight: bold;
  margin: 14px 0 4px;
}

.paper .decided,
.paper .citeline {
  text-align: center;
  font-size: 14px;
  color: #4a453a;
}

.paper .citeline {
  margin-top: 8px;
  color: #1c1a16;
}

.paper hr.rule {
  border: 0;
  border-top: 1.5px solid #1c1a16;
  margin: 20px auto 18px;
  width: 34%;
}

.paper .cover {
  display: block;
  margin: 0 auto 18px;
}

.paper .trix-content > div,
.paper .trix-content > p {
  margin: 0 0 14px;
}

.paper .trix-content h1 {
  text-align: center;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  font-size: inherit;
  font-weight: normal;
  margin: 22px 0 12px;
}

.paper .trix-content blockquote {
  border: 0;
  margin: 12px 36px;
  padding: 0;
  font-size: 15.5px;
}

.pdf-pages {
  display: grid;
  gap: 16px;
}

.pdf-sheet {
  position: relative;
  background: #f7f3e8;
  border: 1px solid var(--edge);
  --scale-round-x: 1px;
  --scale-round-y: 1px;
}

/* multiply turns the PDF's white into the sheet's cream and leaves the ink, even when the PDF paints its own white */
.pdf-sheet canvas {
  display: block;
  width: 100%;
  height: 100%;
  mix-blend-mode: multiply;
}

/* Cut down from PDF.js 6.4's pdf_viewer.css, the variables are theirs. Check it again when PDF.js moves */
.pdf-sheet .textLayer {
  position: absolute;
  inset: 0;
  overflow: clip;
  line-height: 1;
  text-align: initial;
  transform-origin: 0 0;
  forced-color-adjust: none;
  --min-font-size: 1;
  --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
  --min-font-size-inv: calc(1 / var(--min-font-size));
}

.pdf-sheet .textLayer :is(span, br) {
  position: absolute;
  color: transparent;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
  user-select: text;
}

.pdf-sheet .textLayer > :not(.markedContent),
.pdf-sheet .textLayer .markedContent span:not(.markedContent) {
  --font-height: 0;
  --scale-x: 1;
  --rotate: 0deg;
  font-size: calc(var(--text-scale-factor) * var(--font-height));
  transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
}

.pdf-sheet .textLayer .markedContent {
  display: contents;
}

.pdf-sheet .textLayer ::selection {
  background: rgba(0, 0, 255, 0.25);
  color: transparent;
}

.pdf-sheet .textLayer .endOfContent {
  display: block;
  position: absolute;
  inset: 100% 0 0;
  user-select: none;
}

.pdf-link {
  margin-top: 6px;
  text-align: center;
}

.reader-actions {
  justify-content: center;
}

label.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fg);
}

/* ---------------------------------------------------------------- the forms */

.fields {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 4px;
}

label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
trix-editor {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 16px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: 0;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

trix-editor {
  min-height: 14em;
}

input:hover,
textarea:hover,
trix-editor:hover {
  border-color: var(--accent);
}

/* actiontext.css takes the editor's outline away, this puts it back */
input:focus-visible,
textarea:focus-visible,
trix-editor:focus,
button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Trix's icons are black, they need a light shelf to sit on */
trix-toolbar .trix-button-group {
  background-color: var(--text);
}

input[type="submit"],
button:not([class]) {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 0;
  padding: 9px 16px;
  cursor: pointer;
}

.alert {
  color: var(--bad);
}

.notice {
  color: var(--good);
}

ul.alert {
  margin: 0;
  padding-left: 18px;
}

/* ---------------------------------------------------------------- the sky */

/* application.js marks html after the first Turbo visit, so the fade plays once per real page load */
html[data-redrawn] body::before {
  animation: none;
}

/* One tile taller than the window so the drift never runs out. A transform, so the stars move without a repaint */
@media (prefers-reduced-motion: no-preference) {
  body::before {
    position: fixed;
    inset: 0 0 -600px 0;
    transform: translate3d(0, var(--sky-y, 0px), 0);
    will-change: transform;
  }
}

/* ---------------------------------------------------------------- the foot */

#footer {
  justify-self: center;
  margin: 30px 0 15px;
}

@media (max-width: 600px) {
  .top {
    margin: 20px 0;
    padding: 15px 20px;
  }

  .pane {
    gap: 20px;
  }

  .panel {
    padding: 16px 14px 20px;
  }

  .paper {
    padding: 24px 18px;
  }

  /* Each tab as wide as its words, spread across the bar, so New article stays on one line */
  .tabs {
    grid-auto-columns: auto;
    justify-content: space-between;
    padding: 0 12px;
  }

  .tabs .tab {
    font-size: 14px;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .tabs .tab[aria-current="page"]::after {
    left: 4px;
    right: 4px;
  }
}

/* ---------------------------------------------------------------- printing */

/* The paper drops its own padding in print, so the page has to bring the margin or the text runs to the sheet's
   edge, past what most printers can reach */
@page {
  margin: 1in;
}
@media print {
  /* color-scheme dark paints the canvas dark, and in print the canvas is the page margin, a black frame round the
     notes */
  :root {
    color-scheme: light;
  }

  html,
  body {
    background: #fff !important;
  }

  body {
    padding: 0;
  }

  body::before,
  .top,
  .tabs,
  #footer,
  #comments,
  #newsletter,
  .hint,
  .reader-actions,
  .notice,
  .alert {
    display: none !important;
  }

  .wrap {
    max-width: none;
  }

  .paper {
    border: 0;
    padding: 0;
    background: #fff;
  }
}
