/* Eye comfort (static/js/comfort.js): text size, warm light, dimmer photos in
 * dark mode and a calmer ticker. Works on the site pages and the lesson pages. */

/* text size: rem-based sizes scale with the root; lesson pages use --base-size */
html.ec-lg { font-size: 112.5%; --base-size: 19.5px; }
html.ec-xl { font-size: 125%; --base-size: 21.5px; }

/* warm light: a soft amber layer over everything (like a phone's night light) */
html.ec-warm::after { content: ""; position: fixed; inset: 0; z-index: 2147483000; pointer-events: none;
  background: rgb(255 166 77 / .12); mix-blend-mode: multiply; }
html.ec-warm[data-theme="dark"]::after { background: rgb(255 150 60 / .07); mix-blend-mode: normal; }

/* dark mode: photos and videos a touch dimmer so they don't glare */
:root[data-theme="dark"] main img:not(.no-dim), :root[data-theme="dark"] main video,
:root[data-theme="dark"] .lesson-doc img { filter: brightness(.88); }

/* the home ticker: slower, pauses under the mouse, still when animations are off */
.landing-ticker-track { animation-duration: 64s !important; }
.landing-ticker:hover .landing-ticker-track { animation-play-state: paused; }
.no-motion .landing-ticker-track { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .landing-ticker-track { animation: none !important; } }

/* ---------- the panel ---------- */
.ec-panel { --ec-bg: rgb(var(--c-card, 255 250 244)); --ec-ink: rgb(var(--c-ink, 9 37 28)); --ec-line: rgb(var(--c-line, 235 213 190));
  --ec-muted: rgb(var(--c-slate-500, 83 99 90)); --ec-accent: rgb(var(--c-accent-1, 30 74 59)); --ec-tint: rgb(var(--c-accent-1-tint, 237 230 212));
  position: fixed; top: 74px; right: 16px; z-index: 75; width: min(340px, calc(100vw - 32px)); padding: 16px 18px 14px; border-radius: 22px;
  background: var(--ec-bg); color: var(--ec-ink); border: 1px solid var(--ec-line); box-shadow: 0 24px 50px -24px rgb(0 0 0 / .45);
  font: 15px/1.4 Nunito, system-ui, sans-serif; }
.lesson-doc .ec-panel { --ec-bg: var(--card); --ec-ink: var(--ink); --ec-line: var(--line); --ec-muted: var(--muted); --ec-accent: var(--deep); --ec-tint: var(--c4bg); }
.ec-panel[hidden] { display: none; }
.ec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font: 600 18px/1.2 Fredoka, Nunito, sans-serif; }
.ec-x { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--ec-muted); font-size: 20px; cursor: pointer; }
.ec-x:hover { background: var(--ec-tint); color: var(--ec-ink); }
.ec-label { margin: 8px 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ec-muted); }
.ec-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border-radius: 14px; background: var(--ec-tint); }
.ec-seg button { padding: 7px 0; border: 0; border-radius: 10px; background: transparent; color: var(--ec-ink); font-weight: 800; cursor: pointer; }
.ec-seg button:nth-child(1) { font-size: 14px; } .ec-seg button:nth-child(2) { font-size: 17px; } .ec-seg button:nth-child(3) { font-size: 20px; }
.ec-seg button[aria-pressed="true"] { background: var(--ec-bg); color: var(--ec-accent); box-shadow: 0 2px 6px -2px rgb(0 0 0 / .2); }
.ec-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ec-line); cursor: pointer; }
.ec-row:last-of-type { border-bottom: 0; }
.ec-row b { display: block; font-weight: 800; }
.ec-row small { display: block; color: var(--ec-muted); font-size: 12.5px; }
.ec-row input { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 44px; height: 26px; margin: 0; border-radius: 999px;
  background: var(--ec-line); cursor: pointer; transition: background .2s; }
.ec-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s; }
.ec-row input:checked { background: var(--ec-accent); }
.ec-row input:checked::after { transform: translateX(18px); }
.ec-row input:focus-visible, .ec-seg button:focus-visible, .ec-x:focus-visible { outline: 3px solid var(--ec-accent); outline-offset: 2px; }
.ec-tip { margin: 8px 0 0; padding: 8px 10px; border-radius: 12px; background: var(--ec-tint); color: var(--ec-muted); font-size: 13px; }
@media (max-width: 480px) { .ec-panel { top: 68px; left: 16px; right: 16px; width: auto; } }

/* the eye-break card */
.ec-break { position: fixed; top: 80px; left: 50%; z-index: 76; transform: translateX(-50%); display: grid; gap: 4px; justify-items: center; text-align: center;
  width: min(360px, calc(100vw - 32px)); padding: 16px 18px; border-radius: 20px; background: #13281f; color: #f8eadc;
  box-shadow: 0 24px 50px -20px rgb(0 0 0 / .5); font: 15px/1.45 Nunito, system-ui, sans-serif; animation: ec-in .35s ease-out; }
.ec-break b { font: 600 19px/1.2 Fredoka, Nunito, sans-serif; }
.ec-break i { font-style: normal; font-weight: 800; color: #e9b872; }
.ec-break button { margin-top: 6px; padding: 5px 16px; border: 1px solid rgb(255 255 255 / .3); border-radius: 999px; background: transparent; color: inherit; font-weight: 700; cursor: pointer; }
@keyframes ec-in { from { opacity: 0; transform: translate(-50%, -8px); } }

/* "Colour themes" in the panel, and the group headings in the theme picker (site-palette.js) */
.ec-palettes { display: flex; width: 100%; align-items: baseline; justify-content: space-between; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--ec-line);
  border-radius: 14px; background: transparent; color: var(--ec-ink); font: 800 15px Nunito, system-ui, sans-serif; cursor: pointer; }
.ec-palettes small { color: var(--ec-muted); font-weight: 600; font-size: 12px; }
.ec-palettes:hover { border-color: var(--ec-accent); }
.palette-group { grid-column: 1 / -1; margin: 8px 0 0; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: rgb(var(--c-slate-500)); }
.palette-group:first-child { margin-top: 0; }
.palette-picker { width: min(320px, calc(100vw - 32px)); }

/* the home "Choose your path" strip: slower, and a still, wrapped grid when animations are off */
.path-track { animation-duration: 80s !important; }
.no-motion .path-marquee { mask-image: none; -webkit-mask-image: none; }
.no-motion .path-track { animation: none !important; flex-wrap: wrap; width: auto; }
.no-motion .path-track > [aria-hidden="true"] { display: none; }
.no-motion .path-track > .landing-path-card { width: auto; flex: 1 1 16rem; }
@media (prefers-reduced-motion: reduce) {
  .path-marquee { mask-image: none; -webkit-mask-image: none; }
  .path-track { animation: none !important; flex-wrap: wrap; width: auto; }
  .path-track > [aria-hidden="true"] { display: none; }
  .path-track > .landing-path-card { width: auto; flex: 1 1 16rem; }
}

/* very small phones: the top bar must fit 360px (logo, Explore, eye comfort, Log in) */
@media (max-width: 400px) {
  header nav { gap: .5rem; padding-left: .75rem; padding-right: .75rem; }
  header nav .nav-link { padding: .4rem .5rem; }
  header nav img[alt="Umair Code Lab"] { height: 2.15rem; }
}

/* dark mode: the accent fills are light there, so the text on them is dark (WCAG AA) */
:root[data-theme="dark"] .plan-tab.is-active, :root[data-theme="dark"] .plan-lab.is-cta, :root[data-theme="dark"] .labs-filter button.is-on,
:root[data-theme="dark"] .finder-q button.is-on, :root[data-theme="dark"] .yo-steps button.is-on { color: #0c1c16; }
:root[data-theme="dark"] .os-primary { color: #0c1c16; }
/* the little hero cards: the file name and the "made for every age" label */
.pg-code .landing-code-topbar { color: #fff; }
:root[data-theme="dark"] .pg-code .landing-code-topbar { color: #0c1c16; }
.pg-ages > p { color: #09251c; }
:root[data-theme="dark"] .pg-ages > p { color: #0c1c16; }

/* ---------- button & card styles (chosen in the Eye comfort panel; Playful = the site's own look) ---------- */
/* Soft: flat, no chunky lip under buttons, gentle shadows */
html.ui-soft :is(.btn-primary, .btn-sun, .btn-quiet, .pg-btn-white, .nav-link.is-active, .nav-strip a.is-active, .lesson-doc .dbtn, .lesson-doc .hbtn, .lk-btn) { box-shadow: none !important; }
html.ui-soft :is(.btn-primary, .btn-sun, .pg-btn-white, .lesson-doc .dbtn, .lesson-doc .hbtn):active { transform: none; }
html.ui-soft :is(.card, .pg-stat, .tutor-band, .lesson-doc .block, .rcard) { box-shadow: 0 1px 3px rgb(0 0 0 / .08) !important; }
html.ui-soft :is(.btn-primary, .btn-sun, .btn-quiet, .pg-btn-white) { border-radius: 14px; }

/* Sharp: squarer corners everywhere, crisp and grown-up */
html.ui-sharp :is(.btn-primary, .btn-sun, .btn-quiet, .pg-btn-white, .btn-whatsapp, .nav-link, .chip, .plan-tab, .plan-lab, .labs-filter button, .lesson-doc .dbtn, .lesson-doc .hbtn, .lk-btn, .eyebrow) { border-radius: 6px !important; }
html.ui-sharp :is(.card, .pg-stat, .tutor-band, .contact-band, .dash-hero, .auth-shell, .pg-band .card, .new-card, .lesson-doc .block, .lesson-doc .practice, .lesson-doc .quiz, .lesson-doc .example, .lesson-doc .solution, .lesson-doc .tip, .rcard, .ec-panel) { border-radius: 10px !important; }
html.ui-sharp :is(.btn-primary, .btn-sun, .pg-btn-white, .lesson-doc .dbtn, .lesson-doc .hbtn) { box-shadow: none !important; }

/* Outline: buttons drawn as outlines (the main gold button stays filled so the next step is still clear) */
html.ui-outline :is(.btn-primary, .pg-btn-white) { background: transparent !important; color: rgb(var(--c-accent-1)) !important; border: 2px solid currentColor !important; box-shadow: none !important; }
html.ui-outline :is(.btn-primary, .pg-btn-white):hover { background: rgb(var(--c-accent-1-tint)) !important; }
html.ui-outline .btn-sun { box-shadow: none !important; }
html.ui-outline .nav-link.is-active { background: transparent !important; color: rgb(var(--c-accent-1)) !important; box-shadow: inset 0 0 0 2px currentColor !important; }
html.ui-outline :is(.card, .pg-stat) { box-shadow: none !important; border-width: 2px; }
html.ui-outline .lesson-doc .dbtn { background: transparent !important; color: var(--deep) !important; border: 2px solid currentColor !important; box-shadow: none !important; }
html.ui-outline[data-theme="dark"] .lesson-doc .dbtn { color: var(--c1) !important; }

/* the style buttons in the panel show their own shape */
.ec-seg.ec-style { grid-template-columns: repeat(4, 1fr); }
.ec-seg.ec-style button { display: grid; justify-items: center; gap: 3px; font-size: 12px !important; padding: 6px 0; }
.ec-shape { display: block; width: 26px; height: 12px; border-radius: 999px; background: var(--ec-accent); }
.ec-shape-playful { box-shadow: 0 2px 5px rgb(0 0 0 / .3); }
.ec-shape-soft { border-radius: 6px; opacity: .8; }
.ec-shape-sharp { border-radius: 2px; }
.ec-shape-outline { background: transparent; border: 2px solid var(--ec-accent); }

/* a 10-shade ramp in the colour picker */
.palette-ramp { display: block; width: 100%; height: 12px; border-radius: 999px; border: 1px solid rgb(0 0 0 / .1); }
