/*
  Robayer WealthLab — Global Reusable Components
  Header, navigation, footer, buttons, cards, forms, badges, eyebrows.
  Every future page composes itself from these — no page should invent
  a one-off button or card style.
  Depends on: tokens.css, base.css, layout.css
*/

/* ============================================================
   EYEBROW / LABEL TEXT
   ============================================================ */
.eyebrow {
  display: block;
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  font-size: var(--text-eyebrow);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-accent);
}

.eyebrow--gold { color: var(--color-sika-gold); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  min-height: 44px; /* touch target floor, all breakpoints */
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-small);
  border: 1px solid transparent;
  transition: background-color var(--duration-base) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background-color: var(--color-growth-green);
  color: var(--color-white);
}

.btn--primary:hover {
  background-color: var(--color-growth-green-dark);
  text-decoration: none;
}

.btn--secondary {
  background-color: transparent;
  border-color: var(--color-ink-navy);
  color: var(--color-ink-navy);
}

.btn--secondary:hover {
  background-color: var(--color-ink-navy);
  color: var(--color-white);
  text-decoration: none;
}

.btn--accent {
  background-color: var(--color-sika-gold);
  color: var(--color-text-on-accent);
}

.btn--accent:hover {
  background-color: var(--color-sika-gold-dark);
  text-decoration: none;
}

.btn--disabled,
.btn:disabled {
  background-color: var(--color-stone-grey);
  color: var(--color-white);
  cursor: not-allowed;
  pointer-events: none;
}

.btn--block {
  width: 100%;
}

/* ============================================================
   SITE HEADER / NAVIGATION
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: var(--color-bg);
  border-bottom: 0.5px solid var(--color-border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 1.125rem;
  color: var(--color-ink-navy);
}

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

.nav__logo-mark {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  font-size: var(--text-small);
}

.nav__list a {
  color: var(--color-ink-navy);
}

.nav__list a[aria-current="page"] {
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 2px;
}

.nav__toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
}

/* Mobile navigation */
@media (max-width: 767px) {
  .nav__toggle {
    display: flex;
  }

  .nav__menu {
    position: fixed;
    inset: var(--header-height) 0 0 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background-color: var(--color-bg);
    padding: var(--space-4);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-base) var(--ease-standard),
                transform var(--duration-base) var(--ease-standard),
                visibility var(--duration-base);
  }

  .nav__menu.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav__list a {
    display: block;
    padding: var(--space-3) 0;
    border-bottom: 0.5px solid var(--color-border);
  }

  .nav__cta {
    margin-top: var(--space-4);
  }
}

/* ============================================================
   BREADCRUMBS
   Not used on any page yet — reserved for the detail pages that need
   it (Blog Article, Book Detail, Resource Detail) per the Phase 3 IA.
   Kept defined here, ready, rather than written ad hoc when those
   pages are built in Sprint 2+.
   ============================================================ */
.breadcrumbs {
  padding-block: var(--space-2);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.breadcrumbs a {
  color: var(--color-text-secondary);
}

.breadcrumbs a:hover {
  color: var(--color-accent);
}

.breadcrumbs__separator {
  margin-inline: var(--space-1);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background-color: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--duration-base) var(--ease-standard);
}

.card:hover {
  box-shadow: var(--shadow-2);
}

.card--featured {
  border: 2px solid var(--color-sika-gold);
}

.card__eyebrow {
  margin-bottom: var(--space-2);
}

.card__title {
  font-size: var(--text-h4);
  margin-bottom: var(--space-2);
}

.card__body {
  font-size: var(--text-small);
  color: var(--color-text-secondary);
}

/* ============================================================
   TESTIMONIAL (reusable component per Phase 3/4 spec)
   ============================================================ */
.testimonial {
  background-color: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.testimonial__quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: var(--weight-medium); /* matches the only italic weight actually loaded (Fraunces 500 italic) */
  font-size: var(--text-body-lg);
  color: var(--color-ink-navy);
  margin-bottom: var(--space-3);
}

.testimonial__attribution {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.testimonial__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-growth-green);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  flex-shrink: 0;
}

.testimonial__name {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-small);
  color: var(--color-text-heading);
}

.testimonial__context {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* Inline variant — used on Book Detail immediately before a CTA */
.testimonial--inline {
  max-width: 680px;
  margin-inline: auto;
}

/* ============================================================
   PULL QUOTE (centered standalone quote — Home trust section,
   reusable anywhere a short standalone quote sits between sections)
   ============================================================ */
.pull-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: var(--weight-medium); /* matches the only italic weight actually loaded (Fraunces 500 italic) */
  font-size: var(--text-body-lg);
  color: var(--color-text-heading);
  max-width: 480px;
  margin-inline: auto;
}

/* ============================================================
   FORMS
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.field__label {
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  font-size: var(--text-small);
  color: var(--color-text-heading);
}

.field__input,
.field__textarea,
.field__select {
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  background-color: var(--color-light-sand);
  border: 1px solid var(--color-stone-grey);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
}

.field__textarea {
  min-height: 120px;
  resize: vertical;
}

.field__input:focus,
.field__textarea:focus,
.field__select:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  border-color: var(--color-accent);
}

.field--error .field__input,
.field--error .field__textarea {
  border-color: var(--color-error);
  outline-color: var(--color-error);
}

.field__error {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.75rem;
  color: var(--color-error);
}

/* The [hidden] attribute alone loses to the display:flex rule above
   (author stylesheet always beats the UA stylesheet, regardless of
   specificity) — this override is what actually keeps the message
   hidden until newsletter-form.js clears the hidden attribute. */
.field__error[hidden] {
  display: none;
}

.field__hint {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* ============================================================
   BADGES / ALERTS (semantic colors)
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: var(--weight-medium);
}

.badge--success { background-color: var(--color-success-tint); color: var(--color-success); }
.badge--warning { background-color: var(--color-warning-tint); color: var(--color-warning); }
.badge--error   { background-color: var(--color-error-tint);   color: var(--color-error); }
.badge--info    { background-color: var(--color-info-tint);    color: var(--color-info); }

.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  font-size: var(--text-small);
}

.alert--success { border-color: var(--color-success); background-color: var(--color-success-tint); }
.alert--warning { border-color: var(--color-warning); background-color: var(--color-warning-tint); }
.alert--error   { border-color: var(--color-error);   background-color: var(--color-error-tint); }
.alert--info    { border-color: var(--color-info);    background-color: var(--color-info-tint); }

/* ============================================================
   SITE FOOTER
   ============================================================ */
.site-footer {
  border-top: 0.5px solid var(--color-border);
  padding-block: var(--space-6);
}

.footer__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

@media (max-width: 767px) {
  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

.footer__heading {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-small);
  color: var(--color-text-heading);
  margin-bottom: var(--space-2);
}

.footer__list a {
  display: block;
  padding-block: var(--space-1);
  font-size: var(--text-small);
  color: var(--color-text-secondary);
}

.footer__list a:hover {
  color: var(--color-accent);
}

.footer__bottom {
  padding-top: var(--space-4);
  border-top: 0.5px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* ============================================================
   FORM STATES — disabled (default/focus/error covered above)
   ============================================================ */
.field__input:disabled,
.field__textarea:disabled,
.field__select:disabled {
  background-color: var(--color-light-sand);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
  cursor: not-allowed;
  opacity: 0.7;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding-block: var(--space-8);
  text-align: center;
}

@media (max-width: 767px) {
  .hero {
    padding-block: var(--space-6);
  }
}

.hero__content {
  max-width: 640px;
  margin-inline: auto;
}

.hero__eyebrow {
  margin-bottom: var(--space-3);
}

.hero__title {
  margin-bottom: var(--space-3);
}

.hero__subtitle {
  font-size: var(--text-body-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.hero__actions {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Split variant — text and supporting image side by side (wide viewports only) */
.hero--split .hero__content {
  max-width: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--space-6);
  text-align: left;
}

.hero--split .hero__actions {
  justify-content: flex-start;
}

@media (max-width: 1199px) {
  .hero--split .hero__content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero--split .hero__actions {
    justify-content: center;
  }
}

/* ============================================================
   BOOK CARD
   ============================================================ */
.book-card {
  background-color: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--duration-base) var(--ease-standard);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.book-card:hover {
  box-shadow: var(--shadow-2);
}

.book-card--featured {
  border: 2px solid var(--color-sika-gold);
}

.book-card__cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  background-color: var(--color-sika-gold);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

/* Compact modifier — used inside .feature-banner, where the cover sits
   beside text rather than atop a full card */
.book-card__cover--compact {
  width: 160px;
  flex-shrink: 0;
  margin-bottom: 0;
}

/* Color variants for multi-book displays (Books page, style guide) */
.book-card__cover--green { background-color: var(--color-growth-green); }

.book-card__title {
  font-family: var(--font-display);
  font-size: var(--text-h4);
  color: var(--color-text-heading);
}

.book-card__price {
  font-family: var(--font-mono);
  color: var(--color-accent);
  font-size: var(--text-body);
}

.book-card__description {
  font-size: var(--text-small);
  color: var(--color-text-secondary);
}

/* ============================================================
   BLOG CARD
   ============================================================ */
.blog-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.blog-card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--color-light-sand);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.blog-card__title {
  font-family: var(--font-display);
  font-size: var(--text-h4);
  color: var(--color-text-heading);
}

.blog-card__title a {
  color: inherit;
}

.blog-card__title a:hover {
  color: var(--color-accent);
}

.blog-card__excerpt {
  font-size: var(--text-small);
  color: var(--color-text-secondary);
}

.blog-card__meta {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* ============================================================
   RESOURCE CARD
   ============================================================ */
.resource-card {
  background-color: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  transition: box-shadow var(--duration-base) var(--ease-standard);
}

.resource-card:hover {
  box-shadow: var(--shadow-2);
}

/* Resource cards are sometimes whole-card links (Home resources preview) */
a.resource-card {
  display: block;
  text-decoration: none;
}

.resource-card__icon {
  width: 24px;
  height: 24px;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.resource-card__format {
  margin-bottom: var(--space-2);
}

.resource-card__title {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-body);
  color: var(--color-text-heading);
}

/* Not-yet-available resources (Resources page "coming soon" cards) */
.resource-card--upcoming {
  border-style: dashed;
  opacity: 0.7;
}

/* ============================================================
   TABLE
   ============================================================ */
.table {
  font-size: var(--text-small);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.table thead th {
  background-color: var(--color-ink-navy);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  text-align: left;
  padding: var(--space-3);
}

.table tbody td {
  padding: var(--space-3);
  min-height: 44px;
}

.table tbody tr:nth-child(odd) {
  background-color: var(--color-warm-paper);
}

.table tbody tr:nth-child(even) {
  background-color: var(--color-white);
}

.table td.numeric,
.table th.numeric {
  text-align: right;
}

/* ============================================================
   ICON
   ============================================================ */
.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--lg {
  width: 24px;
  height: 24px;
}

/* ============================================================
   NEWSLETTER BAND (used on Home, Blog, Resources, Book Detail)
   ============================================================ */
.newsletter-band {
  background-color: var(--color-growth-green);
  color: var(--color-white);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.newsletter-band h2,
.newsletter-band h3 {
  color: var(--color-white);
}

.newsletter-band p {
  color: rgba(255, 255, 255, 0.85);
}

/* The band sits on Growth Green, so the email field needs a bit more
   width and its error message needs to read on a dark background */
.newsletter-band__input { min-width: 220px; }

.newsletter-band .field__error { color: var(--color-white); }

/* ============================================================
   FEATURE BANNER (single-product spotlight — Home featured eBook,
   reusable for any future featured book/course/resource block)
   ============================================================ */
.feature-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5);
}

.feature-banner__eyebrow { color: var(--color-sika-gold); }
.feature-banner__title   { color: var(--color-white); }

.feature-banner__copy {
  color: var(--color-light-sand);
  max-width: 420px;
}

/* ============================================================
   FILTER BAR (category pills — Books page now, reusable for any
   future page that needs client-side category filtering, e.g. Blog)
   ============================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  border: 1px solid var(--color-border-strong);
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  font-size: var(--text-small);
  transition: background-color var(--duration-base) var(--ease-standard),
              color var(--duration-base) var(--ease-standard),
              border-color var(--duration-base) var(--ease-standard);
}

.filter-pill:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.filter-pill[aria-pressed="true"] {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-white);
}

/* ============================================================
   FAQ (accordion via native <details>/<summary> — keyboard operable
   and exposes expanded state to assistive tech with no ARIA needed)
   ============================================================ */
.faq__item {
  border-bottom: 0.5px solid var(--color-border);
}

.faq__item:first-child {
  border-top: 0.5px solid var(--color-border);
}

.faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 44px;
  padding-block: var(--space-4);
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  font-size: var(--text-body);
  color: var(--color-text-heading);
  cursor: pointer;
  list-style: none;
}

.faq__question::-webkit-details-marker {
  display: none;
}

.faq__icon {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.faq__icon::before,
.faq__icon::after {
  content: "";
  position: absolute;
  top: 9px;
  left: 2px;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background-color: var(--color-accent);
}

.faq__icon::after {
  transform: rotate(90deg);
  transition: opacity var(--duration-base) var(--ease-standard);
}

.faq__item[open] .faq__icon::after {
  opacity: 0;
}

.faq__answer {
  max-width: 65ch;
  padding-bottom: var(--space-4);
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

/* ============================================================
   TABLE OF CONTENTS (Book Detail chapter list — reusable for any
   future book that needs one)
   ============================================================ */
.toc {
  border-top: 0.5px solid var(--color-border);
}

.toc__item {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding-block: var(--space-3);
  border-bottom: 0.5px solid var(--color-border);
}

.toc__number {
  flex-shrink: 0;
  width: 2ch;
  color: var(--color-accent);
}

.toc__title {
  color: var(--color-text-primary);
}

/* ============================================================
   CHECK ITEM (icon + wrapping text — Book Detail "What you'll
   learn" / "Who this is for" checklists; reusable for future books)
   .cluster isn't right here since its flex-wrap moves whole items
   to a new line instead of letting the text itself wrap next to a
   fixed icon.
   ============================================================ */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.check-item__icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.check-item__text {
  flex: 1;
}

/* ============================================================
   ARTICLE LAYOUT (sticky TOC sidebar + content — Blog Article
   template, reusable for every future article)
   ============================================================ */
.article-layout {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 1200px) {
  .article-layout {
    grid-template-columns: 260px 1fr;
    align-items: start;
  }

  .article-layout__sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-4));
  }
}

/* ============================================================
   ARTICLE BODY (long-form content typography — headings, lists,
   and paragraph rhythm for prose, scoped so it doesn't affect the
   list-style reset everywhere else on the site)
   ============================================================ */
.article-body {
  max-width: 680px;
}

.article-body > * + * {
  margin-top: var(--space-4);
}

.article-body h2,
.article-body h3 {
  margin-top: var(--space-6);
}

.article-body ul,
.article-body ol {
  padding-left: 1.25em;
}

.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }

.article-body li + li {
  margin-top: var(--space-2);
}

/* Active section link, set by js/components/article-reading.js */
.toc__title a[aria-current="location"] {
  color: var(--color-accent);
  font-weight: var(--weight-medium);
}

/* ============================================================
   READING PROGRESS BAR (Blog Article template)
   Width is driven by js/components/article-reading.js via the
   --reading-progress custom property, not an inline style, since
   it's a continuously-variable runtime value rather than a design
   decision.
   ============================================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: calc(var(--reading-progress, 0) * 1%);
  background-color: var(--color-accent);
  z-index: var(--z-overlay);
}
