*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: light dark;
  --font-sans: "Fraunces", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-code: "Space Grotesk";
}

html {
  overflow-x: clip;
}

[data-theme="light"] { color-scheme: light; background: #fff; }
[data-theme="dark"] { color-scheme: dark; background: #14161a; }

body {
  font-family: var(--font-sans);
  font-weight: 300;
  max-width: min(720px, 100%);
  margin: 3rem auto;
  padding: 0 1.5rem 4rem;
  line-height: 1.65;
  color: #1a1a1a;
  background: #fff;
  isolation: isolate;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

[data-theme="dark"] body { color: #e8e8e8; background: #14161a; }
[data-theme="dark"] a { color: #6cb6ff; }
[data-theme="dark"] .post-card { border-color: #2a2d33; }
[data-theme="dark"] .post-card:hover { background: #1b1e24; }
[data-theme="dark"] code, [data-theme="dark"] pre { background: #1e2127; }
[data-theme="dark"] blockquote { border-color: #3a3d44; color: #b6bac2; }
[data-theme="dark"] article.post-body .font-instrument em { color: #b6bac2; }
[data-theme="dark"] hr { border-color: #2a2d33; }
[data-theme="dark"] .tag { background: #23262c; color: #b6bac2; }

a { color: #0969da; text-decoration: none; }
a:hover { text-decoration: underline; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  font-size: 0.95rem;
  width: 100%;
  min-width: 0;
}

.site-nav [data-lyceum-switcher] {
  margin-left: auto;
}

.site-nav .memrise-link,
.site-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.site-nav .memrise-logo {
  width: 1.15em;
  height: auto;
  fill: currentColor;
}

.site-nav .nav-icon {
  width: 0.95em;
  height: 0.95em;
  fill: currentColor;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.25;
}

h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.35rem; margin-top: 2rem; }
h3 { font-size: 1.1rem; margin-top: 1.5rem; }
h4 { font-size: 1.05rem; margin-top: 1.75rem; margin-bottom: 0.65rem; }
h5 { font-size: 1rem; margin-top: 1.25rem; }
h6 { font-size: 0.95rem; margin-top: 1rem; }

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-card {
  display: block;
  padding: 1.25rem 0;
  border-bottom: 1px solid #e2e2e2;
  color: inherit;
}

.post-card:hover { text-decoration: none; background: #fafafa; }

.post-card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  margin: 0 0 0.35rem;
}

.post-card-summary {
  margin: 0 0 0.5rem;
  color: #555;
  font-size: 0.95rem;
}

[data-theme="dark"] .post-card-summary { color: #9aa0aa; }

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #777;
}

.tag {
  display: inline-block;
  background: #f0f2f5;
  color: #444;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.8rem;
}

.tag-list { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* Colour-coded changelog product / area tags */
.chg-tag {
  display: inline-block;
  vertical-align: middle;
  margin: 0 0.2rem 0.15rem 0;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
  background: #f0f2f5;
  color: #444;
}

[data-theme="dark"] .chg-tag { background: #23262c; color: #b6bac2; }

.tag-list a.tag:hover { text-decoration: none; opacity: 0.85; }

.chg-tag--web-core-app { background: #dbeafe; color: #1e40af; }
.chg-tag--community-courses { background: #ede9fe; color: #5b21b6; }
.chg-tag--android { background: #dcfce7; color: #166534; }
.chg-tag--ios { background: #e5e7eb; color: #1f2937; }
.chg-tag--internal { background: #ffedd5; color: #9a3412; }
.chg-tag--learning { background: #cffafe; color: #155e75; }
.chg-tag--path { background: #fce7f3; color: #9d174d; }
.chg-tag--plans { background: #fef3c7; color: #92400e; }
.chg-tag--onboarding { background: #e0e7ff; color: #3730a3; }
.chg-tag--mems { background: #f3e8ff; color: #6b21a8; }

[data-theme="dark"] .chg-tag--web-core-app { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .chg-tag--community-courses { background: #3b0764; color: #d8b4fe; }
[data-theme="dark"] .chg-tag--android { background: #14532d; color: #86efac; }
[data-theme="dark"] .chg-tag--ios { background: #374151; color: #e5e7eb; }
[data-theme="dark"] .chg-tag--internal { background: #7c2d12; color: #fdba74; }
[data-theme="dark"] .chg-tag--learning { background: #164e63; color: #a5f3fc; }
[data-theme="dark"] .chg-tag--path { background: #831843; color: #f9a8d4; }
[data-theme="dark"] .chg-tag--plans { background: #78350f; color: #fde68a; }
[data-theme="dark"] .chg-tag--onboarding { background: #312e81; color: #c7d2fe; }
[data-theme="dark"] .chg-tag--mems { background: #581c87; color: #e9d5ff; }

.empty-state {
  color: #777;
  padding: 2rem 0;
}

.back-link { display: inline-block; margin-bottom: 1.5rem; font-size: 0.9rem; }

article.post-body { margin-top: 1.5rem; min-width: 0; overflow-wrap: anywhere; }
article.post-body img { max-width: 100%; height: auto; border-radius: 6px; }
article.post-body table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
}
article.post-body pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: 6px;
  background: #f6f8fa;
  font-family: var(--font-code);
}

.code-block,
.code-block * {
  font-family: var(--font-code);
}

.code-block {
  margin: 1.15rem 0;
  border: 1px solid #d8dee6;
  border-radius: 8px;
  overflow: hidden;
  background: #f6f8fa;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  padding: 0.4rem 0.65rem 0.4rem 0.85rem;
  border-bottom: 1px solid #d8dee6;
  background: #eef1f5;
}

.code-block-label {
  font-family: var(--font-code);
  font-size: 0.78rem;
  color: #57606a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-block-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; flex-shrink: 0; }

.code-block-btn {
  appearance: none;
  border: 1px solid #d0d7de;
  background: #fff;
  color: #24292f;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-family: var(--font-code);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
}

.code-block-btn:hover { background: #f3f4f6; }

.code-block-btn.is-active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

article.post-body .code-block pre,
article.post-body .code-block-pre {
  margin: 0;
  border-radius: 0;
  background: transparent;
  overflow-x: auto;
  padding: 0.7rem 0;
}

.code-block-pre code {
  display: block;
  font-family: var(--font-code);
  font-size: 0.9em;
  line-height: 1.55;
}

.code-line {
  display: flex;
  align-items: flex-start;
  min-width: 0;
}

.code-line-num {
  flex: none;
  box-sizing: content-box;
  width: var(--code-gutter, 2ch);
  padding: 0 0.75rem 0 0.85rem;
  text-align: right;
  user-select: none;
  color: #8c959f;
}

.code-line-src {
  flex: 1;
  min-width: 0;
  padding-right: 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

html[data-code-wrap="off"] .code-line-src {
  white-space: pre;
  overflow-wrap: normal;
}

html[data-code-wrap="off"] .code-block-pre {
  overflow-x: auto;
}

html[data-code-wrap="off"] .code-line {
  min-width: max-content;
}

html[data-code-lines="off"] .code-line-num { display: none; }

html[data-code-lines="off"] .code-line-src { padding-left: 1rem; }

.tok-comment { color: #6a737d; }
.tok-keyword { color: #d73a49; }
.tok-string { color: #032f62; }
.tok-number { color: #005cc5; }

[data-theme="dark"] .code-block {
  border-color: #30363d;
  background: #1e2127;
}

[data-theme="dark"] .code-block-header {
  border-bottom-color: #30363d;
  background: #161b22;
}

[data-theme="dark"] .code-block-label { color: #8b949e; }

[data-theme="dark"] .code-block-btn {
  border-color: #30363d;
  background: #21262d;
  color: #e6edf3;
}

[data-theme="dark"] .code-block-btn:hover { background: #30363d; }

[data-theme="dark"] .code-block-btn.is-active {
  background: #e8e8e8;
  border-color: #e8e8e8;
  color: #14161a;
}

[data-theme="dark"] .code-line-num { color: #6e7681; }

[data-theme="dark"] .tok-comment { color: #8b949e; }
[data-theme="dark"] .tok-keyword { color: #ff7b72; }
[data-theme="dark"] .tok-string { color: #a5d6ff; }
[data-theme="dark"] .tok-number { color: #79c0ff; }
article.post-body code {
  font-family: var(--font-code);
  font-size: 0.9em;
}
article.post-body :not(pre) > code {
  background: #f0f2f5;
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
article.post-body blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid #ddd;
  color: #555;
}

article.post-body .font-instrument {
  font-family: var(--font-display);
  font-weight: 400;
}

article.post-body .font-instrument em {
  color: #555;
}

.post-error { color: #b42318; padding: 2rem 0; }

body.post-page { max-width: min(960px, 100%); }

.post-layout {
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
}

#post-root { flex: 1; min-width: 0; }

.toc {
  flex: 0 0 240px;
  order: -1;
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding: 0.9rem 1rem;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  background: #fafafa;
  font-size: 0.88rem;
}

.toc-title {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding-left: 1rem;
}

.toc > ul { padding-left: 0; }

.toc li { margin: 0.35rem 0; }

.toc a {
  color: inherit;
  display: inline-block;
}

html { scroll-behavior: smooth; }

article.post-body h1,
article.post-body h2,
article.post-body h3,
article.post-body h4,
article.post-body h5,
article.post-body h6 {
  scroll-margin-top: 1.5rem;
}

@media (max-width: 800px) {
  .post-layout { flex-direction: column; }
  .toc {
    order: 0;
    flex-basis: auto;
    position: static;
    max-height: none;
    width: 100%;
  }
}

[data-theme="dark"] .toc { background: #1b1e24; border-color: #2a2d33; }
[data-theme="dark"] .changelog-tag-group { border-bottom-color: #2a2d33; }

/* ---- List / post toolbars: tag filter, sort, view toggle ---- */

.list-toolbar, .post-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  background: #fafafa;
}

.post-toolbar { margin: 1.25rem 0 1.5rem; }

.post-toolbar-row, .list-toolbar-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.list-toolbar-controls { justify-content: space-between; }

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-chip {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #d8d8d8;
  background: #fff;
  color: #444;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tag-chip:hover { border-color: #b7b7b7; }

.tag-chip.is-active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #555;
}

.sort-control select {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #d8d8d8;
  background: #fff;
  color: inherit;
}

.view-toggle, .sort-toggle {
  display: inline-flex;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  overflow: hidden;
}

.view-toggle button, .sort-toggle button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  border: none;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.view-toggle button + button, .sort-toggle button + button {
  border-left: 1px solid #d8d8d8;
}

.view-toggle button.is-active, .sort-toggle button.is-active {
  background: #1a1a1a;
  color: #fff;
}

.changelog-search-wrap { flex: 1; min-width: min(12rem, 100%); }

.changelog-search {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #d8d8d8;
  background: #fff;
  color: inherit;
}

.changelog-empty { margin: 0; color: #777; font-size: 0.9rem; }

.changelog-tag-group {
  margin-top: 1.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #e2e2e2;
}

.feed-subscribe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.feed-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #d8d8d8;
  background: #fff;
  color: #333;
}

.feed-btn:hover { text-decoration: none; border-color: #b7b7b7; }

.feed-btn--rss {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.feed-icon {
  width: 0.85rem;
  height: 0.85rem;
}

[data-theme="dark"] .feed-btn {
  background: #14161a;
  border-color: #2a2d33;
  color: #d5d8de;
}

[data-theme="dark"] .feed-btn--rss {
  background: #e8e8e8;
  border-color: #e8e8e8;
  color: #14161a;
}

.post-list--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 1rem;
}

.post-list--grid .post-card {
  height: 100%;
  padding: 1rem;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
}

.post-list--grid .post-card:hover { background: #fafafa; }

[data-theme="dark"] .list-toolbar, [data-theme="dark"] .post-toolbar { background: #1b1e24; border-color: #2a2d33; }
[data-theme="dark"] .tag-chip,
[data-theme="dark"] .sort-control select,
[data-theme="dark"] .view-toggle button,
[data-theme="dark"] .sort-toggle button,
[data-theme="dark"] .changelog-search {
  background: #14161a;
  border-color: #2a2d33;
  color: #d5d8de;
}
[data-theme="dark"] .view-toggle button + button, [data-theme="dark"] .sort-toggle button + button { border-left-color: #2a2d33; }
[data-theme="dark"] .tag-chip.is-active,
[data-theme="dark"] .view-toggle button.is-active,
[data-theme="dark"] .sort-toggle button.is-active {
  background: #e8e8e8;
  border-color: #e8e8e8;
  color: #14161a;
}
[data-theme="dark"] .post-list--grid .post-card { border-color: #2a2d33; }
[data-theme="dark"] .post-list--grid .post-card:hover { background: #1b1e24; }

/* ---- Universal navbar search: liquid glass ---- */

.site-search {
  position: relative;
  margin-left: auto;
  min-width: 0;
}

.site-search-glass {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.15));
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.8),
    inset 0 -1px 6px rgba(0, 0, 0, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.25s ease, background 0.25s ease;
}

.site-search-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  background-size: 220% 100%;
  background-position: 200% 0;
  animation: glass-sheen 7s ease-in-out infinite;
  pointer-events: none;
}

.site-search:focus-within .site-search-glass {
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.85),
    0 6px 24px rgba(0, 0, 0, 0.1),
    0 0 0 3px rgba(120, 170, 255, 0.3);
}

@keyframes glass-sheen {
  0% { background-position: 200% 0; }
  55%, 100% { background-position: -120% 0; }
}

.site-search-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  cursor: default;
  line-height: 0;
}

.site-search-icon {
  flex: none;
  width: 0.95rem;
  height: 0.95rem;
  color: #777;
}

.site-search-input {
  position: relative;
  width: 9.5rem;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.85rem;
  color: inherit;
  outline: none;
  transition: width 0.25s ease;
}

.site-search:focus-within .site-search-input,
.site-search-input:not(:placeholder-shown) {
  width: 13rem;
}

.site-search-results {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  width: 22rem;
  max-width: min(22rem, 80vw);
  max-height: 60vh;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.45));
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96) translateY(-6px);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 50;
}

.site-search-results.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.search-result {
  display: block;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  color: inherit;
  animation: search-result-in 0.28s ease both;
}

.search-result:last-child { border-bottom: none; }

.search-result:hover, .search-result.is-active {
  background: rgba(120, 170, 255, 0.16);
  text-decoration: none;
}

@keyframes search-result-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: none; }
}

.search-result-section {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 0.15rem;
}

.search-result-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.search-result-snippet {
  display: block;
  font-size: 0.82rem;
  color: #666;
  margin-top: 0.15rem;
}

.search-result mark, .search-result-title mark {
  background: rgba(255, 214, 87, 0.55);
  color: inherit;
  border-radius: 3px;
  padding: 0 0.1em;
}

.search-empty {
  margin: 0;
  padding: 0.9rem;
  font-size: 0.85rem;
  color: #777;
}

[data-theme="dark"] .site-search-glass {
  border-color: rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    inset 0 -1px 6px rgba(0, 0, 0, 0.25),
    0 4px 16px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .site-search-glass::before {
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.16) 50%, transparent 70%);
  background-size: 220% 100%;
}
[data-theme="dark"] .site-search:focus-within .site-search-glass {
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.16),
    0 6px 24px rgba(0, 0, 0, 0.4),
    0 0 0 3px rgba(108, 182, 255, 0.35);
}
[data-theme="dark"] .site-search-icon { color: #9aa0aa; }
[data-theme="dark"] .site-search-results {
  border-color: rgba(255, 255, 255, 0.12);
  background: linear-gradient(160deg, rgba(30, 32, 38, 0.85), rgba(20, 22, 26, 0.7));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .search-result { border-bottom-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .search-result:hover, [data-theme="dark"] .search-result.is-active { background: rgba(108, 182, 255, 0.16); }
[data-theme="dark"] .search-result-section, [data-theme="dark"] .search-result-snippet, [data-theme="dark"] .search-empty { color: #9aa0aa; }
[data-theme="dark"] .search-result mark, [data-theme="dark"] .search-result-title mark { background: rgba(255, 214, 87, 0.35); }

@media (max-width: 720px) {
  body {
    margin: 1.5rem auto;
    padding: 0 1rem 3rem;
  }

  .site-nav {
    gap: 0.55rem;
  }

  .theme-toggle { margin-left: 0.15rem; }

  .site-search-toggle { cursor: pointer; }

  .site-search-glass {
    padding: 0.45rem;
  }

  .site-search-input {
    width: 0;
    min-width: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
  }

  .site-search:focus-within .site-search-input,
  .site-search-input:not(:placeholder-shown) {
    width: 0;
  }

  .site-nav.is-search-open .nav-link,
  .site-nav.is-search-open .memrise-link,
  .site-nav.is-search-open .theme-toggle {
    display: none;
  }

  .site-nav.is-search-open .site-search {
    flex: 1;
    margin-left: 0;
    min-width: 0;
  }

  .site-nav.is-search-open .site-search-glass {
    width: 100%;
    padding: 0.4rem 0.8rem;
  }

  .site-nav.is-search-open .site-search-input,
  .site-nav.is-search-open .site-search:focus-within .site-search-input,
  .site-nav.is-search-open .site-search-input:not(:placeholder-shown) {
    width: 100%;
    opacity: 1;
    pointer-events: auto;
  }

  .site-search-results {
    width: min(calc(100vw - 2rem), 22rem);
    max-width: calc(100vw - 2rem);
    right: 0;
  }

  .site-nav.is-search-open .site-search-results {
    left: 0;
    right: auto;
    width: 100%;
    max-width: none;
  }

  .changelog-search-wrap { min-width: 0; width: 100%; }
  .post-toolbar-row, .list-toolbar-controls { align-items: stretch; }
  .home-copy { padding: 1.2rem 1.15rem 1.25rem; }
}

@media (max-width: 560px) {
  .site-nav .nav-label { display: none; }
  .site-nav .nav-link,
  .site-nav .memrise-link { gap: 0; }
}

/* ---- Metaball bubble background (ray-marched, cursor trail) ---- */

.bubbles-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.bubbles-toggle-bar {
  position: relative;
  z-index: 1;
}

/* Keep the nav (and the Lyceum switcher dropdown) above page content. */
.site-nav {
  position: relative;
  z-index: 1000;
}

/* iOS 26 liquid glass: frosted plate so metaballs refract through the copy. */
.home-copy {
  position: relative;
  z-index: 1;
  padding: 1.6rem 1.75rem 1.7rem;
  border-radius: 28px;
  overflow: hidden;
  isolation: isolate;
}

.home-copy-glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.52) 0%, rgba(255, 255, 255, 0.12) 42%, rgba(255, 255, 255, 0.22) 100%);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.9),
    inset 0 -18px 36px rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 18px 50px rgba(0, 0, 0, 0.12);
  -webkit-backdrop-filter: blur(10px) saturate(200%);
  backdrop-filter: blur(10px) saturate(200%);
}

.home-copy-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 28%, rgba(255, 255, 255, 0.55) 48%, transparent 68%);
  background-size: 240% 100%;
  background-position: 200% 0;
  animation: glass-sheen 8s ease-in-out infinite;
  pointer-events: none;
}

.home-copy-glass::after {
  content: "";
  position: absolute;
  top: -40%;
  left: 8%;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0%, transparent 68%);
  pointer-events: none;
}

.home-copy-text {
  position: relative;
  z-index: 1;
}

.home-copy-text h1 {
  margin-top: 0;
}

.home-copy-text a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

[data-theme="dark"] .home-copy-glass {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 45%, rgba(255, 255, 255, 0.1) 100%);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.22),
    inset 0 -18px 36px rgba(0, 0, 0, 0.18),
    0 18px 50px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .home-copy-glass::before {
  background: linear-gradient(115deg, transparent 28%, rgba(255, 255, 255, 0.2) 48%, transparent 68%);
  background-size: 240% 100%;
}

[data-theme="dark"] .home-copy-glass::after {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, transparent 68%);
}

.bubbles-canvas.is-active { opacity: 1; }

.bubbles-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: -1.25rem 0 2rem;
  font-size: 0.85rem;
  color: #666;
}

@media (max-width: 480px) {
  .bubbles-toggle-bar { margin-top: 0.5rem; }
}

[data-theme="dark"] .bubbles-toggle-bar { color: #9aa0aa; }

.bubbles-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 2.5rem;
  height: 1.4rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.08);
  cursor: pointer;
  flex: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.bubbles-switch::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.bubbles-switch.is-on {
  background: linear-gradient(135deg, #6cb6ff, #7c5cff);
  border-color: transparent;
}

.bubbles-switch.is-on::after { transform: translateX(1.1rem); }

[data-theme="dark"] .bubbles-switch { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .bubbles-switch::after { background: #e8e8e8; }

/* ---- Theme toggle (auto / light / dark) ---- */

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  margin-left: 0.6rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.theme-toggle:hover { background: rgba(0, 0, 0, 0.06); }

.theme-toggle-icon {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
  pointer-events: none;
}

.theme-toggle-badge {
  position: absolute;
  right: -0.05rem;
  bottom: -0.05rem;
  min-width: 0.8rem;
  height: 0.8rem;
  padding: 0 0.15rem;
  border-radius: 3px;
  background: #0969da;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.52rem;
  font-weight: 700;
  line-height: 0.8rem;
  text-align: center;
  display: none;
  pointer-events: none;
}

.theme-toggle.theme-toggle--auto .theme-toggle-badge { display: block; }

[data-theme="dark"] .theme-toggle:hover { background: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .theme-toggle-badge { background: #6cb6ff; color: #14161a; }
