/* Parshav Singla: portfolio styles
   One accent colour, automatic light and dark themes, system fonts, no dependencies. */

@view-transition { navigation: auto; }

:root {
  color-scheme: light dark;

  --bg: light-dark(#ffffff, #0d1117);
  --bg-soft: light-dark(#f4f6f9, #121820);
  --card: light-dark(#ffffff, #141b24);
  --line: light-dark(#dde2e9, #263140);
  --text: light-dark(#111827, #e7ebf0);
  --muted: light-dark(#4b5767, #9ba7b6);
  --accent: light-dark(#0b5cab, #6ab0f3);
  --accent-strong: light-dark(#084a8c, #9ccbf8);
  --accent-soft: light-dark(#e7f0fa, #15283d);
  --on-accent: light-dark(#ffffff, #08121d);
  --shadow: light-dark(0 1px 2px rgb(16 24 40 / 0.06), 0 1px 2px rgb(0 0 0 / 0.4));

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 12px;
  --wrap: 1080px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --space-section: clamp(2.75rem, 6vw, 4.5rem);
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

img, svg { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  line-height: 1.2;
  margin: 0 0 0.6rem;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 5.2vw, 3.25rem); font-weight: 750; }
h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 650; }
p { margin: 0 0 1rem; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }

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

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

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; color: var(--on-accent); }

/* ------------------------------------------------------------ header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.85rem;
  font-weight: 750;
  letter-spacing: 0;
}

.header-actions { display: flex; align-items: center; gap: 0.25rem; }

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  list-style: none;
}
.nav-list a {
  display: block;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.97rem;
  font-weight: 550;
  text-decoration: none;
}
.nav-list a:hover { color: var(--text); background: var(--bg-soft); }
.nav-list a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--bg-soft); }
.icon-btn svg { width: 1.2rem; height: 1.2rem; }

.menu-toggle { display: none; }

@media (max-width: 1000px) {
  .js .menu-toggle { display: inline-grid; }
  .js .site-nav {
    position: absolute;
    inset: 100% 0 auto 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--gutter) 1rem;
    display: none;
  }
  .js .site-nav.open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; }
  .nav-list a { padding: 0.75rem 0.8rem; font-size: 1.05rem; }
  :root:not(.js) .header-inner { flex-wrap: wrap; padding-block: 0.5rem; }
  :root:not(.js) .nav-list { flex-direction: row; flex-wrap: wrap; }
}

/* -------------------------------------------------------------- hero */

.hero { padding-block: clamp(2.5rem, 7vw, 5rem) var(--space-section); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.lead {
  font-size: clamp(1.1rem, 2.2vw, 1.25rem);
  color: var(--muted);
  max-width: 40rem;
  margin-top: 1rem;
}

.seeking {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  max-width: 40rem;
  margin: 1.5rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
  font-weight: 550;
  line-height: 1.5;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn svg { width: 1em; height: 1em; }

.portrait {
  margin: 0;
  justify-self: end;
  width: 100%;
  max-width: 17rem;
}
.portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; justify-self: start; max-width: 9.5rem; }
}

/* ------------------------------------------------------------- stats */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.stat {
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.stat strong {
  font-size: 1.85rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.stat span { margin-top: 0.4rem; color: var(--muted); font-size: 0.94rem; line-height: 1.45; }

@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------------------------------------------------------- sections */

.section { padding-block: var(--space-section); content-visibility: auto; contain-intrinsic-size: auto 600px; }
.section.alt { background: var(--bg-soft); border-block: 1px solid var(--line); }
.section.tight { padding-block: 1.75rem; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.5rem;
}
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); max-width: 38rem; }
.more-link { font-weight: 600; font-size: 0.97rem; white-space: nowrap; }

.page-head {
  padding-block: clamp(2.25rem, 5vw, 3.75rem) clamp(1.5rem, 3vw, 2.25rem);
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.page-head h1 { font-size: clamp(1.9rem, 4.2vw, 2.6rem); margin-bottom: 0.5rem; }
.page-head p { margin: 0; color: var(--muted); max-width: 42rem; font-size: 1.1rem; }

.crumbs { margin: 0 0 0.9rem; font-size: 0.9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent-strong); }

/* ------------------------------------------------------------- cards */

.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid.cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid.cols-2 { grid-template-columns: 1fr; } }

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }
.card h3, .card-title { margin-bottom: 0.5rem; }
.card-title { font-size: 1.2rem; font-weight: 650; line-height: 1.2; letter-spacing: -0.015em; }
.card p { color: var(--muted); }
.card .card-foot { margin-top: auto; padding-top: 0.5rem; }
.card-meta {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 550;
}

.badge {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  vertical-align: middle;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0.9rem 0 0; }
.tags li {
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 550;
  line-height: 1.5;
}
.card .tags { margin-top: 1rem; }

.bullets { margin: 0 0 0.25rem; padding-left: 1.15rem; color: var(--muted); }
.bullets li { margin-bottom: 0.5rem; padding-left: 0.2rem; }
.bullets li::marker { color: var(--accent); }

/* ---------------------------------------------------- experience list */

.stack { display: grid; gap: 1.1rem; grid-template-columns: minmax(0, 1fr); }

.entry-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  margin-bottom: 0.9rem;
}
.entry-head h3, .entry-head .card-title { margin: 0; }
.entry-org { margin: 0.15rem 0 0; color: var(--text); font-weight: 550; }
.entry-when { text-align: right; color: var(--muted); font-size: 0.93rem; line-height: 1.5; }
.entry-when strong { display: block; color: var(--text); font-weight: 600; }
@media (max-width: 640px) { .entry-when { text-align: left; } }
.entry-intro { margin-bottom: 0.75rem; }

/* ----------------------------------------------------- publications */

.pub-title { font-size: 1.3rem; }
.pub-authors { color: var(--text) !important; margin-bottom: 0.4rem; }
.pub-authors b { font-weight: 700; }
.pub-venue { font-size: 0.97rem; }
.pub-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.1rem; }

.cite {
  margin: 1rem 0 0;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------- about */

.about-grid {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: start;
}
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } .about-grid .portrait { max-width: 9.5rem; justify-self: start; } }
.prose p { max-width: 42rem; }

.facts { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0 0 0.9rem; padding: 0; list-style: none; color: var(--text); font-weight: 600; font-size: 0.95rem; }
.defs { margin: 0; }
.defs dt { margin-top: 0.7rem; font-weight: 650; font-size: 0.9rem; color: var(--text); }
.defs dd { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.97rem; }

.list-plain { list-style: none; display: grid; gap: 0.9rem; }
.list-plain li { padding-bottom: 0.9rem; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; padding-bottom: 0; }
.list-plain .row-title { display: block; font-weight: 650; }
.list-plain .row-sub { display: block; color: var(--muted); font-size: 0.95rem; }

.skill-row { margin-bottom: 1.1rem; }
.skill-row h3 { font-size: 0.95rem; margin-bottom: 0.1rem; color: var(--text); }
.skill-row .tags { margin-top: 0.45rem; }

/* ----------------------------------------------------------- contact */

.contact-list { list-style: none; display: grid; gap: 0.2rem; margin: 0; }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.45rem; }
.btn.small { padding: 0.25rem 0.75rem; font-size: 0.88rem; }
.contact-list li { display: grid; grid-template-columns: 8.75rem minmax(0, 1fr); gap: 0.25rem 1rem; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.contact-list li:last-child { border-bottom: 0; }
.contact-list .label { color: var(--muted); font-weight: 550; white-space: nowrap; }
.contact-list .value { font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 480px) { .contact-list li { grid-template-columns: 1fr; } }
.copy-status { margin-left: 0; color: var(--accent-strong); font-size: 0.9rem; font-weight: 600; }

/* -------------------------------------------------------------- cta */

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--accent-soft);
}
.cta h2 { margin-bottom: 0.3rem; }
.cta p { margin: 0; color: var(--muted); max-width: 36rem; }

/* ----------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding-block: 2.25rem 1.5rem; margin-top: auto; font-size: 0.95rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 2rem; }
.footer-grid h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.7rem; }
.footer-grid ul { list-style: none; display: grid; gap: 0.4rem; }
.footer-grid a { color: var(--text); text-decoration: none; }
.footer-grid a:hover { color: var(--accent-strong); text-decoration: underline; }
.footer-about { color: var(--muted); max-width: 22rem; margin: 0.6rem 0 0; }
.footer-base { margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

/* ------------------------------------------------------------- 404 */

.notfound { padding-block: clamp(4rem, 12vw, 8rem); text-align: left; }
.notfound .big { font-size: clamp(4rem, 14vw, 7rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: var(--accent); margin: 0 0 0.5rem; }

/* ------------------------------------------------- interaction polish */

.card {
  position: relative;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card.link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px light-dark(rgb(16 24 40 / 0.1), rgb(0 0 0 / 0.45));
}
.card-foot a.stretched { font-weight: 600; text-decoration: none; }
.card-foot a.stretched::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card.link-card:hover .card-foot a.stretched { text-decoration: underline; text-decoration-thickness: 2px; }
.card:has(a.stretched:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.card a.stretched:focus-visible { outline: none; }
.card .btn, .card .more-link, .card .pub-links a { position: relative; z-index: 1; }

.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 2.5rem; }
@media (max-width: 760px) { .skills-grid { grid-template-columns: 1fr; } }
.muted { color: var(--muted); font-size: 0.97rem; }

/* ------------------------------------------------------- utilities */

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  @view-transition { navigation: none; }
}

@media print {
  .site-header, .site-footer, .actions, .skip-link, .cta, .menu-toggle { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .section, .section.alt, .page-head { background: none; border: 0; padding-block: 0.75rem; }
  .card { box-shadow: none; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

a > svg { width: 1em; height: 1em; }
.more-link svg, .card a:not(.btn) > svg { display: inline; vertical-align: -0.125em; }

/* ------------------------------------------------------ pagination, filters */

[hidden] { display: none !important; }
.pager-item { min-width: 0; }
.pager-item > .card { height: 100%; }
.pager-status { margin: 0 0 1rem; min-height: 1.5em; color: var(--muted); font-size: 0.93rem; }
.filters { display: none; }
.js .filters { display: flex; }

.filters { flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.chip span { color: var(--muted); font-weight: 550; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip[aria-pressed="true"] span { color: inherit; opacity: 0.85; }

.pager { margin-top: 1.75rem; }
.pager ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; list-style: none; }
.pager button {
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-strong); }
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pager button:disabled { opacity: 0.45; cursor: not-allowed; }
.pager .gap { align-self: center; padding: 0 0.2rem; color: var(--muted); }

.card.highlight { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.card.highlight p { color: var(--text); }


/* ------------------------------------------------ preferences (settings panel) */

html[data-text="sm"] { font-size: 93.75%; }
html[data-text="lg"] { font-size: 112.5%; }

html[data-motion="reduce"] { scroll-behavior: auto; }
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after {
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
}

:root[data-theme="contrast"] {
  color-scheme: dark;
  --bg: #000;
  --bg-soft: #0b0b0b;
  --card: #000;
  --line: #ffffff;
  --text: #ffffff;
  --muted: #e8e8e8;
  --accent: #8fd3ff;
  --accent-strong: #c4e8ff;
  --accent-soft: #00213a;
  --on-accent: #000;
  --shadow: none;
}
:root[data-theme="contrast"] .card, :root[data-theme="contrast"] .btn, :root[data-theme="contrast"] .chip { border-color: #fff; }

/* ------------------------------------------------------- small helpers */

.nowrap { white-space: nowrap; }
.js-only { display: none !important; }
.js .js-only { display: inline-grid !important; }
.js .pixie-launch.js-only { display: inline-flex !important; }
.js .pixie-launch[hidden] { display: none !important; }

.card-meta, .entry-when, .footer-about, .row-sub, .section-head p, .page-head p, .lead, .stat span, .crumbs { text-wrap: balance; }
li, dd, td { text-wrap: pretty; }
.tags li { white-space: nowrap; }
.entry-when span.place { white-space: nowrap; }

/* -------------------------------------------------- dialogs and panels */

dialog {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 20px 50px light-dark(rgb(16 24 40 / 0.22), rgb(0 0 0 / 0.6));
}
dialog::backdrop { background: rgb(8 12 18 / 0.5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }

.panel.settings {
  position: fixed;
  inset: 4.25rem max(var(--gutter), calc((100vw - var(--wrap)) / 2)) auto auto;
  margin: 0;
  width: min(22.5rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 5.5rem);
  overflow: auto;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1rem 0.5rem 1.25rem; }
.panel-head h2 { margin: 0; font-size: 1.1rem; }
.panel-body { display: grid; gap: 1.1rem; padding: 0.5rem 1.25rem 1.25rem; }
.panel fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.panel legend { padding: 0; margin-bottom: 0.5rem; font-size: 0.85rem; font-weight: 650; color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.seg .chip { padding: 0.35rem 0.8rem; font-size: 0.9rem; }
.switch { display: flex; align-items: center; gap: 0.7rem; font-weight: 600; cursor: pointer; }
.switch input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.field label { display: block; margin-bottom: 0.4rem; font-size: 0.85rem; font-weight: 650; color: var(--muted); }
.field select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}
.hint { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }

dialog.palette {
  width: min(40rem, calc(100vw - 1.5rem));
  max-height: min(34rem, calc(100dvh - 4rem));
  margin: 8vh auto auto;
  overflow: hidden;
}
.palette-box { display: flex; flex-direction: column; max-height: inherit; }
.palette-input { display: flex; align-items: center; gap: 0.7rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 1.2rem; height: 1.2rem; flex: none; color: var(--muted); }
.palette-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
}
.palette-input input::-webkit-search-cancel-button { display: none; }
kbd {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-soft);
  color: var(--muted);
  font: 600 0.72rem var(--font);
}
#search-results { list-style: none; margin: 0; padding: 0.4rem; overflow-y: auto; }
#search-results li a { display: block; padding: 0.6rem 0.8rem; border-radius: 9px; color: var(--text); text-decoration: none; }
#search-results li.active a { background: var(--accent-soft); }
#search-results .r-title { display: block; font-weight: 650; }
#search-results .r-meta { display: block; margin-top: 0.1rem; color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
#search-results .empty { padding: 1.2rem 0.8rem; color: var(--muted); }
.palette-foot { display: flex; gap: 1.2rem; margin: 0; padding: 0.6rem 1rem; border-top: 1px solid var(--line); background: var(--bg-soft); color: var(--muted); font-size: 0.8rem; }
.palette-foot kbd { margin-right: 0.15rem; }
@media (max-width: 640px) { .palette-foot { display: none; } .palette-input kbd { display: none; } }

/* ----------------------------------------------------------- Pixie chat */

.pixie-launch {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.05rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  box-shadow: 0 8px 22px light-dark(rgb(11 92 171 / 0.35), rgb(0 0 0 / 0.55));
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.pixie-launch:hover { background: var(--accent-strong); transform: translateY(-2px); }
.pixie-launch svg { width: 1.2rem; height: 1.2rem; }

.pixie {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 70;
  display: flex;
  flex-direction: column;
  width: min(24rem, calc(100vw - 2rem));
  height: min(35rem, calc(100dvh - 2rem));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 20px 50px light-dark(rgb(16 24 40 / 0.25), rgb(0 0 0 / 0.6));
  overflow: hidden;
}
.pixie[hidden] { display: none !important; }
.pixie-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.7rem 0.6rem 0.7rem 1rem; border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.pixie-head strong { display: block; line-height: 1.2; }
.pixie-head span { color: var(--muted); font-size: 0.8rem; }
.pixie-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; overscroll-behavior: contain; }
.msg { max-width: 88%; padding: 0.55rem 0.8rem; border-radius: 14px; font-size: 0.94rem; line-height: 1.5; overflow-wrap: anywhere; }
.msg.from-pixie { align-self: flex-start; background: var(--bg-soft); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.from-user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.msg.typing { color: var(--muted); font-style: italic; }
.msg.error { border-color: #c0392b; }
.pixie-suggest { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1rem 0.6rem; }
.pixie-suggest .chip { font-size: 0.83rem; padding: 0.3rem 0.75rem; text-align: left; }
.pixie-form { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.6rem 0.8rem; border-top: 1px solid var(--line); }
.pixie-form textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  max-height: 7.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
}
.pixie-send {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}
.pixie-send:disabled { opacity: 0.5; cursor: wait; }
.pixie-send svg { width: 1.2rem; height: 1.2rem; }
.pixie-note { margin: 0; padding: 0 1rem 0.7rem; color: var(--muted); font-size: 0.74rem; line-height: 1.4; }
@media (max-width: 520px) {
  .pixie { right: 0; bottom: 0; width: 100vw; height: min(40rem, 88dvh); border-radius: 16px 16px 0 0; }
}
@media print { .pixie, .pixie-launch, dialog { display: none !important; } }
