:root {
  /* Brand Colors */
  --brand: #161221;
  --brand-dark: #181426;
  --brand-darker: #21173c;
  --brand-light: #2a1f4a;
  --brand-xlight: #f3f2f8;
  --brand-alpha: rgba(22, 18, 33, .15);

  /* Sidebar */
  --sidebar-bg: #161221;
  --sidebar-hover: rgba(255, 255, 255, .08);
  --sidebar-active: rgba(255, 255, 255, .15);
  --sidebar-text: rgba(255, 255, 255, .85);

  /* Header */
  --header-bg: #181426;

  /* Main Backgrounds */
  --surface: #ffffff;
  --bg: #ebeee4;
  --border: #d8d6e3;

  /* Text */
  --text: #161221;
  --text2: #4f4966;
  --text3: #7d7894;

  /* Radius */
  --radius: 10px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow: 0 1px 3px rgba(0, 0, 0, .08),
    0 4px 14px rgba(22, 18, 33, .10);
  --shadow-lg: 0 8px 32px rgba(33, 23, 60, .20);

  /* Layout */
  --sidebar-w: 264px;
  --header-h: 60px;
  /* Safe-area-aware header height — used for sidebar top offset & layout padding */
  --header-total: calc(var(--header-h) + env(safe-area-inset-top, 0px));

  /* Fonts */
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-d: 'Space Grotesk', sans-serif;
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Fullscreen height across browsers */
  height: 100%;
  height: -webkit-fill-available;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* dvh with fallbacks: old Safari / Android WebView need -webkit-fill-available */
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-touch-callout: none;
}

ul,
ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input,
textarea {
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

select {
  font-family: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(98, 89, 202, .25);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(98, 89, 202, .4);
}

::selection {
  background: rgba(22, 18, 33, .15);
  color: var(--text);
}

/* ── HEADER ──
   FIX: use min-height so it grows with the iOS safe-area inset (notch).
   align-items:flex-end + padding-bottom keeps nav content at the bottom
   of the expanded bar, matching the native feel on notch devices.
   padding-top absorbs the notch so content is never hidden behind it.
*/
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  /* Fixed height on normal screens; expands for notch on iOS/Android */
  height: var(--header-h);
  /* Extra top padding pushes content below the status bar / notch */
  padding-top: env(safe-area-inset-top, 0px);
  /* Compensate so inner content area stays --header-h tall */
  min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  background: var(--header-bg);
  box-shadow: 0 2px 16px rgba(0, 0, 0, .2);
  display: flex;
  align-items: center;
  /* Horizontal safe-area padding (landscape notch on phones) */
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  gap: 12px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.logo-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .18);
  display: grid;
  place-items: center;
}

/* Logo SVG stroke is set inline in header.php; these rules handle sizing */
.logo-box svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logo-name {
  font-family: var(--font-d);
  font-weight: 700;
  font-size: .96rem;
  color: #fff;
  white-space: nowrap;
}

.logo-name span {
  opacity: .65;
  font-weight: 500;
}

.hdr-sep {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, .2);
  flex-shrink: 0;
}

.hdr-tag {
  font-size: .69rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
  white-space: nowrap;
}

.hdr-search {
  flex: 1;
  max-width: 380px;
  margin: 0 auto;
  position: relative;
}

.hdr-search input {
  width: 100%;
  height: 34px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 8px;
  padding: 0 12px 0 36px;
  color: #fff;
  font-size: .83rem;
  outline: none;
  transition: background .2s, border .2s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}

.hdr-search input::placeholder {
  color: rgba(255, 255, 255, .38);
}

.hdr-search input:focus {
  background: rgba(255, 255, 255, .18);
  border-color: rgba(255, 255, 255, .3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .08);
}

/* Hide browser-native clear button in search fields */
.hdr-search input::-webkit-search-cancel-button,
.hdr-search input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.hdr-search .si {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.hdr-search .si svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: rgba(255, 255, 255, .45);
  stroke-width: 2;
}

.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.hamburger:hover {
  background: rgba(255, 255, 255, .18);
}

.hamburger:active {
  background: rgba(255, 255, 255, .25);
  transform: scale(.95);
}

.hamburger svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ── SEARCH DROPDOWN ──
   FIX: removed `hidden` attribute usage from HTML; visibility is now
   controlled purely via CSS (.show class) so transitions work correctly
   on all browsers including iOS Safari.
*/
.search-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  z-index: 400;
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Hidden by default via visibility+opacity (no hidden attr needed) */
  visibility: hidden;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}

.search-drop.show {
  visibility: visible;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear 0s;
}

.sdi {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sdi:last-child {
  border-bottom: none;
}

.sdi:hover,
.sdi:active,
.sdi.active {
  background: var(--brand-xlight);
}

.sdi:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.sdi-icon svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: var(--brand);
  stroke-width: 2;
}

.sdi-title {
  font-size: .83rem;
  font-weight: 500;
  color: var(--text);
}

.sdi-parent {
  font-size: .73rem;
  color: var(--text3);
  margin-top: 1px;
}

.no-results {
  padding: 16px;
  text-align: center;
  font-size: .83rem;
  color: var(--text3);
}

/* ── LAYOUT ──
   FIX: padding-top uses --header-total so notch-extended headers don't
   overlap page content on iOS / Android.
*/
.layout {
  display: flex;
  padding-top: var(--header-total);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
}

/* ── SIDEBAR ──
   FIX: top uses --header-total so sidebar doesn't overlap the extended
   header on notch devices.
*/
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: var(--header-total);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  padding: 12px 0;
  padding-left: env(safe-area-inset-left, 0px);
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

/* ── OVERLAY ──
   FIX: removed the `hidden` attribute from HTML; visibility is CSS-only.
   JS now only toggles .show — no more hidden attr conflicts.
*/
.sb-overlay {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(20, 18, 50, .5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  visibility: hidden;
  opacity: 0;
  transition: opacity .25s ease, visibility 0s linear .25s;
  pointer-events: none;
}

.sb-overlay.show {
  visibility: visible;
  opacity: 1;
  transition: opacity .25s ease, visibility 0s linear 0s;
  pointer-events: auto;
}

.nav-lbl {
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
  padding: 16px 18px 6px;
}

.nav-group {
  position: relative;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  height: 42px;
  color: var(--sidebar-text);
  font-size: .85rem;
  font-weight: 500;
  border-radius: 8px;
  margin: 1px 8px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s;
  position: relative;
  touch-action: manipulation;
}

.nav-item:hover {
  background: var(--sidebar-hover);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: #fff;
}

.nav-item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .4);
  outline-offset: 2px;
}

.ni-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .72;
}

.nav-item.active .ni-icon {
  opacity: 1;
}

.ni-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ni-label {
  flex: 1;
  line-height: 1.3;
}

.ni-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: .45;
  transition: transform .22s;
}

.nav-item.open .ni-chevron {
  transform: rotate(90deg);
}

.ni-chevron svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.subnav {
  overflow: hidden;
  max-height: 0;
  transition: max-height .26s ease;
}

.subnav.open {
  max-height: 1000px;
}

.subnav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px 0 39px;
  height: 36px;
  color: rgba(255, 255, 255, .62);
  font-size: .82rem;
  border-radius: 8px;
  margin: 1px 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, color .12s;
  touch-action: manipulation;
}

.subnav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255, 255, 255, .9);
}

.subnav-item.active {
  color: #fff;
  font-weight: 500;
}

.subnav-item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .4);
  outline-offset: 2px;
}

.sni-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .3);
  flex-shrink: 0;
  transition: background .12s;
}

.subnav-item.active .sni-dot {
  background: #fff;
}

/* ── MAIN ── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: calc(100vh - var(--header-total));
  min-height: calc(100dvh - var(--header-total));
  display: flex;
  flex-direction: column;
}

/* ── HOME / HERO ── */
.hero {
  background: linear-gradient(135deg, var(--brand-darker) 0%, var(--brand) 55%, var(--brand-light) 100%);
  padding: 60px 48px 68px;
  position: relative;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 36px 36px;
}

.hero-glow {
  position: absolute;
  top: -80px;
  right: -80px;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(255, 255, 255, .1) 0%, transparent 65%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 99px;
  padding: 4px 14px;
  font-size: .71rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .85);
  margin-bottom: 18px;
}

.hero-dot {
  width: 5px;
  height: 5px;
  background: #fff;
  border-radius: 50%;
  opacity: .6;
}

.hero h1 {
  font-family: var(--font-d);
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  font-weight: 700;
  line-height: 1.14;
  color: #fff;
  margin-bottom: 14px;
  max-width: 580px;
}

.hero h1 em {
  color: rgba(255, 255, 255, .6);
  font-style: normal;
}

.hero-sub {
  font-size: .97rem;
  color: rgba(255, 255, 255, .62);
  max-width: 500px;
  line-height: 1.75;
  margin-bottom: 36px;
}

.hero-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  gap: 11px;
  max-width: 860px;
  position: relative;
  z-index: 1;
}

.hero-card {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  position: relative;
  transition: background .2s, border-color .2s, transform .2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  will-change: transform;
}

.hero-card:hover,
.hero-card:active {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .28);
  transform: translateY(-2px);
}

.hero-card:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .5);
  outline-offset: 2px;
}

.hc-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .15);
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.hc-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hc-label {
  font-size: .87rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 3px;
  line-height: 1.3;
}

.hc-desc {
  font-size: .75rem;
  color: rgba(255, 255, 255, .52);
  line-height: 1.5;
}

.hc-arrow {
  position: absolute;
  top: 14px;
  right: 14px;
  opacity: .28;
  transition: opacity .2s, transform .2s;
}

.hero-card:hover .hc-arrow {
  opacity: .65;
  transform: translateX(3px);
}

.hc-arrow svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── PAGE ── */
.page {
  display: none;
  animation: fu .22s ease;
}

.page.show {
  display: block;
}

@keyframes fu {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ── CONTENT ── */
.content {
  padding: 36px 48px 100px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.pg-header {
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.pg-step {
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 7px;
}

.pg-header h2 {
  font-family: var(--font-d);
  font-size: 1.78rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.18;
  margin-bottom: 7px;
}

.pg-header p {
  font-size: .93rem;
  color: var(--text2);
  line-height: 1.72;
  max-width: 640px;
}

.content h3 {
  font-family: var(--font-d);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 30px 0 11px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.content h3::before {
  content: '';
  width: 3px;
  height: 19px;
  border-radius: 2px;
  background: var(--brand);
  flex-shrink: 0;
}

.content p {
  font-size: .9rem;
  color: var(--text2);
  line-height: 1.78;
  margin-bottom: 10px;
}

.content ul {
  margin: 8px 0 16px;
}

.content ul li {
  font-size: .88rem;
  color: var(--text2);
  line-height: 1.72;
  padding: 3px 0 3px 18px;
  position: relative;
}

.content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
  opacity: .5;
}

.content a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .15s;
}

.content a:hover {
  color: var(--brand-light);
}

.content a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── SCREENSHOT ── */
.ss {
  display: block;
  margin: 28px auto;
  text-align: center;
  width: 100%;
  max-width: 840px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: #eeecf8;
}

.ss img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  /* FIX: use visibility instead of opacity for lazy images —
     prevents layout shift while still hiding the blank box */
  transition: opacity .3s ease;
}

.ss img[loading="lazy"] {
  opacity: 0;
}

.ss img.loaded {
  opacity: 1;
}

/* ── FOOTER FIX ──
   Footer is now OUTSIDE .layout, so it renders below the flex row.
   On desktop it needs a left margin to clear the fixed sidebar.
   On mobile (sidebar hidden) margin resets to 0.
*/
.footer {
  margin-left: var(--sidebar-w);
  /* clear the fixed sidebar on desktop */
  background: var(--brand);
  color: rgba(255, 255, 255, .6);
  text-align: center;
  font-size: .77rem;
  padding: 16px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.footer p {
  margin: 0;
}

@media (max-width: 768px) {
  .footer {
    margin-left: 0;
    /* sidebar is off-canvas on mobile */
  }
}

/* ── HISTORY SECTIONS ── */
.history-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.history-section:first-of-type {
  margin-top: 1rem;
  padding-top: 0;
  border-top: none;
}

.history-section h3 {
  font-family: var(--font-d);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--brand-darker);
  margin-bottom: .75rem;
}

/* ── LOADING STATE ── */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  color: var(--text3);
  font-size: .9rem;
}

.page-loading::after {
  content: "";
  width: 22px;
  height: 22px;
  margin-left: 10px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ══════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════ */

/* Large desktop */
@media (min-width: 1600px) {
  .content {
    max-width: 1040px;
    padding: 40px 56px 100px;
  }
}

@media (min-width: 1280px) {
  .content {
    max-width: 980px;
  }

  .ss {
    max-width: 880px;
  }

  .hero-cards {
    max-width: 920px;
  }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --sidebar-w: 240px;
  }

  .content {
    padding: 32px 28px 88px;
  }

  .hero {
    padding: 44px 28px 52px;
  }

  .hero-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .hdr-search {
    max-width: 280px;
  }
}

/* Tablet/content narrow */
@media (max-width: 960px) {
  .content {
    padding: 28px 32px 80px;
  }

  .hero {
    padding: 48px 32px 56px;
  }
}

/* Mobile — sidebar off-canvas */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    /* Ensure sidebar is above overlay */
    z-index: 201;
  }

  .sidebar.open {
    transform: none;
  }

  .hamburger {
    display: flex;
  }

  .main {
    margin-left: 0;
  }

  .content {
    padding: 22px 20px 80px;
  }

  .hero {
    padding: 38px 20px 48px;
  }

  .hero h1 {
    font-size: 1.65rem;
  }

  .hero-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .hdr-search {
    max-width: 200px;
  }

  .hdr-sep,
  .hdr-tag {
    display: none;
  }
}

/* Small tablets / large phones landscape */
@media (min-width: 481px) and (max-width: 768px) {
  .hero-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .hdr-search {
    max-width: 240px;
    flex: 1;
  }
}

/* Small phones */
@media (max-width: 480px) {
  :root {
    --header-h: 54px;
  }

  .hero {
    padding: 30px 14px 40px;
  }

  .hero h1 {
    font-size: 1.4rem;
  }

  .hero-sub {
    font-size: .86rem;
    margin-bottom: 24px;
  }

  .hero-cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .hdr-search {
    max-width: 150px;
  }

  .hdr-search input {
    height: 30px;
    font-size: .8rem;
  }

  .logo-name {
    font-size: .88rem;
  }

  .content {
    padding: 18px 14px 80px;
  }

  .pg-header h2 {
    font-size: 1.45rem;
  }

  .content h3 {
    font-size: .98rem;
  }

  .ss {
    border-radius: var(--radius);
    margin: 18px auto;
  }
}

/* Extra-small phones */
@media (max-width: 360px) {
  .content {
    padding: 14px 12px 80px;
  }

  .logo-name span {
    display: none;
  }

  .hero-cards {
    gap: 6px;
  }

  .hero-card {
    padding: 14px;
  }
}

/* Very small screens */
@media (max-width: 320px) {
  .logo-name {
    font-size: .82rem;
  }

  .hero h1 {
    font-size: 1.25rem;
  }

  .hero-card {
    padding: 12px;
  }

  .hc-icon {
    width: 28px;
    height: 28px;
  }

  .content {
    padding: 12px 10px 80px;
  }
}

/* Landscape on short phones */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 24px 20px 32px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .sidebar {
    padding-top: 8px;
  }
}

/* ── TOUCH DEVICES ── */
@media (hover: none) and (pointer: coarse) {

  .nav-item,
  .subnav-item,
  .hero-card,
  .hamburger,
  .sdi {
    /* Apple HIG & Material: minimum 44px tap targets */
    min-height: 44px;
  }

  .hero-card {
    padding: 20px;
  }

  .nav-item {
    height: auto;
    min-height: 44px;
    padding: 10px 12px;
  }

  .subnav-item {
    height: auto;
    min-height: 40px;
    padding: 8px 12px 8px 39px;
  }
}

/* ── MOBILE SEARCH EXPANSION ── */
@media (max-width: 768px) {
  .header.search-open .hdr-search {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(var(--header-total) + 6px);
    max-width: none;
    z-index: 350;
  }

  .header.search-open .hdr-search input {
    height: 40px;
    font-size: .9rem;
    background: #fff;
    color: var(--text);
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
  }

  .header.search-open .hdr-search input::placeholder {
    color: var(--text3);
  }

  .header.search-open .hdr-search .si svg {
    stroke: var(--text3);
  }

  .sidebar {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}

/* ── PWA / STANDALONE MODE ──
   FIX: when running as installed PWA, the status bar area is not
   automatically handled — we must expand the header manually.
*/
@media (display-mode: standalone) {
  .header {
    /* Already handled by env(safe-area-inset-top) in the base rule */
    min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  }

  .sidebar {
    top: var(--header-total);
  }

  .layout {
    padding-top: var(--header-total);
  }
}

/* ── NOTCH / SAFE-AREA (horizontal) ── */
@supports (padding: max(0px)) {
  .header {
    padding-left: max(16px, env(safe-area-inset-left, 16px));
    padding-right: max(16px, env(safe-area-inset-right, 16px));
  }

  .content {
    padding-left: max(48px, env(safe-area-inset-left, 0px));
    padding-right: max(48px, env(safe-area-inset-right, 0px));
  }
}

@media (max-width: 768px) {
  @supports (padding: max(0px)) {
    .content {
      padding-left: max(20px, env(safe-area-inset-left, 0px));
      padding-right: max(20px, env(safe-area-inset-right, 0px));
    }
  }
}

@media (max-width: 480px) {
  @supports (padding: max(0px)) {
    .content {
      padding-left: max(14px, env(safe-area-inset-left, 0px));
      padding-right: max(14px, env(safe-area-inset-right, 0px));
    }
  }
}

/* ── ACCESSIBILITY ── */
/* Focus-visible rings */
.nav-item:focus-visible,
.subnav-item:focus-visible,
.hero-card:focus-visible,
.hamburger:focus-visible,
.sdi:focus-visible,
.hdr-search input:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .55);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .page-loading::after {
    animation: none;
  }
}

/* High contrast */
@media (prefers-contrast: more) {
  :root {
    --border: #999;
    --text2: #333;
    --text3: #555;
  }

  .nav-item.active::after {
    width: 4px;
  }

  .content a {
    text-decoration: underline;
    text-decoration-thickness: 2px;
  }
}

/* Dark mode — keep light theme as per design, just declare color-scheme */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: light;
  }
}

/* ── PRINT ── */
@media print {

  .header,
  .sidebar,
  .sb-overlay,
  .hamburger,
  .hdr-search {
    display: none !important;
  }

  .layout {
    padding-top: 0;
  }

  .main {
    margin-left: 0 !important;
    max-width: 100% !important;
  }

  .page {
    display: block !important;
    animation: none !important;
  }

  .ss {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .hero {
    background: none;
    color: #000;
    padding: 20px 0;
  }

  .hero h1,
  .hc-label,
  .hc-desc {
    color: #000;
  }

  .hero-sub {
    color: #333;
  }

  .hero-card {
    background: none;
    border: 1px solid #ccc;
  }

  body {
    background: #fff;
    color: #000;
  }

  .content {
    padding: 20px 0;
  }

  .footer {
    background: none;
    color: #666;
    border-top: 1px solid #ccc;
  }

  a {
    text-decoration: underline;
    color: #000;
  }
}