/* BlokStreams Books — shared look for the library, profiles and sign-in pages.
   A library at night: warm black, cream type, one reading-lamp amber. */
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0d0c0b; --bg2: #141210; --card: #1b1916; --card2: #25221d; --line: #2e2a24;
  --fg: #f5f0e7; --muted: #a09889; --dim: #6f695f;
  --accent: #f2a93b; --accent-hi: #ffd58a; --accent-ink: #1d1202;
  --accent-text: #f2a93b; --accent-strong: #ffd58a;
  --danger: #ff7566; --chipbg: #1f1c18;
  --glass-1: rgba(13, 12, 11, .94); --glass-2: rgba(13, 12, 11, .8);
  --tint: rgba(255, 255, 255, .06); --tint-2: rgba(255, 255, 255, .04); --shadow: #000;
  --lamp: rgba(242, 169, 59, .16); --grain: .5; --hero-fade: var(--bg);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --spring: cubic-bezier(.3, 1.45, .5, 1);
  --pad: 16px;
}
/* Daylight: warm paper instead of warm black. Follows the device unless a choice was saved. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f1e7; --bg2: #fffaf1; --card: #ece4d5; --card2: #e2d8c5; --line: #d9cdb8;
    --fg: #221c14; --muted: #6d6454; --dim: #9b917e;
    --accent: #eda42f; --accent-hi: #ffd58a; --accent-text: #98590a; --accent-strong: #98590a;
    --danger: #c5382b; --chipbg: #ede5d6;
    --glass-1: rgba(246, 241, 231, .95); --glass-2: rgba(246, 241, 231, .82);
    --tint: rgba(60, 42, 12, .07); --tint-2: rgba(60, 42, 12, .045); --shadow: rgba(70, 48, 14, .42);
    --lamp: rgba(242, 169, 59, .22); --grain: 0; --hero-fade: rgba(17, 14, 11, .72);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f1e7; --bg2: #fffaf1; --card: #ece4d5; --card2: #e2d8c5; --line: #d9cdb8;
  --fg: #221c14; --muted: #6d6454; --dim: #9b917e;
  --accent: #eda42f; --accent-hi: #ffd58a; --accent-text: #98590a; --accent-strong: #98590a;
  --danger: #c5382b; --chipbg: #ede5d6;
  --glass-1: rgba(246, 241, 231, .95); --glass-2: rgba(246, 241, 231, .82);
  --tint: rgba(60, 42, 12, .07); --tint-2: rgba(60, 42, 12, .045); --shadow: rgba(70, 48, 14, .42);
  --lamp: rgba(242, 169, 59, .22); --grain: 0; --hero-fade: rgba(17, 14, 11, .72);
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (min-width: 760px) { :root { --pad: clamp(24px, 4vw, 64px); } }

* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { font-family: var(--sans); color: var(--fg); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* lamp light from above, and a little paper grain so the black is never flat */
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; }
body::before {
  background:
    radial-gradient(70rem 30rem at 50% -14rem, var(--lamp), transparent 70%),
    radial-gradient(40rem 28rem at 110% 30%, rgba(214, 96, 44, .07), transparent 70%);
}
body::after {
  opacity: var(--grain);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.ic.fill { fill: currentColor; }

/* the mark: an open book whose pages lift once on arrival */
.mark { display: block; overflow: visible; }
.mark .pg { transform-box: fill-box; transform-origin: 50% 100%; animation: pageLift 1.1s var(--spring) .15s backwards; }
.mark .pg.r { animation-delay: .28s; }
@keyframes pageLift { from { transform: scaleY(.2) translateY(6px); opacity: 0; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 13px 20px; font-size: 16px; font-weight: 700;
  transition: transform .18s var(--ease), filter .18s, box-shadow .18s;
}
.btn:active { transform: scale(.97); }
.btn-gold {
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-hi), var(--accent) 60%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 10px 26px -10px rgba(242, 169, 59, .7);
}
@media (hover: hover) { .btn-gold:hover { transform: translateY(-1px); filter: brightness(1.06); } }
.btn-quiet { background: var(--tint); color: var(--fg); border: 1px solid var(--line); backdrop-filter: blur(8px); }

.field {
  width: 100%; padding: 14px 16px; font-size: 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--tint-2); color: var(--fg); outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field::placeholder { color: var(--dim); }
.field:focus { border-color: var(--accent); background: rgba(242, 169, 59, .05); box-shadow: 0 0 0 4px rgba(242, 169, 59, .14); }

/* books drifting up through the lamp light behind the sign-in and profile screens */
.drift { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.drift i {
  position: absolute; bottom: -22vh; left: var(--x); width: var(--w); aspect-ratio: 2 / 3; border-radius: 3px 7px 7px 3px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .35) 0 6%, rgba(255, 255, 255, .1) 7% 8%, transparent 12%), var(--c);
  opacity: 0; animation: driftUp var(--t) linear var(--d) infinite;
}
@keyframes driftUp {
  0% { transform: translateY(0) rotate(var(--r)); opacity: 0; }
  12% { opacity: var(--o, .16); }
  80% { opacity: var(--o, .16); }
  100% { transform: translateY(-135vh) rotate(calc(var(--r) * -1)); opacity: 0; }
}

@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .35; } }

@view-transition { navigation: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0ms !important; }
  .drift { display: none; }
}

/* a profile picture: one of the drawn book characters, clipped to a soft square */
.avatar { display: block; overflow: hidden; border-radius: 28%; }
.avatar svg { display: block; width: 100%; height: 100%; }
html { transition: background-color .3s; }
