/* Built from dev/themes.css by dev/release.js: edit it there and run `node dev/release.js` again. */
/* The theme switch (dev/themes.js), shared by the home page and the profile: the sun-and-moon button in the
   navigation, the choice offered on the first visit, and the change itself — the new theme opens over the old in a
   circle (a view transition), or, where the browser has none, the colours cross-fade. */

:root {
  --th-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --th-spring: cubic-bezier(0.3, 1.4, 0.5, 1);
  --th-ink: #111214;
  --th-muted: #62656d;
  --th-glass: rgb(255 255 255 / 0.74);
  --th-glass-hover: #ffffff;
  --th-edge: inset 0 0 0 1px rgb(0 0 0 / 0.06);
  --th-veil: rgb(246 247 250 / 0.72);
  --th-card: rgb(255 255 255 / 0.78);
  --th-shadow: 0 1px 2px rgb(16 18 24 / 0.06), 0 30px 60px -30px rgb(16 18 24 / 0.4);
}
:root[data-theme='dark'] {
  --th-ink: #eceef2;
  --th-muted: #8d9099;
  --th-glass: rgb(22 24 30 / 0.66);
  --th-glass-hover: rgb(36 39 48 / 0.9);
  --th-edge: inset 0 0 0 1px rgb(255 255 255 / 0.09);
  --th-veil: rgb(5 5 7 / 0.66);
  --th-card: rgb(18 20 26 / 0.72);
  --th-shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 30px 60px -30px rgb(0 0 0 / 0.9);
}

/* the blade in the logo: graphite by day, light steel by night (its gradient is in each page's sprite) */
:root[data-theme='dark'] #bladeFill stop:first-child { stop-color: #ffffff; }
:root[data-theme='dark'] #bladeFill stop:last-child { stop-color: #9aa3b8; }

/* ---------------------------------------------------------------- the button: a sun by day, a moon by night */

.th-toggle {
  position: relative; display: grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--th-ink); cursor: pointer;
  transition: background 0.25s, box-shadow 0.25s, scale 0.2s var(--th-ease);
}
.th-toggle:hover { background: var(--th-glass); box-shadow: var(--th-edge); }
.nav-pill .th-toggle { width: 36px; height: 36px; margin-left: 6px; } /* the profile page's navigation */
.th-toggle:active { scale: 0.92; }
.th-toggle svg { width: 19px; height: 19px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.th-toggle .th-sun, .th-toggle .th-moon {
  transform-box: view-box; transform-origin: 12px 12px;
  transition: opacity 0.45s var(--th-ease), transform 0.7s var(--th-spring);
}
.th-toggle .th-moon { opacity: 0; transform: rotate(-70deg) scale(0.4); }
:root[data-theme='dark'] .th-toggle .th-sun { opacity: 0; transform: rotate(90deg) scale(0.3); }
:root[data-theme='dark'] .th-toggle .th-moon { opacity: 1; transform: none; }
/* the rays wake up on hover */
.th-toggle:hover .th-sun path { animation: th-rays 1.4s var(--th-ease); }
@keyframes th-rays { 40% { opacity: 0.4; } }
/* pressed: the whole icon turns once */
.th-toggle.is-spun svg { animation: th-spin 0.8s var(--th-ease); }
@keyframes th-spin { from { rotate: -180deg; scale: 0.6; } }

/* ---------------------------------------------------------------- the change itself */

/* the new theme opens in a circle (themes.js animates its clip); the old picture stays still underneath */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-group(root) { animation-duration: 1.05s; }
/* without view transitions: a short cross-fade of every colour */
:root.is-theming, :root.is-theming *, :root.is-theming *::before, :root.is-theming *::after {
  transition: background-color 0.6s ease, color 0.6s ease, border-color 0.6s ease, box-shadow 0.6s ease, fill 0.6s ease, stroke 0.6s ease !important;
}

/* ---------------------------------------------------------------- the first visit: which theme? */

.th-ask {
  position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; overflow: auto; padding: 24px;
  background: var(--th-veil); backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2);
  color: var(--th-ink); text-align: center;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  animation: th-veil 0.6s var(--th-ease) backwards;
}
@keyframes th-veil { from { opacity: 0; backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); } }
.th-ask-in { display: flex; flex-direction: column; align-items: center; width: min(100%, 720px); }
.th-ask-blade { width: 38px; height: 38px; color: var(--th-ink); animation: th-blade 1s var(--th-ease) 0.1s backwards; }
@keyframes th-blade { from { opacity: 0; scale: 0.6; filter: blur(8px); } }
.th-ask h2 {
  margin: 22px 0 0; font-size: clamp(32px, 5vw, 48px); font-weight: 500; line-height: 1.05; letter-spacing: -0.035em;
  animation: th-rise 0.9s var(--th-ease) 0.25s backwards;
}
.th-ask p { max-width: 420px; margin: 12px 0 0; color: var(--th-muted); font-size: 15.5px; line-height: 1.5; animation: th-rise 0.9s var(--th-ease) 0.35s backwards; }
@keyframes th-rise { from { opacity: 0; translate: 0 14px; filter: blur(6px); } }
.th-ask-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; width: 100%; margin-top: 36px; }
.th-card {
  display: flex; flex-direction: column; gap: 0; padding: 10px; border: 0; border-radius: 26px; cursor: pointer; text-align: left;
  background: var(--th-card); box-shadow: var(--th-edge), var(--th-shadow); color: var(--th-ink); font: inherit;
  animation: th-card 0.9s var(--th-spring) backwards;
  transition: translate 0.45s var(--th-ease), box-shadow 0.45s var(--th-ease), opacity 0.4s, scale 0.45s var(--th-ease), filter 0.4s;
}
.th-card:nth-child(1) { animation-delay: 0.45s; }
.th-card:nth-child(2) { animation-delay: 0.55s; }
@keyframes th-card { from { opacity: 0; translate: 0 26px; scale: 0.94; filter: blur(8px); } }
.th-card canvas { display: block; width: 100%; height: auto; aspect-ratio: 300 / 188; border-radius: 18px; transition: scale 0.6s var(--th-ease); }
.th-card > span { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px 6px; }
.th-card b { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; }
.th-card small { color: var(--th-muted); font-size: 13.5px; }
.th-card { overflow: hidden; }
.th-card:hover, .th-card:focus-visible { translate: 0 -4px; box-shadow: inset 0 0 0 1.5px var(--th-ink), var(--th-shadow); }
.th-card:hover canvas, .th-card:focus-visible canvas { scale: 1.035; }
.th-card:focus-visible { outline: none; }
.th-card:active { scale: 0.98; }
/* a card chosen: it answers with a ring, the other one steps back */
.th-ask.is-picked .th-card:not(.is-chosen) { opacity: 0.35; scale: 0.96; filter: blur(2px); }
.th-card.is-chosen { box-shadow: inset 0 0 0 2px var(--th-ink), var(--th-shadow); scale: 1.03; }
:root.is-asking { overflow: hidden; }
@media (max-width: 560px) {
  .th-ask-cards { grid-template-columns: 1fr; gap: 12px; margin-top: 26px; }
  .th-card { flex-direction: row; align-items: center; gap: 12px; }
  .th-card canvas { width: 46%; }
  .th-card > span { padding: 0 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .th-ask, .th-ask-blade, .th-ask h2, .th-ask p, .th-card { animation: none; }
}
