/* Quorble sketch theme: the hand-drawn look (variant D of the playful exploration) applied to the shared
   component library. Everything here is scoped to html[data-theme="sketch"]; with the attribute absent this
   file does nothing and the pages keep the serious look from components.css and tokens.css.

   It only re-declares the tokens each component owns (see components.css) and adds a few overrides for
   things a token cannot express (a selector, a state). It never touches tokens.css and the markup is shared.
   Sketch-only details live here: the two handwriting fonts, the ruled paper, the uneven corners, the ink
   outlines, the marker highlight and the offset shadow.

   How to add another theme: copy this file, change the attribute value and the values, link it after
   components.css, and teach the switch the new name. */

@import url("https://fonts.googleapis.com/css2?family=Patrick+Hand&family=Gloria+Hallelujah&display=swap");

html[data-theme="sketch"] {
  /* Theme-private palette and shapes. Not tokens: nothing outside this file reads them. */
  --sk-paper: #fbf7ee;
  --sk-surface: #fffdf7;
  --sk-ink: #2b2b2b;
  --sk-ink-2: #6f6a60;
  --sk-line: #2b2b2b;          /* outlines are ink, not a grey hairline */
  --sk-pencil: #b9b4a8;        /* disabled: pencilled in, dashed */
  --sk-marker: #fff176;        /* yellow marker highlight */
  --sk-marker-2: #ffd54f;      /* the darker marker, for a filled bar */
  --sk-danger: #d64545;
  --sk-font: "Patrick Hand", "Comic Sans MS", cursive;
  --sk-font-h: "Gloria Hallelujah", "Patrick Hand", cursive;
  --sk-wobble: 255px 15px 225px 15px / 15px 225px 15px 255px;    /* two hand-drawn corner sets, alternated */
  --sk-wobble-2: 15px 255px 15px 225px / 225px 15px 255px 15px;
  --sk-shadow: 3px 3px 0 rgba(43, 43, 43, .25);
  --sk-rule: repeating-linear-gradient(transparent 0 31px, rgba(70, 110, 180, .14) 31px 32px);
  --sk-rule-size: 100% 32px;
  --sk-highlight: linear-gradient(transparent 55%, var(--sk-marker) 55%, var(--sk-marker) 92%, transparent 92%);
  --sk-highlight-fill: linear-gradient(transparent 20%, var(--sk-marker) 20%, var(--sk-marker) 85%, transparent 85%);
  --sk-control: 52px;
  --sk-control-lg: 60px;
}

/* ---- Page: ruled paper, handwriting, a marker stroke under the title ---- */
html[data-theme="sketch"] body {
  --page-bg: var(--sk-paper);
  --page-bg-image: var(--sk-rule);
  --page-bg-size: var(--sk-rule-size);
  --page-font: var(--sk-font);
  --page-text: 19px;
  --page-ink: var(--sk-ink);
  --page-ink-2: var(--sk-ink-2);
}
html[data-theme="sketch"] :is(h1, h2, h3) { --heading-font: var(--sk-font-h); --heading-weight: 400; }
html[data-theme="sketch"] h1 { --h1-text: 30px; --h1-leading: 1.15; --heading-bg: var(--sk-highlight); --heading-pad: 0 6px;
                               --heading-width: fit-content; --heading-transform: rotate(-1deg); }
html[data-theme="sketch"] .note { --note-text: 16px; }
html[data-theme="sketch"] footer { --footer-text: 15px; }

/* ---- Word row ---- */
html[data-theme="sketch"] .word { --word-bg: var(--sk-surface); --word-border: 2px solid var(--sk-line); --word-radius: var(--sk-wobble);
                                  --word-match-font: var(--sk-font-h); --word-match-border: 3px solid var(--sk-line);
                                  --word-match-bg: var(--sk-highlight-fill) var(--sk-surface); --word-fail-ink: var(--sk-danger); }
html[data-theme="sketch"] .word:nth-child(2n) { --word-radius: var(--sk-wobble-2); }
html[data-theme="sketch"] .word.spoiled { --word-spoiled-ink: var(--sk-ink); --word-spoiled-weight: 400; }

/* ---- Player dot: the letter is handwritten; colours stay the player tokens ---- */
html[data-theme="sketch"] .player { --player-letter-font: var(--sk-font-h); --player-letter-weight: 400; --player-ring: 0 0 0 2px var(--sk-line); }

/* The pencil badge gets the same ink outline as the dot it sits on, and the dashed focus ring the buttons use. */
html[data-theme="sketch"] .edit { --edit-bg: var(--sk-surface); --edit-border: 2px solid var(--sk-line); --edit-ink: var(--sk-ink);
                                  --edit-focus-outline: 2px dashed var(--sk-ink); --edit-focus-offset: 3px; }

/* ---- Grey line: the same size as a field label, as in the serious look ---- */
html[data-theme="sketch"] .line { --line-text: 18px; --line-ink: var(--sk-ink-2); }

/* ---- Timer, points line: ink outlines, uneven corners; stage colours stay the timer tokens ---- */
html[data-theme="sketch"] .timer-row { --timer-ink: var(--sk-ink-2); --timer-urgent-ink: var(--sk-danger); }
html[data-theme="sketch"] .timer { --timer-bg: var(--sk-surface); --timer-border: 2px solid var(--sk-line); --timer-radius: var(--sk-wobble); }
html[data-theme="sketch"] .bottom { --bottom-ink: var(--sk-ink-2); --bottom-strong: var(--sk-ink); --bottom-line: 2px solid var(--sk-line); }
html[data-theme="sketch"] .spoil { --spoil-ink: var(--sk-ink); --spoil-failed-ink: var(--sk-danger); --spoil-decoration: underline; }

/* ---- Text entry ---- */
html[data-theme="sketch"] .field { --field-gap: 6px; --field-label-text: 18px; --field-label-ink: var(--sk-ink-2);
                                   --field-error-ink: var(--sk-danger); --field-error-text: 16px; }
html[data-theme="sketch"] .input {
  --input-height: var(--sk-control); --input-pad: 16px; --input-font: var(--sk-font); --input-text: 20px;
  --input-ink: var(--sk-ink); --input-bg: var(--sk-surface); --input-border: 2px solid var(--sk-line); --input-radius: var(--sk-wobble);
  --input-placeholder: var(--sk-ink-2); --input-focus-outline: none;
  --input-disabled-bg: transparent; --input-disabled-ink: var(--sk-pencil); --input-error: var(--sk-danger);
  --input-height-lg: var(--sk-control-lg); --input-text-lg: 24px; --input-pad-lg: 18px;
}
/* Focus is the ink line drawn thicker, as in variant D; disabled is pencilled in. Neither is a token. */
html[data-theme="sketch"] .input:focus, html[data-theme="sketch"] .input.is-focus { border-width: 3px; }
html[data-theme="sketch"] .input:disabled { border-color: var(--sk-pencil); border-style: dashed; }

/* ---- Buttons ---- */
html[data-theme="sketch"] .btn {
  --btn-height: var(--sk-control); --btn-pad: 14px; --btn-font: var(--sk-font); --btn-text: 19px; --btn-weight: 400;
  --btn-ink: var(--sk-ink); --btn-bg: var(--sk-surface); --btn-border: 2px solid var(--sk-line); --btn-radius: var(--sk-wobble-2);
  --btn-focus-outline: 2px dashed var(--sk-ink); --btn-focus-offset: 3px;
  --btn-height-lg: var(--sk-control-lg); --btn-pad-lg: 18px; --btn-text-lg: 22px;
  --btn-primary-bg: var(--sk-ink); --btn-primary-border-color: var(--sk-line); --btn-primary-ink: var(--sk-surface);
  --btn-primary-hover-bg: var(--sk-ink); --btn-primary-active-bg: var(--sk-ink);
  --btn-secondary-hover-bg: var(--sk-paper); --btn-secondary-active-border-color: var(--sk-ink);
  --btn-text-hover-ink: var(--sk-ink); --btn-text-active-bg: var(--sk-marker);
  --btn-disabled-bg: transparent; --btn-disabled-border-color: var(--sk-pencil); --btn-disabled-ink: var(--sk-pencil);
}
html[data-theme="sketch"] .btn:nth-child(2n) { --btn-radius: var(--sk-wobble); }
/* The primary is the ink-filled one: taller, handwritten heading font, a touch askew, an offset shadow that collapses when pressed. */
html[data-theme="sketch"] .btn.primary { --btn-height: var(--sk-control-lg); --btn-font: var(--sk-font-h); --btn-text: 22px;
                                         --btn-border: 3px solid var(--sk-line); --btn-radius: var(--sk-wobble);
                                         --btn-shadow: var(--sk-shadow); --btn-transform: rotate(.6deg); }
html[data-theme="sketch"] .btn.primary:active, html[data-theme="sketch"] .btn.primary.is-active { --btn-shadow: none; --btn-transform: rotate(.6deg) translate(2px, 2px); }
html[data-theme="sketch"] .btn.primary:disabled, html[data-theme="sketch"] .btn.primary.is-disabled { --btn-shadow: none; --btn-transform: none; --btn-border: 2px solid var(--sk-pencil); }
html[data-theme="sketch"] .btn.text { --btn-text-pad: 8px; }
html[data-theme="sketch"] .btn:disabled, html[data-theme="sketch"] .btn.is-disabled { border-style: dashed; }
html[data-theme="sketch"] .btn.text:disabled, html[data-theme="sketch"] .btn.text.is-disabled { border-style: solid; }

/* ---- Choice: the chosen one is marker-highlighted, thicker, tilted; the other is pencilled (dashed) ---- */
html[data-theme="sketch"] .choice { --choice-gap: 12px; --choice-pad: 8px; --choice-off-ink: var(--sk-ink-2); --choice-off-weight: 400;
                                    --choice-on-ink: var(--sk-ink); --choice-on-weight: 400; --choice-on-outline: none; --choice-on-offset: 0;
                                    --choice-on-disabled-ink: var(--sk-pencil); }
html[data-theme="sketch"] .choice .btn[aria-pressed="true"] { --btn-border: 3px solid var(--sk-line); --btn-transform: rotate(-1deg);
                                                               --btn-bg: var(--sk-highlight-fill) var(--sk-surface); }
html[data-theme="sketch"] .choice .btn[aria-pressed="false"] { --btn-border: 2px dashed var(--sk-line); }
html[data-theme="sketch"] .choice .btn[aria-pressed="true"]:disabled { --btn-border: 3px dashed var(--sk-pencil); }

/* ---- Turn screen: Last turn keeps the ink-outlined rows, a touch roomier than the serious cut since the hand is taller; the
   Show all link is handwriting, underlined like every link here; the sent mark is ink; the Spoil button is a plain secondary
   with ink text, and the spoiling line is ink in the heading hand, as tall as the sketch entry box, since the spoiler blue is
   not in this palette ---- */
html[data-theme="sketch"] .frame.turn { --frame-gap: 14px; }
html[data-theme="sketch"] .entry-row { --entry-gap: 12px; }
html[data-theme="sketch"] .last { --last-gap: 8px; --last-row-pad: 8px 14px; --last-max: 204px; --last-edge: 2px solid var(--sk-line); --more-text: 18px; --more-ink: var(--sk-ink-2); --more-weight: 400;
                                  --more-pad: 6px 0; --more-hover-ink: var(--sk-ink); --more-active-bg: var(--sk-marker); }
html[data-theme="sketch"] .more { text-decoration: underline; }
html[data-theme="sketch"] .earlier { --earlier-gap: 8px; --earlier-edge: 2px dashed var(--sk-line); --earlier-space: 14px; --earlier-action-ink: var(--sk-ink-2); --earlier-action-weight: 400; }
html[data-theme="sketch"] .played { --played-pad: 18px; --played-gap: 8px; --played-mark: 22px; }
html[data-theme="sketch"] .sent { --sent-size: 22px; --sent-ink: var(--sk-ink); }
html[data-theme="sketch"] .spoiling { --spoiling-height: var(--sk-control-lg); --spoiling-font: var(--sk-font-h); --spoiling-text: 22px; --spoiling-weight: 400;
                                      --spoiling-ink: var(--sk-ink); --spoiling-pad: 18px; }

/* ---- Round over, game over: the Spoiled! heading is ink, as the spoiler blue is not in this palette; the standings keep
   ink rules between rows in the hand; the final figure is the heading hand; the two stacked buttons sit a little apart so the
   primary's offset shadow clears the one above ---- */
html[data-theme="sketch"] .outcome { --outcome-spoiled-ink: var(--sk-ink); }
html[data-theme="sketch"] .scores { --scores-text: 19px; --scores-ink: var(--sk-ink); --scores-ink-2: var(--sk-ink-2); --scores-neg-ink: var(--sk-danger);
                                    --scores-line: 2px solid var(--sk-line); --scores-pad: 8px 0; --scores-gap: 12px; --scores-delta-text: 16px;
                                    --scores-total-weight: 400; --scores-you-weight: 400; --scores-rank-width: 18px; }
html[data-theme="sketch"] .score.you .name { text-decoration: underline; }
html[data-theme="sketch"] .final { --final-gap: 6px; --final-font: var(--sk-font-h); --final-text: 30px; --final-leading: 1.15; --final-weight: 400; }
html[data-theme="sketch"] .actions { --actions-gap: 12px; }

/* ---- Spectator and votes: the who rows and the tally take the hand's sizes and ink rules; the watching line is the heading
   hand, as tall as the sketch entry box, like the spoiling line; an option's Put to a vote sits a little further from its
   control ---- */
html[data-theme="sketch"] .who { --who-gap: 12px; --who-dot-gap: 6px; --who-text: 18px; --who-ink: var(--sk-ink-2); }
html[data-theme="sketch"] .tally { --tally-text: 19px; --tally-ink: var(--sk-ink); --tally-line: 2px solid var(--sk-line); --tally-pad: 8px 0; --tally-count-weight: 400; }
html[data-theme="sketch"] .watching { --watching-height: var(--sk-control-lg); --watching-font: var(--sk-font-h); --watching-text: 22px; --watching-weight: 400; --watching-ink: var(--sk-ink); }
html[data-theme="sketch"] .field.option { --option-gap: 12px; }

/* ---- Stepper ---- */
html[data-theme="sketch"] .step { --step-gap: 12px; --step-btn-width: var(--sk-control); --step-btn-weight: 400; --step-btn-text: 28px; }

/* ---- Your look: the colour box is an ink-outlined wobbly box like the inputs; a swatch gets the dot's ink ring, and the
   chosen one the dashed ring the buttons use for focus, since an inset ink outline vanishes on a dark colour here ---- */
html[data-theme="sketch"] .color { --picker-size: var(--sk-control); --picker-pad: 6px; --picker-bg: var(--sk-surface);
                                   --picker-border: 2px solid var(--sk-line); --picker-radius: var(--sk-wobble);
                                   --picker-swatch-radius: var(--sk-wobble-2); --picker-error: var(--sk-danger); }
html[data-theme="sketch"] .swatch { --swatch-border: 2px solid var(--sk-line); --swatch-on-outline: 2px dashed var(--sk-ink); --swatch-on-offset: 3px;
                                    --swatch-disabled-bg: transparent; --swatch-disabled-border: 2px dashed var(--sk-pencil); }

/* ---- Room bar and Leave confirm: ink rule under them on the paper, the handwriting at its larger sizes ---- */
html[data-theme="sketch"] .roombar { --roombar-bg: var(--sk-paper); --roombar-line: 2px solid var(--sk-line); --roombar-ink: var(--sk-ink);
                                     --roombar-ink-2: var(--sk-ink-2); --roombar-text: 16px; --roombar-strong: 19px;
                                     --roombar-eyebrow: 15px; --roombar-eyebrow-weight: 400; }
html[data-theme="sketch"] .confirm { --confirm-bg: var(--sk-surface); --confirm-line: 2px solid var(--sk-line); --confirm-ink: var(--sk-ink);
                                     --confirm-text: 21px; --confirm-shadow: var(--sk-shadow); }
html[data-theme="sketch"] .top .next { color: var(--sk-ink); }

/* ---- Phone frames: a sheet of ruled paper with an ink edge and a dropped shadow ---- */
html[data-theme="sketch"] :is(.frame, .mock) { --frame-bg: var(--sk-paper); --frame-bg-image: var(--sk-rule); --frame-bg-size: var(--sk-rule-size);
                                              --frame-border: 2px solid var(--sk-line); --frame-radius: var(--sk-wobble); --frame-shadow: var(--sk-shadow); }
html[data-theme="sketch"] .frame { --frame-h1-text: 30px; }

/* ---- The switch itself ---- */
html[data-theme="sketch"] .theme-switch { --switch-bg: var(--sk-surface); --switch-border: 2px solid var(--sk-line); --switch-radius: var(--sk-wobble-2);
                                          --switch-font: var(--sk-font); --switch-text: 16px; --switch-ink: var(--sk-ink-2);
                                          --switch-on-bg: var(--sk-ink); --switch-on-ink: var(--sk-surface); --switch-shadow: var(--sk-shadow); }
