/**
 * Appily Forty — Orchard Help Hub
 * Distinct layout: hero + quick chips + sidebar / content / dock
 */

.page-help-forty.a40-help-forty {
  background: var(--a40-warm);
}

.a40-help {
  padding-bottom: 4rem;
}

/* ── Reveal ── */
.a40-help-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.a40-help-reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ── Hero ── */
.a40-help-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 3.25rem) 0 clamp(1.75rem, 4vw, 2.5rem);
  background: var(--a40-hero-gradient);
}
.a40-help-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.a40-help-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(55px);
  opacity: 0.5;
  animation: a40-help-blob 16s ease-in-out infinite;
}
.a40-help-blob--1 {
  width: 340px;
  height: 340px;
  top: -10%;
  right: 5%;
  background: var(--a40-blob-warm);
}
.a40-help-blob--2 {
  width: 280px;
  height: 280px;
  bottom: -15%;
  left: 0;
  background: rgba(64, 145, 108, 0.18);
  animation-delay: -6s;
}
.a40-help-ring {
  position: absolute;
  top: 50%;
  right: 8%;
  width: min(280px, 35vw);
  aspect-ratio: 1;
  border: 2px dashed rgba(45, 106, 79, 0.15);
  border-radius: 50%;
  transform: translateY(-50%);
  animation: a40-help-spin 24s linear infinite;
}
@keyframes a40-help-blob {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-12px, 10px); }
}
@keyframes a40-help-spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

.a40-help-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 400px);
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: center;
}

.a40-help-eyebrow {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--a40-orange);
}

.a40-help-hero h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.85rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--a40-ink);
}
.a40-help-hero h1 span {
  color: var(--a40-orange); -webkit-text-fill-color: var(--a40-orange); background: none;
}

.a40-help-lede {
  margin: 0 0 1.25rem;
  max-width: 46ch;
  color: var(--a40-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.a40-help-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.a40-help-stats li {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(45, 106, 79, 0.12);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  min-width: 72px;
}
.a40-help-stats strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--a40-green-dark);
  line-height: 1.2;
}
.a40-help-stats span {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--a40-muted);
}

/* Search */
.a40-help-search-wrap { position: relative; }
.a40-help-search {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  background: var(--a40-surface);
  border: 2px solid var(--a40-border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(33, 37, 41, 0.08);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.a40-help-search:focus-within {
  border-color: var(--a40-mint);
  box-shadow: 0 16px 48px rgba(64, 145, 108, 0.15);
}
.a40-help-search-icon {
  flex-shrink: 0;
  color: var(--a40-orange);
}
.a40-help-search input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  color: var(--a40-ink);
  outline: none;
  min-width: 0;
}
.a40-help-search-clear {
  border: 0;
  background: var(--a40-border);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--a40-muted);
  transition: background 0.2s;
}
.a40-help-search-clear:hover { background: var(--a40-orange); color: #fff; }
.a40-help-search-hint {
  margin: 0.5rem 0 0 0.25rem;
  font-size: 0.76rem;
  color: var(--a40-muted);
}

/* ── Quick chips ── */
.a40-help-quick {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 252, 247, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--a40-border);
  padding: 0.75rem 0;
}
.a40-help-quick-inner {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.15rem;
}
.a40-help-quick-inner::-webkit-scrollbar { display: none; }

.a40-help-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--a40-ink);
  text-decoration: none !important;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.a40-help-chip:hover {
  transform: translateY(-2px);
  border-color: var(--a40-orange);
  box-shadow: 0 6px 20px rgba(224, 122, 47, 0.12);
  color: var(--a40-orange);
}
.a40-help-chip-icon { font-size: 1rem; }

/* ── Main layout ── */
.a40-help-body { padding-top: 2rem; }

.a40-help-empty {
  text-align: center;
  padding: 2rem;
  color: var(--a40-muted);
  background: var(--a40-surface);
  border-radius: 14px;
  border: 1px dashed var(--a40-border);
  margin-bottom: 1.5rem;
}

.a40-help-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 280px;
  gap: 1.5rem;
  align-items: start;
}

/* Sidebar nav */
.a40-help-sidebar {
  position: sticky;
  top: 4.5rem;
}
.a40-help-sidebar-label {
  margin: 0 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a40-muted);
}
.a40-help-nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.a40-help-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--a40-surface);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--a40-ink);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s, background 0.25s;
  position: relative;
  overflow: hidden;
}
.a40-help-nav-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
  background: var(--help-hue, var(--a40-orange));
  opacity: 0;
  transition: opacity 0.25s;
}
.a40-help-nav-btn.is-active {
  border-color: rgba(224, 122, 47, 0.25);
  box-shadow: 0 8px 24px rgba(33, 37, 41, 0.08);
  transform: translateX(4px);
}
.a40-help-nav-btn.is-active::before { opacity: 1; }
.a40-help-nav-btn:hover:not(.is-active) {
  border-color: var(--a40-border);
  box-shadow: 0 4px 16px rgba(33, 37, 41, 0.05);
}

.a40-help-nav-btn.hue-citrus { --help-hue: var(--a40-orange); }
.a40-help-nav-btn.hue-berry { --help-hue: var(--a40-berry); }
.a40-help-nav-btn.hue-stone { --help-hue: #d45d79; }
.a40-help-nav-btn.hue-tropical { --help-hue: var(--a40-mint); }

.a40-help-nav-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(145deg, #fff9f0, #f0faf4);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.a40-help-nav-text { flex: 1; min-width: 0; }
.a40-help-nav-stage {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a40-muted);
}
.a40-help-nav-title {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.3;
}
.a40-help-nav-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--a40-muted);
  background: var(--a40-border);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}
.a40-help-nav-btn.is-active .a40-help-nav-count {
  background: var(--help-hue, var(--a40-orange));
  color: #fff;
}

/* Main panels */
.a40-help-panel {
  display: none;
  animation: a40-help-panel-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.a40-help-panel.is-active { display: block; }
@keyframes a40-help-panel-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.a40-help-panel-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.35rem 1.5rem;
  background: var(--a40-surface);
  border-radius: 16px 16px 0 0;
  border: 1px solid var(--a40-border);
  border-bottom: 0;
}
.a40-help-panel-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(224, 122, 47, 0.12), rgba(64, 145, 108, 0.1));
  font-size: 1.5rem;
  flex-shrink: 0;
}
.a40-help-panel.hue-citrus .a40-help-panel-icon { background: linear-gradient(145deg, rgba(224, 122, 47, 0.15), rgba(244, 161, 39, 0.1)); }
.a40-help-panel.hue-berry .a40-help-panel-icon { background: linear-gradient(145deg, rgba(193, 18, 31, 0.12), rgba(193, 18, 31, 0.06)); }
.a40-help-panel.hue-stone .a40-help-panel-icon { background: linear-gradient(145deg, rgba(212, 93, 121, 0.12), rgba(212, 93, 121, 0.06)); }
.a40-help-panel.hue-tropical .a40-help-panel-icon { background: linear-gradient(145deg, rgba(64, 145, 108, 0.15), rgba(64, 145, 108, 0.08)); }

.a40-help-panel-stage {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a40-orange);
  margin-bottom: 0.2rem;
}
.a40-help-panel-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--a40-ink);
}
.a40-help-panel-head p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--a40-muted);
  line-height: 1.5;
}

.a40-help-faq-list {
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 0 0 16px 16px;
  overflow: hidden;
}

.a40-help-faq {
  border-top: 1px solid var(--a40-border);
  transition: background 0.2s;
}
.a40-help-faq:first-child { border-top: 0; }
.a40-help-faq[open] { background: linear-gradient(90deg, rgba(224, 122, 47, 0.04), transparent); }
.a40-help-faq[hidden] { display: none; }

.a40-help-faq summary {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.1rem 1.35rem;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--a40-ink);
  transition: color 0.2s;
}
.a40-help-faq summary::-webkit-details-marker { display: none; }
.a40-help-faq summary:hover { color: var(--a40-orange); }

.a40-help-faq-num {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--a40-muted);
  flex-shrink: 0;
  min-width: 2.5rem;
}
.a40-help-faq-q { flex: 1; font-size: 0.92rem; line-height: 1.4; }

.a40-help-faq-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--a40-border);
  flex-shrink: 0;
  position: relative;
  transition: background 0.25s, transform 0.35s;
}
.a40-help-faq-toggle::before,
.a40-help-faq-toggle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 2px;
  background: var(--a40-ink);
  transform: translate(-50%, -50%);
  transition: transform 0.25s, background 0.25s;
}
.a40-help-faq-toggle::after { transform: translate(-50%, -50%) rotate(90deg); }
.a40-help-faq[open] .a40-help-faq-toggle {
  background: var(--a40-orange);
  transform: rotate(45deg);
}
.a40-help-faq[open] .a40-help-faq-toggle::before,
.a40-help-faq[open] .a40-help-faq-toggle::after { background: var(--a40-surface); }

.a40-help-faq-a {
  padding: 0 1.35rem 1.25rem 4.6rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--a40-muted);
  animation: a40-help-faq-open 0.35s ease;
}
.a40-help-faq-a a { color: var(--a40-green); font-weight: 600; }
@keyframes a40-help-faq-open {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* Dock */
.a40-help-dock {
  position: sticky;
  top: 4.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.a40-help-dock-card {
  padding: 1.25rem;
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(33, 37, 41, 0.04);
}
.a40-help-dock-card--primary {
  background: linear-gradient(160deg, var(--a40-green-dark) 0%, #1a3d2e 100%);
  border-color: transparent;
  color: #fff;
}
.a40-help-dock-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  margin-bottom: 0.65rem;
}
.a40-help-dock-card--primary h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
}
.a40-help-dock-card--primary p {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  opacity: 0.85;
  line-height: 1.5;
}
.a40-help-dock-cta {
  display: block;
  text-align: center;
  padding: 0.65rem 1rem;
  background: var(--a40-orange);
  color: #fff !important;
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: 999px;
  text-decoration: none !important;
  margin-bottom: 0.75rem;
  transition: transform 0.2s, background 0.2s;
}
.a40-help-dock-cta:hover {
  background: var(--a40-orange-dark);
  color: #fff !important;
  transform: translateY(-2px);
  text-decoration: none !important;
}
.a40-help-dock-link {
  display: block;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.9) !important;
  text-decoration: none !important;
  margin-bottom: 0.35rem;
  word-break: break-all;
}
.a40-help-dock-meta {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  opacity: 0.75;
}
.a40-help-dock-card h4 {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--a40-ink);
}
.a40-help-dock-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.84rem;
  color: var(--a40-muted);
  line-height: 1.55;
}
.a40-help-dock-list li { margin-bottom: 0.35rem; }
.a40-help-dock-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}
.a40-help-dock-links a {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--a40-green);
  text-decoration: none !important;
}
.a40-help-dock-links a:hover { color: var(--a40-orange); }

/* Search mode — show all matching panels */
.a40-help-main.is-searching .a40-help-panel {
  display: block;
  margin-bottom: 1.5rem;
}
.a40-help-main.is-searching .a40-help-panel:not(:has(.a40-help-faq:not([hidden]))) {
  display: none;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .a40-help-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .a40-help-dock {
    grid-column: 1 / -1;
    position: static;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 860px) {
  .a40-help-hero-inner { grid-template-columns: 1fr; }
  .a40-help-ring { display: none; }
  .a40-help-layout { grid-template-columns: 1fr; }
  .a40-help-sidebar {
    position: static;
  }
  .a40-help-nav {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0.35rem;
  }
  .a40-help-nav-btn {
    flex: 0 0 auto;
    min-width: 200px;
  }
  .a40-help-nav-btn.is-active { transform: none; }
  .a40-help-dock { grid-template-columns: 1fr; }
  .a40-help-faq-a { padding-left: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  .a40-help-reveal { opacity: 1; transform: none; transition: none; }
  .a40-help-blob, .a40-help-ring, .a40-help-panel, .a40-help-faq-a {
    animation: none !important;
  }
}
