/* =====================================================================
   Horizon: white screens, one blue, grey push buttons, a GREEN FRAME around
   whatever is selected, bold black pictograms. A sober, clinical look given
   depth: soft gradients on buttons, raised panels, and a planet as a faint
   horizon behind the page.
   Spec: docs/themes/horizon.md
   ===================================================================== */
:root[data-theme="horizon"] {
  color-scheme: light;
  --hz-blue: #1f5fb4; --hz-blue-dark: #174a8f; --hz-ink: #15181d; --hz-navy: #0f2747;
  --select: #2ea043;
  --bg: #eef2f6; --bg-2: #fbfcfd; --surface: #fff; --surface-2: #f3f6f9; --well: #e5eaf0;
  --text: var(--hz-ink); --muted: #4a5360; --faint: #69737f; --border: #d3dae2; --border-strong: #9eabb9; --rule: var(--border-strong);
  --accent: var(--hz-blue);
  --primary: var(--hz-blue); --primary-strong: var(--hz-blue-dark); --primary-contrast: #fff; --primary-soft: #eaf1fa;
  --danger: #cc1421; --danger-soft: #fbe3e5; --success: #1e8a34;
  --radius: 6px; --r-ctl: 4px; --r-ctl-in: 3px; --r-dialog: 6px; --r-menu: 6px; --r-board: 4px; --r-cell: 3px; --r-pill: 4px;
  --content-w: 880px;
  --shadow: 0 1px 2px rgba(20, 40, 70, .08), 0 16px 36px -16px rgba(20, 40, 70, .32);
  --dialog-shadow: var(--shadow);
  --menu-shadow: var(--shadow);
  --overlay: rgba(15, 39, 71, .35);
  /* grey push buttons, raised by a top highlight */
  --push: linear-gradient(180deg, #fdfdfe, #e2e7ed);
  --push-hover: linear-gradient(180deg, #fff, #eaeef3);
  --push-edge: inset 0 1px 0 #fff, 0 1px 2px rgba(20, 40, 70, .12);
  /* Frutiger is not free, so used only where installed */
  --font: Frutiger, "Frutiger Linotype", "Segoe UI", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --toast-bg: var(--hz-ink); --toast-fg: #fff; --toast-action: #9ec3ec;
  --record-bg: #e6f4ea; --record-fg: #1e8a34;
  /* 2048 (not in any app yet: blues rising to Horizon blue, green and amber on top) */
  --g-board: #d3dae2; --g-slot: #e5eaf0;
  --t2: #fff; --t4: #eef4fb; --t8: #cfe0f5; --t16: #9ec3ec; --t32: #5f98d8; --t64: #1f5fb4;
  --t128: #174a8f; --t256: #0f2747; --t512: #2ea043; --t1024: #1e8a34; --t2048: #d48a00;
  --t-ink: var(--hz-ink); --t-paper: #fff; --t16-fg: var(--hz-ink);
  /* memory grid */
  --flash: var(--hz-blue); --tile: #e5eaf0;
  /* card table: a pale screen */
  --table-bg: linear-gradient(180deg, #fff, #e9eef4);
  --table-frame: 0 0 0 1px #b9c3cf;
  --slot-line: #b9c3cf;
  --card-paper: #fff; --card-r: .05;
  --card-shadow: 0 0 0 1px #9eabb9, 0 2px 4px rgba(20, 40, 70, .15);
  --court-panel: #eaf1fa; --court-rule: inset 0 0 0 1px color-mix(in srgb, currentColor 35%, transparent);
  --suit-red: #cc1421; --suit-black: var(--hz-ink);
  --card-back-art: repeating-linear-gradient(45deg, rgba(255, 255, 255, .14) 0 1px, transparent 1px 6px), linear-gradient(180deg, #2c72c9, #174a8f);
  --back-edge: #fff; --back-edge-w: .05; --back-shadow: 0 0 0 1px #174a8f;
}
[data-theme="horizon"] ::selection { background: #cfe0f5; }
/* the backdrop: the planet turns, satellites and airliners cross (js/backdrops/horizon.js); faint over the content column */
[data-theme="horizon"] .backdrop { --veil: .55; }
/* The planet, reduced to a horizon: a pale disc rising
   from the bottom-right corner, a blue rim and a thin atmosphere. Fixed behind the page. */
[data-theme="horizon"] body::before {
  --horizon: max(70vw, 70vh);
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 112% 138%,
      rgba(31, 95, 180, .07) calc(var(--horizon) - 60px),
      rgba(31, 95, 180, .12) calc(var(--horizon) - 2px),
      rgba(31, 95, 180, .4) var(--horizon),
      rgba(76, 150, 225, .22) calc(var(--horizon) + 3px),
      rgba(120, 185, 240, .1) calc(var(--horizon) + 22px),
      transparent calc(var(--horizon) + 80px)),
    linear-gradient(180deg, var(--bg-2), var(--bg) 55%);
}
[data-theme="horizon"] body { background: transparent; }
[data-theme="horizon"] html { background: var(--bg); }

/* ---------- chrome ---------- */
[data-theme="horizon"] .topbar {
  background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 0;
  box-shadow: inset 0 3px 0 var(--hz-blue), 0 1px 0 var(--border), 0 6px 18px -12px rgba(20, 40, 70, .35);
}
[data-theme="horizon"] .brand { font-size: 1.06rem; font-weight: 700; letter-spacing: 0; }
[data-theme="horizon"] .brand-text span { color: var(--hz-blue); }
[data-theme="horizon"] .brand-mark {
  display: grid;
  border-radius: 4px;
  background: linear-gradient(180deg, #2a6fc6, var(--hz-blue-dark)); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 2px 6px rgba(23, 74, 143, .35);
}
[data-theme="horizon"] :is(.icon-btn, .theme-btn, .topbar .lang-toggle) { border: 1px solid #b7c2ce; background: var(--push); box-shadow: var(--push-edge); }
[data-theme="horizon"] :is(.icon-btn, .theme-btn):hover { background: var(--push-hover); border-color: var(--hz-blue); }
[data-theme="horizon"] .icon-btn { width: 38px; height: 38px; }
[data-theme="horizon"] .topbar .lang-toggle { padding: 2px; }
[data-theme="horizon"] .topbar .lang-toggle button[aria-pressed="true"] { background: var(--hz-blue); color: #fff; box-shadow: none; }
[data-theme="horizon"] .main-nav a { color: var(--hz-navy); border-radius: 3px; }
[data-theme="horizon"] .main-nav a:hover { background: #eef4fb; color: var(--hz-navy); }
[data-theme="horizon"] .main-nav a[aria-current="true"] { background: transparent; color: var(--hz-blue); box-shadow: inset 0 -3px 0 var(--hz-blue); border-radius: 0; }
[data-theme="horizon"] .theme-menu { border-color: #b7c2ce; }
[data-theme="horizon"] .theme-opt[aria-checked="true"] { background: #eef4fb; }
[data-theme="horizon"] .theme-opt[aria-checked="true"]:hover { background: #e1ebf7; }
[data-theme="horizon"] .theme-opt .ico { color: var(--hz-blue); }

/* ---------- controls ---------- */
[data-theme="horizon"] .btn { border-color: #aab5c2; background: var(--push); color: var(--hz-ink); box-shadow: var(--push-edge); font-weight: 700; letter-spacing: .01em; }
[data-theme="horizon"] .btn:hover:not(:disabled) { background: var(--push-hover); border-color: var(--hz-blue); }
[data-theme="horizon"] .btn-primary {
  border: 1px solid var(--hz-blue-dark);
  background: linear-gradient(180deg, #2c72c9, #1b55a2); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 2px 5px rgba(23, 74, 143, .3);
}
[data-theme="horizon"] .btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #2c72c9, #1b55a2); border-color: var(--hz-blue-dark); filter: brightness(1.07); }
[data-theme="horizon"] .btn-danger { color: var(--danger); }
/* selection is a green frame, never a fill */
[data-theme="horizon"] .segmented { background: var(--well); box-shadow: inset 0 0 0 1px var(--border); }
[data-theme="horizon"] .segmented button { color: var(--muted); }
[data-theme="horizon"] .segmented button[aria-pressed="true"] { background: #fff; color: var(--hz-ink); box-shadow: inset 0 0 0 2px var(--select), 0 1px 2px rgba(20, 40, 70, .15); }
[data-theme="horizon"] .stat { border-color: var(--border); background: linear-gradient(180deg, #fff, #f0f3f7); box-shadow: 0 1px 1px rgba(20, 40, 70, .06); }
[data-theme="horizon"] .stat-label { color: var(--faint); letter-spacing: .08em; }
[data-theme="horizon"] .stat-value { color: var(--hz-navy); }
[data-theme="horizon"] .tool { color: var(--muted); }
[data-theme="horizon"] .tool:hover:not(:disabled) { background: #eef4fb; }
[data-theme="horizon"] .tool[aria-pressed="true"] { background: #fff; color: var(--hz-ink); box-shadow: inset 0 0 0 2px var(--select); }
[data-theme="horizon"] .tool .badge { background: var(--hz-blue); }
[data-theme="horizon"] .field input { border-color: #b9c3cf; }
[data-theme="horizon"] .field input:focus-visible { outline: 0; border-color: var(--hz-blue); box-shadow: inset 0 0 0 1px var(--hz-blue); }
[data-theme="horizon"] .switch { width: 44px; height: 24px; border-radius: 4px; background: var(--push); box-shadow: inset 0 0 0 1px #aab5c2, var(--push-edge); }
[data-theme="horizon"] .switch::before { top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1px #aab5c2, 0 1px 2px rgba(20, 40, 70, .2); }
[data-theme="horizon"] .switch[aria-checked="true"] { background: linear-gradient(180deg, #2c72c9, #1b55a2); box-shadow: inset 0 0 0 1px var(--hz-blue-dark); }
[data-theme="horizon"] .switch[aria-checked="true"]::before { transform: translateX(20px); box-shadow: 0 0 0 1px var(--hz-blue-dark); }
[data-theme="horizon"] :is(.check input, .range) { accent-color: var(--hz-blue); }

/* ---------- surfaces, dialog, toast ---------- */
[data-theme="horizon"] .box { border-color: var(--border); box-shadow: 0 1px 2px rgba(20, 40, 70, .06); }
[data-theme="horizon"] .box > h3, [data-theme="horizon"] .settings-title { color: var(--hz-navy); font-weight: 700; }
[data-theme="horizon"] .dialog { border: 1px solid var(--border); border-top: 4px solid var(--hz-blue); }
[data-theme="horizon"] .dialog h2 { color: var(--hz-navy); letter-spacing: -.01em; }
[data-theme="horizon"] .rules { padding-left: 0; list-style: none; }
[data-theme="horizon"] .rules li { position: relative; padding-left: 16px; }
[data-theme="horizon"] .rules li::before { content: ""; position: absolute; left: 0; top: .55em; width: 6px; height: 6px; border-radius: 1px; background: var(--hz-blue); }
[data-theme="horizon"] .record { border-radius: 3px; }
[data-theme="horizon"] #toast { border-radius: 4px; }
[data-theme="horizon"] .install-banner { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--hz-blue); border-radius: 4px; }
[data-theme="horizon"] .drawer { border-top: 4px solid var(--hz-blue); }
[data-theme="horizon"] .icon-tile { background: linear-gradient(180deg, #fff, #f3f6f9); }

/* ---------- home ---------- */
[data-theme="horizon"] .home-hero { margin: 22px 0 8px; }
[data-theme="horizon"] .hero-title { display: block; margin: 0 0 8px; color: var(--hz-navy); font-size: clamp(1.7rem, 6vw, 2.4rem); font-weight: 700; letter-spacing: -.015em; }
[data-theme="horizon"] .hero-title::after { content: ""; display: block; width: 56px; height: 4px; margin-top: 12px; background: var(--hz-blue); }
[data-theme="horizon"] .intro { max-width: 58ch; margin: 0; color: var(--muted); line-height: 1.55; }
[data-theme="horizon"] .install-banner { margin-top: 22px; }

/* section heads: a blue square, the title in tracked capitals, a rule out to a count box */
[data-theme="horizon"] .section-head { align-items: center; gap: 4px 10px; margin: 34px 0 12px; }
[data-theme="horizon"] .section-title { display: flex; align-items: center; gap: 10px; color: var(--hz-navy); font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
[data-theme="horizon"] .section-title::before { content: ""; width: 10px; height: 10px; background: var(--hz-blue); }
[data-theme="horizon"] .section-head::after { content: ""; flex: 1; order: 2; height: 1px; background: var(--border-strong); opacity: .6; }
[data-theme="horizon"] .section-count { display: block; order: 3; min-width: 26px; padding: 2px 7px; border: 1px solid var(--border); border-radius: 3px; background: #fff; color: var(--faint); font-size: .72rem; text-align: center; }
[data-theme="horizon"] .section-note { order: 4; flex-basis: 100%; color: var(--muted); font-size: .84rem; }
[data-theme="horizon"] .page > .section-head .section-title { font-size: 1.3rem; letter-spacing: -.01em; text-transform: none; }
[data-theme="horizon"] .page > .section-head .section-title::before { width: 12px; height: 12px; }

[data-theme="horizon"] .game-list { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
[data-theme="horizon"] .game-card {
  position: relative; overflow: hidden;
  align-items: flex-start; gap: 14px; padding: 18px;
  border-color: var(--border); border-radius: 6px; background: #fff;
  box-shadow: 0 1px 2px rgba(20, 40, 70, .06);
  transition: transform .16s ease, border-color .2s, box-shadow .2s;
}
/* a blue edge slides in from the left on hover */
[data-theme="horizon"] .game-card::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--hz-blue); transform: scaleY(0); transition: transform .2s ease; }
[data-theme="horizon"] :is(.game-card:hover, .game-card:focus-visible) { transform: translateY(-2px); border-color: #b3c1d1; box-shadow: 0 2px 4px rgba(20, 40, 70, .06), 0 14px 28px -14px rgba(20, 40, 70, .35); outline: none; }
[data-theme="horizon"] :is(.game-card:hover, .game-card:focus-visible)::after { transform: none; }
[data-theme="horizon"] .game-card .game-icon { width: 44px; height: 44px; padding: 9px; border: 1px solid var(--border); border-radius: 4px; background: linear-gradient(180deg, #fff, #edf1f5); color: var(--hz-ink); box-shadow: none; }
[data-theme="horizon"] .game-icon svg { width: 100%; height: 100%; }
[data-theme="horizon"] .game-icon .ac { color: var(--hz-blue); }
/* icon tiles are drawn in #fff for a coloured box: here they become black pictograms, their currentColor parts Horizon blue */
[data-theme="horizon"] .kind-glyph .game-card .game-icon { padding: 2px; color: var(--hz-blue); }
[data-theme="horizon"] .game-icon svg [fill="#fff"] { fill: var(--hz-ink); }
[data-theme="horizon"] .game-icon svg [stroke="#fff"] { stroke: var(--hz-ink); }
[data-theme="horizon"] .kind-line .game-card .game-icon { color: var(--hz-ink); }
[data-theme="horizon"] .kind-line .game-card .game-icon svg { width: 100%; height: 100%; }
[data-theme="horizon"] .game-meta h3 { margin: 2px 0 5px; color: var(--hz-navy); font-size: 1.06rem; }
[data-theme="horizon"] .game-meta p { font-size: .87rem; line-height: 1.45; color: var(--muted); }
[data-theme="horizon"] .game-status { display: inline-block; margin-top: 11px; padding: 4px 10px; border-radius: 3px; background: #eaf1fa; color: var(--hz-blue-dark); font-size: .76rem; font-weight: 600; }
/* The card above sets align-items: flex-start, which also reaches .kind-art and would
   collapse the art panel to nothing: its art is absolutely positioned, so the box has
   no content width to shrink to, and the 16/10 aspect-ratio then gives it no height. */
[data-theme="horizon"] .kind-art .game-card { align-items: stretch; padding: 0 0 16px; gap: 12px; }
[data-theme="horizon"] .kind-art .game-card .game-icon { width: auto; height: auto; padding: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: var(--table-bg); }
[data-theme="horizon"] .kind-art .game-card .game-meta { padding: 0 16px; }

/* ---------- footer ---------- */
[data-theme="horizon"] .site-footer { background: #fff; border-top: 1px solid var(--border); box-shadow: inset 0 3px 0 var(--hz-blue); }
[data-theme="horizon"] .footer-brand { color: var(--hz-navy); }

/* ---------- game pieces: blue keys and a grey OK ---------- */
[data-theme="horizon"] .keypad button {
  border: 1px solid #1379b3; border-radius: 3px;
  background: linear-gradient(180deg, #3fb9ee, #178fd0); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 1px 2px rgba(20, 40, 70, .2);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .18);
}
[data-theme="horizon"] .keypad button:hover { border-color: #0f6699; background: linear-gradient(180deg, #55c3f1, #1d98d9); }
[data-theme="horizon"] .keypad button.accent { border-color: #aab5c2; background: var(--push); color: var(--hz-ink); box-shadow: var(--push-edge); text-shadow: none; }
[data-theme="horizon"] .mem-grid i.lit { box-shadow: 0 0 22px rgba(31, 95, 180, .3); }

/* ---------- hover: everything clickable has to visibly react ---------- */
[data-theme="horizon"] .main-nav a:hover:not([aria-current="true"]) { box-shadow: inset 0 -3px 0 #b3c8e3; }
[data-theme="horizon"] .tool:hover:not(:disabled) { color: var(--hz-blue); }
[data-theme="horizon"] .theme-opt:hover { background: #e4edf8; box-shadow: inset 3px 0 0 var(--hz-blue); }
/* filled buttons brighten and get a soft blue ring */
[data-theme="horizon"] :is(.btn-primary, .keypad button):hover:not(:disabled) { filter: brightness(1.12); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 0 0 3px rgba(31, 95, 180, .25); }
[data-theme="horizon"] .keypad button.accent:hover:not(:disabled) { background: var(--push-hover); border-color: var(--hz-blue); filter: none; }
