/*
 * "Paper" theme (prototype, ?theme=paper): warm off-white paper with a very
 * faint ruled notebook pattern. Every rule is scoped to
 * <html data-theme="paper">, so nothing changes in the other themes.
 *
 * The ruling is drawn by body::before, a fixed layer under the brain canvas and
 * the content, made of CSS gradients only (no image): one horizontal line every
 * --row-h and two vertical margin lines (red left, azure right) --margin from the
 * sides. js/paper.js places the big titles on these lines.
 * It is kept at a few percent of opacity on purpose: the page must read as
 * plain paper first and as ruled paper only when looked at.
 */

html[data-theme="paper"] {
  --bg: #fcfbf6;
  --fg: #1c1b17;
  --muted: #66625a;
  --line: rgba(60, 50, 20, .14);
  --card: rgba(253, 252, 248, .96);
  --shadow: 0 8px 30px rgba(60, 45, 10, .08);
  --halo: rgba(252, 251, 246, .9);
  --field: #fdfcf9;
  --field-line: #d4cfbd;
  --ring: rgba(60, 45, 10, .14);

  --rule: rgba(60, 60, 70, .075);           /* horizontal lines */
  --margin-left: rgba(229, 50, 45, .30);    /* vertical lines: the red and azure of the logo, paled to stay in the background */
  --margin-right: rgba(30, 167, 232, .34);  /* set both to transparent to remove them */
  --row-h: 36px;                            /* distance between two horizontal lines */
  --margin: clamp(20px, 5vw, 72px);         /* distance of the vertical lines from the sides */

  /* the brain is a little smaller and lower, so it clears the titles that now sit on the lines */
  --brain-scale: .85;
  --brain-y: .57;
  --brain-clear: 1;                         /* and it fits itself in the free space between the titles, on any screen */
}

html[data-theme="paper"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--margin-left), var(--margin-left)),
    linear-gradient(var(--margin-right), var(--margin-right)),
    linear-gradient(to bottom, transparent calc(var(--row-h) - 1px), var(--rule) calc(var(--row-h) - 1px));
  background-size:
    1px 100%,
    1px 100%,
    100% var(--row-h);
  background-position:
    var(--margin) 0,
    calc(100% - var(--margin)) 0,
    0 0;
  background-repeat: no-repeat, no-repeat, repeat-y;
}

/* In the stacked layout the page scrolls, so the ruling scrolls with it. */
html[data-theme="paper"] body.static::before {
  position: absolute;
  min-height: 100%;
}

/* Titles stay inside the two vertical margin lines, with a little air. */
html[data-theme="paper"] .disp.tl {
  left: calc(var(--margin) + 16px);
}
html[data-theme="paper"] .disp.br {
  right: calc(var(--margin) + 16px);
}
@media (max-width: 700px) {
  html[data-theme="paper"] .disp {
    max-width: calc(100vw - 2 * var(--margin) - 32px);
  }
}
