:root {
  --studio-clerk-primary: #234738;
  --studio-clerk-primary-foreground: #fffaf0;
  --studio-clerk-foreground: #192823;
  --studio-clerk-background: #f7f5ef;
  --studio-clerk-muted: #eaece3;
  --studio-clerk-muted-foreground: #4f6056;
  --studio-clerk-input: #fffdf7;
  --studio-clerk-border: #c8d0c1;


}

.footer-actions { display:flex; align-items:center; flex-wrap:nowrap; gap:clamp(10px,1.2vw,18px); }
.theme-toggle {
  box-sizing:border-box; display:inline-grid; place-items:center; flex:0 0 54px;
  width:54px; height:44px; margin:0; padding:0; border:0; border-radius:10px;
  background:transparent; cursor:pointer;
}
.theme-track {
  position:relative; display:grid; grid-template-columns:1fr 1fr; place-items:center;
  box-sizing:border-box; width:54px; height:28px; border-radius:99px;
  background:#254637; color:#d8e5db; box-shadow:inset 0 0 0 1px #688573;
}
.theme-track::before {
  content:""; position:absolute; left:2.5px; top:3px; width:22px; height:22px;
  border-radius:50%; background:#faf0d6; transition:transform 180ms ease;
}
.theme-track svg { position:relative; display:block; width:14px; height:14px; pointer-events:none; }
.theme-track svg:first-child { color:#344b34; }
:root[data-theme="dark"] .theme-track::before { transform:translateX(27px); background:#f2c59b; }
:root[data-theme="dark"] .theme-track svg:first-child { color:inherit; }
:root[data-theme="dark"] .theme-track svg:last-child { color:#273b2e; }
.theme-toggle:hover .theme-track { box-shadow:inset 0 0 0 1px #9bb5a0; }
.theme-toggle:focus-visible { outline:2px solid var(--studio-focus,#905022); outline-offset:1px; }
@media (prefers-reduced-motion:reduce) { .theme-track::before { transition:none; } }
@media (forced-colors:active) {
  .theme-track { forced-color-adjust:none; background:Canvas; color:CanvasText; outline:1px solid CanvasText; }
  .theme-track::before, :root[data-theme="dark"] .theme-track::before { background:Highlight; }
  .theme-track svg:first-child, :root[data-theme="dark"] .theme-track svg:last-child { color:HighlightText; }
}
@media (max-width:520px) {
  .footer-actions { margin-inline-start:auto; }
}
@media (scripting: none) {
  .theme-toggle { display:none; }
}
@media print {
  .theme-toggle { display:none; }
}

@media screen {
  :root[data-theme="dark"] {
    color-scheme:dark;
    --studio-bg:#151c18;
    --studio-surface:#1e2922;
    --studio-raised:#253429;
    --studio-hover:#304337;
    --studio-input:#171f1a;
    --studio-text:#edf2e8;
    --studio-muted:#b7c6b8;
    --studio-border:#46584a;
    --studio-control-border:#738778;
    --studio-link:#a9d5b6;
    --studio-link-hover:#f3c6a1;
    --studio-focus:#efb98e;
    --studio-action:#aed5b7;
    --studio-action-hover:#cbe7d1;
    --studio-action-ink:#16271d;
    --studio-error:#ffcab9;
    --studio-error-bg:#492d27;
    --studio-warm:#f2c89e;
    --studio-warm-bg:#44362a;


    --studio-clerk-primary:var(--studio-action);
    --studio-clerk-primary-foreground:var(--studio-action-ink);
    --studio-clerk-foreground:var(--studio-text);
    --studio-clerk-background:var(--studio-surface);
    --studio-clerk-muted:var(--studio-raised);
    --studio-clerk-muted-foreground:var(--studio-muted);
    --studio-clerk-input:var(--studio-input);
    --studio-clerk-border:var(--studio-control-border);
    --ac-paper:var(--studio-bg);
    --ac-white:var(--studio-surface);
    --ac-ink:var(--studio-text);
    --ac-muted:var(--studio-muted);
    --ac-border:var(--studio-border);
    --ac-green:var(--studio-link);
    --paper:var(--studio-bg);
    --surface:var(--studio-surface);
    --ink:var(--studio-text);
    --muted:var(--studio-muted);
    --forest:var(--studio-link);
    --border:var(--studio-border);
    --control-border:var(--studio-control-border);

    background:var(--studio-bg);
    color:var(--studio-text);

    body { background:var(--studio-bg); color:var(--studio-text); }
    img[src="/assets/wordmark.svg"], .cl-logoImage { filter:brightness(0) invert(.92) sepia(.1); }
    :focus-visible { outline-color:var(--studio-focus); }
    :is(.studio-header, .watch-header, .partner-bar, .bar, .site-footer, .footer-utilities) {
      border-color:var(--studio-border);
    }
    .catalog-page > header { border-color:var(--studio-border); }
    .site-footer, .footer-utilities { color:var(--studio-muted); }
    .site-footer .footer-youtube-icon path { fill:var(--studio-bg); }

    /* Catalog, quick search and account controls */
    .mast nav :is(a, button):not(.current) { color:var(--studio-text); }
    .mast nav :is(a:hover, .current) {
      border-bottom-color:var(--studio-link);
    }
    .account-sign-in:hover { background:var(--studio-hover); border-color:var(--studio-control-border); }
    .account-actions .account-sign-up, .filters button.active,
    .catalog-pager button:enabled, .lesson-actions #resources a:first-child {
      background:var(--studio-action); color:var(--studio-action-ink); border-color:var(--studio-action);
    }
    .account-actions .account-sign-up:hover,
    .catalog-pager button:enabled:hover, .lesson-actions #resources a:first-child:hover {
      background:var(--studio-action-hover); border-color:var(--studio-action-hover);
    }
    :is(.cardCat, .tool, .count, .catalog-page-number) { color:var(--studio-muted); }
    .catalog-pager { border-color:var(--studio-border); }
    .catalog-pager button:disabled { color:var(--studio-muted); border-color:var(--studio-border); }
    .catalog .filters button:not(.active) { border-color:var(--studio-control-border); }
    .catalog .filters button:not(.active):hover { background:var(--studio-hover); }
    .card .save { background:var(--studio-raised); color:var(--studio-text); border-color:var(--studio-control-border); }
    .card .save:hover { background:var(--studio-hover); }
    :is(#lesson, .account-status, .account-mount-status) {
      background:var(--studio-surface); color:var(--studio-text); border-color:var(--studio-border);
    }
    #account-dialog .account-mount-status, .account-dialog-head button {
      background:var(--studio-surface); color:var(--studio-text);
    }
    .account-dialog-head button:hover, .close:hover { background:var(--studio-hover); }
    .catalog-status:not(:empty) { color:var(--studio-error); }
    #lessonStatus { color:var(--studio-error); background:var(--studio-error-bg); }
    .field input[type="search"] {
      background:var(--studio-input); color:var(--studio-text); border-color:var(--studio-control-border);
    }
    input::placeholder, textarea::placeholder { color:var(--studio-muted); }
    .lesson-actions { border-color:var(--studio-border); }
    .lessonInfo a:hover { color:var(--studio-link-hover); }
    .lessonInfo .lesson-actions a {
      background:var(--studio-raised); color:var(--studio-link); border-color:var(--studio-border);
    }
    .lessonInfo .lesson-actions a:hover {
      background:var(--studio-hover); border-color:var(--studio-control-border);
    }
    @media (max-width:900px) {
      @media (min-width:651px) {
      .mast nav a { border-color:var(--studio-control-border); }
      .mast nav .current { background:#365b46; }
      .mast nav :is(#explore,#savedNav) { color:var(--studio-text); }
      .mast nav :is(#explore,#savedNav).current { background:#365b46; color:var(--studio-text); }
      }
    }

    /* Watch page, bookmarks and playback preferences */
    .watch-header a, .watch-chapters a, .watch-details a, .reading-header a, #transcript a, .watch-details summary {
      color:var(--studio-link);
    }
    :is(.watch-header a, .watch-chapters a, .watch-details a, .reading-header a, #transcript a):hover {
      color:var(--studio-link-hover);
    }
    .watch-player > .sg-marks, .watch-details > section, .next-card, .sg-marks .moment-list {
      background:var(--studio-surface); color:var(--studio-text); border-color:var(--studio-border);
    }
    :is(.watch-subject, .reading-header span, .next-copy small, .playback-privacy, .playback-age, .playback-privacy-help) {
      color:var(--studio-muted);
    }
    :is(#transcript, .next-classes, .transcript-chapter, .watch-chapters a, .watch-chapters span, .moment-bar),
    .sg-marks .moment-list li:has(button) { border-color:var(--studio-border); }
    .watch-chapters span, .moment-count { background:var(--studio-raised); color:var(--studio-link); }
    .sg-marks { color:var(--studio-text); }
    .sg-marks button:hover { background:var(--studio-hover); }
    .sg-marks button:focus-visible { outline-color:var(--studio-focus); }
    dialog#playback-preferences,
    #playback-preferences :is(.privacy-head, .playback-settings, .playback-age) {
      background:var(--studio-surface); color:var(--studio-text); border-color:var(--studio-border);
    }
    #playback-preferences .privacy-head h2, #playback-preferences .playback-privacy { color:var(--studio-text); }
    #playback-preferences .playback-privacy-help { color:var(--studio-muted); }
    #playback-preferences .privacy-head button, .playback-age select {
      background-color:var(--studio-raised); color:var(--studio-text); border-color:var(--studio-control-border);
    }
    #playback-preferences .privacy-head button:hover { background:var(--studio-hover); }
    #playback-preferences .playback-privacy input:checked {
      background:radial-gradient(circle at 26px 50%, #172920 7px, transparent 8px) var(--studio-action);
      border-color:var(--studio-action);
    }
    #playback-preferences :is(button,input,select):focus-visible { outline-color:var(--studio-focus); }

    /* Search, partnerships, policies and inquiries */
    .skip:focus, .skip-link:focus {
      background:var(--studio-surface); color:var(--studio-text);
    }
    :is(.finder label, .summary span, .result small, .result p, .empty p, .source-note, .channel-stats dt, .formats dd) {
      color:var(--studio-muted);
    }
    :is(.summary, .result, .editorial, .formats > div + div, .channel-stats div + div, .filters a) {
      border-color:var(--studio-border);
    }
    :is(.channel-stats, .bar > a:last-child, .empty a, .result li a, .partner-bar .library-link, .partnership-formats .action, .kit-actions a, .kit-actions button) {
      background:var(--studio-raised); color:var(--studio-link); border-color:var(--studio-control-border);
    }
    :is(.bar > a:last-child, .empty a, .result li a, .partner-bar .library-link, .partnership-formats .action, .kit-actions a, .kit-actions button, .filters a:not([aria-current])):hover {
      background:var(--studio-hover); color:var(--studio-text);
    }
    .filters a[aria-current], .finder .field button, .inquiry-form button, .inquiry-restart, .offline-home {
      background:var(--studio-action); color:var(--studio-action-ink); border-color:var(--studio-action);
    }
    :is(.finder .field button, .inquiry-form button, .inquiry-restart, .offline-home):hover {
      background:var(--studio-action-hover); color:var(--studio-action-ink);
    }
    .legal-page :is(h1, h2), #inquiry-heading, .inquiry-form, .inquiry-form label { color:var(--studio-text); }
    .legal-page :is(.legal-copy, .legal-contents, .legal-header) a, .inquiry-form a { color:var(--studio-link); }
    .legal-page :is(.legal-copy, .legal-contents, .legal-header) a:hover, .partner-shell a:not(.action):hover {
      color:var(--studio-link-hover);
    }
    .legal-page :is(.legal-title, .legal-header, .legal-contents, .legal-copy section) { border-color:var(--studio-border); }
    .legal-page .legal-title > p, .inquiry-form label span, .inquiry-form #inquiry-privacy {
      color:var(--studio-muted);
    }
    .inquiry-form :is(input,textarea) {
      background:var(--studio-input); color:var(--studio-text); border-color:var(--studio-control-border);
    }
    .inquiry-received { background:var(--studio-raised); color:var(--studio-text); }
    .inquiry-error { background:var(--studio-error-bg); color:var(--studio-error); }

    /* Academy and administration */
    :is(.ac-invitation, .ac-empty, .ac-message, .ac-badge, .course-select, .notice, .secondary, .pill, .pk-panel :is(a,button)) {
      background:var(--studio-raised); color:var(--studio-text); border-color:var(--studio-border);
    }
    :is(.course-select:hover, .course-select[aria-current], .secondary:hover) {
      background:var(--studio-hover); border-color:var(--studio-control-border);
    }
    .ac-button { background:var(--studio-action); color:var(--studio-action-ink); border-color:var(--studio-action); }
    .ac-button:hover { background:var(--studio-action-hover); color:var(--studio-action-ink); border-color:var(--studio-action-hover); }
    .ac-button--secondary { background:transparent; color:var(--studio-link); border-color:var(--studio-control-border); }
    .ac-button--secondary:hover { background:var(--studio-hover); color:var(--studio-text); border-color:var(--studio-control-border); }
    .gate .button.primary, #workspace .button.primary, #review-dialog .button.primary, .pk-panel .pk-primary {
      background:var(--studio-action); color:var(--studio-action-ink); border-color:var(--studio-action);
    }
    :is(.gate .button.primary, #workspace .button.primary, #review-dialog .button.primary, .pk-panel .pk-primary):hover {
      background:var(--studio-action-hover); border-color:var(--studio-action-hover);
    }
    :is(.ac-badge--neutral, .pill[data-status="scheduled"]) { background:var(--studio-warm-bg); color:var(--studio-warm); }
    .pill[data-status="published"] { background:#2f4b38; color:var(--studio-link); }
    :is(.ac-message[data-error="true"], .notice[data-problem="true"]) { background:var(--studio-error-bg); color:var(--studio-error); }
    .ac-form :is(input:not([type="checkbox"],[type="radio"]), select, textarea), .field :is(input, textarea, select) {
      background-color:var(--studio-input); color:var(--studio-text); border-color:var(--studio-control-border);
    }
    :is(.ac-dialog, .pk-panel) { background:var(--studio-surface); color:var(--studio-text); border-color:var(--studio-border); }
    :is(.inquiry-meta, .inquiries-list .inquiry-message) { color:var(--studio-muted); }
    .inquiries-list a { color:var(--studio-link); }
    .restore-shell div {
      background:linear-gradient(var(--studio-raised),var(--studio-raised)) 1.4rem 1.6rem / 37% .85rem no-repeat,
        linear-gradient(var(--studio-raised),var(--studio-raised)) 1.4rem 3.25rem / 67% .55rem no-repeat;
    }
    .chart span { background:var(--studio-link); }
  }
}

@media (forced-colors:none) {
  :root {
    --scroll-thumb:#577364;
    --scroll-track:#eceee6;
    --selection-fill:#28533f;
    --selection-ink:#fff9e9;
    scrollbar-color:var(--scroll-thumb) var(--scroll-track);
  }
  :root[data-theme="dark"] {
    --scroll-thumb:#91aa98;
    --scroll-track:#202c25;
    --selection-fill:#edbc94;
    --selection-ink:#20281f;
  }
  ::selection {background-color:var(--selection-fill);color:var(--selection-ink)}
  @supports not (scrollbar-color:auto) {
    ::-webkit-scrollbar-thumb {background-color:var(--scroll-thumb);border:3px solid var(--scroll-track);border-radius:1rem}
    ::-webkit-scrollbar-track {background-color:var(--scroll-track)}
    ::-webkit-scrollbar {width:14px;height:14px}
  }
}

/* Text entry uses the field edge as its focus indicator in either theme. */
:root { --field-focus: #2c6550; }
:root[data-theme="dark"] { --field-focus: #a9d5b6; }
html body :is(input:not([type]),input:is([type=text],[type=email],[type=password],[type=search],[type=url],[type=tel],[type=number],[type=date],[type=time],[type=datetime-local]),textarea,select):focus {
  outline: none !important;
  border-color: var(--field-focus) !important;
  box-shadow: inset 0 0 0 1px var(--field-focus) !important;
}
html body :is(.sa-url,.ac-profile-handle):focus-within {
  border-radius: 6px;
  outline: 2px solid var(--field-focus);
  outline-offset: -2px;
}
html body :is(.sa-url,.ac-profile-handle) input:focus {box-shadow:none !important;border-color:transparent !important}
@media (forced-colors:active) {
  html body :is(input,textarea,select):focus-visible {outline:2px solid Highlight !important;outline-offset:-2px}
  html body :is(.sa-url,.ac-profile-handle):focus-within {outline-color:Highlight}
}
.traffic-choice {position:fixed;z-index:12;inset:auto max(1rem,env(safe-area-inset-right)) max(1rem,env(safe-area-inset-bottom)) auto;width:min(23rem,calc(100% - 2rem));box-sizing:border-box;padding:1rem 1.2rem;background:#203d32;color:#fff9ec;border:1px solid #789483;border-radius:.7rem;box-shadow:0 .25rem 1.25rem #0002;font-size:.9rem}
.traffic-choice p {color:inherit;margin:0 0 .6rem;line-height:1.45}
.traffic-choice a {color:inherit;text-decoration:underline}
.traffic-choice div {display:flex;gap:.6rem}
.traffic-choice button {flex:1;min-height:2.75rem;background:transparent;color:inherit;border:1px solid #9db3a7;border-radius:.35rem;font:inherit;cursor:pointer}

@media (max-width:650px) {
  .mast nav :is(#explore,#savedNav,#academyNav,a).current {background:transparent;color:var(--studio-text,inherit)}
}

/* Landmarks and headings retain focus for skip links and route announcements. */
html body :is(
  main, section, article, aside, header, footer, nav, dialog, h1, h2, h3, h4, h5, h6,
  [role="main"], [role="region"], [role="heading"]
):where(
  :not([role]), [role="main"], [role="region"], [role="heading"], [role="navigation"], [role="dialog"]
):not([tabindex="0"],[contenteditable]):focus {
  outline:none;
}

/* Use one chevron and inset for single-select controls while keeping their native menus. */
:root {
  --studio-select-inset:1.25rem;
  --studio-select-chevron:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m2 4 4 4 4-4' fill='none' stroke='%23486256' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] {
  --studio-select-chevron:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m2 4 4 4 4-4' fill='none' stroke='%23b7cfc1' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
body select:not([multiple],[size]:not([size="1"])) {
  appearance:none;
  padding-inline-end:calc(var(--studio-select-inset) + 1.4rem);
  background-image:var(--studio-select-chevron);
  background-repeat:no-repeat;
  background-position:right var(--studio-select-inset) center;
  background-size:.75rem .75rem;
}
body select:not([multiple],[size]:not([size="1"])):dir(rtl) {
  background-position:left var(--studio-select-inset) center;
}
@media (forced-colors:active) {
  body select:not([multiple],[size]:not([size="1"])) {appearance:auto;background-image:none}
}
