/**
 * Shared app hub chrome — photo hero + purpose steps
 * Used by pantry, shopping list, recipes browse, dashboard, account.
 */

.app-hub {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding-bottom: 1.5rem;
}

.app-hub-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 0;
  min-height: 156px;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 1.15rem;
  background: linear-gradient(135deg, #3d2e1f 0%, #5c4033 48%, #7a5640 100%);
  box-shadow: 0 8px 24px rgba(61, 46, 31, 0.12);
  animation: app-hub-hero-in 0.55s ease both;
}

/* Informational steps — collapsible on small screens so they do not steal the first viewport */
.app-hub-guide {
  margin-bottom: 1.15rem;
  border: 1px solid #e8b896;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff8f2 0%, #fffaf5 100%);
  overflow: hidden;
}

.app-hub-guide-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b5c4f;
  user-select: none;
}

.app-hub-guide-summary::-webkit-details-marker {
  display: none;
}

.app-hub-guide-summary em:first-child {
  color: #d96c3d;
}

.app-hub-guide-chevron {
  margin-left: auto;
  font-size: 0.75rem;
  color: #6b5c4f;
  transition: transform 0.2s;
}

.app-hub-guide[open] .app-hub-guide-chevron {
  transform: rotate(180deg);
}

.app-hub-guide:not([open]) .app-hub-guide-body {
  display: none;
}

.app-hub-guide-body {
  padding: 0;
}

.app-hub-guide-body > .app-hub-purpose,
.app-hub-guide-body > .lists-purpose {
  margin-bottom: 0;
  padding: 0.75rem;
  animation: none;
}

.app-hub-guide-body .app-hub-purpose-card,
.app-hub-guide-body .lists-purpose-card {
  box-shadow: none;
}

.app-hub-hero-media {
  position: relative;
  min-height: 156px;
  overflow: hidden;
}

.app-hub-hero-photo.page-illustration--photo,
.app-hub-hero-photo {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  object-fit: cover;
  box-shadow: none !important;
  transform: none;
}

.app-hub-hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 30%, rgba(61, 46, 31, 0.5) 72%, rgba(61, 46, 31, 0.85) 100%),
    linear-gradient(180deg, transparent 45%, rgba(61, 46, 31, 0.35) 100%);
  pointer-events: none;
}

.app-hub-hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.25rem 1.4rem 1.25rem 0.4rem;
  color: #fffaf5;
  background: linear-gradient(135deg, #3d2e1f 0%, #5c4033 48%, #7a5640 100%);
}

.app-hub-hero-brand {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f0c4a8;
}

.app-hub-hero-title {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-size: clamp(1.45rem, 1.2rem + 0.9vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #fff;
}

.app-hub-hero-subtitle {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: rgba(255, 250, 245, 0.82);
  max-width: 36ch;
}

.app-hub-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.app-hub-hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.app-hub-hero-tools {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.app-hub-hero:has(.app-hub-hero-tools) .app-hub-hero-copy {
  padding-right: 5.5rem;
}

.app-hub-hero-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 250, 245, 0.28);
  background: rgba(255, 250, 245, 0.1);
  color: #fffaf5;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

button.app-hub-hero-link {
  font-family: inherit;
}

.app-hub-hero-link:hover {
  background: rgba(255, 250, 245, 0.2);
  border-color: rgba(255, 250, 245, 0.45);
  color: #fff;
}

.app-hub-purpose {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  animation: app-hub-stage-in 0.45s ease both;
  animation-delay: 0.06s;
}

.app-hub-purpose--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-hub-purpose--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.app-hub-purpose--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

button.app-hub-purpose-card {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.app-hub-purpose-card {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.05rem;
  border: 1px solid #e8b896;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff8f2 0%, #fff3e8 100%);
  box-shadow: 0 4px 14px rgba(92, 64, 51, 0.06);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

a.app-hub-purpose-card:hover {
  border-color: #d4b8a2;
  box-shadow: 0 10px 24px rgba(217, 108, 61, 0.1);
  transform: translateY(-2px);
  color: inherit;
}

.app-hub-purpose-card.is-active {
  border-color: #d96c3d;
  background: linear-gradient(180deg, #fff0e4, #ffe2cc);
  box-shadow: 0 0 0 3px rgba(217, 108, 61, 0.14);
}

.app-hub-purpose-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fff7ed;
  color: #d96c3d;
  font-size: 1.05rem;
}

.app-hub-purpose-body {
  min-width: 0;
}

.app-hub-purpose-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: #3d2e1f;
  margin-bottom: 0.2rem;
}

.app-hub-purpose-desc {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #6b5c4f;
}

.app-hub-stage {
  margin-bottom: 1.15rem;
  padding: 1.15rem 1.25rem 1.25rem;
  border: 1px solid #e8b896;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff8f2 0%, #fff3e8 100%);
  box-shadow: 0 4px 16px rgba(61, 46, 31, 0.06);
  animation: app-hub-stage-in 0.4s ease both;
}

.app-hub-stage-title {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 750;
  color: #3d2e1f;
}

.app-hub-stage-meta {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #6b5c4f;
}

@keyframes app-hub-hero-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes app-hub-stage-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-hub-hero,
  .app-hub-purpose,
  .app-hub-stage {
    animation: none;
  }
}

@media (max-width: 900px) {
  .app-hub-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    margin-bottom: 0.85rem;
    border-radius: 16px;
  }

  .app-hub-hero-media {
    min-height: 88px;
    max-height: 100px;
  }

  .app-hub-hero-veil {
    background:
      linear-gradient(180deg, transparent 10%, rgba(61, 46, 31, 0.55) 55%, rgba(61, 46, 31, 0.94) 100%);
  }

  .app-hub-hero-copy {
    padding: 0.75rem 1rem 0.9rem;
    margin-top: -2.25rem;
    gap: 0.25rem;
  }

  .app-hub-hero:has(.app-hub-hero-tools) .app-hub-hero-copy {
    padding-right: 4.75rem;
  }

  .app-hub-hero-tools {
    top: 0.55rem;
    right: 0.65rem;
  }

  .app-hub-hero-title {
    font-size: 1.3rem;
  }

  .app-hub-hero-subtitle {
    font-size: 0.82rem;
    max-width: none;
  }

  .app-hub-hero-actions {
    margin-top: 0.35rem;
    gap: 0.4rem;
  }

  .app-hub-hero-link {
    padding: 0.35rem 0.7rem;
    font-size: 0.76rem;
  }

  .app-hub-guide {
    margin-bottom: 0.85rem;
  }

  .app-hub-guide-summary {
    display: flex;
  }

  .app-hub-guide:not([open]) .app-hub-guide-body {
    display: none;
  }

  .app-hub-purpose,
  .app-hub-purpose--2,
  .app-hub-purpose--3,
  .app-hub-purpose--4 {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .app-hub-purpose-card {
    padding: 0.75rem 0.85rem;
  }

  /* Interactive destination cards stay visible; tighten stack */
  a.app-hub-purpose-card,
  button.app-hub-purpose-card {
    padding: 0.8rem 0.9rem;
  }

  .app-hub-purpose-desc {
    font-size: 0.75rem;
  }
}

@media (min-width: 901px) {
  .app-hub-guide-body > .app-hub-purpose,
  .app-hub-guide-body > .lists-purpose {
    padding: 0 0.95rem 0.95rem;
  }
}

/* Chapter masthead — one terracotta + photo banner, not a leftover thumbnail */
.app-hub-hero--masthead {
  display: grid;
  grid-template-columns: minmax(13rem, 0.62fr) minmax(0, 1.5fr);
  align-items: stretch;
  gap: 0;
  min-height: 14.5rem;
  border-radius: 22px;
  overflow: hidden;
  margin-bottom: 1.35rem;
  background: linear-gradient(160deg, #d96c3d 0%, #c45c32 55%, #a84620 100%);
  box-shadow: 0 16px 34px rgba(168, 70, 32, 0.22);
  animation: none;
}

.app-hub-hero--masthead .app-hub-hero-media {
  order: 2;
  min-height: 14.5rem;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}

.app-hub-hero--masthead .app-hub-hero-photo {
  animation: none;
  transform: none;
  object-position: 68% 88%;
}

.app-hub-hero--masthead .app-hub-hero-veil {
  background: none;
}

.app-hub-hero--masthead .app-hub-hero-copy {
  order: 1;
  padding: 1.3rem 1.4rem;
  margin-top: 0;
  color: #fffaf5;
  gap: 0.4rem;
  justify-content: center;
}

.app-hub-hero--masthead .app-hub-hero-brand {
  color: #ffe3d2;
}

.app-hub-hero--masthead .app-hub-hero-title {
  color: #fffaf5;
}

.app-hub-hero--masthead .app-hub-hero-subtitle {
  color: rgba(255, 250, 245, 0.82);
  max-width: 28ch;
}

.app-hub-hero--masthead .app-hub-hero-link {
  border: 1px solid rgba(255, 250, 245, 0.28);
  background: #fff6ee;
  color: #c45c32;
}

.app-hub-hero--masthead .app-hub-hero-link:hover {
  background: #fffaf5;
  border-color: #fffaf5;
  color: #9a3d1c;
}

@media (max-width: 900px) {
  .app-hub-hero--masthead {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 7.5rem;
    min-height: 0;
    border-radius: 16px;
    margin-bottom: 0.85rem;
  }

  .app-hub-hero--masthead .app-hub-hero-media,
  .app-hub-hero--masthead .app-hub-hero-copy {
    grid-area: 1 / 1;
    order: unset;
  }

  .app-hub-hero--masthead .app-hub-hero-media {
    min-height: 7.5rem;
    max-height: 7.5rem;
  }

  .app-hub-hero--masthead .app-hub-hero-photo {
    object-position: 62% 86%;
  }

  .app-hub-hero--masthead .app-hub-hero-veil {
    background: linear-gradient(180deg, transparent 22%, rgba(168, 70, 32, 0.45) 58%, #c45c32 100%);
  }

  .app-hub-hero--masthead .app-hub-hero-copy {
    z-index: 2;
    justify-content: flex-end;
    padding: 1.6rem 0.95rem 0.65rem;
    margin-top: 0;
    gap: 0;
  }

  .app-hub-hero--masthead .app-hub-hero-title {
    font-size: 1.22rem;
  }

  .app-hub-hero--masthead .app-hub-hero-actions {
    display: none;
  }
}

@media (min-width: 901px) and (max-width: 1100px) {
  .app-hub-purpose--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ===== Hub energy — shared tab rails & surfaces (Plan-aligned) ===== */
.hub-tab-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.3rem;
  background: #fff6ee;
  border: 1px solid #f0c4a8;
  border-radius: 999px;
}

.hub-tab {
  flex: 1 1 5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b5c4f;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.hub-tab:hover {
  background: #fffaf5;
  color: #3d2e1f;
}

.hub-tab.is-active,
.hub-tab.active {
  background: linear-gradient(135deg, #e8734a, #d96c3d);
  color: #fffaf5;
  box-shadow: 0 2px 8px rgba(196, 92, 50, 0.28);
}

.hub-surface {
  background: linear-gradient(180deg, #fff8f2 0%, #fff3e8 100%);
  border: 1px solid #e8b896;
  border-radius: 16px;
  padding: 1rem 1.15rem;
  box-shadow: 0 2px 10px rgba(61, 46, 31, 0.05);
}

.hub-surface--sage {
  background: linear-gradient(180deg, #f0f7f2 0%, #e6f0ea 100%);
  border-color: #a8c9b4;
}

.hub-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c45c32;
}

/* Hub help tips — shared across hub pages */
.hub-help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #a89585;
  font-size: 0.72rem;
  line-height: 1;
  cursor: help;
  flex-shrink: 0;
  vertical-align: middle;
}

.hub-help-tip .help-tip-icon {
  display: block;
  font-style: normal;
  font-size: 1em;
}

.hub-help-tip:hover,
.hub-help-tip:focus-visible {
  color: #d96c3d;
  outline: none;
}

.app-hub .plan-tooltip .tooltip-inner {
  max-width: 17rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: left;
}

/* ─── Hub card surfaces (opaque on --light / #fffaf5 page fill) ─── */
:root {
  --hub-surface-bg: #fff;
  --hub-surface-bg-soft: linear-gradient(180deg, #fff 0%, #fffefb 100%);
  --hub-surface-border: #e0d4c8;
  --hub-surface-shadow: 0 2px 10px rgba(61, 46, 31, 0.06);
}

.rshow-card,
.rshow-aside-card,
.mshow-card,
.mshow-aside-card,
.rform-section,
.rimport-card,
.rimport-upgrade,
.rlist-pg-results,
.meals-pg-catalog,
.pantry-pg-panel,
.sl-pg-card,
.pantry-pg-inventory,
.lists-pg-card,
.lists-pg-stage,
.rc-card,
.mc-card,
.rscrape-wait-pg .rscrape-wait-card,
.dash-today-card,
.blog-pg-catalog,
.blog-pg-article,
.blog-pg-related,
.plan-block,
.plan-more,
.gen-section {
  background-color: var(--hub-surface-bg, #fff);
}
