/* ==========================================================================
   EASA Psychoeducation v2 — EASA brand palette (teal + gold, Poppins)
   ========================================================================== */

/* Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { min-height: 100%; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

/* Design tokens — pulled from the EASA logo and site
   -------------------------------------------------------------------------- */
:root {
  /* Teal family — primary brand (Lane County / compass / subtitle) */
  --teal-deep:  #155d6e;
  --teal-mid:   #1a6778;
  --teal-rich:  #23808f;
  --teal-soft:  #5595a4;
  --teal-pale:  #b8d4db;
  --teal-paler: #dce9ed;

  /* Gold family — accent (EASA letterform) */
  --gold:       #e4b038;
  --gold-warm:  #d29a1f;
  --gold-soft:  #f0cf78;
  --gold-pale:  #fae9b9;
  --gold-wash:  #fcf3dc;

  /* Neutrals */
  --cream:      #fbf6ea;
  --paper:      #fdfaf1;
  --white-warm: #fffdf7;
  --text:       #1d2a33;
  --text-soft:  #4a5962;

  /* Depth */
  --shadow-sm: 0 2px 6px rgba(21, 93, 110, 0.07);
  --shadow:    0 6px 20px rgba(21, 93, 110, 0.10);
  --shadow-lg: 0 14px 40px rgba(21, 93, 110, 0.16);

  /* Shape */
  --radius-sm: 12px;
  --radius:    20px;
  --radius-lg: 28px;
  --pill:      999px;

  /* Motion */
  --ease:       cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast:     160ms var(--ease);
  --t-med:      280ms var(--ease);
  --t-slow:     480ms var(--ease);

  /* Layout */
  --container:  760px;
  --container-wide: 960px;
}

/* Base typography — Poppins to match EASA site
   -------------------------------------------------------------------------- */
body {
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: #fffdf7; /* LIGHTEST 1 — matches EASA Squarespace section bg */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  color: var(--teal-deep);
  letter-spacing: -0.015em;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); margin-bottom: 0.75rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; font-weight: 600; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; color: var(--teal-deep); }

/* Layout
   -------------------------------------------------------------------------- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container--wide { max-width: var(--container-wide); }

main {
  flex: 1;
  padding: 2rem 0 4rem;
}

/* Top bar
   -------------------------------------------------------------------------- */
.topbar {
  padding: 1rem 0;
  background: var(--white-warm);
  border-bottom: 1px solid rgba(21, 93, 110, 0.08);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  color: var(--teal-deep);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Compass-star mark (nod to EASA logo) */
.topbar__brand::before {
  content: "";
  display: block;
  width: 26px;
  height: 26px;
  background: var(--teal-mid);
  clip-path: polygon(
    50% 0%, 55% 45%, 100% 50%, 55% 55%,
    50% 100%, 45% 55%, 0% 50%, 45% 45%
  );
  flex-shrink: 0;
}

.topbar__home {
  color: var(--teal-mid);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--pill);
  transition: background var(--t-fast);
}

.topbar__home:hover,
.topbar__home:focus-visible { background: var(--teal-paler); }

/* Chapter header (per tool)
   -------------------------------------------------------------------------- */
.tool-title {
  text-align: center;
  margin-bottom: 2rem;
  padding-top: 1rem;
}

.tool-title h1 {
  background: var(--teal-deep);
  color: var(--gold-pale);
  display: inline-block;
  padding: 0.9rem 2rem;
  border-radius: var(--pill);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.tool-title p {
  margin-top: 1rem;
  color: var(--text-soft);
  font-size: 1.05rem;
  font-weight: 400;
}

/* Progress indicator
   -------------------------------------------------------------------------- */
.progress { margin-bottom: 2rem; }

.progress__bar {
  height: 6px;
  background: var(--teal-paler);
  border-radius: var(--pill);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal-mid), var(--teal-rich));
  border-radius: var(--pill);
  transition: width var(--t-med);
}

.progress__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-soft);
  font-weight: 500;
}

/* Chapter (section)
   -------------------------------------------------------------------------- */
.chapter {
  display: none;
  animation: fade-in var(--t-med);
}

.chapter.is-active { display: block; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chapter__intro {
  background: var(--teal-paler);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  font-size: 1.05rem;
  line-height: 1.65;
}

.chapter__intro--warm { background: var(--gold-wash); }

.chapter__intro--dark { background: var(--teal-deep); color: var(--white-warm); }
.chapter__intro--dark strong { color: var(--gold-soft); }

/* Chapter navigation
   -------------------------------------------------------------------------- */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  padding: 0.85rem 1.5rem;
  border-radius: var(--pill);
  transition: transform var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
  text-decoration: none;
  font-size: 1rem;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn--primary {
  background: var(--teal-deep);
  color: var(--white-warm);
  box-shadow: var(--shadow);
}
.btn--primary:hover:not(:disabled) { background: var(--teal-mid); box-shadow: var(--shadow-lg); }

.btn--ghost {
  background: transparent;
  color: var(--teal-mid);
  border: 2px solid var(--teal-pale);
}
.btn--ghost:hover:not(:disabled) { border-color: var(--teal-mid); background: var(--teal-paler); }

.btn--large { padding: 1rem 1.8rem; font-size: 1.05rem; }

/* Card grids
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .card-grid--2 { grid-template-columns: repeat(2, 1fr); }
}

/* Reveal cards (tap to expand)
   -------------------------------------------------------------------------- */
.reveal-card {
  width: 100%;
  text-align: left;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--teal-mid);
  color: var(--white-warm);
  box-shadow: var(--shadow);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: pointer;
  position: relative;
}

.reveal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.reveal-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.reveal-card--tan { background: var(--gold); color: var(--teal-deep); }
.reveal-card--tan h3 { color: var(--teal-deep); }
.reveal-card--sage { background: var(--teal-pale); color: var(--teal-deep); }
.reveal-card--sage h3 { color: var(--teal-deep); }
.reveal-card--sage-dark { background: var(--teal-deep); color: var(--white-warm); }
.reveal-card--sage-dark h3 { color: var(--white-warm); }

.reveal-card h3 {
  color: inherit;
  font-size: 1.2rem;
  margin: 0;
  font-weight: 700;
}

.reveal-card__teaser {
  font-size: 0.98rem;
  line-height: 1.55;
  opacity: 0.92;
}

.reveal-card__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
  margin-top: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  align-self: flex-start;
  transition: background var(--t-fast);
}

.reveal-card--tan .reveal-card__toggle,
.reveal-card--sage .reveal-card__toggle {
  background: rgba(21, 93, 110, 0.12);
}

.reveal-card__toggle::after {
  content: "→";
  transition: transform var(--t-fast);
  font-weight: 400;
}

.reveal-card[aria-expanded="true"] .reveal-card__toggle::after { transform: rotate(90deg); }

.reveal-card__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--t-med);
}

.reveal-card[aria-expanded="true"] .reveal-card__body { max-height: 800px; }

.reveal-card__body ul {
  list-style: none;
  padding: 0.5rem 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.reveal-card__body li {
  padding-left: 1.35rem;
  position: relative;
  font-size: 0.98rem;
  line-height: 1.55;
}

.reveal-card__body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

/* Flip cards
   -------------------------------------------------------------------------- */
.flip-deck {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .flip-deck { grid-template-columns: repeat(2, 1fr); }
}

.flip-card {
  perspective: 1200px;
  height: 280px;
  cursor: pointer;
}

.flip-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform var(--t-slow);
  transform-style: preserve-3d;
}

.flip-card[aria-pressed="true"] .flip-card__inner { transform: rotateY(180deg); }

.flip-card__face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow);
  overflow: auto;
}

.flip-card__face--front {
  background: var(--gold);
  color: var(--teal-deep);
}

.flip-card__face--back {
  background: var(--teal-paler);
  color: var(--teal-deep);
  transform: rotateY(180deg);
}

.flip-card__label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

.flip-card__text {
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 500;
}

.flip-card__hint {
  margin-top: auto;
  font-size: 0.8rem;
  opacity: 0.7;
  font-weight: 500;
}

.flip-card:hover .flip-card__face { box-shadow: var(--shadow-lg); }
.flip-card:focus-visible { outline: 3px solid var(--teal-deep); outline-offset: 4px; border-radius: var(--radius-lg); }

.flip-card__myth-recap {
  margin-bottom: 0.9rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(21, 93, 110, 0.22);
  font-size: 0.88rem;
  line-height: 1.4;
}

.flip-card__myth-recap-label {
  display: block;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
  opacity: 0.65;
}

.flip-card__myth-recap-text {
  font-style: italic;
  opacity: 0.85;
}

/* Pill chips
   -------------------------------------------------------------------------- */
.pill-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  margin: 1.25rem 0;
}

@media (min-width: 560px) {
  .pill-grid { grid-template-columns: repeat(2, 1fr); }
}

.pill {
  background: var(--teal-mid);
  color: var(--white-warm);
  padding: 0.85rem 1.2rem;
  border-radius: var(--pill);
  text-align: center;
  font-weight: 500;
  font-size: 0.98rem;
  box-shadow: var(--shadow-sm);
  line-height: 1.35;
}

.pill--sage { background: var(--teal-pale); color: var(--teal-deep); }
.pill--tan  { background: var(--gold); color: var(--teal-deep); }

/* Callouts
   -------------------------------------------------------------------------- */
.callout-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 1.25rem 0;
}

.callout {
  background: var(--gold-soft);
  color: var(--teal-deep);
  padding: 1.1rem 1.5rem;
  border-radius: var(--pill);
  text-align: center;
  font-weight: 600;
  font-size: 1.02rem;
  box-shadow: var(--shadow-sm);
  line-height: 1.4;
}

@media (max-width: 480px) {
  .callout { border-radius: var(--radius); text-align: left; }
}

/* End-of-tool CTA
   -------------------------------------------------------------------------- */
.end-cta {
  background: var(--teal-deep);
  color: var(--white-warm);
  padding: 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
  margin-top: 1.5rem;
}

.end-cta h2 { color: var(--white-warm); margin-bottom: 0.75rem; }
.end-cta p { opacity: 0.92; margin-bottom: 1.5rem; }

.end-cta .btn--primary {
  background: var(--gold);
  color: var(--teal-deep);
}
.end-cta .btn--primary:hover { background: var(--gold-soft); }

/* Hub page
   -------------------------------------------------------------------------- */
.hub-hero {
  text-align: center;
  margin-bottom: 3rem;
  padding-top: 1rem;
}

.hub-logo {
  max-width: 260px;
  margin: 0 auto 1.5rem;
}

.hub-hero h1 { margin-bottom: 1rem; }

.hub-hero__sub {
  color: var(--text-soft);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto;
}

.hub-cards {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .hub-cards { grid-template-columns: repeat(3, 1fr); }
}

.hub-card {
  display: flex;
  flex-direction: column;
  background: #ffffff; /* pure white pops gently against the LIGHTEST 1 body */
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(21, 93, 110, 0.08);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  text-decoration: none;
  color: inherit;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
  min-height: 220px;
}

.hub-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: var(--teal-mid);
}
.hub-card--1::before { background: var(--teal-mid); }
.hub-card--2::before { background: var(--gold); }
.hub-card--3::before { background: var(--teal-pale); }

.hub-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.hub-card h2 { font-size: 1.3rem; margin: 0.5rem 0 0 0; font-weight: 700; }

.hub-card__desc { flex: 1; color: var(--text-soft); font-size: 0.98rem; }

.hub-card__go {
  font-weight: 600;
  color: var(--teal-mid);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hub-card__go::after { content: "→"; transition: transform var(--t-fast); }
.hub-card:hover .hub-card__go::after { transform: translateX(4px); }

.hub-note {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--teal-paler);
  border-radius: var(--radius);
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Embed footer — two stacked rows: crisis (top) + EASA contact (bottom)
   -------------------------------------------------------------------------- */
.embed-footer { margin-top: auto; }

.embed-footer__row {
  padding: 1.1rem 0;
  font-size: 0.94rem;
  line-height: 1.5;
}

.embed-footer__row .container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.5rem;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.embed-footer__row--crisis {
  background: var(--teal-deep);
  color: var(--white-warm);
}

.embed-footer__row--crisis a {
  color: var(--gold-soft);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

.embed-footer__row--crisis a:hover { color: var(--gold-pale); }

.embed-footer__row--contact {
  background: var(--gold-wash);
  color: var(--teal-deep);
  border-top: 1px solid rgba(21, 93, 110, 0.1);
}

.embed-footer__row--contact a {
  color: var(--teal-mid);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

.embed-footer__row--contact a:hover { color: var(--teal-deep); }

.embed-footer__label {
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-right: 0.25rem;
}

.embed-footer__row--crisis .embed-footer__label { color: var(--gold-soft); }
.embed-footer__row--contact .embed-footer__label { color: var(--teal-deep); }

.embed-footer__sep {
  opacity: 0.4;
  display: none;
}

@media (min-width: 760px) {
  .embed-footer__sep { display: inline; }
}

/* Colophon
   -------------------------------------------------------------------------- */
.colophon {
  padding: 1.25rem 0;
  background: var(--paper);
  border-top: 1px solid rgba(21, 93, 110, 0.08);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.colophon a {
  color: var(--teal-mid);
  text-decoration: none;
  font-weight: 500;
}

.colophon a:hover { text-decoration: underline; }

/* Section labels
   -------------------------------------------------------------------------- */
.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-warm);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* Concept split (positive vs negative)
   -------------------------------------------------------------------------- */
.concept-split {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin: 1.5rem 0;
}

@media (min-width: 560px) {
  .concept-split { grid-template-columns: repeat(2, 1fr); }
}

.concept-split__col {
  padding: 1.25rem;
  border-radius: var(--radius);
  text-align: center;
}

.concept-split__col--added {
  background: var(--gold-soft);
  color: var(--teal-deep);
}

.concept-split__col--taken {
  background: var(--teal-pale);
  color: var(--teal-deep);
}

.concept-split__col .label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

.concept-split__col .term { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.25rem; }

.concept-split__col .desc { font-size: 0.92rem; line-height: 1.45; }

/* Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .flip-card__inner { transition: none; }
}

/* Focus ring
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--teal-mid);
  outline-offset: 3px;
  border-radius: 4px;
}

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


/* Site footer (crisis + EASA contact, 3-column)
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--teal-deep);
  color: var(--white-warm);
  padding: 2.75rem 0;
  margin-top: auto;
}

.site-footer__grid {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .site-footer__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

.site-footer__col {
  font-size: 0.95rem;
  line-height: 1.65;
}

.site-footer__col p { margin: 0; }

.site-footer__label {
  display: block;
  font-weight: 700;
  color: var(--gold-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.76rem;
  margin-bottom: 0.65rem;
}

.site-footer a {
  color: var(--white-warm);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  font-weight: 500;
}

.site-footer a:hover { color: var(--gold-soft); }

.site-footer__col strong {
  color: var(--white-warm);
  font-weight: 600;
  display: inline-block;
  margin-top: 0.15rem;
}


/* Tool-page back link (navigates to hub within iframe)
   -------------------------------------------------------------------------- */
.tool-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--teal-mid);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  padding: 0.45rem 0.95rem 0.45rem 0.75rem;
  border-radius: var(--pill);
  background: transparent;
  transition: background var(--t-fast), color var(--t-fast);
}
.tool-back:hover,
.tool-back:focus-visible {
  background: var(--teal-paler);
  color: var(--teal-deep);
}
