/* ============================================================
   Family Toolkit — Custom Page Styles
   Applies to: home.php, survey.php (pages with custom chrome)
   Does NOT apply to native Moodle pages (theme.css handles those)
   ============================================================ */

/* ── Custom Properties ────────────────────────────────────────── */

:root {
  --ft-dark:        #001725;
  --ft-garnet:      #8f001a;
  --ft-garnet-dark: #6b0013;
  --ft-cream:       #FEF8E6;
  --ft-border:      #ddd5c4;
  --ft-text:        #1a1a1a;
  --ft-text-muted:  #555;
  --ft-white:       #ffffff;

  --ft-header-h:    64px;
  --ft-radius:      10px;
  --ft-shadow:      0 2px 16px rgba(0, 23, 37, 0.10);
}

/* ── Skip Navigation Link ─────────────────────────────────────── */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.5rem 1.25rem;
  background: var(--ft-garnet);
  color: var(--ft-white);
  border-radius: 0 0 6px 6px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--ft-white);
  outline-offset: 2px;
}

/* Screen-reader-only utility (used alongside aria-live regions) */
.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;
}

/* ── Reset / Base ─────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body.ft-page {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--ft-cream);
  color: var(--ft-text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
}

/* ── Header ──────────────────────────────────────────────────── */

.ft-header {
  background-color: var(--ft-dark);
  border-bottom: 3px solid var(--ft-garnet);
  height: var(--ft-header-h);
  position: sticky;
  top: 0;
  z-index: 100;
}

.ft-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ft-logo {
  color: var(--ft-white);
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.ft-logo:hover,
.ft-logo:focus {
  color: var(--ft-cream);
  text-decoration: none;
  outline: 2px solid rgba(255, 255, 255, 0.4);
  outline-offset: 3px;
  border-radius: 3px;
}

.ft-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ft-nav__username {
  color: rgba(255, 255, 255, 0.70);
  font-size: 0.9rem;
  padding-right: 6px;
}

.ft-nav__link {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.ft-nav__link:hover,
.ft-nav__link:focus {
  color: var(--ft-white);
  background-color: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.ft-nav__btn {
  color: var(--ft-white);
  background-color: var(--ft-garnet);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 9999px;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.ft-nav__btn:hover,
.ft-nav__btn:focus {
  background-color: var(--ft-garnet-dark);
  color: var(--ft-white);
  text-decoration: none;
}

/* ── Main Content Area ────────────────────────────────────────── */

.ft-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 24px 96px;
}

/* ── Partner Logos ────────────────────────────────────────────── */

.ft-card__logos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--ft-border);
}

.ft-card__logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

/* ── Card ────────────────────────────────────────────────────── */

.ft-card {
  background: var(--ft-white);
  border: 1px solid var(--ft-border);
  border-radius: var(--ft-radius);
  box-shadow: var(--ft-shadow);
  padding: 52px 48px;
}

.ft-card__eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ft-garnet);
  margin-bottom: 16px;
}

.ft-card__heading {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--ft-dark);
  line-height: 1.2;
  margin-bottom: 18px;
}

.ft-card__body {
  font-size: 1.05rem;
  color: var(--ft-text-muted);
  line-height: 1.75;
  margin-bottom: 28px;
}

/* ── Benefits List ────────────────────────────────────────────── */

.ft-benefits {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.ft-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.96rem;
  color: var(--ft-text);
  line-height: 1.5;
}

.ft-benefits li::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background-color: var(--ft-garnet);
  margin-top: 7px;
}

/* ── Save Notice ──────────────────────────────────────────────── */

.ft-save-notice {
  background-color: #f5f0e8;
  border-left: 4px solid var(--ft-garnet);
  border-radius: 0 6px 6px 0;
  padding: 16px 20px;
  font-size: 0.9rem;
  color: var(--ft-text);
  line-height: 1.65;
  margin-bottom: 36px;
}

.ft-save-notice strong {
  color: var(--ft-dark);
}

/* ── Action Buttons ───────────────────────────────────────────── */

.ft-card__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.ft-btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 14px 30px;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}

.ft-btn--primary {
  background-color: var(--ft-garnet);
  color: var(--ft-white);
  box-shadow: 0 2px 8px rgba(143, 0, 26, 0.28);
}

.ft-btn--primary:hover,
.ft-btn--primary:focus {
  background-color: var(--ft-garnet-dark);
  color: var(--ft-white);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(143, 0, 26, 0.38);
}

.ft-btn--secondary {
  background-color: transparent;
  color: var(--ft-garnet);
  border: 2px solid var(--ft-garnet);
  padding: 12px 30px;
}

.ft-btn--secondary:hover,
.ft-btn--secondary:focus {
  background-color: var(--ft-garnet);
  color: var(--ft-white);
  text-decoration: none;
}

.ft-btn--ghost {
  background-color: transparent;
  color: var(--ft-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 12px 4px;  /* increased from 10px to reach ≥ 44px touch target */
  border-radius: 0;
  box-shadow: none;
}

.ft-btn--ghost:hover,
.ft-btn--ghost:focus {
  color: var(--ft-dark);
  text-decoration: underline;
}

/* ── Focus Visible Rings (WCAG 2.4.7) ────────────────────────── */

.ft-btn:focus-visible,
a.ft-btn:focus-visible {
  outline: 3px solid var(--ft-garnet);
  outline-offset: 3px;
}

/* On dark nav backgrounds, use a light ring so it's visible */
.ft-logo:focus-visible,
.ft-nav__link:focus-visible,
.ft-nav__btn:focus-visible {
  outline: 3px solid var(--ft-white);
  outline-offset: 3px;
}

.ft-card__actions-row {
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Survey Page: iframe wrapper ──────────────────────────────── */
/* Applies when app.css is loaded in survey.php */

.ft-page--survey .ft-main {
  max-width: 960px;
  padding-top: 32px;
  padding-bottom: 40px;
}

.ft-survey-wrapper {
  background: var(--ft-white);
  border: 1px solid var(--ft-border);
  border-radius: var(--ft-radius);
  box-shadow: var(--ft-shadow);
  overflow: hidden;
}

#survey-frame {
  display: block;
  width: 100%;
  border: none;
  min-height: 600px;
  height: 800px;
  transition: height 0.15s ease;
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 640px) {
  .ft-main {
    padding: 32px 16px 64px;
  }

  .ft-card {
    padding: 36px 24px;
  }

  .ft-card__heading {
    font-size: 1.6rem;
  }

  .ft-card__body {
    font-size: 1rem;
  }

  .ft-nav__username {
    display: none;
  }

  .ft-btn {
    width: 100%;
    text-align: center;
  }

  .ft-card__actions {
    align-items: stretch;
  }

  .ft-btn--ghost {
    text-align: center;
  }

  .ft-card__actions-row {
    flex-direction: column;
    width: 100%;
  }

  .ft-card__logo {
    height: 28px;
  }
}
