/* ═══════════════════════════════════════════════════════════════════════════
   GdeSvoi - character themes on top of app.css:
     notebook - squared school notebook, messages written by hand in ballpoint ink;
     weather  - the chat lives in the current weather of its city (layer drawn by weather.js).
   Both work in light and dark mode (data-theme) like the colour schemes.
═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Caveat'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/caveat-cyr.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Caveat'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/caveat-lat.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

/* ─── Notebook ──────────────────────────────────────────────────────────── */
[data-scheme="notebook"] {
  --paper: #fbfaf4; --ink: #1f3a93; --ink-2: #2f62d8; --grid: rgba(120, 165, 220, .38); --margin: #e8848c;
  --hand: 'Caveat', 'Segoe Print', 'Comic Sans MS', cursive;
  --bg: var(--paper); --bg-2: #f4f1e4; --surface: #fffef9; --surface-2: #f6f3e6; --surface-3: #ece7d4;
  --text: #1f2a44; --text-2: #34405e; --muted: #5d6470; --faint: #8c92a0;
  --line: rgba(31, 58, 147, .14); --line-2: rgba(31, 58, 147, .22);
  --brand: var(--ink); --brand-2: #d12072; --brand-soft: rgba(47, 98, 216, .12); --brand-ink: var(--ink);
  --mine-1: rgba(255, 219, 38, .72); --mine-2: rgba(255, 210, 24, .62); --mine-text: #10204f;
  --other: transparent; --mention: rgba(255, 219, 38, .32); --mention-line: #d99716;
  --shadow-1: none; --shadow-2: 0 6px 18px -8px rgba(31, 42, 68, .25);
}
[data-scheme="notebook"][data-theme="dark"] {
  /* school board: dark green-grey slate, chalk-white lines and writing */
  --paper: #1e2925; --ink: #e9efe9; --ink-2: #9fd3c0; --grid: rgba(220, 235, 225, .09); --margin: rgba(240, 140, 150, .45);
  --bg: var(--paper); --bg-2: #18211e; --surface: #222e2a; --surface-2: #2a3732; --surface-3: #33423c;
  --text: #eef2ee; --text-2: #d0dad4; --muted: #a2b1aa; --faint: #74857d;
  --line: rgba(233, 239, 233, .12); --line-2: rgba(233, 239, 233, .2);
  --brand: #9fd3c0; --brand-2: #f4a6c2; --brand-soft: rgba(159, 211, 192, .14); --brand-ink: #e9efe9;
  --mine-1: rgba(255, 226, 120, .2); --mine-2: rgba(255, 226, 120, .14); --mine-text: #fff4c4;
  --other: transparent; --mention: rgba(255, 226, 120, .12);
}
[data-scheme="notebook"] .feed {
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent calc(100% - 34px), var(--margin) calc(100% - 34px), var(--margin) calc(100% - 32.5px), transparent calc(100% - 32.5px)),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 20px 20px, 20px 20px;
  background-attachment: local;
}
[data-scheme="notebook"] .bubble {
  font-family: var(--hand); font-size: 21px; line-height: 1.2; color: var(--ink);
  box-shadow: none; padding: 4px 8px 4px; background: transparent;
}
[data-scheme="notebook"] .msg:not(.mine) .bubble { border-radius: 4px; }
[data-scheme="notebook"] .msg.mine .bubble {
  color: var(--mine-text); border-radius: 10px 4px 12px 5px / 5px 12px 4px 10px;
  background:
    linear-gradient(-2deg, transparent 4%, var(--mine-1) 9%, var(--mine-2) 92%, transparent 97%);
}
[data-scheme="notebook"] .msg.mention .bubble { background: var(--mention); box-shadow: inset 2px 0 0 var(--mention-line); }
[data-scheme="notebook"] .msg.ai .bubble { box-shadow: inset 2px 0 0 var(--brand-2); }
[data-scheme="notebook"] .bubble .meta { font-family: var(--font); font-size: 10.5px; color: var(--faint); }
[data-scheme="notebook"] .msg.mine .bubble .meta { color: color-mix(in srgb, var(--mine-text) 60%, transparent); }
[data-scheme="notebook"] .bubble .at, [data-scheme="notebook"] .msg.mine .bubble .at { color: #d12072; }
[data-scheme="notebook"][data-theme="dark"] .bubble .at { color: #f4a6c2; }
[data-scheme="notebook"] .who { font-family: var(--hand); font-size: 18px; font-weight: 700; margin-bottom: 0; }
[data-scheme="notebook"] .topbar h1,
[data-scheme="notebook"] .sheet h2, [data-scheme="notebook"] .sheet h3 { font-family: var(--hand); font-size: 26px; font-weight: 700; letter-spacing: 0; }
[data-scheme="notebook"] .day-sep { font-family: var(--hand); font-size: 17px; background: var(--paper); border-style: dashed; }
[data-scheme="notebook"] .composer textarea, [data-scheme="notebook"] .composer input { font-family: var(--hand); font-size: 21px; }
[data-scheme="notebook"] .btn.primary, [data-scheme="notebook"] .send-btn { background: var(--ink); color: var(--paper); }
[data-scheme="notebook"] .msg .ava { filter: saturate(.7); }

/* ─── Weather ───────────────────────────────────────────────────────────── */
[data-scheme="weather"] {
  --wx-sky-1: #dbe8fb; --wx-sky-2: #f4f5f6;
  --brand: #123fe2; --brand-2: #f92689; --mine-1: #2459f0; --mine-2: #0f37c0;
}
[data-scheme="weather"][data-theme="dark"] { --wx-sky-1: #0d1830; --wx-sky-2: #0f1216; --brand: #4c7bee; --brand-2: #fe76a7; }
[data-scheme="weather"][data-wx="clear"][data-wx-day="1"] { --wx-sky-1: #cfe3ff; --wx-sky-2: #fff3dc; }
[data-scheme="weather"][data-wx="clear"][data-wx-day="0"] { --wx-sky-1: #0b1430; --wx-sky-2: #141c3a; }
[data-scheme="weather"][data-wx="clouds"] { --wx-sky-1: #d7dde6; --wx-sky-2: #eef0f3; }
[data-scheme="weather"][data-wx="rain"],
[data-scheme="weather"][data-wx="storm"] { --wx-sky-1: #c5cfdc; --wx-sky-2: #e3e8ee; }
[data-scheme="weather"][data-wx="snow"] { --wx-sky-1: #e9f1fb; --wx-sky-2: #f8fbff; }
[data-scheme="weather"][data-wx="fog"] { --wx-sky-1: #e4e6e9; --wx-sky-2: #f1f2f3; }
[data-scheme="weather"][data-theme="dark"][data-wx="clouds"],
[data-scheme="weather"][data-theme="dark"][data-wx="fog"] { --wx-sky-1: #1a2029; --wx-sky-2: #11151b; }
[data-scheme="weather"][data-theme="dark"][data-wx="rain"],
[data-scheme="weather"][data-theme="dark"][data-wx="storm"] { --wx-sky-1: #141d2b; --wx-sky-2: #0d1118; }
[data-scheme="weather"][data-theme="dark"][data-wx="snow"] { --wx-sky-1: #1a2436; --wx-sky-2: #121821; }
[data-scheme="weather"][data-theme="dark"][data-wx="clear"][data-wx-day="1"] { --wx-sky-1: #13284f; --wx-sky-2: #1c1a24; }

[data-scheme="weather"] .main { background: linear-gradient(180deg, var(--wx-sky-1), var(--wx-sky-2)); transition: background 1.2s var(--ease); }
[data-scheme="weather"] .feed { position: relative; z-index: 1; }
[data-scheme="weather"] .bubble { backdrop-filter: blur(6px); }
[data-scheme="weather"] .msg:not(.mine) .bubble { background: color-mix(in srgb, var(--surface) 84%, transparent); }
[data-scheme="weather"] .day-sep { background: color-mix(in srgb, var(--surface) 70%, transparent); }

/* the layer itself: fixed behind the feed, never catches taps */
.wx-layer { position: absolute; inset: var(--top) 0 0 0; pointer-events: none; z-index: 0; overflow: hidden; }
.wx-layer canvas { width: 100%; height: 100%; display: block; }
.wx-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.wx-flash.on { animation: wx-flash .9s ease-out; }
@keyframes wx-flash { 0% { opacity: 0; } 8% { opacity: .55; } 16% { opacity: .1; } 24% { opacity: .4; } 100% { opacity: 0; } }

/* weather chip in the chat header */
.wx-chip { display: none; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 650; color: var(--text-2);
  background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); border-radius: 20px; padding: 3px 9px; white-space: nowrap; }
[data-scheme="weather"] .wx-chip.on { display: inline-flex; }
@media (max-width: 480px) { .wx-chip { padding: 3px 7px; font-size: 12px; } [data-scheme="weather"] .topbar .title { min-width: 0; } [data-scheme="weather"] .topbar .sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }

@media (prefers-reduced-motion: reduce) { .wx-layer canvas { display: none; } }
