/* 101studio v6: light and dark.
   Light stays the default (white paper). Dark is set as data-theme="dark" on <html> by boot.js before paint and by theme.js
   on a click. The colours are tokens; the few places in v6.css / pages.css that hold a fixed colour are mapped here.
   The switch in the top bar: a small pill with a round screen that slides from end to end. In light the screen shows a
   warm sun, in dark a lavender moon; the sun's rays draw in and a second disc slides over it to cut the crescent.
   The faint light under the screen is the only glow on the site. Loaded after v6.css (and pages.css on the inner pages). */

/* ---------- dark tokens ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0a0a0a;
  --ink: #f2f2f0;
  --mute: #a3a3a0;
  --dim: #8c8c89;
  --red-hover: #ff2b4a;
  --soft: #171717;
  --body: #c2c2be;
  --line: rgba(255, 255, 255, .12);
  --surface: #141414;          /* menus and panels */
  --surface-2: #1f1f1f;        /* hover rows, tiles */
  --surface-3: #262626;        /* selected item */
  --quiet: rgba(255, 255, 255, .66);
}

/* ---------- the switch ---------- */
.theme-t {
  --tt-w: 64px; --tt-h: 35px; --tt-k: calc(var(--tt-h) - 6px);
  --tt-ease: cubic-bezier(.22, 1, .36, 1);
  position: relative; flex: none; display: block; width: var(--tt-w); height: var(--tt-h);
  margin: 0; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: #f0f0ee;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07), inset 0 1px 2px rgba(0, 0, 0, .05);
  transition: background-color .6s ease, box-shadow .6s ease, scale .25s ease-out;
}
/* the round screen; it slides to the other end */
.tt-knob {
  position: absolute; left: 3px; top: 3px; width: var(--tt-k); height: var(--tt-k); border-radius: 50%;
  display: grid; place-items: center;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 0 0 1px rgba(0, 0, 0, .04), 0 0 6px rgba(232, 105, 10, .16);
  transition: translate .6s var(--tt-ease), background-color .6s ease, box-shadow .6s ease;
}
.tt-ico { width: 74%; height: 74%; display: block; overflow: visible; rotate: 90deg; transition: rotate .6s var(--tt-ease); }
.tt-core { fill: #e8690a; transform-box: view-box; transform-origin: 12px 12px; scale: .5; transition: scale .6s var(--tt-ease), translate .6s var(--tt-ease), fill .6s ease; }
.tt-cutter { translate: 10px -10px; transition: translate .6s var(--tt-ease); }
.tt-rays { stroke: #e8690a; stroke-width: 1.6; stroke-linecap: round; fill: none;
  transform-box: view-box; transform-origin: 12px 12px;
  transition: scale .45s var(--tt-ease), opacity .3s ease, stroke .6s ease; }

.theme-t:active { scale: .97; }
.theme-t:focus-visible { outline: 1px solid rgba(10, 10, 10, .35); outline-offset: 3px; }
.theme-t:focus:not(:focus-visible) { outline: none; }

/* dark: charcoal body, the screen at the right, the rays drawn in, the crescent cut */
[data-theme="dark"] .theme-t { background: #1c1c1f; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), inset 0 1px 2px rgba(0, 0, 0, .4); }
[data-theme="dark"] .theme-t:focus-visible { outline-color: rgba(255, 255, 255, .4); }
[data-theme="dark"] .tt-knob {
  translate: calc(var(--tt-w) - var(--tt-k) - 6px) 0;
  background: #2b2b31;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06), 0 0 6px rgba(150, 132, 255, .2);
}
[data-theme="dark"] .tt-ico { rotate: 0deg; }
[data-theme="dark"] .tt-core { fill: #eceaff; scale: 1; translate: .8px -.6px; transition-delay: .06s; }   /* the crescent's weight sits low left; nudge it to the optical centre */
[data-theme="dark"] .tt-cutter { translate: 0 0; transition-delay: .1s; }
[data-theme="dark"] .tt-rays { stroke: #eceaff; scale: .5; opacity: 0; }
:root:not([data-theme="dark"]) .tt-rays { transition-delay: .12s, .12s, 0s; }

/* place in the top bar: beside the login button on a computer; beside login and the menu button on a phone */
@media (min-width: 1080px) {
  .nav { flex-direction: row; align-items: center; gap: 10px; }
}
@media (max-width: 1079px) {
  .theme-t { --tt-w: 70px; --tt-h: 44px; }
  .top .nav { gap: 8px; }
}
@media (max-width: 380px) {
  .theme-t { --tt-w: 62px; }
  .top .nav a.pill { padding: 0 14px; }
}
@media (max-width: 345px) {
  .theme-t { --tt-w: 52px; }
  .top .nav { gap: 6px; }
  .top .nav a.pill { padding: 0 12px; }
  .brand { flex: none; width: 96px; }
}

/* ---------- the change: the new mode opens from the switch in a soft-edged circle (theme.js).
   While it runs every other transition is off (.theme-switching), so nothing fades again after the circle has passed. ---------- */
@property --vt-r { syntax: "<length>"; inherits: false; initial-value: 0px; }
:root.theme-vt::view-transition-group(root) { animation: none; }
:root.theme-vt::view-transition-old(root),
:root.theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root.theme-vt::view-transition-old(root) { z-index: 1; }
:root.theme-vt::view-transition-new(root) {
  z-index: 2;
  /* the circle opens as a plain CSS animation (theme.js sets where it starts and how far it goes) */
  animation: vt-open .85s cubic-bezier(.33, 1, .68, 1) both;
  -webkit-mask-image: radial-gradient(circle at var(--vt-x) var(--vt-y), #000 max(0px, calc(var(--vt-r) - 180px)), transparent var(--vt-r));
  mask-image: radial-gradient(circle at var(--vt-x) var(--vt-y), #000 max(0px, calc(var(--vt-r) - 180px)), transparent var(--vt-r));
}
@keyframes vt-open { from { --vt-r: 0px; } to { --vt-r: var(--vt-end, 2400px); } }
.theme-switching :not(.theme-t, .theme-t *),
.theme-switching :not(.theme-t, .theme-t *)::before,
.theme-switching :not(.theme-t, .theme-t *)::after { transition: none !important; }
/* browsers without view transitions: the colours ease over instead (the switch keeps its own motion) */
.theme-fade :not(.theme-t, .theme-t *), .theme-fade body {
  transition: background-color .6s ease, color .6s ease, border-color .6s ease, box-shadow .6s ease, fill .6s ease, stroke .6s ease !important;
}

/* ---------- dark: the fixed colours in v6.css ---------- */
[data-theme="dark"] a:focus-visible,
[data-theme="dark"] button:focus-visible { outline-color: rgba(255, 255, 255, .4); }
/* the logo: red star stays, the word turns white (the studio's own white logo file) */
img.logo-w { display: none; }
[data-theme="dark"] img.logo-d { display: none; }
[data-theme="dark"] img.logo-w { display: block; }

[data-theme="dark"] .pill-dark,
[data-theme="dark"] .nav a.pill-dark { background: var(--ink); color: #0a0a0a; }
[data-theme="dark"] .pill-dark:hover,
[data-theme="dark"] .nav a.pill-dark:hover { background: #d6d6d2; color: #0a0a0a; }
[data-theme="dark"] .lead { color: var(--body, #c2c2be); }

[data-theme="dark"] .intro-cursor span { color: #0a0a0a; }
[data-theme="dark"] .intro-cursor.is-red span { color: #fff; }
[data-theme="dark"] .intro-cursor svg { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6)); }
[data-theme="dark"] .intro-sel i { background: var(--paper); }

/* the portal button: the same smoked glass, a little lighter so it still reads as glass on the dark paper */
[data-theme="dark"] .pill-red {
  background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .03) 55%), rgba(40, 40, 48, .72);
  box-shadow:
    0 22px 44px -20px rgba(0, 0, 0, .8),
    inset 0 0 0 1px rgba(255, 255, 255, .08),
    inset 0 1px 0 rgba(255, 255, 255, .42), inset 0 10px 16px -10px rgba(255, 255, 255, .2), inset 0 -1px 0 rgba(255, 255, 255, .08);
}
[data-theme="dark"] .pill-red:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .04) 55%), rgba(46, 46, 54, .76);
  box-shadow:
    0 28px 52px -20px rgba(0, 0, 0, .85),
    inset 0 0 0 1px rgba(255, 255, 255, .1),
    inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 10px 16px -10px rgba(255, 255, 255, .24), inset 0 -1px 0 rgba(255, 255, 255, .1);
}

/* desktop top bar and Tools panel */
@media (min-width: 1080px) {
  [data-theme="dark"] .menu { border-color: rgba(255, 255, 255, .12); }
  [data-theme="dark"] .menu a { color: rgba(255, 255, 255, .7); }
  [data-theme="dark"] .menu a:hover,
  [data-theme="dark"] .menu a:focus-visible,
  [data-theme="dark"] .menu a[aria-expanded="true"],
  [data-theme="dark"] .menu a[aria-current="page"] { color: var(--ink); background-color: rgba(255, 255, 255, .07); }

  [data-theme="dark"] .mega-scrim { background: rgba(10, 10, 10, .72); }
  [data-theme="dark"] .mega { background: var(--surface); box-shadow: 0 16px 56px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .06); }
  [data-theme="dark"] .mega-item .lb,
  [data-theme="dark"] .mega-copy,
  [data-theme="dark"] .mega-row .rk,
  [data-theme="dark"] .mega-row .rm,
  [data-theme="dark"] .mega-jumps-l { color: var(--quiet); }
  [data-theme="dark"] .mega-item.is-on { background-color: var(--surface-3); }
  [data-theme="dark"] .mega-item.is-on .lb { color: var(--ink); }
  [data-theme="dark"] .mega-spot { background: #000; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); }
  [data-theme="dark"] .mega-chip { color: #0a0a0a; }
  [data-theme="dark"] .mega-row:first-child,
  [data-theme="dark"] .mega-row:hover { background-color: var(--surface-2); }
  [data-theme="dark"] .mega-list:hover .mega-row:first-child:not(:hover) { background-color: transparent; }
  [data-theme="dark"] .t3d { filter: none; }
  [data-theme="dark"] .mega-foot { border-top-color: rgba(255, 255, 255, .08); }
  [data-theme="dark"] .mega-jump { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
  [data-theme="dark"] .mega-jump:hover,
  [data-theme="dark"] .mega-ghost:hover { background-color: var(--surface-2); }
  [data-theme="dark"] .mega-cta { color: #0a0a0a; background-color: var(--ink); }
  [data-theme="dark"] .mega-cta:hover { background-color: #d6d6d2; }
}

/* phone and tablet top bar and menu */
@media (max-width: 1079px) {
  [data-theme="dark"] .burger { background: var(--ink); }
  [data-theme="dark"] .burger span { background: #0a0a0a; }
  [data-theme="dark"] .m-scrim { background: rgba(10, 10, 10, .6); }
  [data-theme="dark"] .m-menu { background: var(--surface); box-shadow: 0 16px 56px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .06); }
  [data-theme="dark"] .m-link:active,
  [data-theme="dark"] .m-link[aria-current="page"] { background: var(--surface-2); }
  [data-theme="dark"] .m-chip { border-color: rgba(255, 255, 255, .14); background: transparent; }
  [data-theme="dark"] .m-chip.is-on { background: var(--ink); border-color: var(--ink); color: #0a0a0a; }
  [data-theme="dark"] .m-card-pic { background: #000; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); }
  [data-theme="dark"] .m-card-n { color: #0a0a0a; }
  [data-theme="dark"] .m-card-k { color: rgba(255, 255, 255, .6); }
  [data-theme="dark"] .m-explore { background: var(--surface-2); }
  [data-theme="dark"] .m-actions a { background: var(--ink); color: #0a0a0a; }
}

/* ---------- dark: the fixed colours in pages.css (inner pages) ---------- */
[data-theme="dark"] .film { background: var(--paper); }
[data-theme="dark"] .pill-light:hover { background: var(--surface-3); }
[data-theme="dark"] .chip { color: rgba(255, 255, 255, .62); }
[data-theme="dark"] .chip:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .chip[aria-pressed="true"] { color: var(--ink); background: var(--soft); }
[data-theme="dark"] .tool .pill-light,
[data-theme="dark"] .tool .pill-light:hover { background: var(--surface-3); }
[data-theme="dark"] .tool:not(:hover):not(:target) .pill-light { background: var(--soft); }
[data-theme="dark"] .mail:hover { color: #d0d0cc; }
[data-theme="dark"] .pg-foot .fn a { color: rgba(255, 255, 255, .66); }
[data-theme="dark"] .pg-foot a:hover,
[data-theme="dark"] .pg-foot .fn a:hover,
[data-theme="dark"] .pg-foot .fn a[aria-current="page"] { color: var(--ink); }
