/* ============================================================================
   PrimeBytes — Immersive landing page (zensical.org-style hero)
   ============================================================================ */

:root {
  --pb-bg: #0b0c0f;
  --pb-fg: #ffffff;
  --pb-muted: hsla(215, 15%, 90%, 0.75);
  --pb-accent: #38bdf8;
  --pb-accent-2: #0ea5e9;
  --pb-gradient: linear-gradient(135deg, #1e3a8a 0%, #1e40af 45%, #0284c7 100%);
}

/* ----- Detect landing via :has() and reshape the chrome ----- */
html:has(#hero), body:has(#hero) {
  background-color: var(--pb-bg);
  height: 100%;
  margin: 0;
}

body:has(#hero) .md-header {
  background-color: transparent !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
  color: var(--pb-fg);
  position: absolute;
  z-index: 5;
}

body:has(#hero) .md-header__option {
  display: none;
}

body:has(#hero) .md-header__title,
body:has(#hero) .md-header__topic,
body:has(#hero) .md-header__ellipsis,
body:has(#hero) .md-search__input,
body:has(#hero) .md-search__input::placeholder {
  color: var(--pb-fg);
}

body:has(#hero) .md-search__form {
  background-color: hsla(220, 15%, 90%, 0.12);
  backdrop-filter: blur(8px);
}

body:has(#hero) .md-tabs {
  display: block !important;
  background-color: transparent;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 4;
  box-shadow: inset 0 -0.05rem 0 hsla(0, 0%, 100%, 0.1);
}

body:has(#hero) .md-tabs__list {
  display: flex;
  flex-wrap: wrap;
  padding: 0 1rem;
  margin: 0;
  max-width: 1220px;
  margin: 0 auto;
}

body:has(#hero) .md-tabs__link {
  color: var(--pb-fg);
  opacity: 0.85;
}

body:has(#hero) .md-tabs__link:hover,
body:has(#hero) .md-tabs__item--active .md-tabs__link {
  opacity: 1;
}

body:has(#hero) .md-tabs__item--active {
  border-bottom: 0.05rem solid var(--pb-fg);
}

body:has(#hero) .md-main__inner {
  display: block !important;
  margin: 0 !important;
  max-width: none !important;
  padding: 0 !important;
}

body:has(#hero) .md-sidebar,
body:has(#hero) .md-sidebar--primary,
body:has(#hero) .md-sidebar--secondary,
body:has(#hero) .md-footer {
  display: none !important;
}

body:has(#hero) .md-content {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

body:has(#hero) .md-content__inner {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
}

body:has(#hero) .md-content__inner > h1:first-child,
body:has(#hero) .md-content__inner > .md-content__button {
  display: none !important;
}

/* ----- Full-viewport hero ----- */
.pb-hero {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  overflow: hidden;
  background: var(--pb-bg);
  color: var(--pb-fg);
}

/* ----- Background layers ----- */
.pb-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--pb-bg);
}

.pb-grid-bg {
  position: absolute;
  inset: 0;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 40%, black 10%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 40%, black 10%, transparent 85%);
}

.pb-grid-line {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
  animation-duration: 2200ms;
  animation-timing-function: cubic-bezier(0.16, 0.84, 0.44, 1);
  animation-fill-mode: both;
}

.pb-grid-line--v {
  top: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(56, 189, 248, 0) 0%,
    rgba(56, 189, 248, 0.07) 12%,
    rgba(56, 189, 248, 0.07) 88%,
    rgba(56, 189, 248, 0) 100%
  );
}

.pb-grid-line--h {
  left: 0;
  height: 1px;
  width: 100%;
  background: linear-gradient(
    to right,
    rgba(56, 189, 248, 0) 0%,
    rgba(56, 189, 248, 0.07) 12%,
    rgba(56, 189, 248, 0.07) 88%,
    rgba(56, 189, 248, 0) 100%
  );
}

.pb-grid-line--from-top    { animation-name: pb-grid-slide-from-top; }
.pb-grid-line--from-bottom { animation-name: pb-grid-slide-from-bottom; }
.pb-grid-line--from-left   { animation-name: pb-grid-slide-from-left; }
.pb-grid-line--from-right  { animation-name: pb-grid-slide-from-right; }

@keyframes pb-grid-slide-from-top {
  0%   { transform: translateY(-100%); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes pb-grid-slide-from-bottom {
  0%   { transform: translateY(100%); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes pb-grid-slide-from-left {
  0%   { transform: translateX(-100%); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes pb-grid-slide-from-right {
  0%   { transform: translateX(100%); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateX(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .pb-grid-line { animation: none !important; }
}

.pb-glow {
  display: none;
}

@keyframes pb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -30px) scale(1.05); }
  66%      { transform: translate(-30px, 40px) scale(0.95); }
}

/* ----- Status strip (top) ----- */
.pb-status {
  position: absolute;
  top: 88px;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 2rem;
  font-family: var(--md-code-font, ui-monospace, "JetBrains Mono", Menlo, monospace);
  font-size: 0.72rem;
  color: var(--pb-muted);
  letter-spacing: 0.02em;
}

.pb-status-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pb-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
  animation: pb-blink 2s ease-in-out infinite;
}

.pb-status-label {
  color: #cbd5e1;
}

.pb-status-row em {
  font-style: normal;
  color: #22c55e;
}

@keyframes pb-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

@media (max-width: 720px) {
  .pb-status { display: none; }
}

/* ----- Teaser (the big text + buttons) ----- */
.pb-teaser {
  position: absolute;
  bottom: 120px;
  left: 0;
  right: 0;
  z-index: 3;
}

.pb-grid-wrap {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 2rem;
}

.pb-teaser h1 {
  color: var(--pb-fg);
  font-size: clamp(2.25rem, 4.2vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0 0 1.25rem;
  max-width: 18ch;
  text-wrap: balance;
  text-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
  border: none;
}

.pb-teaser p {
  color: var(--pb-fg);
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  line-height: 1.55;
  max-width: 52ch;
  text-wrap: pretty;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.7);
  margin: 0 0 0.9rem;
}

.pb-teaser p small {
  color: var(--pb-muted);
  font-size: 0.85rem;
}

.pb-teaser p small em {
  font-style: italic;
}

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

/* Enterprise buttons — flat, restrained, with inline icons */
.pb-teaser .md-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--pb-fg) !important;
  background-color: transparent;
  border: 1px solid hsla(220, 15%, 90%, 0.2);
  border-radius: 6px;
  text-decoration: none !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.pb-teaser .md-button .pb-btn-icon {
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.pb-teaser .md-button:hover,
.pb-teaser .md-button:focus {
  color: var(--pb-fg) !important;
  background-color: hsla(220, 15%, 90%, 0.06);
  border-color: hsla(220, 15%, 90%, 0.4);
}

.pb-teaser .md-button:hover .pb-btn-icon {
  opacity: 1;
  transform: translateX(2px);
}

.pb-teaser .md-button--primary {
  color: #ffffff !important;
  background-color: #0369a1;
  border-color: #0369a1;
}

.pb-teaser .md-button--primary:hover,
.pb-teaser .md-button--primary:focus {
  color: #ffffff !important;
  background-color: #0284c7;
  border-color: #0284c7;
}

.pb-teaser .md-button--primary .pb-btn-icon {
  color: #ffffff;
  opacity: 1;
}

.pb-teaser .md-button--primary:hover .pb-btn-icon {
  transform: scale(1.1);
}

/* ----- Bottom meta strip ----- */
.pb-meta {
  position: absolute;
  bottom: 64px;
  right: 0;
  z-index: 3;
  padding: 0 2rem;
  font-family: var(--md-code-font, ui-monospace, "JetBrains Mono", Menlo, monospace);
  font-size: 0.72rem;
  color: var(--pb-muted);
  letter-spacing: 0.02em;
}

.pb-meta code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.pb-meta-key { color: var(--pb-accent); }
.pb-meta-val { color: var(--pb-accent-2); }

/* ----- Responsive breakpoints ----- */

/* Tablet portrait (768px range) — infinity sits above the teaser */
@media (max-width: 900px) {
  .pb-teaser h1 {
    font-size: clamp(2rem, 5.5vw, 2.75rem);
    max-width: 22ch;
  }
  .pb-teaser p {
    font-size: 1rem;
  }
  .pb-teaser { bottom: 110px; }
}

/* Mobile (≤ 600px) — text-dominant, simpler layout */
@media (max-width: 600px) {
  .pb-meta { display: none; }
  .pb-teaser {
    bottom: 100px;
  }
  .pb-grid-wrap {
    padding: 0 1.25rem;
  }
  .pb-status {
    padding: 0 1.25rem;
    top: 76px;
    font-size: 0.66rem;
    gap: 0.4rem 1rem;
  }
  .pb-teaser h1 {
    font-size: clamp(1.65rem, 7vw, 2.1rem);
    max-width: none;
    line-height: 1.1;
    margin-bottom: 0.9rem;
  }
  .pb-teaser p {
    font-size: 0.92rem;
    line-height: 1.5;
    max-width: none;
    margin-bottom: 0.65rem;
  }
  .pb-teaser p small {
    font-size: 0.78rem;
  }
  .pb-cta {
    flex-direction: column;
    align-items: stretch;
    margin-top: 1.25rem;
    gap: 0.6rem;
  }
  .pb-teaser .md-button {
    justify-content: center;
    padding: 0.75rem 1rem;
  }
  /* On narrow viewports the infinity gets cropped aggressively by slice.
     Tone it down so it doesn't drown out the text. */
  .pb-infinity {
    opacity: 0.55;
  }
  .pb-trail { stroke-width: 2 !important; }
}

/* Very small / landscape phones */
@media (max-width: 380px) {
  .pb-status { display: none; }
  .pb-teaser h1 { font-size: 1.6rem; }
}

/* ----- Subtle scroll lock on landing ----- */
body:has(#hero) {
  overflow: hidden;
}

.md-footer-meta {
  display: none;
}

/* ----- Header logo: height-constrained so wide PNG keeps aspect ratio ----- */
.md-header__topic .md-ellipsis {
  font-weight: 800;
  letter-spacing: -0.01em;
}
.md-header__button.md-logo {
  padding: 0.4rem 0 0.4rem 0.4rem;
}
.md-header__title {
  margin-left: 4px;
}
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  width: auto;
  height: 1.5rem;
  max-width: none;
}

/* Keep the logo visible on mobile/tablet — the theme's default hides
   .md-logo below 1220px in favor of the drawer hamburger. */
@media screen and (max-width: 76.234375em) {
  .md-header__button.md-logo {
    display: inline-block;
  }
  /* On the landing page the tabs are forced visible, so the drawer
     hamburger is redundant. Other pages still need it for nav. */
  body:has(#hero) .md-header__button[for="__drawer"] {
    display: none;
  }
}
