/* Pagelight's look, shared by every page: glass over a colour field.

   The tokens, the drifting colour behind the glass, and the controls every
   page has (buttons, fields, the logo). Each page's own stylesheet adds its
   layout on top: app.css, site.css, settings.css. The landing page (/) is
   self-contained in next.css with the same values.

   brand.css still sets the older paper names (--paper, --ink, ...); they are
   pointed at the glass colours on body, so anything that reads them follows.

   Book pages are always paper. Nothing here filters a page image. */

:root {
  --bg: #06070C;
  --text: #F2F3F7;
  --text-2: rgba(242, 243, 247, .72);
  --text-3: rgba(242, 243, 247, .5);
  --glass: rgba(255, 255, 255, .07);
  --glass-2: rgba(255, 255, 255, .03);
  --glass-strong: rgba(14, 16, 26, .78);
  --rim: rgba(255, 255, 255, .14);
  --rim-top: rgba(255, 255, 255, .26);
  --hair: rgba(255, 255, 255, .09);
  --wash: rgba(255, 255, 255, .05);
  --shadow: 0 24px 60px -28px rgba(2, 4, 14, .8);
  --hl: #FFD34D;
  --hl-ink: #1D1500;
  --teal: #1FB5A9;
  --coral: #FF7A59;
  --user: rgba(31, 181, 169, .2);
  --user-rim: rgba(31, 181, 169, .38);
  --desk: rgba(0, 0, 0, .28);
  --blob-a: rgba(31, 181, 169, .34);
  --blob-b: rgba(255, 211, 77, .2);
  --blob-c: rgba(255, 122, 89, .2);
  --display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --sans: "IBM Plex Sans Arabic", "Readex Pro", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #EEF1F6; --text: #0B0D14; --text-2: rgba(11, 13, 20, .7); --text-3: rgba(11, 13, 20, .5);
    --glass: rgba(255, 255, 255, .58); --glass-2: rgba(255, 255, 255, .34); --glass-strong: rgba(255, 255, 255, .86);
    --rim: rgba(255, 255, 255, .8); --rim-top: rgba(255, 255, 255, .95); --hair: rgba(11, 13, 20, .09); --wash: rgba(11, 13, 20, .04);
    --shadow: 0 24px 60px -30px rgba(40, 56, 90, .35);
    --user: rgba(31, 181, 169, .16); --user-rim: rgba(31, 181, 169, .34); --desk: rgba(11, 13, 20, .05);
    --blob-a: rgba(31, 181, 169, .26); --blob-b: rgba(255, 196, 40, .26); --blob-c: rgba(255, 122, 89, .2);
    --coral: #D9462B;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #EEF1F6; --text: #0B0D14; --text-2: rgba(11, 13, 20, .7); --text-3: rgba(11, 13, 20, .5);
  --glass: rgba(255, 255, 255, .58); --glass-2: rgba(255, 255, 255, .34); --glass-strong: rgba(255, 255, 255, .86);
  --rim: rgba(255, 255, 255, .8); --rim-top: rgba(255, 255, 255, .95); --hair: rgba(11, 13, 20, .09); --wash: rgba(11, 13, 20, .04);
  --shadow: 0 24px 60px -30px rgba(40, 56, 90, .35);
  --user: rgba(31, 181, 169, .16); --user-rim: rgba(31, 181, 169, .34); --desk: rgba(11, 13, 20, .05);
  --blob-a: rgba(31, 181, 169, .26); --blob-b: rgba(255, 196, 40, .26); --blob-c: rgba(255, 122, 89, .2);
  --coral: #D9462B;
  color-scheme: light;
}

body {
  /* what brand.css and the scripts reach for */
  --paper: var(--bg);
  --ink: var(--text);
  --ink-2: var(--text-2);
  --ink-3: var(--text-3);
  --rule: var(--hair);
  --tint: var(--wash);
  --marker: var(--hl);
  --marker-ink: var(--hl-ink);
  --pen: var(--coral);
  --line: 1px solid var(--hair);
  --line-ink: 1px solid var(--rim);

  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }
:focus-visible { outline-color: var(--hl) !important; }

/* ---------- the colour the glass frosts over ---------- */

.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; inline-size: 60vmax; block-size: 60vmax; border-radius: 50%; will-change: transform; animation: drift 30s var(--ease) infinite alternate; }
.aurora i:nth-child(1) { background: radial-gradient(circle, var(--blob-a), transparent 65%); inset-block-start: -24vmax; inset-inline-start: -14vmax; }
.aurora i:nth-child(2) { background: radial-gradient(circle, var(--blob-b), transparent 65%); inset-block-start: 34vh; inset-inline-end: -26vmax; animation-duration: 36s; }
.aurora i:nth-child(3) { background: radial-gradient(circle, var(--blob-c), transparent 65%); inset-block-end: -34vmax; inset-inline-start: 24vw; animation-duration: 42s; }
@keyframes drift { to { transform: translate3d(5vw, 3vh, 0) scale(1.1); } }

/* ---------- controls ---------- */

.btn {
  border: 1px solid var(--rim);
  border-radius: 12px;
  background: var(--glass);
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--rim-top);
  transition: background-color var(--t-fast) linear, transform .2s var(--ease);
}
.btn:hover { background: var(--wash); color: var(--text); }
.btn:active { transform: scale(.97); background: var(--wash); }
.btn--primary, .btn--marker { background: var(--hl); color: var(--hl-ink); border-color: transparent; box-shadow: none; }
.btn--primary:hover, .btn--marker:hover { background: color-mix(in srgb, var(--hl) 88%, white); color: var(--hl-ink); }
.btn[aria-pressed="true"] { background: var(--hl); color: var(--hl-ink); border-color: transparent; }
.btn[disabled], .btn[aria-disabled="true"] { background: transparent; color: var(--text-3); border-color: var(--hair); box-shadow: none; }

select, textarea, input {
  color: var(--text);
  background-color: var(--wash);
  border: 1px solid var(--hair);
  border-radius: 12px;
}
select:focus, textarea:focus, input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--hl) 55%, transparent); border-color: transparent; }
select option { background: var(--bg); color: var(--text); }

.pagenum, .cite, .saved-count, .gist-cite { border-radius: 6px; }

.logo { color: var(--text); }
/* the mark: tools/brand.py draws it */
.logo-mark { inline-size: 26px; block-size: 26px; border-radius: 7px; }

/* a frosted card, for any page */
.glass {
  background: linear-gradient(180deg, var(--glass), var(--glass-2));
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--rim);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 var(--rim-top), var(--shadow);
}
