@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;500;600;700&display=swap");

:root {
  --bg: #f6efe7;
  --bg-alt: #efe4d6;
  --ink: #2b1f1b;
  --muted: #6f5a4c;
  --accent: #c7744b;
  --accent-2: #2f5b63;
  --card: #fffaf4;
  --shadow: 0 20px 60px rgba(43, 31, 27, 0.14);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

.password-field-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}

.password-field-wrap input[type="password"],
.password-field-wrap input[type="text"] {
  width: 100%;
  padding-right: 64px;
}

.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: 1px solid rgba(43, 31, 27, 0.25);
  background: #fff;
  color: #2b1f1b;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1;
  padding: 7px 8px;
  cursor: pointer;
}

.password-toggle-btn:hover {
  background: #fed90c;
}

.bg-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(0px);
  opacity: 0.6;
  animation: float 18s ease-in-out infinite;
}

.orb-1 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(199, 116, 75, 0.6), transparent 70%);
  top: -140px;
  left: -120px;
}

.orb-2 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(47, 91, 99, 0.5), transparent 70%);
  bottom: -160px;
  right: -120px;
  animation-delay: 4s;
}

.orb-3 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(255, 210, 153, 0.55), transparent 70%);
  top: 40%;
  right: 10%;
  animation-delay: 7s;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(43, 31, 27, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 31, 27, 0.08) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.3;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(22px); }
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(14px);
  background: rgba(246, 239, 231, 0.9);
  border-bottom: 1px solid rgba(43, 31, 27, 0.08);
  z-index: 1200;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 18px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.brand-cluster {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
  min-width: 0;
}

.brand-right-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  background: transparent !important;
  padding: 0;
  border-radius: 0;
  border: 0;
}

.brand-shield-link,
.brand-wordmark-link {
  text-decoration: none;
  background: transparent !important;
  padding: 0;
  border: 0;
}

.brand-shield {
  width: 102px;
  height: 102px;
  object-fit: contain;
  display: block;
}

.brand-wordmark {
  height: 40px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  flex: 1 1 auto;
  /* Wrap instead of overflowing left over the brand wordmark when the row
     runs out of room (was visible at ~1280px viewports). */
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.social-icons {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.brand-social-icons {
  justify-content: center;
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  /* override the inherited nav-link padding that was squishing the icon */
  padding: 0 !important;
  overflow: visible;
  border-radius: 999px;
  border: 1px solid rgba(43, 31, 27, 0.25);
  background: rgba(255, 255, 255, 0.6);
  color: #2b1f1b;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.social-icons a:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(43, 31, 27, 0.15);
}

.social-icons svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  transform: none;
  transform-origin: center;
  fill: currentColor;
}

.admin-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(43, 31, 27, 0.3);
}

main {
  padding-bottom: 80px;
}

.page-shell {
  position: relative;
  z-index: 10;
  pointer-events: auto;
  will-change: transform, opacity;
}

.page-transition .page-shell {
  animation: pageFadeIn 0.22s ease both;
}

.page-transition.slide-next .page-shell {
  animation: pageSlideNext 0.38s ease both;
}

.page-transition.slide-prev .page-shell {
  animation: pageSlidePrev 0.38s ease both;
}

.page-transition-exit .page-shell {
  animation: pageFadeOut 0.26s ease both;
}

.page-transition-exit.slide-next .page-shell {
  animation: pageSlideExitNext 0.28s ease both;
}

.page-transition-exit.slide-prev .page-shell {
  animation: pageSlideExitPrev 0.28s ease both;
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pageFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes pageSlideNext {
  from { opacity: 0; transform: translateX(70px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pageSlidePrev {
  from { opacity: 0; transform: translateX(-70px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pageSlideExitNext {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-40px); }
}

@keyframes pageSlideExitPrev {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

@media (prefers-reduced-motion: reduce) {
  .page-transition .page-shell,
  .page-transition.slide-next .page-shell,
  .page-transition.slide-prev .page-shell,
  .page-transition-exit .page-shell {
    animation: pageFadeIn 0.12s ease both;
  }
}

.hero {
  padding: 80px 0 40px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  align-items: center;
}

.hero-copy h1 {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 500;
  font-size: clamp(42px, 6vw, 72px);
  margin: 12px 0 16px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--muted);
}

.lead {
  font-size: 18px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 28px;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 36px;
}

.hero-meta strong {
  display: block;
  font-size: 16px;
}

.hero-meta span {
  font-size: 13px;
  color: var(--muted);
}

.hero-art {
  display: grid;
  gap: 20px;
}

.art-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: translateY(10px);
  animation: fadeUp 1s ease forwards;
}

.art-card.alt {
  transform: translateY(30px);
}

.art-image {
  height: 220px;
  background-size: cover;
  background-position: center;
}

.art-info {
  padding: 18px;
}

.section {
  padding: 60px 0;
  position: relative;
  z-index: 10;
}

.section:target {
  scroll-margin-top: 120px;
}

.section.alt {
  background: rgba(255, 255, 255, 0.4);
  margin: 20px 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}

.grid {
  display: grid;
  /* auto-fill (not auto-fit) keeps empty tracks, so a catalog with a single
     product renders a normal-width card instead of stretching it across the
     whole row and blowing up the cover-cropped image. */
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
  position: relative;
  z-index: 50;
}

.grid > .card {
  max-width: 420px;
}

.card {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 50;
  cursor: pointer;
  pointer-events: auto;
}

.card:hover {
  transform: translateY(-6px);
}

.card-image {
  height: 220px;
  background-size: cover;
  background-position: center;
}

.card-body {
  padding: 18px;
}

.card-body h3 {
  margin: 0 0 6px;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 500;
  font-size: 22px;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  align-items: center;
}

.about-image img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: block;
}

.about-body h3 {
  margin-top: 0;
}

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.card-meta .price {
  font-weight: 600;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
}

/* Without this, a grid item's min-content (e.g. the subscribe form's fixed
   input + nowrap button) can expand the track past the container and clip
   the whole column off-screen on phones. */
.story-grid > * {
  min-width: 0;
}

.story-panel {
  background: var(--card);
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
}

.checklist li {
  padding-left: 22px;
  position: relative;
  margin-bottom: 10px;
}

.checklist li::before {
  content: "*";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.autoap-note {
  margin-top: 22px;
  background: #ffffff;
  border: 1px solid rgba(43, 31, 27, 0.16);
  border-left: 4px solid #fed90c;
  border-radius: 12px;
  padding: 14px 16px;
}

.autoap-note h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.autoap-steps {
  margin: 0 0 10px 18px;
  padding: 0;
}

.autoap-steps li {
  margin: 4px 0;
}

.autoap-warn {
  margin: 0;
  color: #1f1f1f;
}

.demo-compat-note {
  margin-top: 16px;
  background: #12221d;
  color: #ffffff;
  border: 1px solid rgba(254, 217, 12, 0.45);
  border-left: 4px solid #fed90c;
  border-radius: 12px;
  padding: 16px;
}

.demo-compat-note h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.demo-compat-note p {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.86);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
  align-items: start;
}

.detail-image {
  height: 420px;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
}

.bundle-carousel {
  position: relative;
  height: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #fff;
}

.bundle-carousel-track {
  position: absolute;
  inset: 0;
}

.bundle-carousel-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 220ms ease;
}

.bundle-carousel-slide.is-active {
  opacity: 1;
}

.bundle-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.bundle-carousel-btn.prev {
  left: 12px;
}

.bundle-carousel-btn.next {
  right: 12px;
}

.bundle-carousel-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.detail-info h1 {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 500;
  font-size: clamp(32px, 4vw, 48px);
}

.detail-price {
  font-size: 22px;
  color: var(--accent);
}

.detail-copy {
  white-space: normal;
}

.detail-description-full {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.rich-editor-mini {
  margin-top: 6px;
}

.rich-editor-mini .editor-toolbar {
  padding: 6px;
  gap: 6px;
}

.rich-editor-mini .editor-toolbar button {
  min-width: 34px;
  padding: 6px 8px;
  font-size: 12px;
}

.rich-editor-mini .editor-body {
  min-height: 90px;
  padding: 10px 12px;
}

.detail-warning {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e15a5a;
  background: #fff1f1;
  color: #b00020;
  font-weight: 700;
}

.detail-warning strong {
  margin-right: 6px;
}

.detail-warning > span {
  display: inline;
}

/* Compatibility: green (supported) vs red (not supported) columns */
.compat {
  grid-column: 1 / -1;
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.compat-title {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 16px;
}

.compat-col {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid;
}

.compat-yes {
  border-color: #2f9e57;
  background: #eafaf0;
}

.compat-no {
  border-color: #d6453b;
  background: #fdeeee;
}

.compat-col h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.compat-yes h4 {
  color: #1f7a43;
}

.compat-no h4 {
  color: #b42318;
}

.compat-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.compat-col li {
  position: relative;
  padding-left: 24px;
  font-size: 14px;
  line-height: 1.4;
  color: #1d2733;
}

.compat-yes li::before {
  content: "\2713"; /* ✓ */
  position: absolute;
  left: 0;
  color: #2f9e57;
  font-weight: 700;
}

.compat-no li::before {
  content: "\2717"; /* ✗ */
  position: absolute;
  left: 0;
  color: #d6453b;
  font-weight: 700;
}

.compat-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .compat {
    grid-template-columns: 1fr;
  }
}

/* Firmware screenshot gallery */
.shot-gallery {
  grid-column: 1 / -1;
  margin-top: 24px;
}

.shot-gallery h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.shot {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(43, 31, 27, 0.18);
  background: #0e1116;
  box-shadow: var(--shadow);
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.shot figcaption {
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--muted);
  background: #ffffff;
}

.shot {
  cursor: zoom-in;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shot:hover,
.shot:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(20, 12, 8, 0.28);
  outline: none;
}

/* Home Assistant showcase block within the gallery */
.ha-showcase {
  grid-column: 1 / -1;
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid rgba(43, 31, 27, 0.16);
}

.ha-showcase h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.ha-lead {
  margin: 0 0 14px;
  max-width: 70ch;
  color: var(--muted);
  line-height: 1.55;
}

.ha-points {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.ha-points li {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(43, 31, 27, 0.14);
  background: rgba(255, 255, 255, 0.55);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.ha-points li strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text, #2b1f1b);
}

.ha-showcase .shot-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Per-product FAQ (public product page) */
.detail-faq {
  margin-top: 28px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  border: 1px solid rgba(43, 31, 27, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.faq-item > summary {
  cursor: pointer;
  list-style: none;
  padding: 13px 16px;
  font-weight: 600;
  color: var(--text, #2b1f1b);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.faq-item > summary::-webkit-details-marker { display: none; }

.faq-item > summary::after {
  content: "+";
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.faq-item[open] > summary::after {
  transform: rotate(45deg);
}

.faq-answer {
  padding: 0 16px 14px;
  color: var(--muted);
  line-height: 1.55;
}

/* FAQ manager (admin product edit) */
.faq-toggle-form {
  margin: 10px 0 8px;
}

.faq-subhead {
  margin: 22px 0 4px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.faq-admin-item {
  border: 1px solid rgba(43, 31, 27, 0.16);
  border-radius: 16px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.5);
}

.faq-admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.faq-admin-title {
  font-weight: 700;
  font-size: 15px;
  flex: 1 1 240px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.faq-admin-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 999px;
}

.faq-admin-badge.is-published {
  background: rgba(118, 175, 145, 0.22);
  color: #2f6b49;
}

.faq-admin-badge.is-draft {
  background: rgba(43, 31, 27, 0.1);
  color: var(--muted);
}

.faq-admin-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.faq-admin-meta input[type="number"] {
  width: 80px;
}

.faq-admin-new {
  border-style: dashed;
}

/* Collapsible admin cards (product editor + Product FAQ) */
.faq-section > summary.faq-section-summary,
.collapse-card > summary.collapse-card-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-section > summary.faq-section-summary::-webkit-details-marker,
.collapse-card > summary.collapse-card-summary::-webkit-details-marker {
  display: none;
}

.faq-section-summary > span,
.collapse-card-summary > span {
  font-size: 1.17em;
  font-weight: 700;
}

.faq-section-summary::after,
.collapse-card-summary::after {
  content: "+";
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.faq-section[open] > .faq-section-summary::after,
.collapse-card[open] > .collapse-card-summary::after {
  transform: rotate(45deg);
}

.faq-section[open] > .faq-section-summary,
.collapse-card[open] > .collapse-card-summary {
  margin-bottom: 20px;
}

/* Tighten the vertical gap between stacked admin cards */
.section.stack-below {
  padding-bottom: 10px;
}

.section.stack-above {
  padding-top: 10px;
}

/* Lightbox (click a screenshot to view it full size) */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 9, 12, 0.86);
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-figure {
  margin: 0;
  max-width: 95vw;
  text-align: center;
}

.lightbox-image {
  display: block;
  max-width: 95vw;
  max-height: 84vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
}

.lightbox-caption {
  margin-top: 12px;
  color: #e8eef5;
  font-size: 14px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.26);
}

body.lightbox-lock {
  overflow: hidden;
}

/* ---- Compatibility wiki ---- */
.compat-lede {
  max-width: 720px;
  color: var(--muted);
}

.compat-rule {
  margin: 18px 0 24px;
  padding: 16px 18px;
  border: 1px solid #2f9e57;
  background: #eafaf0;
  border-radius: 12px;
  max-width: 820px;
}

.compat-rule h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #1f7a43;
}

.compat-rule p {
  margin: 0;
  color: #1d2733;
}

.compat-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 18px 0 12px;
}

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

.compat-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compat-filter {
  border: 1px solid rgba(43, 31, 27, 0.25);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.compat-filter.is-active {
  background: var(--ink, #2b1f1b);
  color: #fff;
  border-color: var(--ink, #2b1f1b);
}

.compat-table {
  width: 100%;
  border-collapse: collapse;
}

.compat-table th,
.compat-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(43, 31, 27, 0.14);
  vertical-align: top;
  font-size: 14px;
}

.compat-badge {
  display: inline-block;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid;
}

.compat-compatible { color: #1f7a43; background: #eafaf0; border-color: #2f9e57; }
.compat-dependent { color: #a15c00; background: #fff4e3; border-color: #e09a3e; }
.compat-incompatible { color: #b42318; background: #fdeeee; border-color: #d6453b; }
.compat-unverified { color: #475467; background: #eef1f5; border-color: #b7c0cd; }

.compat-evidence {
  margin-left: 6px;
  font-size: 12px;
}

.compat-checked {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.compat-empty {
  padding: 16px;
  color: var(--muted);
}

.compat-disclaimer {
  margin: 14px 0 28px;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 820px;
}

.compat-submit {
  margin-top: 8px;
}

.compat-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* compact admin editor */
.compat-edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 16px;
}

.compat-edit-form input,
.compat-edit-form select,
.compat-edit-form textarea {
  flex: 1 1 150px;
  min-width: 120px;
}

.compat-edit-form textarea {
  flex-basis: 100%;
}

.compat-admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(43, 31, 27, 0.18);
  border-radius: 10px;
  margin-bottom: 10px;
}

.compat-admin-row.pending {
  border-color: #e09a3e;
  background: #fff8ee;
}

.compat-admin-entry {
  border: 1px solid rgba(43, 31, 27, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.compat-admin-entry > summary {
  cursor: pointer;
}

@media (max-width: 720px) {
  .compat-table thead { display: none; }
  .compat-table, .compat-table tbody, .compat-table tr, .compat-table td { display: block; width: 100%; }
  .compat-table tr { border: 1px solid rgba(43, 31, 27, 0.16); border-radius: 10px; margin-bottom: 10px; padding: 6px 4px; }
  .compat-table td { border: none; padding: 6px 12px; }
  .compat-table td::before { content: attr(data-label) ": "; font-weight: 700; color: var(--muted); }
  .compat-table td:first-child::before { content: ""; }
}

.detail-instructions {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(43, 31, 27, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
}

.detail-instructions-full {
  grid-column: 1 / -1;
}

.detail-instructions h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.detail-meta-full {
  grid-column: 1 / -1;
  max-width: 980px;
  width: 100%;
  margin: 10px auto 0;
}

.detail-meta-full > div {
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

.btn.primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow);
}

.btn.ghost {
  border-color: var(--ink);
  color: var(--ink);
}

.btn.link {
  border-color: transparent;
  color: var(--accent-2);
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn.danger {
  background: #b4573d;
  color: white;
}

.btn.disabled,
.btn[aria-disabled="true"],
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.form-card {
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 520px;
}

.form-card.full-width {
  max-width: 100%;
  width: 100%;
}

/* Wider product editor (Edit/New bundle) so fields aren't squeezed into one
   narrow column. Each per-language block is a collapsible <details> accordion
   so only the language being edited takes up vertical space. */
.form-card-wide {
  max-width: 1080px;
}

details.form-lang > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

details.form-lang > summary::-webkit-details-marker {
  display: none;
}

details.form-lang > summary::before {
  content: "\25B8"; /* ▸ */
  font-size: 11px;
  transition: transform 0.15s ease;
}

details.form-lang[open] > summary::before {
  content: "\25BE"; /* ▾ */
}

details.form-lang[open] > summary {
  margin-bottom: 14px;
}

/* Collapsible per-device diagnostics cards (admin). Each PowerView device is a
   <details> accordion so the admin can scan many device headers at a glance and
   expand only the one they need. Full-width so the bundle table uses the page. */
details.diag-device > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

details.diag-device > summary::-webkit-details-marker {
  display: none;
}

details.diag-device > summary::before {
  content: "\25B8"; /* ▸ */
  font-size: 13px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

details.diag-device[open] > summary::before {
  content: "\25BE"; /* ▾ */
}

details.diag-device[open] > summary {
  margin-bottom: 16px;
}

.diag-device-head {
  flex: 1;
  min-width: 0;
}

.form-grid {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.signup-card {
  width: min(1120px, 100%);
  max-width: 1120px;
}

.signup-complete {
  width: min(620px, 100%);
  max-width: 620px;
}

.signup-complete-resend {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(43, 31, 27, 0.14);
}

.signup-complete-resend summary {
  cursor: pointer;
  font-weight: 700;
}

.signup-complete-resend .btn {
  justify-self: start;
}

.signup-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.signup-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(43, 31, 27, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
}

.signup-panel h3 {
  margin: 0 0 16px;
}

.signup-panel-address,
.turnstile-row,
.signup-actions {
  grid-column: 1 / -1;
}

.turnstile-row {
  width: min(100%, 460px);
  min-height: 168px;
  padding: 18px;
  border: 1px solid rgba(43, 31, 27, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
}

.turnstile-row h3 {
  margin: 0 0 6px;
}

.turnstile-row .form-note {
  margin: 0 0 14px;
}

.turnstile-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.turnstile-retry {
  margin-top: 8px;
}

.signup-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.signup-address-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.signup-field-wide,
.signup-phone-row {
  grid-column: 1 / -1;
}

.signup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.signup-actions .form-note {
  margin: 0;
}

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

  .signup-panel-address,
  .turnstile-row,
  .signup-actions {
    grid-column: auto;
  }

  .signup-address-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .signup-card {
    padding: 22px;
  }

  .signup-panel {
    padding: 16px;
  }

  .signup-fields,
  .signup-address-fields {
    grid-template-columns: 1fr;
  }

  .signup-field-wide,
  .signup-phone-row {
    grid-column: auto;
  }

  .signup-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  gap: 10px;
  z-index: 1200;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(35, 28, 24, 0.92);
  color: #f6f1ec;
  font-size: 13px;
  box-shadow: 0 14px 30px rgba(20, 12, 8, 0.35);
  display: grid;
  gap: 6px;
  animation: toastIn 0.25s ease;
}

.toast.success {
  border: 1px solid rgba(118, 175, 145, 0.6);
}

.toast.error {
  border: 1px solid rgba(200, 92, 72, 0.6);
}

.toast-title {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 10px;
  color: rgba(246, 241, 236, 0.7);
}

.toast-message {
  margin: 0;
}

@keyframes toastIn {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.section-hint {
  margin: 6px 0 16px;
  font-size: 12px;
  color: var(--muted);
}

.form-lang {
  border: 1px dashed rgba(43, 31, 27, 0.2);
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
}

.form-lang h4 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.form-grid label {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.form-grid .form-field {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.form-grid .field-label {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.form-grid label.checkbox-row {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  min-width: 0;
}

/* Checkboxes must not inherit the full-width input sizing above — a stretched
   checkbox renders as a broken slider-like bar (seen on the login
   "remember" row). */
.form-grid input[type="checkbox"],
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.phone-input-row {
  display: grid;
  grid-template-columns: minmax(170px, 0.45fr) minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
}

.phone-input-row label {
  margin: 0;
  min-width: 0;
}

@media (max-width: 640px) {
  .phone-input-row {
    grid-template-columns: 1fr;
  }
}

.admin-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.admin-image-card {
  display: grid;
  gap: 6px;
  align-items: center;
  justify-items: center;
  border: 1px solid rgba(43, 31, 27, 0.15);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}

.admin-image-card img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
}

.admin-image-remove-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #000;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.admin-image-remove-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #c62828;
  cursor: pointer;
}

input,
textarea,
select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(43, 31, 27, 0.2);
  font-family: "Nunito", "Trebuchet MS", sans-serif;
}

.lang-select {
  flex: 0 0 auto;
}

.lang-select select {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.alert {
  background: #f2d2c6;
  padding: 12px 16px;
  border-radius: 12px;
  margin-top: 12px;
}

.alert.success {
  background: #d0e5db;
}

.alert.subtle {
  background: rgba(43, 31, 27, 0.08);
}

.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.two-factor-card { max-width: 560px; }
.two-factor-qr { display:block; width:240px; max-width:100%; height:auto; margin:20px auto; border-radius:12px; }
.two-factor-secret { display:block; padding:12px; margin-bottom:20px; overflow-wrap:anywhere; text-align:center; letter-spacing:.08em; background:rgba(43,31,27,.06); border-radius:8px; }
.recovery-code-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:20px 0; }
.recovery-code-grid code { padding:10px; text-align:center; background:rgba(43,31,27,.06); border-radius:8px; }

.foldable {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin: 24px 0;
}

.foldable-summary {
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.foldable-body {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: hidden;
  overflow-anchor: none;
  will-change: height, opacity;
}

.profile-columns {
  flex-direction: row;
  align-items: flex-start;
}

.profile-columns > .foldable-block {
  flex: 1 1 0;
}

details.foldable > .foldable-body {
  display: flex;
}

details.foldable:not([open]) > .foldable-body {
  display: flex;
}

.foldable-users {
  order: 2;
}

.foldable-active {
  order: 1;
}

.foldable-admins {
  order: 3;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

thead {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

td,
th {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(43, 31, 27, 0.1);
}

.table-sortable th {
  position: relative;
  padding-right: 28px;
  cursor: pointer;
  user-select: none;
}

.table-sortable th::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid rgba(43, 31, 27, 0.35);
  transform: translateY(-45%);
}

.table-sortable th.sort-asc::after {
  border-top: none;
  border-bottom: 7px solid rgba(43, 31, 27, 0.85);
}

.table-sortable th.sort-desc::after {
  border-top: 7px solid rgba(43, 31, 27, 0.85);
}

.inline-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.checkbox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}

.checkbox-row input[type="checkbox"] {
  margin: 0;
}

.admin-actions .action-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-actions .action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-actions-inline .action-row {
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
}

.admin-actions-inline .inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.admin-actions-inline input {
  width: 180px;
}

.truncate {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bundle-pic-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(43, 31, 27, 0.15);
  background: #fff;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 24px;
  font-size: 13px;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 18, 13, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 30;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  width: min(560px, 94vw);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.modal-body {
  margin-top: 16px;
}

.list {
  margin: 12px 0 0;
  padding-left: 18px;
}

.meta-list {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.meta-list strong {
  color: var(--ink);
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #6b7280;
  color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.28);
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 12px;
  text-transform: uppercase;
}

.badge.active,
.badge.published,
.badge.accepted,
.badge.completed,
.badge.yes {
  background: #22c55e;
  color: #062e12;
}

.badge.disabled,
.badge.sold_out,
.badge.cancelled,
.badge.cancel_requested,
.badge.no {
  background: #ef4444;
  color: #ffffff;
}

.badge.draft,
.badge.pending,
.badge.processing,
.badge.new {
  background: #f59e0b;
  color: #1f1300;
}

.badge.shipped {
  background: #3b82f6;
  color: #ffffff;
}

.badge.archived,
.badge.never {
  background: #6b7280;
  color: #ffffff;
}

.blog-meta {
  font-size: 13px;
  color: rgba(43, 31, 27, 0.7);
}

.blog-post .foldable-summary {
  align-items: center;
}

.rich-editor {
  position: relative;
  border: 1px solid rgba(43, 31, 27, 0.2);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fffdf9;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid rgba(43, 31, 27, 0.12);
  background: rgba(255, 255, 255, 0.7);
}

.editor-toolbar select,
.editor-toolbar input[type="color"],
.editor-toolbar button {
  border: 1px solid rgba(43, 31, 27, 0.2);
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}

.editor-toolbar button {
  min-width: 34px;
  font-weight: 600;
}

.editor-toolbar input[type="file"][data-editor-image-input] {
  display: none;
}

.editor-body {
  position: relative;
  min-height: 140px;
  padding: 12px;
  outline: none;
  line-height: 1.6;
}

.editor-body img {
  max-width: 100%;
  height: auto;
}

.editor-body img.editor-image-selected {
  outline: 2px solid #fed90c;
  outline-offset: 2px;
}

.editor-image-resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #111111;
  border-radius: 3px;
  background: #fed90c;
  cursor: nwse-resize;
  z-index: 4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  padding: 0;
}

.editor-body:empty:before {
  content: attr(data-placeholder);
  color: rgba(43, 31, 27, 0.5);
}

.rich-content h2 {
  margin-top: 0;
}

.rich-content h3 {
  margin-top: 12px;
}

.rich-content ul,
.rich-content ol {
  padding-left: 20px;
}

.rich-content table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  border: none;
}

.rich-content th,
.rich-content td {
  padding: 8px 10px;
  border: none;
}

.blog-subscribe {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cart-total {
  font-weight: 600;
}

.blog-subscribe input {
  flex: 1 1 220px;
  min-width: 0;
}

.blog-subscribe .btn {
  white-space: nowrap;
}

.gallery-filters {
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.gallery-filters select {
  min-width: 180px;
}

.blog-image {
  height: 220px;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  margin-bottom: 16px;
}

.blog-archive {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(43, 31, 27, 0.12);
}

.blog-archive-list {
  display: grid;
  gap: 10px;
}

.blog-archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(43, 31, 27, 0.06);
}

.blog-archive-title {
  font-weight: 600;
  color: var(--ink);
}

.image-preview {
  display: grid;
  gap: 10px;
}

.image-preview img {
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Badge colors are defined above with semantic bright mapping. */

.section-title {
  margin: 40px 0 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.site-footer {
  padding: 50px 0 30px;
  background: rgba(43, 31, 27, 0.08);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

/* Footer contact: icon + label rows (rendered from the social_links table) */
.footer-social-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-social-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
}

.footer-social-link:hover .social-text {
  text-decoration: underline;
}

.footer-social-link .social-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  flex: 0 0 22px;
}

.footer-social-link .social-ico svg,
.footer-social-link .social-ico img {
  height: 20px;
  width: auto;
  max-width: 22px;
  display: block;
}

/* Inline icon next to a footer text link (e.g. Home Assistant) */
.footer-inline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer-inline-icon {
  height: 16px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

/* Footer editor: Visual / raw-HTML tabs */
.editor-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.editor-tab {
  padding: 5px 14px;
  border: 1px solid var(--border, #d8cfc8);
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font: inherit;
}

.editor-tab.is-active {
  background: #fff;
  font-weight: 600;
}

.editor-html {
  width: 100%;
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px;
  border: 1px solid var(--border, #d8cfc8);
  border-radius: 8px;
  resize: vertical;
}

.brand-footer {
  margin-bottom: 8px;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
}

.footer-custom {
  display: grid;
  gap: 20px;
}

.footer-micro-brand {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0.9;
}

.footer-micro-shield {
  width: 14px;
  height: 14px;
  object-fit: contain;
  display: block;
}

.footer-micro-wordmark {
  height: 10px;
  width: auto;
  object-fit: contain;
  display: block;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sectionSlideNext {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes sectionSlidePrev {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

details.ajax-slide-next .foldable-body {
  animation: sectionSlideNext 0.32s ease both;
}

details.ajax-slide-prev .foldable-body {
  animation: sectionSlidePrev 0.32s ease both;
}

@media (max-width: 820px) {
  .nav-links {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .profile-columns {
    flex-direction: column;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 8px;
  }
}

/* Yellow + Black Theme Override */
:root {
  --bg: #fed90c;
  --bg-alt: #f2cc07;
  --ink: #000000;
  --muted: #151515;
  --accent: #000000;
  --accent-2: #000000;
  --card: #f8d40b;
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 10px 24px rgba(0, 0, 0, 0.2);
}

body {
  color: #000000;
  background: linear-gradient(180deg, #ffffff 0%, #fed90c 100%);
  background-attachment: fixed;
}

a,
.nav-links a,
.blog-archive-title,
.meta-list strong {
  color: #000000 !important;
}

.bg-grid {
  background-image: linear-gradient(rgba(0, 0, 0, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.16) 1px, transparent 1px);
}

.orb-1,
.orb-2,
.orb-3 {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.14), transparent 70%);
}

.site-header,
.site-footer,
.section.alt {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(0, 0, 0, 0.24) !important;
}

.site-header {
  background: #ffffff !important;
  border-bottom: 1px solid #000000 !important;
}

.site-header a,
.site-header .nav-links a,
.site-header .admin-pill,
.site-header .social-icons a,
.site-header .lang-select select {
  color: #000000 !important;
  border-color: rgba(0, 0, 0, 0.28) !important;
}

.site-header .nav-links a {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.site-header .auth-link {
  font-size: inherit !important;
  letter-spacing: inherit !important;
  padding: 0 !important;
}

.site-header .nav-links > a {
  flex: 0 0 auto;
  font-size: 1.25em !important;
  line-height: 1.1;
  padding: 0 2px 8px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  z-index: 2;
  transition: color 0.26s ease, text-shadow 0.26s ease;
}

.site-header .nav-links > a:hover,
.site-header .nav-links > a:focus-visible {
  color: #000000 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  text-decoration: underline;
  text-underline-offset: 4px;
  transform: none;
  text-shadow: 0 0 14px rgba(254, 217, 12, 0.62);
}

.site-header .nav-links {
  position: relative;
}

.site-header .nav-links .nav-hover-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-radius: 999px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  background: var(--bg);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.22) inset;
  transform: translate3d(0, 0, 0);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
}

.site-header .admin-pill,
.site-header .social-icons a,
.site-header .lang-select select {
  background: #ffffff !important;
  box-shadow: none !important;
}

.site-header .nav-links a,
.site-header .admin-pill,
.site-header .social-icons a,
.site-header .lang-select select {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.site-header .admin-pill:hover,
.site-header .admin-pill:focus-visible,
.site-header .social-icons a:hover,
.site-header .social-icons a:focus-visible,
.site-header .lang-select select:hover,
.site-header .lang-select select:focus {
  background: #000000 !important;
  color: #fed90c !important;
  border-color: #000000 !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.22), 0 6px 14px rgba(0, 0, 0, 0.2) !important;
  transform: translateY(-1px);
}

.cookie-consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3000;
  background: #fff;
  border-top: 2px solid #000;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
  padding: 14px 18px;
}

.cookie-consent-inner {
  width: min(1120px, 96vw);
  margin: 0 auto;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
}

.cookie-consent-copy h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.cookie-consent-copy p {
  margin: 0;
  font-size: 0.92rem;
}

.cookie-consent-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cookie-consent-actions .btn {
  appearance: none;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--accent) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.18s ease, text-shadow 0.18s ease;
}

.cookie-consent-actions .btn:hover,
.cookie-consent-actions .btn:focus-visible {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #000 !important;
  text-shadow: 0 0 10px rgba(254, 217, 12, 0.62);
  transform: none !important;
}

.cookie-consent-modal {
  width: min(680px, 94vw);
  border: 1px solid rgba(0, 0, 0, 0.26);
  border-radius: 14px;
  padding: 0;
}

.cookie-consent-modal::backdrop {
  background: rgba(0, 0, 0, 0.48);
}

.cookie-consent-modal-inner {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.cookie-consent-modal-inner h3 {
  margin: 0;
}

.cookie-consent-modal-inner p {
  margin: 0 0 6px;
}

.cookie-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: rgba(254, 217, 12, 0.1);
}

.cookie-row span {
  display: grid;
  gap: 2px;
}

.cookie-row small {
  color: #202020;
}

.cookie-row.is-locked {
  background: rgba(0, 0, 0, 0.06);
}

@media (max-width: 860px) {
  .cookie-consent-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .cookie-consent-copy { min-width: 0; width: 100%; }
  .cookie-consent-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .cookie-consent-actions .btn { width: 100%; text-align: left; }
}

@media (max-width: 480px) {
  .cookie-consent-banner { padding: 12px; overflow-wrap: anywhere; }
  .cookie-consent-inner { width: 100%; }
  .cookie-consent-copy { min-width: 0; width: 100%; }
  .cookie-consent-actions { width: 100%; flex-direction: column; align-items: stretch; gap: 10px; }
  .cookie-consent-actions .btn { width: 100%; text-align: left; }
}

.hero-meta a.hero-meta-link { color: inherit; text-decoration: none; }
.hero-meta a.hero-meta-link:hover strong,
.hero-meta a.hero-meta-link:focus-visible strong { text-decoration: underline; }

.social-icons a,
.admin-pill,
.lang-select select,
input,
textarea,
select,
.form-lang,
.art-card,
.card,
.story-panel,
.form-card,
.table-wrap,
.foldable,
.modal-card,
.stat-card,
.rich-editor,
.editor-toolbar,
.blog-archive-item,
.alert,
.alert.success,
.alert.subtle {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: rgba(0, 0, 0, 0.3) !important;
  box-shadow: var(--shadow) !important;
}

td,
th,
.blog-archive,
.editor-toolbar,
.table-wrap {
  border-color: rgba(0, 0, 0, 0.22) !important;
}

.table-sortable th::after {
  border-top-color: rgba(0, 0, 0, 0.55) !important;
}

.table-sortable th.sort-asc::after {
  border-bottom-color: #000000 !important;
}

.table-sortable th.sort-desc::after {
  border-top-color: #000000 !important;
}

.btn.primary {
  background: #000000 !important;
  color: #fed90c !important;
  border-color: #000000 !important;
}

.btn.ghost,
.btn.link,
.btn.small,
.btn.danger {
  background: #fed90c !important;
  color: #000000 !important;
  border-color: #000000 !important;
}

.btn {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.btn:hover,
.btn:focus-visible {
  background: #000000 !important;
  color: #fed90c !important;
  border-color: #000000 !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.22), 0 6px 14px rgba(0, 0, 0, 0.2) !important;
  transform: translateY(-1px);
}

.eyebrow,
.lead,
.hero-meta span,
.section-hint,
.checkbox-row,
thead,
.pagination,
.footer-bottom,
.blog-meta,
.meta-list {
  color: rgba(0, 0, 0, 0.82) !important;
}

/* Footer brand: compact so it never crowds the link columns */
.brand-footer .brand-shield {
  width: 36px;
  height: 36px;
}
.brand-footer .brand-wordmark {
  height: 18px;
}

/* ---- Install-animation embed (howto section) ---- */
.howto-frame {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 6px auto 0;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #ffffff;
}
.howto-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ---- Homepage "place into stack" scroll transition ---- */
.home-stack {
  perspective: 1500px;
}
.home-stack > section.reveal-section {
  opacity: 0;
  transform: translateY(72px) rotateX(11deg) scale(0.965);
  transform-origin: center top;
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.85s cubic-bezier(0.22, 0.9, 0.24, 1.04);
  will-change: opacity, transform;
}
.home-stack > section.reveal-section.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .home-stack > section.reveal-section {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* =====================================================================
   Mobile / responsive fixes
   ===================================================================== */
/* Global guard against accidental horizontal scroll (sticky-safe). */
html,
body {
  overflow-x: clip;
  max-width: 100%;
}
img,
svg,
iframe,
video {
  max-width: 100%;
}

/* Hamburger button is desktop-hidden by default. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  background: #000;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.site-header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1240px) {
  /* --- Header: shrink brand + collapse nav into the hamburger --- */
  .nav-row {
    padding: 12px 0;
    gap: 12px;
  }
  .brand-cluster {
    gap: 8px;
  }
  .brand-right-stack {
    gap: 4px;
  }
  .brand-shield {
    width: 46px;
    height: 46px;
  }
  .brand-wordmark {
    height: 22px;
  }
  .brand-social-icons {
    gap: 6px;
  }
  .brand-social-icons a {
    width: 24px;
    height: 24px;
  }
  .brand-social-icons svg {
    width: 16px;
    height: 16px;
  }
  .nav-toggle {
    display: flex;
  }
  .site-header .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 14px 18px 18px;
    background: #ffffff;
    border-bottom: 1px solid #000;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    font-size: 14px;
  }
  .site-header.nav-open .nav-links {
    display: flex;
  }
  .site-header .nav-links a {
    padding: 11px 8px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }
  .lang-select {
    order: -2;
    width: 100%;
    margin-bottom: 4px;
  }
  .lang-select select {
    width: 100%;
  }
  .site-header .nav-links .auth-link {
    text-align: left;
  }
}

@media (max-width: 880px) {
  /* --- Stack every multi-column grid into one column --- */
  .hero-grid,
  .about-grid,
  .story-grid,
  .footer-grid,
  .grid {
    grid-template-columns: 1fr;
  }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .section {
    padding-left: 0;
    padding-right: 0;
  }

  /* --- Disable the 3D stack reveal on small screens (perf + no overflow) --- */
  .home-stack {
    perspective: none;
  }
  .home-stack > section.reveal-section {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

@media (max-width: 560px) {
  .hero h1,
  .hero-copy h1 {
    font-size: clamp(28px, 9vw, 40px);
  }
  .howto-frame {
    border-radius: 12px;
  }
}

/* Wide tables (e.g. compatibility) scroll horizontally inside their wrapper
   instead of being clipped by the page-level overflow guard. */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
