:root {
  --bg: #050816;
  --bg-glow: rgba(87, 210, 255, 0.18);
  --panel: rgba(9, 14, 31, 0.92);
  --panel-strong: rgba(12, 18, 39, 0.98);
  --ink: #eff4ff;
  --muted: #97a7d1;
  --accent: #7af3ff;
  --line: rgba(122, 243, 255, 0.18);
  --shadow: 0 32px 90px rgba(0, 0, 0, 0.55);
  --radius-lg: 28px;
  --radius-md: 18px;
  --card-width: min(900px, calc(100vw - 1.5rem));
  --card-height: min(82vh, 46rem);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  height: 100%;
  background:
    linear-gradient(rgba(5, 8, 22, 0.7), rgba(5, 8, 22, 0.82)),
    url("./../img/pxfuel.jpg") center / cover no-repeat fixed;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  line-height: 1.65;
}

a,
button {
  color: inherit;
  cursor: pointer;
}

a,
.subtle-link,
.post-link,
.series-parts a,
.content-body a,
.back-button {
  text-decoration: none;
}

button {
  font: inherit;
}

.site-shell {
  width: min(1100px, calc(100vw - 1.5rem));
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  padding: 1.5rem 0;
  display: grid;
  align-items: center;
  overflow: auto;
}

main,
.landing-stack {
  display: grid;
  justify-items: center;
  align-items: center;
}

.landing-stack {
  width: 100%;
  position: relative;
}

.card-stack {
  width: var(--card-width);
  height: var(--card-height);
  position: relative;
  perspective: 1800px;
  transform-style: preserve-3d;
  transform-origin: center center;
  z-index: 2;
}

.card-face,
.content-page {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 18%),
    var(--panel);
  border: 2px solid rgba(122, 243, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.business-card,
.content-page {
  position: relative;
}

.business-card {
  overflow: hidden;
}

.content-page {
  overflow: visible;
}

.business-card::before,
.content-page::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: inherit;
  pointer-events: none;
}

.card-face {
  width: 100%;
  height: 100%;
  padding: 1.5rem;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  transition: transform 920ms cubic-bezier(0.19, 0.84, 0.24, 1), opacity 360ms ease;
}

.card-front {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.card-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg) scale(0.985);
  opacity: 0;
  pointer-events: none;
}

.card-stack.is-flipped .card-front {
  transform: rotateY(-180deg) scale(0.975);
  opacity: 0;
  pointer-events: none;
}

.card-stack.is-flipped .card-back {
  transform: rotateY(0deg) scale(1);
  opacity: 1;
  pointer-events: auto;
  z-index: 3;
}

.about-panel,
.contact-strip,
.recent-posts {
  padding: 1.25rem 0;
}

.card-front .about-panel,
.card-front .contact-strip,
.card-front .recent-posts {
  width: min(42rem, 100%);
  margin: 0 auto;
}

.about-panel p,
.content-body p,
.content-body li {
  margin: 0;
  color: var(--muted);
}

.about-panel a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.1em;
  text-decoration-color: rgba(122, 243, 255, 0.55);
  text-underline-offset: 0.18em;
}

.about-panel a:hover {
  color: #c4fbff;
  text-decoration-color: #c4fbff;
}

.about-panel h1 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 600;
}

.contact-strip {
  padding-top: 0.65rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--line);
}

.contact-list,
.post-list,
.series-parts {
  list-style: none;
  margin: 0;
  padding: 0;
}

.contact-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1rem;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  color: var(--muted);
  min-height: 2.4rem;
  padding: 0 0.15rem;
  font-size: 0.9rem;
}

.contact-link:hover,
.subtle-link:hover,
.post-link:hover,
.content-body a:hover,
.back-button:hover {
  color: var(--accent);
}

.subtle-link,
.post-link,
.content-body a {
  text-decoration: underline;
  text-decoration-color: rgba(122, 243, 255, 0.28);
  text-underline-offset: 0.16em;
}

.contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(122, 243, 255, 0.06);
  flex: 0 0 auto;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.contact-link:hover .contact-icon,
.contact-link:focus-visible .contact-icon {
  transform: translateY(-1px);
  border-color: rgba(122, 243, 255, 0.45);
  background: rgba(122, 243, 255, 0.12);
}

.contact-icon svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: currentColor;
}

.contact-value {
  color: inherit;
  line-height: 1;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.section-heading h2,
.content-header h1,
.about-panel h1 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1rem, 2vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
}

.subtle-link,
.series-meta,
.content-header .eyebrow,
.back-button,
.back-placeholder {
  color: var(--muted);
  font-size: 0.92rem;
}

.section-note {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: left;
}

.post-groups {
  display: grid;
  gap: 0.42rem;
  padding-left: 1.35rem;
  list-style: disc;
  text-align: left;
}

.post-group {
  display: list-item;
  padding: 0.08rem 0;
}

.post-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
}

.standalone-post-link {
  font-size: 1rem;
  font-weight: 500;
}

.post-meta {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
  white-space: nowrap;
}

.post-meta-series {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.series-meta {
  margin: 0;
}

.series-parts {
  display: inline-flex;
  gap: 0.28rem;
  vertical-align: middle;
}

.series-part-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
}

.post-group-secondary {
  margin-top: 0.05rem;
}

.post-group-secondary .standalone-post-link {
  font-weight: 600;
}

.content-page {
  width: min(860px, 100%);
  min-height: 100%;
  padding: 1.9rem 1.5rem 1.5rem;
}

.article-page {
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.standalone-card-shell {
  width: var(--card-width);
  height: var(--card-height);
}

.standalone-card-shell .content-page {
  width: 100%;
  height: 100%;
}

.card-back .content-page {
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.card-back .content-page::before {
  display: none;
}

.content-header {
  margin-bottom: 1.1rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  font-weight: 700;
}

.content-body {
  color: var(--ink);
  font-size: 1rem;
}

.article-flow {
  min-height: 0;
  overflow: auto;
  padding-right: 0.2rem;
}

.article-flow,
.card-back-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 243, 255, 0.75) rgba(122, 243, 255, 0.08);
}

.article-flow::-webkit-scrollbar,
.card-back-content::-webkit-scrollbar {
  width: 0.82rem;
}

.article-flow::-webkit-scrollbar-track,
.card-back-content::-webkit-scrollbar-track {
  background:
    linear-gradient(180deg, rgba(122, 243, 255, 0.08), rgba(122, 243, 255, 0.02));
  border-left: 1px solid rgba(122, 243, 255, 0.08);
  border-radius: 999px;
}

.article-flow::-webkit-scrollbar-thumb,
.card-back-content::-webkit-scrollbar-thumb {
  background:
    linear-gradient(180deg, rgba(196, 251, 255, 0.92), rgba(122, 243, 255, 0.58));
  border: 0.18rem solid rgba(7, 12, 27, 0.88);
  border-radius: 999px;
  box-shadow:
    0 0 0.9rem rgba(122, 243, 255, 0.22),
    inset 0 0 0.3rem rgba(255, 255, 255, 0.24);
}

.article-flow::-webkit-scrollbar-thumb:hover,
.card-back-content::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(223, 254, 255, 0.98), rgba(122, 243, 255, 0.72));
}

.article-flow::-webkit-scrollbar-corner,
.card-back-content::-webkit-scrollbar-corner {
  background: transparent;
}

.content-body > * {
  margin: 0;
}

.content-body > p + p {
  margin-top: 1rem;
}

.content-body > p + ul,
.content-body > p + ol,
.content-body > p + blockquote,
.content-body > p + .reference-stack,
.content-body > p + .inline-reference-slot,
.content-body > ul + p,
.content-body > ol + p,
.content-body > blockquote + p,
.content-body > .reference-stack + p,
.content-body > .inline-reference-slot + p,
.content-body > ul + ul,
.content-body > ol + ol,
.content-body > ul + ol,
.content-body > ol + ul,
.content-body > blockquote + blockquote,
.content-body > .reference-stack + .reference-stack {
  margin-top: 1rem;
}

.content-body > .inline-reference-slot + p {
  margin-top: 0.75rem;
}

.content-body blockquote {
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(122, 243, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.content-body blockquote > :first-child {
  margin-top: 0;
}

.content-body blockquote > :last-child {
  margin-bottom: 0;
}

.reference-stack {
  display: grid;
  gap: 0.9rem;
}

.reference-toggle {
  margin: 0;
}

.reference-toggle > summary {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(122, 243, 255, 0.45);
  text-underline-offset: 0.16em;
}

.reference-toggle > summary:hover {
  color: #c4fbff;
  text-decoration-color: #c4fbff;
}

.reference-toggle[open] > summary {
  margin-bottom: 0.65rem;
}

.reference-card,
.inline-reference-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(122, 243, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  padding: 1rem 1.05rem;
}

.reference-card-definition {
  background: rgba(122, 243, 255, 0.05);
}

.reference-card-rule {
  background: rgba(134, 160, 255, 0.08);
}

.reference-label {
  margin: 0 0 0.18rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reference-card h2,
.inline-reference-box h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.reference-card p,
.inline-reference-box p {
  margin: 0.5rem 0 0;
}

.inline-reference-group {
  margin: 0.95rem 0;
}

.inline-reference-group > p {
  margin: 0;
}

.inline-reference-slot[hidden] {
  display: none;
}

.inline-reference-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.15rem;
}

.inline-reference-link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(122, 243, 255, 0.45);
  text-underline-offset: 0.16em;
}

.inline-reference-link:hover,
.inline-reference-link:focus-visible {
  color: #c4fbff;
  text-decoration-color: #c4fbff;
}

.inline-reference-close {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  padding: 0.28rem 0.72rem;
  white-space: nowrap;
}

.inline-reference-close:hover,
.inline-reference-close:focus-visible {
  color: var(--accent);
  border-color: rgba(122, 243, 255, 0.38);
  background: rgba(122, 243, 255, 0.08);
}

.rule-anchor {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.rule-anchor:hover {
  color: var(--accent);
}

.rule-anchor-target {
  display: block;
  position: relative;
  top: -0.35rem;
  visibility: hidden;
}

.content-body a {
  color: var(--accent);
}

.content-body code {
  font-family: inherit;
  font-size: 0.96em;
  color: var(--ink);
  background: rgba(122, 243, 255, 0.08);
  border: 1px solid rgba(122, 243, 255, 0.12);
  border-radius: 0.38rem;
  padding: 0.02rem 0.28rem;
}

.relay-note {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.relay-note,
.relay-note * {
  font-family: inherit !important;
}

.relay-line,
.relay-helper,
.relay-toolbar-copy,
.relay-inline-note,
.relay-expand summary,
.bridge-call,
.relay-shape {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: normal;
}

.relay-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(122, 243, 255, 0.05);
}

.relay-toolbar-copy {
  margin: 0;
  color: var(--ink);
  font: inherit;
}

.relay-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.relay-toggle-button {
  font: inherit;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.relay-toggle-button.is-active,
.relay-toggle-button:hover {
  color: var(--ink);
  background: rgba(122, 243, 255, 0.12);
  border-color: rgba(122, 243, 255, 0.35);
}

.relay-tree,
.relay-tree ul {
  margin: 0;
  padding-left: 1.2rem;
}

.relay-tree {
  padding: 1rem 1.1rem 1rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 22%),
    rgba(8, 12, 28, 0.88);
}

.relay-tree > li + li,
.relay-tree li > ul,
.relay-tree li + li {
  margin-top: 0.55rem;
}

.relay-tree li::marker {
  color: rgba(122, 243, 255, 0.8);
}

.relay-helper {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.relay-line {
  color: var(--muted);
  line-height: 1.6;
}

.bridge-call,
.relay-shape {
  color: var(--ink);
  font-family: inherit;
}

.bridge-call {
  display: inline-flex;
  align-items: baseline;
  gap: 0.04rem;
  padding: 0.14rem 0.42rem;
  border: 1px solid rgba(122, 243, 255, 0.16);
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
}

.relay-shape {
  letter-spacing: normal;
}

.relay-inline-note {
  font-family: inherit;
  color: var(--muted);
  font-size: inherit;
}

.relay-expand {
  margin-top: 0.45rem;
}

.relay-expand summary {
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}

.relay-expand summary:hover {
  color: #c4fbff;
}

.relay-inline-list {
  margin-top: 0.55rem;
}

.suit {
  display: inline-block;
  font-weight: 700;
}

.suit-heart,
.suit-diamond {
  color: #ff8ea1;
}

.suit-spade {
  color: #eef4ff;
}

.suit-club {
  color: #7af3ff;
}

.relay-view[hidden] {
  display: none;
}

.card-back-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
}

.card-back-content {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 1.9rem 1.5rem 0;
}

.page-actions,
.card-back-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.series-footer-nav {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-right: auto;
}

.card-back-series-slot {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-right: auto;
}

.card-back-series-slot[hidden] {
  display: none;
}

.card-back-series-slot .series-footer-nav {
  margin-right: 0;
}

.series-footer-index {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.32rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.series-separator {
  color: rgba(151, 167, 209, 0.5);
}

.back-button {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.back-button-primary {
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(122, 243, 255, 0.06);
  text-decoration: none;
}

.back-placeholder {
  margin: 0;
}

.starfield {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: fixed;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  pointer-events: none;
}

.star::before,
.star::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.star::before {
  background: rgba(255, 255, 255, 0.88);
}

.star::after {
  background: rgba(255, 255, 255, 1);
  opacity: 0;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.98);
  animation: star-flash ease infinite;
}

.star:nth-child(1) { top: 8%; left: 12%; }
.star:nth-child(2) { top: 11%; left: 27%; }
.star:nth-child(3) { top: 16%; left: 74%; }
.star:nth-child(4) { top: 21%; left: 58%; }
.star:nth-child(5) { top: 29%; left: 88%; }
.star:nth-child(6) { top: 34%; left: 16%; }
.star:nth-child(7) { top: 42%; left: 67%; }
.star:nth-child(8) { top: 49%; left: 8%; }
.star:nth-child(9) { top: 57%; left: 81%; }
.star:nth-child(10) { top: 63%; left: 36%; }
.star:nth-child(11) { top: 69%; left: 61%; }
.star:nth-child(12) { top: 74%; left: 22%; }
.star:nth-child(13) { top: 82%; left: 47%; }
.star:nth-child(14) { top: 87%; left: 72%; }
.star:nth-child(15) { top: 91%; left: 14%; }
.star:nth-child(16) { top: 24%; left: 41%; }
.star:nth-child(17) { top: 61%; left: 92%; }
.star:nth-child(18) { top: 38%; left: 4%; }

.star:nth-child(1)::after { animation-duration: 7.2s; animation-delay: 0.6s; }
.star:nth-child(2)::after { animation-duration: 8.8s; animation-delay: 1.8s; }
.star:nth-child(3)::after { animation-duration: 6.9s; animation-delay: 0.2s; }
.star:nth-child(4)::after { animation-duration: 9.4s; animation-delay: 2.1s; }
.star:nth-child(5)::after { animation-duration: 7.8s; animation-delay: 1.1s; }
.star:nth-child(6)::after { animation-duration: 8.1s; animation-delay: 2.7s; }
.star:nth-child(7)::after { animation-duration: 6.7s; animation-delay: 1.5s; }
.star:nth-child(8)::after { animation-duration: 9.7s; animation-delay: 0.9s; }
.star:nth-child(9)::after { animation-duration: 7.5s; animation-delay: 2.5s; }
.star:nth-child(10)::after { animation-duration: 8.6s; animation-delay: 1.3s; }
.star:nth-child(11)::after { animation-duration: 6.5s; animation-delay: 0.4s; }
.star:nth-child(12)::after { animation-duration: 9.1s; animation-delay: 2.2s; }
.star:nth-child(13)::after { animation-duration: 7.1s; animation-delay: 1.7s; }
.star:nth-child(14)::after { animation-duration: 8.3s; animation-delay: 0.8s; }
.star:nth-child(15)::after { animation-duration: 9.6s; animation-delay: 2.9s; }
.star:nth-child(16)::after { animation-duration: 7.4s; animation-delay: 1.1s; }
.star:nth-child(17)::after { animation-duration: 8.9s; animation-delay: 2.4s; }
.star:nth-child(18)::after { animation-duration: 6.8s; animation-delay: 0.7s; }

@keyframes star-flash {
  0%, 30%, 100% {
    opacity: 0;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.98);
  }
  6% {
    opacity: 1;
    box-shadow: 0 0 1.4rem 0.22rem rgba(255, 255, 255, 0.98);
  }
}

@media (max-width: 720px) {
  .site-shell {
    width: min(100vw - 1rem, 1100px);
    padding: 1rem 0;
  }

  .card-face,
  .content-page {
    padding: 1.1rem;
  }

  .card-stack {
    width: min(100vw - 1rem, 900px);
    height: min(86vh, 44rem);
  }

  .standalone-card-shell {
    width: min(100vw - 1rem, 900px);
    height: min(86vh, 44rem);
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .post-row {
    grid-template-columns: 1fr;
    gap: 0.28rem;
  }

  .post-meta,
  .post-meta-series {
    text-align: left;
    justify-content: flex-start;
  }

  .card-back-actions {
    justify-content: flex-start;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .series-footer-nav {
    width: 100%;
  }

  .relay-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
