/* Phyllux site chrome — persistent sidebar (desktop) + drawer (narrow). Pair with assets/nav-lock.css */

/* First focusable control on every page: keyboard / screen-reader jump to primary landmark */
.phyllux-skip-link {
  position: absolute;
  left: 0.5rem;
  top: -100px;
  z-index: 2000;
  padding: 0.5rem 1rem;
  background: var(--phyllux-sb-accent, rgba(212, 168, 75, 0.95));
  color: #0a0c08;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}
.phyllux-skip-link:focus {
  top: 0.5rem;
  outline: 2px solid #f8f5ec;
  outline-offset: 2px;
}

:root {
  --phyllux-sb-width: clamp(268px, 22vw, 320px);
  --phyllux-topbar-h: 3.375rem;
  --phyllux-sb-accent: rgba(212, 168, 75, 0.95);
}

/* ── Sidebar panel ───────────────────────────────────────── */
.phyllux-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1000;
  width: var(--phyllux-sb-width);
  max-width: calc(100vw - 56px);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(212, 168, 75, 0.14), transparent 45%),
    linear-gradient(180deg, rgba(14, 18, 22, 0.99) 0%, rgba(6, 8, 11, 0.99) 100%);
  border-right: 1px solid rgba(212, 168, 75, 0.22);
  box-shadow:
    inset -1px 0 0 rgba(255, 255, 255, 0.04),
    8px 0 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overscroll-behavior: contain;
  transform: translateX(0);
  transition:
    transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.28s ease;
}

@media (prefers-reduced-motion: reduce) {
  .phyllux-sidebar {
    transition: none;
  }
}

.phyllux-sidebar:focus {
  outline: none;
}

.phyllux-sidebar__inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.35rem 1.15rem 1.75rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 168, 75, 0.35) transparent;
}

.phyllux-sidebar__brand {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  text-decoration: none;
  margin-bottom: 0.65rem;
}

.phyllux-sidebar__mark {
  font-size: 1.45rem;
  line-height: 1;
  filter: saturate(1.05);
}

.phyllux-sidebar__wordmark {
  font-family: 'Fraunces', 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.12em;
  color: #f8f5ec;
}

.phyllux-sidebar__lede {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: rgba(200, 210, 198, 0.78);
  margin: 0 0 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(212, 168, 75, 0.15);
}

.phyllux-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.phyllux-sb-group {
  padding: 0 0 0.85rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(125, 138, 117, 0.16);
}

.phyllux-sb-group:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.phyllux-sb-label {
  margin: 0 0 0.45rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(212, 168, 75, 0.68);
}

.phyllux-sidebar__nav .phyllux-sb-group > a {
  display: flex;
  align-items: center;
  padding: 0.48rem 0.72rem;
  margin: 0 -0.2rem;
  border-radius: 8px;
  font-size: 0.9175rem;
  color: #b8c4b5;
  text-decoration: none;
  transition:
    background 0.14s ease,
    color 0.14s ease,
    transform 0.14s ease;
}

.phyllux-sidebar__nav .phyllux-sb-group > a:hover {
  background: rgba(212, 168, 75, 0.1);
  color: var(--phyllux-sb-accent);
}

.phyllux-sidebar__nav .phyllux-sb-group > a:active {
  transform: scale(0.99);
}

body[data-current-page]
  .phyllux-sidebar__nav a.phyllux-current {
  background: rgba(212, 168, 75, 0.16);
  color: var(--phyllux-sb-accent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 0 var(--phyllux-sb-accent);
  padding-left: calc(0.72rem + 6px);
}

/* ── Mobile overlay & top bar ─────────────────────────────── */
.phyllux-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 990;
  background: rgba(2, 4, 6, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}

.phyllux-sidebar-backdrop[hidden] {
  display: none !important;
}

.phyllux-topbar {
  display: none;
}

@media (max-width: 900px) {
  body.phyllux-site-shell {
    padding-left: 0 !important;
    padding-top: var(--phyllux-topbar-h) !important;
  }

  .phyllux-sidebar {
    transform: translateX(-104%);
    width: min(92vw, 320px);
    box-shadow:
      inset -1px 0 0 rgba(255, 255, 255, 0.04),
      22px 0 60px rgba(0, 0, 0, 0.55);
    z-index: 1005;
  }

  body.phyllux-drawer-open .phyllux-sidebar {
    transform: translateX(0);
  }

  .phyllux-topbar {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    height: var(--phyllux-topbar-h);
    padding: 0 0.9rem;
    background: rgba(8, 10, 7, 0.92);
    border-bottom: 1px solid rgba(125, 138, 117, 0.28);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 995;
  }

  .phyllux-topbar-brand {
    font-family: 'Fraunces', 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1.125rem;
    color: #f5f1e8;
    text-decoration: none;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .phyllux-sidebar-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: -0.25rem;
    border-radius: 10px;
    border: 1px solid rgba(212, 168, 75, 0.28);
    background: rgba(12, 15, 20, 0.75);
    color: rgba(245, 241, 232, 0.95);
    cursor: pointer;
    transition:
      border-color 0.2s ease,
      background 0.2s ease,
      color 0.2s ease;
  }

  .phyllux-sidebar-toggle:hover,
  body.phyllux-drawer-open .phyllux-sidebar-toggle {
    border-color: rgba(212, 168, 75, 0.55);
    background: rgba(212, 168, 75, 0.12);
    color: #fff;
  }

  .phyllux-sidebar-toggle__bars {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 18px;
  }

  .phyllux-sidebar-toggle__bars span {
    display: block;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition:
      transform 0.26s ease,
      opacity 0.2s ease;
  }

  body.phyllux-drawer-open .phyllux-sidebar-toggle__bars span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  body.phyllux-drawer-open .phyllux-sidebar-toggle__bars span:nth-child(2) {
    opacity: 0;
  }

  body.phyllux-drawer-open .phyllux-sidebar-toggle__bars span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ── Desktop: offset entire page ──────────────────────────── */
@media (min-width: 901px) {
  body.phyllux-site-shell:not(.shield-page) {
    padding-left: var(--phyllux-sb-width);
  }

  .phyllux-sidebar-backdrop {
    display: none !important;
  }

  .phyllux-topbar {
    display: none !important;
  }

  body.phyllux-site-shell {
    padding-top: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .phyllux-sidebar,
  .phyllux-sidebar-toggle__bars span {
    transition: none !important;
  }
}

/* Site-wide operator status banner */
.phyllux-site-status {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid rgba(212, 168, 75, 0.35);
  background: rgba(212, 168, 75, 0.12);
}

@media (min-width: 901px) {
  body.phyllux-site-shell .phyllux-site-status {
    max-width: none;
    margin-right: auto;
    margin-left: 0;
  }
}

.phyllux-site-status__text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #c9d4c0;
  font-family: inherit;
  text-align: center;
}

@media (max-width: 640px) {
  .phyllux-site-status {
    padding: 0.5rem 0.85rem;
  }

  .phyllux-site-status__text {
    font-size: 0.8125rem;
    text-align: left;
  }
}

/* Media long-reads: bury light image bleed, keep void banding consistent */
body[data-current-page="media"] #main-content {
  background-color: #0a0a0f;
}

body[data-current-page="media"] #main-content > section.section:not(.hero):not(.coda) {
  background: linear-gradient(180deg, rgba(12, 12, 18, 0.98) 0%, rgba(8, 8, 12, 0.99) 100%);
}

body[data-current-page="media"] #main-content > section.section.dark:not(.hero) {
  background: linear-gradient(180deg, rgba(7, 7, 11, 0.99) 0%, rgba(14, 14, 20, 0.94) 100%) !important;
}

body[data-current-page="media"] #main-content > section.section.coda {
  background: linear-gradient(180deg, rgba(10, 10, 15, 0.96) 0%, rgba(6, 6, 10, 1) 100%);
}

body[data-current-page="media"] #main-content .hero-image-wrapper {
  background: #08080c;
  box-shadow:
    inset 0 0 90px rgba(5, 5, 8, 0.65),
    0 0 0 1px rgba(212, 175, 55, 0.1);
}

body[data-current-page="media"] #main-content .hero-img,
body[data-current-page="media"] #main-content .diagram-block img,
body[data-current-page="media"] #main-content .coda-image img,
body[data-current-page="media"] #main-content .gallery-grid img {
  background: #0a0a0f;
  filter: brightness(0.92) contrast(1.06) saturate(1.03);
  vertical-align: bottom;
}

body[data-current-page="media"] #main-content figure.diagram-block {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}

body[data-current-page="media"] #main-content figure.diagram-block::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 10px;
  box-shadow: inset 0 0 72px rgba(5, 5, 8, 0.55);
}

body[data-current-page="media"] #main-content .coda-image {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

body[data-current-page="media"] #main-content .coda-image::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 10px;
  box-shadow: inset 0 0 72px rgba(5, 5, 8, 0.5);
}
