/* ---------------------------------------------------------------
   karantanwar.com — hand-rolled. No framework, no webfonts.
   Type and motion follow Apple HIG: SF via system stack, tight
   optical tracking on display sizes, spring-ish easing curves.
   --------------------------------------------------------------- */

/* ---- tokens --------------------------------------------------- */
:root {
  color-scheme: light dark;

  --bg:        #ffffff;
  --bg-sub:    #f5f5f7;
  --bg-card:   #ffffff;
  --bg-glass:  rgba(255, 255, 255, 0.72);
  --fg:        #1d1d1f;
  --fg-mid:    #4b4b50;
  --fg-dim:    #6e6e73;
  --line:      rgba(0, 0, 0, 0.10);
  --line-soft: rgba(0, 0, 0, 0.055);
  --accent:    #0066cc;
  --accent-sub: rgba(0, 102, 204, 0.09);
  --shadow-1:  0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-2:  0 2px 4px rgba(0, 0, 0, 0.05), 0 18px 48px rgba(0, 0, 0, 0.10);

  /* surface fills — every per-theme value lives in a token so the dark
     palette below is the ONLY place a second colour is ever written */
  --fill:        #f5f5f7;
  --fill-strong: #f5f5f7;
  --fill-code:   #f5f5f7;
  --thumb:       #ffffff;
  --thumb-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  --fig-filter:  none;
  --sun-o:       0;   /* 0 = light theme (show moon), 1 = dark (show sun) */

  /* the two curves everything uses */
  --ease:   cubic-bezier(0.32, 0.72, 0, 1);   /* Apple's sheet/scroll curve */
  --ease-io: cubic-bezier(0.4, 0, 0.2, 1);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo,
          Consolas, monospace;

  --gutter: clamp(20px, 5vw, 40px);
  --measure: 1120px;
  --nav-h: 52px;

  --moon-o: calc(1 - var(--sun-o));
}

/* Dark palette. Two selectors, one palette — CSS can't OR a media query with
   an attribute selector, so the block is stated twice. Edit both or neither.
   [data-theme] is stamped on <html> by the inline script in each page's head;
   absent it, the OS decides. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #000000;
    --bg-sub:    #0a0a0b;
    --bg-card:   #101012;
    --bg-glass:  rgba(10, 10, 11, 0.72);
    --fg:        #f5f5f7;
    --fg-mid:    #c3c3c7;
    --fg-dim:    #86868b;
    --line:      rgba(255, 255, 255, 0.13);
    --line-soft: rgba(255, 255, 255, 0.07);
    --accent:    #2997ff;
    --accent-sub: rgba(41, 151, 255, 0.13);
    --shadow-1:  0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-2:  0 2px 6px rgba(0, 0, 0, 0.6), 0 20px 60px rgba(0, 0, 0, 0.45);
    --fill:        rgba(255, 255, 255, 0.045);
    --fill-strong: rgba(255, 255, 255, 0.06);
    --fill-code:   #0f0f11;
    --thumb:       #2c2c2e;
    --thumb-shadow: none;
    --fig-filter:  brightness(0.88) contrast(1.02);
    --sun-o:       1;
  }
}
:root[data-theme="dark"] {
    --bg:        #000000;
    --bg-sub:    #0a0a0b;
    --bg-card:   #101012;
    --bg-glass:  rgba(10, 10, 11, 0.72);
    --fg:        #f5f5f7;
    --fg-mid:    #c3c3c7;
    --fg-dim:    #86868b;
    --line:      rgba(255, 255, 255, 0.13);
    --line-soft: rgba(255, 255, 255, 0.07);
    --accent:    #2997ff;
    --accent-sub: rgba(41, 151, 255, 0.13);
    --shadow-1:  0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-2:  0 2px 6px rgba(0, 0, 0, 0.6), 0 20px 60px rgba(0, 0, 0, 0.45);
    --fill:        rgba(255, 255, 255, 0.045);
    --fill-strong: rgba(255, 255, 255, 0.06);
    --fill-code:   #0f0f11;
    --thumb:       #2c2c2e;
    --thumb-shadow: none;
    --fig-filter:  brightness(0.88) contrast(1.02);
    --sun-o:       1;
}

/* keep form controls and scrollbars in step with a pinned theme */
:root[data-theme="light"] { color-scheme: only light; }
:root[data-theme="dark"]  { color-scheme: only dark; }

/* ---- reset ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---- layout --------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap--narrow { max-width: 720px; }

.section { padding-block: clamp(64px, 11vh, 128px); }
.section--sub { background: var(--bg-sub); }
.rule { height: 1px; background: var(--line-soft); border: 0; }

/* ---- type ----------------------------------------------------- */
.display {
  font-size: clamp(2.75rem, 8.2vw, 5.5rem);
  font-weight: 600;
  line-height: 1.03;
  letter-spacing: -0.035em;
}
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.022em; line-height: 1.12; }
h2.title { font-size: clamp(1.75rem, 3.6vw, 2.75rem); letter-spacing: -0.028em; }
h3 { font-size: 1.3125rem; }

.eyebrow {
  font-size: 0.75rem;
  font-weight: 590;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 14px;
}

.lede {
  font-size: clamp(1.0625rem, 1.9vw, 1.3125rem);
  line-height: 1.5;
  color: var(--fg-mid);
  letter-spacing: -0.016em;
}
.dim { color: var(--fg-dim); }
.tnum { font-variant-numeric: tabular-nums; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: clamp(28px, 4vw, 48px);
}
.section-head p { max-width: 42ch; color: var(--fg-dim); font-size: 0.9375rem; }

/* inline text link — underline grows from the left on hover */
.link {
  color: var(--accent);
  position: relative;
  white-space: nowrap;
}
.link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.42s var(--ease);
}
@media (hover: hover) { .link:hover::after { transform: scaleX(1); } }
.link--arrow > span { display: inline-block; transition: transform 0.42s var(--ease); }
@media (hover: hover) { .link--arrow:hover > span { transform: translateX(3px); } }

/* ---- nav ------------------------------------------------------ */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--nav-h);
  background: var(--bg-glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.5s var(--ease-io), background 0.5s var(--ease-io);
}
.nav[data-scrolled="true"] { border-bottom-color: var(--line-soft); }
.nav__in {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.nav__mark {
  font-size: 0.875rem;
  font-weight: 590;
  letter-spacing: -0.01em;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.nav__glyph {
  width: 22px; height: 22px;
  border-radius: 7px;
  background: var(--fg);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.5s var(--ease);
}
@media (hover: hover) { .nav__mark:hover .nav__glyph { transform: rotate(-8deg) scale(1.06); } }

.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a {
  font-size: 0.8125rem;
  color: var(--fg-dim);
  padding: 6px 11px;
  border-radius: 980px;
  transition: color 0.3s var(--ease-io), background 0.3s var(--ease-io);
}
@media (hover: hover) { .nav__links a:hover { color: var(--fg); background: var(--line-soft); } }
.nav__links a[aria-current="page"] { color: var(--fg); }
@media (max-width: 620px) { .nav__links a.opt { display: none; } }
@media (max-width: 460px) { .nav__mark span.name { display: none; } }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 7px 15px;
  border-radius: 980px;
  transition: transform 0.4s var(--ease), opacity 0.3s var(--ease-io);
}
@media (hover: hover) { .pill:hover { opacity: 0.88; transform: scale(1.03); } }
.pill:active { transform: scale(0.97); }
.pill--ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
}
@media (hover: hover) { .pill--ghost:hover { background: var(--line-soft); opacity: 1; } }

/* ---- hero ----------------------------------------------------- */
.hero {
  position: relative;
  padding-top: calc(var(--nav-h) + clamp(56px, 13vh, 130px));
  padding-bottom: clamp(48px, 9vh, 96px);
  overflow: clip;
}
/* soft light behind the headline; nudged by the pointer via --px/--py */
.hero__glow {
  position: absolute;
  top: -22%; left: 50%;
  width: min(1000px, 125vw);
  aspect-ratio: 1;
  translate: calc(-50% + var(--px, 0px) * 1) calc(var(--py, 0px) * 1);
  background: radial-gradient(circle at 50% 50%,
              var(--accent-sub) 0%, transparent 62%);
  pointer-events: none;
  z-index: 0;
  transition: translate 1.1s var(--ease-io);
}
.hero__role {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.8125rem;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 980px;
  padding: 6px 14px 6px 11px;
  margin-bottom: 26px;
}
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #30d158;
  box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.45);
  animation: pulse 2.8s var(--ease-io) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(48, 209, 88, 0); }
  100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0); }
}

.hero > .wrap { position: relative; z-index: 1; }
.hero .display { max-width: 15ch; }
.hero__sub { margin-top: 26px; max-width: 58ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }

/* the hairline stat strip under the hero */
.strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: 1px solid var(--line-soft);
  margin-top: clamp(48px, 8vh, 88px);
}
.strip > div { padding: 22px 24px 22px 0; }
.strip > div + div {
  padding-left: 24px;
  border-left: 1px solid var(--line-soft);
}
@media (max-width: 640px) {
  .strip > div + div { padding-left: 0; border-left: 0; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip > div { border-bottom: 1px solid var(--line-soft); }
}
.strip dt { font-size: 0.75rem; color: var(--fg-dim); letter-spacing: 0.01em; }
.strip dd {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}
.strip dd small { font-size: 0.8125rem; font-weight: 400; color: var(--fg-dim); letter-spacing: -0.01em; }

/* ---- cards ---------------------------------------------------- */
.grid { display: grid; gap: clamp(14px, 1.6vw, 20px); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); }
@media (max-width: 820px) { .grid--2 { grid-template-columns: minmax(0, 1fr); } }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: clamp(22px, 2.4vw, 30px);
  box-shadow: var(--shadow-1);
  transition: transform 0.55s var(--ease), box-shadow 0.55s var(--ease),
              border-color 0.55s var(--ease);
}
@media (hover: hover) {
  .card--lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2);
    border-color: var(--line);
  }
}
.card__tag {
  font-size: 0.6875rem;
  font-weight: 590;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--accent);
}
.card__body {
  color: var(--fg-mid);
  font-size: 0.9375rem;
  line-height: 1.55;
  max-width: 70ch;
}
.card__foot {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.875rem;
}
.card--wide { grid-column: 1 / -1; }

/* metric chips inside a card */
.metrics { display: flex; flex-wrap: wrap; gap: 8px; }
.metric {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  background: var(--fill);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 5px 10px;
  color: var(--fg-mid);
}
.metric b { font-weight: 590; color: var(--fg); }

/* ---- experience list ------------------------------------------ */
.role {
  display: grid;
  grid-template-columns: minmax(0, 210px) minmax(0, 1fr);
  gap: clamp(12px, 3vw, 56px);
  padding-block: clamp(26px, 3.4vw, 40px);
  border-top: 1px solid var(--line-soft);
}
.role:first-of-type { border-top: 0; }
@media (max-width: 720px) { .role { grid-template-columns: 1fr; } }
.role__when { font-size: 0.875rem; color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.role__org { font-size: 1.0625rem; font-weight: 590; letter-spacing: -0.016em; margin-bottom: 3px; }
.role__title { font-size: 1.3125rem; letter-spacing: -0.022em; }
.role__where { font-size: 0.8125rem; color: var(--fg-dim); margin-top: 4px; }
.role ul { list-style: none; padding: 0; margin-top: 16px; display: grid; gap: 12px; }
.role li {
  position: relative;
  padding-left: 18px;
  max-width: 74ch;
  color: var(--fg-mid);
  font-size: 0.9375rem;
  line-height: 1.6;
}
.role li::before {
  content: "";
  position: absolute;
  left: 1px; top: 0.66em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--line);
}
.role li b, .role li strong { font-weight: 590; color: var(--fg); }

/* ---- segmented control (iOS picker) --------------------------- */
.segmented {
  position: relative;
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--fill-strong);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented__thumb {
  position: absolute;
  top: 2px;
  height: calc(100% - 4px);
  background: var(--thumb);
  border-radius: 9px;
  box-shadow: var(--thumb-shadow);
  transition: transform 0.45s var(--ease), width 0.45s var(--ease);
  will-change: transform, width;
}
.segmented button {
  position: relative;
  z-index: 1;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-dim);
  padding: 7px 15px;
  border-radius: 9px;
  white-space: nowrap;
  transition: color 0.3s var(--ease-io);
}
.segmented button[aria-selected="true"] { color: var(--fg); }

/* filtered-out items collapse out of the grid */
.filterable[hidden] { display: none; }

/* ---- article -------------------------------------------------- */
.progress {
  position: fixed;
  top: var(--nav-h); left: 0;
  height: 2px;
  width: 100%;
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  background: var(--accent);
  z-index: 99;
}
.prose { font-size: 1.0625rem; line-height: 1.68; color: var(--fg-mid); }
.prose > * + * { margin-top: 1.35em; }
.prose h2 {
  margin-top: 2.4em;
  font-size: 1.5rem;
  color: var(--fg);
  letter-spacing: -0.024em;
}
.prose h3 { margin-top: 2em; font-size: 1.1875rem; color: var(--fg); }
.prose strong { color: var(--fg); font-weight: 590; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose ul, .prose ol { padding-left: 1.15em; display: grid; gap: 0.5em; }
.prose li::marker { color: var(--fg-dim); }
.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--fill-strong);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 0.14em 0.4em;
  color: var(--fg);
}
.prose pre {
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.6;
  background: var(--fill-code);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 18px 20px;
  overflow-x: auto;
  color: var(--fg);
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
/* figures break out of the text column, centred on it */
.prose figure {
  margin-top: 2.6em;
  width: min(calc(100vw - 2 * var(--gutter)), 920px);
  position: relative;
  left: 50%;
  translate: -50% 0;
}
.prose figure img {
  margin-inline: auto;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: var(--bg-sub);
}
.prose figcaption {
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--fg-dim);
  text-align: center;
}

/* these diagrams are drawn on white, so in dark mode knock the glare back a
   little and lift it on hover for a proper look */
.prose figure img {
  filter: var(--fig-filter);
  transition: filter 0.5s var(--ease-io);
}
.prose figure:hover img { filter: none; }

/* provenance note at the head of a republished piece */
.note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--fill);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--fg-mid);
}
.note svg { flex: none; margin-top: 2px; color: var(--fg-dim); }

/* long byline under an article title */
.byline {
  font-size: 0.875rem;
  color: var(--fg-dim);
  line-height: 1.6;
  max-width: 62ch;
}
.byline b { color: var(--fg); font-weight: 590; }
/* tables: hairline rows, no vertical rules, figures aligned */
.table-scroll {
  overflow-x: auto;
  margin-top: 2.2em;
  -webkit-overflow-scrolling: touch;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  min-width: 460px;
}
.prose th, .prose td {
  text-align: left;
  padding: 11px 18px 11px 0;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.prose thead th {
  font-size: 0.6875rem;
  font-weight: 590;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border-bottom-color: var(--line);
}
.prose tbody td { color: var(--fg-mid); }
.prose td.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
.prose th.num { text-align: right; padding-right: 0; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr.best td { color: var(--fg); font-weight: 590; }

.prose blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 18px;
  color: var(--fg);
  font-size: 1.1875rem;
  letter-spacing: -0.018em;
}

/* ---- post list ------------------------------------------------ */
.post {
  display: block;
  padding-block: clamp(24px, 3vw, 34px);
  border-top: 1px solid var(--line-soft);
  transition: opacity 0.4s var(--ease-io);
}
.post h3 { font-size: clamp(1.25rem, 2.4vw, 1.625rem); letter-spacing: -0.024em; }
.post__meta { font-size: 0.8125rem; color: var(--fg-dim); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.post p { color: var(--fg-mid); font-size: 0.9375rem; margin-top: 8px; max-width: 62ch; }
.post .go { display: inline-block; margin-top: 12px; font-size: 0.875rem; color: var(--accent); }
.post .go span { display: inline-block; transition: transform 0.42s var(--ease); }
@media (hover: hover) {
  a.post:hover h3 { color: var(--accent); }
  a.post:hover .go span { transform: translateX(4px); }
  a.post h3 { transition: color 0.35s var(--ease-io); }
}

/* ---- footer --------------------------------------------------- */
.foot {
  border-top: 1px solid var(--line-soft);
  padding-block: 48px 40px;
  font-size: 0.8125rem;
  color: var(--fg-dim);
}
.foot__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: baseline;
  justify-content: space-between;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 20px; }
@media (hover: hover) { .foot a:hover { color: var(--fg); } }
.foot a { transition: color 0.3s var(--ease-io); }

/* ---- scroll reveal -------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translate3d(0, 16px, 0);
}
.reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.75s var(--ease-io), transform 0.85s var(--ease);
  transition-delay: calc(var(--i, 0) * 65ms);
}
.no-js .reveal, .reveal.in { opacity: 1; }
.no-js .reveal { transform: none; }

/* ---- theme toggle --------------------------------------------- */
/* One button. It flips to whatever you are not currently looking at, and the
   choice sticks in localStorage. Untouched, the site follows the OS. */
.themer {
  display: grid;
  place-items: center;
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 980px;
  color: var(--fg-dim);
  transition: color 0.3s var(--ease-io), background 0.3s var(--ease-io),
              transform 0.4s var(--ease);
}
@media (hover: hover) {
  .themer:hover { color: var(--fg); background: var(--line-soft); }
}
.themer:active { transform: scale(0.9); }
.themer svg {
  grid-area: 1 / 1;
  width: 16px;
  height: 16px;
  transition: opacity 0.4s var(--ease-io), transform 0.55s var(--ease);
}
.themer .sun {
  opacity: var(--sun-o);
  transform: rotate(calc((1 - var(--sun-o)) * -80deg)) scale(calc(0.6 + 0.4 * var(--sun-o)));
}
.themer .moon {
  opacity: var(--moon-o);
  transform: rotate(calc((1 - var(--moon-o)) * 80deg)) scale(calc(0.6 + 0.4 * var(--moon-o)));
}
/* nothing to toggle without JS, so don't advertise it */
.no-js .themer { display: none; }

/* brief global crossfade, added by JS only for the duration of a switch */
html.theming, html.theming *, html.theming *::before, html.theming *::after {
  transition: background-color 0.35s var(--ease-io), border-color 0.35s var(--ease-io),
              color 0.35s var(--ease-io), box-shadow 0.35s var(--ease-io),
              fill 0.35s var(--ease-io) !important;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero__glow { translate: -50% 0; }
}

/* ---- cross-document navigation --------------------------------- */
@view-transition { navigation: auto; }

::view-transition-old(root) { animation-duration: 0.22s; animation-timing-function: var(--ease-io); }
::view-transition-new(root) { animation-duration: 0.32s; animation-timing-function: var(--ease-io); }

/* the chrome stays put while the page underneath changes */
.nav { view-transition-name: nav; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* screen-reader only */
.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip {
  position: absolute; top: 8px; left: 8px;
  z-index: 200;
  background: var(--fg); color: var(--bg);
  padding: 9px 14px; border-radius: 10px;
  font-size: 0.8125rem;
  transform: translateY(-160%);
  transition: transform 0.35s var(--ease);
}
.skip:focus { transform: none; }
