/* InHive GitBook-style layout — sidebar + content + top header + floating switcher.
   Design tokens (palette / spacing / radius / motion) live in _shared.css.
   This file owns layout-specific rules only. */

/* ── Layout root ──────────────────────────────────────────────────────────── */

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

/* ── Top header ──────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  width: 100%;
  /* Full-width sticky bar with centred content inside (max-width is on the
     inner items, not the bar itself — otherwise edges would show body bg
     behind the bar on wide viewports during scroll). */
}

.topbar > * {
  /* center inner items within an implicit 1280px content column */
  flex-shrink: 0;
}

.topbar__brand,
.topbar__search,
.topbar__menu {
  /* keep items inside a 1280px content stripe via the topbar itself —
     simplest cross-browser way is to add side padding on viewports >1280 */
}

@media (min-width: 1281px) {
  .topbar {
    padding-left: calc((100% - 1280px) / 2 + 24px);
    padding-right: calc((100% - 1280px) / 2 + 24px);
  }
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.topbar__brand:hover { text-decoration: none; }

.topbar__logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.topbar__search {
  flex: 0 1 280px;
  max-width: 280px;
  margin-left: auto;
  position: relative;
}

.topbar__search input {
  width: 100%;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 36px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color var(--motion-micro) var(--easing);
}

.topbar__search input:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.topbar__search input::placeholder { color: var(--muted); }

.topbar__search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.topbar__kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events: none;
}

/* Search results dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-height: 440px;
  overflow-y: auto;
  z-index: 30;
  display: none;
}

.search-results.open { display: block; }

.search-results__item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}

.search-results__item:hover,
.search-results__item.focus {
  background: var(--surface-high);
  text-decoration: none;
}

.search-results__item:last-child { border-bottom: none; }

.search-results__page {
  display: block;
  font-size: 0.76rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
  font-weight: 600;
}

.search-results__text {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}

.search-results__text mark {
  background: var(--gold-dim);
  color: var(--gold);
  padding: 0 2px;
  border-radius: 3px;
}

.search-results__empty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

.sidebar {
  position: sticky;
  top: 53px; /* under topbar */
  align-self: start;
  height: calc(100vh - 53px);
  overflow-y: auto;
  padding: 24px 16px;
}

.sidebar__lang {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
  margin-bottom: 24px;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__nav a,
.sidebar__nav details > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}

.sidebar__nav a:hover,
.sidebar__nav details > summary:hover {
  background: var(--surface);
  text-decoration: none;
}

/* Active leaf link — mirrors app's _SidebarItem active state (gold-dim + gold icon) */
.sidebar__nav a.active {
  background: var(--gold-dim);
  color: var(--accent-gold);
  font-weight: 500;
}

/* <a> inside <summary> — fills row so весь padding is clickable */
.sidebar__nav details > summary > a {
  display: block;
  flex: 1;
  padding: 0;
  margin: -7px 0 -7px 0;
  padding: 7px 0;
  background: transparent !important;
  color: inherit !important;
  font-weight: inherit !important;
}
/* When section parent (FAQ/Dev) currently active — gold text only, no bg */
.sidebar__nav details:has(.nav-link.active) > summary {
  color: var(--gold);
  font-weight: 500;
}
/* When summary's own link is active (FAQ index page) — light bg too */
.sidebar__nav details > summary:has(> a.active) {
  background: var(--surface-high);
}

.sidebar__nav details { margin-bottom: 0; }
.sidebar__nav details > summary::marker { content: ""; }
.sidebar__nav details > summary::after {
  content: "›";
  margin-left: auto;
  color: var(--muted);
  transform: rotate(0);
  transition: transform 0.15s;
  font-size: 1.05rem;
}
.sidebar__nav details[open] > summary::after { transform: rotate(90deg); }
.sidebar__nav details:has(.nav-link.active) > summary::after { color: var(--gold); }

/* Nested ul — sub-items с per-item vertical line (Happ-style ::before) */
.sidebar__nav details ul {
  padding: 0;
  margin: 4px 0 4px 16px;
  list-style: none;
}
/* Topics — ещё один уровень indent от категории (внутри FAQ → Категория → Topic) */
.sidebar__nav details details ul {
  margin-left: 14px;
}
.sidebar__nav details ul li { list-style: none; margin: 0; }
.sidebar__nav details ul a {
  position: relative;
  padding: 6px 12px;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 400;
}
/* Per-item vertical guide line */
.sidebar__nav details ul a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  transition: background 0.12s, width 0.12s;
}
.sidebar__nav details ul a:hover {
  color: var(--text);
  background: var(--surface);
}
.sidebar__nav details ul a.active {
  color: var(--gold);
  background: transparent;
  font-weight: 500;
}
.sidebar__nav details ul a.active::before {
  background: var(--gold);
  width: 2px;
}
/* Nested details (FAQ → category → topics) + vertical guide line */
.sidebar__nav details details {
  margin: 0;
  margin-left: 16px;
}
.sidebar__nav details details > summary {
  position: relative;
  padding: 6px 12px;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--muted);
}
.sidebar__nav details details > summary::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.sidebar__nav details details > summary:hover {
  color: var(--text);
  background: var(--surface);
}
.sidebar__nav details details:has(.nav-link.active) > summary {
  color: var(--text);
  font-weight: 500;
}
/* Категория с active sub-item — line gold под этим summary */
.sidebar__nav details details:has(.nav-link.active) > summary::before {
  background: var(--gold);
  width: 2px;
}

/* ── Sidebar "Powered by" footer ─────────────────────────────────────────── */
.sidebar__powered {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 4px 4px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  transition: color 0.15s, transform 0.1s;
}
.sidebar__powered:hover {
  color: var(--gold);
  transform: translateY(-1px);
  text-decoration: none;
}
.sidebar__powered-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  font-weight: 600;
}
.breadcrumb a {
  color: var(--gold);
  font-weight: 600;
}

/* ── Prev/Next widget ────────────────────────────────────────────────────── */
.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 40px 0 16px;
}
.prev-next a {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  transition: border-color 0.15s, background 0.15s;
}
.prev-next a:hover {
  border-color: var(--gold);
  background: var(--surface-high);
  text-decoration: none;
}
.prev-next a.next { text-align: right; }
.prev-next a span.pn-label {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.prev-next a.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Page footer (report-bug + last-updated) ─────────────────────────────── */
.page-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.page-footer .last-updated {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
  padding: 0;
  border: none;
}
.page-footer .report-bug {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.page-footer .report-bug:hover {
  color: var(--gold);
  background: var(--surface);
}

/* ── Last updated (standalone, для legal/index страниц без footer-блока) ── */
.last-updated {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 24px 0 0;
  padding-top: 16px;
}

/* ── Copy-split (AI-friendly dropdown) ───────────────────────────────────── */
.copy-split {
  position: relative;
  display: inline-flex;
}
.copy-split__main,
.copy-split__chevron {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.copy-split__main {
  border-radius: 8px 0 0 8px;
  border-right: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.copy-split__chevron {
  border-radius: 0 8px 8px 0;
  padding: 6px 10px;
}
.copy-split__main:hover,
.copy-split__chevron:hover {
  color: var(--text);
  border-color: var(--text);
}
.copy-split__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 6px;
  min-width: 280px;
  z-index: 25;
}
.copy-split__menu hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}
.copy-split__menu button {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 0.88rem;
}
.copy-split__menu button:hover {
  background: var(--surface-high);
}
.copy-split__menu button .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 0.92rem;
  flex-shrink: 0;
}
.copy-split__menu button > div {
  flex: 1;
  min-width: 0;
}
.copy-split__menu button strong {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 2px;
}
.copy-split__menu button small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

/* ── Index page list rows (faq, dev) — Happ-style flat list ──────────────── */
.idx-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}
.idx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--surface);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s, transform 0.1s;
  font-size: 0.94rem;
}
.idx-row:hover {
  background: var(--surface-high);
  text-decoration: none;
}
.idx-row__arrow {
  color: var(--muted);
  font-size: 1.2rem;
  margin-left: 12px;
}

/* ── Main content ─────────────────────────────────────────────────────────── */

.content {
  padding: 32px 48px 64px;
  min-width: 0;
}

.content__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.content__header h1 {
  margin: 0;
}

.content__copy {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--motion-micro) var(--easing),
              border-color var(--motion-micro) var(--easing);
}

.content__copy:hover {
  color: var(--text);
  border-color: var(--text);
}

.content__copy svg { flex-shrink: 0; }

/* Platforms table — Happ-style */
.platforms {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0 32px;
  border-radius: 12px;
  overflow: hidden;
}

.platforms th,
.platforms td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

.platforms th {
  background: var(--surface);
  font-weight: 600;
  color: var(--gold);
}

.platforms tbody tr:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.02);
}
html[data-theme="light"] .platforms tbody tr:nth-child(odd) td {
  background: rgba(0, 0, 0, 0.02);
}

.platforms a { display: inline-block; }
.platforms a + a { margin-left: 0; }
.platforms .pf-label { color: var(--muted); margin-right: 4px; }

/* Feature cards — bordered, hover-lift, mirrors app's card aesthetic */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0 var(--space-xxl);
}

.feature {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  background: var(--surface);
  transition: border-color var(--motion-micro) var(--easing),
              background var(--motion-micro) var(--easing),
              transform var(--motion-micro) var(--easing);
}

.feature:hover {
  border-color: var(--accent-gold);
  background: var(--surface-high);
  transform: translateY(-1px);
}

.feature h3 {
  color: var(--gold);
  font-size: 0.98rem;
  margin: 0 0 var(--space-xs);
}

.feature p {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ── Language sections (global lang switcher controls visibility) ─────────── */

.lang-section h1 { margin: 0 0 8px; font-size: 2rem; }
.lang-section .meta { color: var(--muted); margin-bottom: 28px; font-size: 0.88rem; }
.lang-section h2 {
  color: var(--gold);
  font-size: 1.3rem;
  margin: 28px 0 10px;
  font-weight: 600;
}
.lang-section h3 { font-size: 1.02rem; margin: 18px 0 4px; font-weight: 600; }
.lang-section p { margin: 0 0 12px; }
.lang-section ul { padding-left: 22px; margin: 8px 0 14px; }
.lang-section li { margin: 3px 0; }
.lang-section a { color: var(--gold); }
.lang-section a:hover { text-decoration: underline; }
.lang-section .prev-next a,
.lang-section .prev-next a:hover,
.lang-section .idx-row,
.lang-section .idx-row:hover { text-decoration: none; }
.lang-section strong { font-weight: 600; }

/* ── Protocols section: header + toggle + marquee/grid disclosure ────────── */

.protocols-section { margin: var(--space-lg) 0 var(--space-xxl); }

.protocols-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.protocols-header h2 {
  margin: 0;
}

.protocols-toggle {
  background: transparent;
  border: 0.5px solid var(--border);
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--motion-micro) var(--easing),
              border-color var(--motion-micro) var(--easing),
              background var(--motion-micro) var(--easing);
}

.protocols-toggle svg {
  transition: transform var(--motion-panel) var(--easing);
}

.protocols-toggle:hover {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  background: var(--surface);
}

.protocols-section[data-expanded="true"] .protocols-toggle svg {
  transform: rotate(180deg);
}

/* Toggle visibility of marquee vs grid */
.protocols-section[data-expanded="false"] .protocols-grid { display: none; }
.protocols-section[data-expanded="true"]  .protocols-marquee { display: none; }

.protocols-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
  list-style: none;
  padding: 0;
  margin: 0;
}

.protocols-grid .protocol-card { min-height: auto; }

/* ── Protocols seamless infinite marquee (Ryan Mulligan pattern) ──────────
   Two identical <ul.protocols-content> lists side by side, each min-width 100%.
   Both animate translateX(0) → translateX(-100% - gap). When animation loops
   back to 0, the 2nd list is at the pixel position where the 1st was at start
   → invisibly seamless. No JS, no width calculations needed. */

.protocols-marquee {
  --marquee-gap: var(--space-md);
  display: flex;
  overflow: hidden;
  gap: var(--marquee-gap);
  user-select: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
}

.protocols-content {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: var(--marquee-gap);
  min-width: 100%;
  list-style: none;
  padding: 0;
  margin: 0;
  animation: protocols-scroll 50s linear infinite;
}

.protocols-marquee:hover .protocols-content {
  animation-play-state: paused;
}

@keyframes protocols-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-100% - var(--marquee-gap))); }
}

.protocol-card {
  flex: 0 0 260px;
  min-height: 110px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  background: var(--surface);
  transition: background var(--motion-micro) var(--easing);
}

.protocol-card:hover {
  background: var(--surface-high);
}

.protocol-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin: 0 0 var(--space-xs);
}

.protocol-card__head h3 {
  margin: 0;
  color: var(--gold);
  font-size: 0.98rem;
}

.protocol-card__src {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-xs);
  transition: color var(--motion-micro) var(--easing),
              background var(--motion-micro) var(--easing);
}

.protocol-card__src:hover {
  color: var(--accent-gold);
  background: var(--surface-high);
  text-decoration: none;
}

.protocol-card h3 {
  color: var(--gold);
  font-size: 0.98rem;
  margin: 0 0 var(--space-xs);
}

.protocol-card p {
  color: var(--muted);
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
  .protocols-content { animation: none; }
}

/* ── Hero section (home page) — mirrors app's Home connect composition ──── */

.hero {
  position: relative;
  text-align: center;
  padding: 56px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  isolation: isolate;
}

/* Honeycomb pattern behind hero — proper flat-top hex tessellation.
   Tile 45×26 contains 1 full hex (col 0) + 2 partial (col 1, offset by h/2 vertically).
   Hex r=15, h=26 (≈ r*√3, equilateral).
   Color is theme-aware via mask-image trick: SVG is the mask shape, background-color controls hue. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--accent-gold);
  -webkit-mask-image:
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 45 26' width='45' height='26'%3E%3Cg fill='none' stroke='%23000' stroke-width='0.5'%3E%3Cpath d='M7.5 0L22.5 0L30 13L22.5 26L7.5 26L0 13Z'/%3E%3Cpath d='M30 -13L45 -13L52.5 0L45 13L30 13L22.5 0Z'/%3E%3Cpath d='M30 13L45 13L52.5 26L45 39L30 39L22.5 26Z'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(ellipse at center, #000 30%, transparent 75%);
  mask-image:
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 45 26' width='45' height='26'%3E%3Cg fill='none' stroke='%23000' stroke-width='0.5'%3E%3Cpath d='M7.5 0L22.5 0L30 13L22.5 26L7.5 26L0 13Z'/%3E%3Cpath d='M30 -13L45 -13L52.5 0L45 13L30 13L22.5 0Z'/%3E%3Cpath d='M30 13L45 13L52.5 26L45 39L30 39L22.5 26Z'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-repeat: repeat, no-repeat;
  mask-repeat: repeat, no-repeat;
  -webkit-mask-size: 90px 52px, 100% 100%;
  mask-size: 90px 52px, 100% 100%;
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  opacity: 0.22;
  pointer-events: none;
}

/* Light theme: darker pattern color + stronger opacity for visibility on cream */
html[data-theme="light"] .hero::before {
  background-color: #8E6418;
  opacity: 0.30;
}

.hero__logo {
  position: relative;
  width: 180px;
  height: 180px;
  margin-bottom: var(--space-xl);
  transition: filter var(--motion-panel) var(--easing);
}

.hero__logo:hover {
  filter: drop-shadow(0 0 12px var(--gold-glow));
}

.hero__ring,
.hero__bee {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hero__bee {
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
}

.hero__title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 var(--space-md);
  color: var(--text);
}

.hero__tagline {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto var(--space-xl);
  line-height: 1.55;
}

.hero__cta {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

/* ── Buttons — flat, mirror app's "no ripple" character ──────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 0.5px solid transparent;
  transition: background var(--motion-micro) var(--easing),
              border-color var(--motion-micro) var(--easing),
              color var(--motion-micro) var(--easing);
}

.btn:hover { text-decoration: none; }

/* Higher-specificity selectors so .lang-section a (0,1,1) doesn't override these */
.lang-section a.btn--primary,
a.btn--primary,
.btn--primary {
  background: var(--accent-gold);
  color: #18140F;
  border-color: var(--accent-gold);
}

.lang-section a.btn--primary:hover,
a.btn--primary:hover,
.btn--primary:hover {
  background: transparent;
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  text-decoration: none;
}

.lang-section a.btn--ghost,
a.btn--ghost,
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.lang-section a.btn--ghost:hover,
a.btn--ghost:hover,
.btn--ghost:hover {
  background: var(--surface);
  border-color: var(--text);
  color: var(--text);
  text-decoration: none;
}

@media (max-width: 600px) {
  .hero { padding: 32px 16px 32px; }
  .hero__logo { width: 140px; height: 140px; }
  .hero__title { font-size: 2.25rem; }
  .hero__tagline { font-size: 0.95rem; }
}

/* ── Theme reveal — canvas overlay with honeycomb wave carve (matches app) ── */

.theme-reveal-canvas {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

/* ── Floating theme switcher (Happ-style) ────────────────────────────────── */

.theme-switcher {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 15;
  display: inline-flex;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  box-shadow: var(--shadow-panel);
}

.theme-switcher button {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--motion-micro) var(--easing),
              background var(--motion-micro) var(--easing);
}

.theme-switcher button:hover { color: var(--text); }

.theme-switcher button.active {
  background: var(--gold-dim);
  color: var(--accent-gold);
}

/* ── Topbar menu button (hamburger, mobile only) ─────────────────────────── */

.topbar__menu {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}

.topbar__menu:hover { background: var(--surface); }

.topbar__brand-short { display: none; }

/* ── Sidebar backdrop (mobile drawer dim layer) ──────────────────────────── */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-sidebar) var(--easing);
}

body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }

  /* Sidebar becomes a slide-in drawer — starts below the topbar so the
     lang dropdown at the top of the sidebar isn't hidden under it. */
  .sidebar {
    display: block;
    position: fixed;
    top: 56px;                       /* clear sticky topbar */
    left: 0;
    height: calc(100vh - 56px);
    width: min(86vw, 320px);
    background: var(--bg);
    border-right: 0.5px solid var(--border);
    padding: 16px 16px 80px;
    z-index: 19;
    transform: translateX(-100%);
    transition: transform var(--motion-sidebar) var(--easing);
    overflow-y: auto;
    box-shadow: var(--shadow-panel);
  }

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

  /* Hide floating theme switcher while drawer is open — they live in the same corner */
  body.sidebar-open .theme-switcher {
    opacity: 0;
    pointer-events: none;
  }

  /* Topbar adjustments — reserve space on right for the floating theme switcher */
  .topbar {
    padding: 10px 60px 10px 14px;
    gap: 10px;
  }
  .topbar__menu { display: inline-flex; }
  .topbar__brand { gap: 8px; }
  .topbar__brand-text { display: none; }
  .topbar__brand-short {
    display: inline;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
  }
  /* Compact search on mobile — narrow fixed width, sits right next to brand. */
  .topbar__search {
    display: block;
    flex: 0 1 auto;
    width: 140px;
    max-width: none;
    margin-left: 8px;        /* small gap from "InHive" brand */
  }
  .topbar__search input {
    padding: 6px 10px 6px 30px;
    font-size: 0.88rem;
  }
  .topbar__search-icon { left: 9px; }
  .topbar__kbd { display: none; }

  /* Content padding — extra top for sticky topbar, normal bottom (switcher now top-right) */
  .content { padding: 20px 16px 32px; }

  /* Typography scale-down on mobile */
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.2rem; margin-top: var(--space-xl); }
  h3 { font-size: 1rem; }
  .lang-section h1 { font-size: 1.85rem; }
  .lang-section h2 { font-size: 1.2rem; }

  /* Hero — already 140px logo via existing @media (max-width: 600px) */
  .hero { padding: 32px 14px 32px; }
  .hero__title { font-size: 2.25rem; }
  .hero__tagline { font-size: 0.95rem; }
  .hero__cta { gap: var(--space-sm); }
  .btn { padding: 11px 18px; min-height: 44px; }

  /* Prev/Next — single column on mobile */
  .prev-next { grid-template-columns: 1fr; gap: 8px; margin: 28px 0 12px; }
  .prev-next a.next { text-align: left; }

  /* Index list — one column */
  .idx-list { grid-template-columns: 1fr; }

  /* Features — one column */
  .features { grid-template-columns: 1fr; gap: var(--space-md); }

  /* Theme switcher — top-right corner on mobile, above topbar */
  .theme-switcher {
    top: 8px;
    right: 8px;
    bottom: auto;
    padding: 2px;
    z-index: 25;            /* above topbar (z-index 20) */
  }
  .theme-switcher button {
    padding: 6px 8px;
    min-width: 32px;
    min-height: 32px;
  }

  /* Content header on mobile — stack title + copy button */
  .content__header {
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
  }
  .content__copy { font-size: 0.8rem; padding: 5px 10px; }

  /* Tables — allow horizontal scroll instead of overflow */
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .platforms { white-space: normal; }
}

@media (max-width: 600px) {
  .hero { padding: 24px 12px 28px; }
  .hero__logo { width: 140px; height: 140px; }
  .hero__title { font-size: 2rem; }
  .hero__tagline { font-size: 0.92rem; }
  h1, .lang-section h1 { font-size: 1.6rem; }
}
