:root {
  color-scheme: light dark;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-muted: #ededeb;
  --text: #1d2328;
  --muted: #5b6670;
  --line: #d7d9d6;
  --accent: #126c83;
  --accent-strong: #0f5364;
  --accent-soft: #dceff3;
  --code-bg: #eef2f1;
  --shadow: 0 18px 45px rgba(34, 41, 47, 0.08);
  --shadow-soft: 0 10px 30px rgba(34, 41, 47, 0.06);
}

body[data-theme="dark"] {
  --bg: #101416;
  --surface: #171d20;
  --surface-muted: #20282b;
  --text: #edf1f2;
  --muted: #a9b4b8;
  --line: #2e393d;
  --accent: #66c5d7;
  --accent-strong: #9eddea;
  --accent-soft: #17333a;
  --code-bg: #11191c;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.18);
}

@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) {
    --bg: #101416;
    --surface: #171d20;
    --surface-muted: #20282b;
    --text: #edf1f2;
    --muted: #a9b4b8;
    --line: #2e393d;
    --accent: #66c5d7;
    --accent-strong: #9eddea;
    --accent-soft: #17333a;
    --code-bg: #11191c;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.18);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html:focus-within {
  scroll-behavior: smooth;
}

body {
  --font-stack:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --font-stack--headings: var(--font-stack);
  --font-stack--monospace: "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --color-foreground-primary: var(--text);
  --color-foreground-secondary: var(--muted);
  --color-foreground-muted: var(--muted);
  --color-foreground-border: var(--line);
  --color-background-primary: var(--bg);
  --color-background-secondary: var(--surface);
  --color-background-hover: var(--surface-muted);
  --color-background-hover--transparent: rgba(237, 237, 235, 0);
  --color-background-border: var(--line);
  --color-brand-primary: var(--accent-strong);
  --color-brand-content: var(--accent-strong);
  --color-brand-visited: var(--accent);
  --color-link: var(--accent-strong);
  --color-link--hover: var(--accent);
  --color-link--visited: var(--accent);
  --color-link-underline: color-mix(in srgb, var(--accent) 65%, transparent);
  --color-link-underline--hover: var(--accent-strong);
  --color-link-underline--visited: color-mix(in srgb, var(--accent) 45%, transparent);
  --color-sidebar-background: var(--bg);
  --color-sidebar-background-border: var(--line);
  --color-sidebar-brand-text: var(--text);
  --color-sidebar-caption-text: var(--muted);
  --color-sidebar-link-text: var(--muted);
  --color-sidebar-link-text--top-level: var(--text);
  --color-sidebar-item-background: transparent;
  --color-sidebar-item-background--current: var(--accent-soft);
  --color-sidebar-item-background--hover: var(--surface-muted);
  --color-sidebar-search-background: var(--surface);
  --color-sidebar-search-background--focus: var(--surface);
  --color-sidebar-search-border: var(--line);
  --color-sidebar-search-icon: var(--muted);
  --color-header-background: color-mix(in srgb, var(--bg) 88%, transparent);
  --color-header-border: var(--line);
  --color-header-text: var(--text);
  --color-toc-background: var(--bg);
  --color-toc-title-text: var(--muted);
  --color-toc-item-text: var(--muted);
  --color-toc-item-text--hover: var(--text);
  --color-toc-item-text--active: var(--accent-strong);
  --color-content-foreground: var(--text);
  --color-content-background: transparent;
  --color-inline-code-background: var(--code-bg);
  --color-card-border: var(--line);
  --color-card-background: var(--surface);
  --color-card-marginals-background: var(--surface-muted);
  --color-table-header-background: var(--surface-muted);
  --color-table-border: var(--line);
  --color-admonition-background: var(--surface);
  --color-highlight-on-target: var(--accent-soft);

  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 65%, transparent);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-strong);
}

a:focus-visible,
main:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.mobile-header .header-center .brand,
.sidebar-brand-text {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
}

.mobile-header .header-center .brand::before,
.sidebar-brand-text::before {
  content: "SR";
  display: inline-grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 0.82rem;
  letter-spacing: 0;
  box-shadow: var(--shadow-soft);
}

.mobile-header .header-center .brand,
.mobile-header a:hover .brand {
  color: var(--text);
  text-decoration: none;
}

.mobile-header .header-center a {
  text-decoration: none;
}

.theme-toggle {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem;
  background: var(--surface);
}

.sidebar-container {
  padding: 0.5rem 0;
}

.sidebar-brand {
  margin: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.sidebar-brand-text {
  color: var(--text);
  font-size: 1rem;
}

.sidebar-search-container {
  margin: 0.7rem 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.sidebar-search {
  border: 0;
  border-radius: 8px;
}

.sidebar-tree .caption,
.sidebar-tree :not(.caption) > .caption-text,
.toc-title {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-tree .reference {
  border-radius: 8px;
  margin: 0 0.65rem;
  width: calc(100% - 1.3rem);
}

.sidebar-tree .reference:hover,
.sidebar-tree .current > .reference:hover {
  background: var(--surface-muted);
}

.sidebar-tree .current-page > .reference,
.sidebar-tree .current > .reference {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.toc-tree {
  border-left: 1px solid var(--line);
}

.content {
  padding: 0 clamp(1rem, 4vw, 3rem);
}

.article-container {
  max-width: none;
}

article[role="main"] {
  max-width: 900px;
  padding: clamp(2.75rem, 6vw, 4.5rem) 0;
}

body[data-content_root="./"] article[role="main"] {
  max-width: 1120px;
}

article[role="main"] h1 {
  margin-bottom: 1rem;
  color: var(--text);
  font-size: clamp(3rem, 8vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

article[role="main"] h2 {
  margin-top: 2.75rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

article[role="main"] h3 {
  margin-top: 2rem;
  color: var(--text);
  font-size: 1.35rem;
}

article[role="main"] p,
article[role="main"] li,
article[role="main"] dd,
article[role="main"] td {
  color: var(--muted);
}

article[role="main"] strong,
article[role="main"] th,
article[role="main"] dt {
  color: var(--text);
}

article[role="main"] ul,
article[role="main"] ol {
  padding-left: 1.3rem;
}

article[role="main"] blockquote,
article[role="main"] .admonition,
article[role="main"] .topic,
article[role="main"] .sidebar,
.related-pages a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

article[role="main"] blockquote {
  border-left: 4px solid var(--accent-strong);
}

article[role="main"] code.literal,
article[role="main"] .sig-inline,
kbd:not(.compound),
.package-row code {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--text);
  font-weight: 600;
}

article[role="main"] div[class*="highlight-"],
article[role="main"] pre.literal-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--code-bg);
  box-shadow: var(--shadow-soft);
}

article[role="main"] .highlight,
article[role="main"] .highlight pre,
article[role="main"] pre.literal-block {
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--text);
}

article[role="main"] table.docutils {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

article[role="main"] table.docutils th {
  background: var(--surface-muted);
}

body[data-content_root="./"] article[role="main"] > section#qsvt-pennylane > h1,
body[data-content_root="./"] article[role="main"] > section#qsvt-pennylane > a.headerlink {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.doc-home {
  display: grid;
  gap: clamp(3rem, 8vw, 6rem);
}

.section {
  width: 100%;
  scroll-margin-top: 6rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
  min-height: min(780px, calc(100vh - 9rem));
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy h1,
.hero-copy h2 {
  max-width: 10ch;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: clamp(4rem, 14vw, 8rem);
  line-height: 0.9;
}

.hero-copy p {
  margin: 0;
}

.hero-text {
  max-width: 680px;
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
}

.hero-actions,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem 1rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.button.primary {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #ffffff;
}

.button:hover {
  transform: translateY(-1px);
}

.hero-side {
  display: grid;
  gap: 1rem;
  align-self: center;
}

.hero-visual {
  aspect-ratio: 13 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-visual svg {
  display: block;
  width: 100%;
  height: 100%;
}

.visual-bg {
  fill: var(--surface);
}

.visual-grid {
  opacity: 0.5;
}

.hero-visual pattern path {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.visual-circuit {
  fill: none;
  stroke: var(--accent-strong);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
}

.visual-circuit circle,
.visual-circuit rect {
  fill: var(--surface);
}

.visual-labels {
  fill: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.focus-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.4rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.focus-panel h2 {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.focus-panel ul {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1.25rem;
}

.hero-badges img,
.badges img {
  display: block;
  max-width: 100%;
  height: 20px;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 1.5rem;
}

.section-heading h2 {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.section-heading p {
  color: var(--muted);
}

.project-grid,
.doc-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.project-card,
.doc-card {
  display: flex;
  min-height: 300px;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.project-card:hover,
.project-card:focus-within,
.doc-card:hover,
.doc-card:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.project-card h3,
.doc-card h3,
.package-row h3 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  line-height: 1.25;
}

.project-card p,
.doc-card p,
.package-row p,
.about-copy p {
  margin: 0;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.card-links a,
.package-row a,
.doc-card a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.card-links a::after,
.package-row a::after,
.doc-card a::after {
  content: " ->";
}

.package-list {
  display: grid;
  gap: 0.75rem;
}

.package-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.9fr) auto;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.package-row:focus-within,
.package-row:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow);
}

.package-row code {
  display: inline-block;
  overflow-x: auto;
  max-width: 100%;
  padding: 0.58rem 0.7rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  white-space: nowrap;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(1.5rem, 5vw, 4rem);
}

.about-copy {
  display: grid;
  gap: 1rem;
  font-size: 1.05rem;
}

@media (max-width: 960px) {
  .project-grid,
  .doc-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .hero,
  .split-section {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-side {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
    align-items: stretch;
  }

  .hero-visual {
    align-self: stretch;
  }

  .package-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .mobile-header {
    align-items: flex-start;
    gap: 0.75rem;
    padding-inline: 1rem;
  }

  .content {
    padding: 0 0.75rem;
  }

  article[role="main"] {
    padding: clamp(2.25rem, 12vw, 3.75rem) 0;
  }

  .hero-copy h1,
  .hero-copy h2 {
    font-size: clamp(3.4rem, 20vw, 5rem);
  }

  .project-grid,
  .doc-card-grid,
  .hero-side {
    grid-template-columns: 1fr;
  }

  .project-card,
  .doc-card {
    min-height: 0;
  }

  .button {
    width: 100%;
  }

  .hero-actions,
  .contact-actions {
    gap: 0.6rem;
  }

  .mobile-header .header-center .brand::before,
  .sidebar-brand-text::before {
    width: 2rem;
    height: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .button:hover,
  .project-card:hover,
  .project-card:focus-within,
  .doc-card:hover,
  .doc-card:focus-within {
    transform: none;
  }
}
