/* ============================================================
   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;
  }
}

/* ── Retirement Transition Toolkit links (QUEEN-55) ───────────── */
/* Only pages that show the RTT button or header link use these. */

.ft-btn--wrap {
  white-space: normal;
  line-height: 1.25;
  text-align: center;
}

@media (max-width: 640px) {
  .ft-header--rtt .ft-header-inner {
    padding: 0 16px;
    gap: 8px;
  }

  .ft-nav__link--rtt {
    white-space: normal;
    line-height: 1.15;
    text-align: center;
    padding: 4px 8px;
  }
}

/* ── Home page path cards ─────────────────────────────────────── */
/* home.php, signed-in users: one card per toolkit. */

.ft-main--home {
  max-width: 880px;
  padding-top: 40px;
}

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

.ft-home__heading {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ft-dark);
  line-height: 1.2;
  margin-bottom: 6px;
}

.ft-home__lead {
  font-size: 1.05rem;
  color: var(--ft-text-muted);
  margin-bottom: 24px;
}

.ft-paths {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  max-width: 440px;
}

.ft-paths--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: none;
}

.ft-path {
  background: var(--ft-white);
  border: 1px solid var(--ft-border);
  border-radius: var(--ft-radius);
  box-shadow: var(--ft-shadow);
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.ft-path__eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ft-garnet);
}

.ft-path__org {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ft-garnet-dark);
  background: #f6e7ea;
  border-radius: 9999px;
  padding: 2px 10px;
  overflow-wrap: anywhere;
}

.ft-path__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ft-dark);
  line-height: 1.25;
}

.ft-path__text {
  font-size: 0.98rem;
  color: var(--ft-text-muted);
  line-height: 1.6;
}

.ft-path__meta {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--ft-text);
}

.ft-path__meta li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ft-path__meta li::before {
  content: '';
  width: 7px;
  height: 7px;
  min-width: 7px;
  border-radius: 50%;
  background-color: var(--ft-garnet);
  transform: translateY(-1px);
}

/* The button sits at the bottom so both cards line up. */
.ft-path__btn {
  margin-top: auto;
  align-self: stretch;
  text-align: center;
}

/* Toolkit administration card (QUEEN-138): a full-width row under the
   toolkit cards, with two buttons side by side (stacked on a phone). */
.ft-path--admin {
  grid-column: 1 / -1;
}

.ft-path__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
}

.ft-path__actions .ft-btn {
  flex: 1 1 200px;
  text-align: center;
}

/* Space between the last line of text and the button. */
.ft-path > :nth-last-child(2) {
  margin-bottom: 8px;
}

@media (max-width: 720px) {
  .ft-paths--two {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .ft-main--home {
    padding-top: 24px;
  }

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

  .ft-home__logos {
    padding-bottom: 18px;
    margin-bottom: 20px;
  }

  .ft-path {
    padding: 22px 20px 20px;
  }
}

/* ── Toolkit administration pages (QUEEN-202): admin.php, admin_org.php ── */

.ft-main--admin {
  max-width: 880px;
  padding-top: 32px;
}

button.ft-btn {
  font-family: inherit;
  border: 0;
}

button.ft-btn--secondary {
  border: 2px solid var(--ft-garnet);
}

.ft-btn--small {
  font-size: 0.9rem;
  padding: 10px 18px;
  min-height: 44px;
}

.ft-btn--danger {
  background-color: #b3261e;
  color: var(--ft-white);
}

.ft-btn--danger:hover,
.ft-btn--danger:focus {
  background-color: #8c1d18;
  color: var(--ft-white);
}

.ft-admin__back {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--ft-garnet);
  font-weight: 600;
  text-decoration: none;
}

.ft-admin__back:hover,
.ft-admin__back:focus {
  text-decoration: underline;
}

.ft-admin__heading {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ft-dark);
  line-height: 1.2;
  margin: 6px 0 8px;
  overflow-wrap: anywhere;
}

.ft-admin__lead {
  color: var(--ft-text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.ft-notice {
  border-radius: var(--ft-radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  line-height: 1.5;
  border: 1px solid;
}

.ft-notice--success {
  background: #eaf5ec;
  border-color: #a8d5b1;
  color: #1d4d27;
}

.ft-notice--error {
  background: #fbeaea;
  border-color: #e7b3b0;
  color: #7a1b16;
}

.ft-panel {
  background: var(--ft-white);
  border: 1px solid var(--ft-border);
  border-radius: var(--ft-radius);
  box-shadow: var(--ft-shadow);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.ft-panel__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ft-dark);
  margin-bottom: 14px;
}

.ft-panel__text {
  color: var(--ft-text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

.ft-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ft-garnet-dark);
  background: #f6e7ea;
  border-radius: 9999px;
  padding: 2px 10px;
}

/* Organization list */
.ft-orglist {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ft-border);
}

.ft-orglist__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name go" "meta go";
  column-gap: 12px;
  row-gap: 2px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--ft-border);
  text-decoration: none;
  color: var(--ft-text);
}

.ft-orglist__item:hover,
.ft-orglist__item:focus {
  background: #fdf6f3;
}

.ft-orglist__name {
  grid-area: name;
  font-weight: 700;
  color: var(--ft-dark);
  overflow-wrap: anywhere;
}

.ft-orglist__meta {
  grid-area: meta;
  font-size: 0.9rem;
  color: var(--ft-text-muted);
}

.ft-orglist__go {
  grid-area: go;
  align-self: center;
  font-size: 1.6rem;
  color: var(--ft-garnet);
}

/* Badges */
.ft-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 9999px;
  padding: 3px 10px;
  background: #eef1f3;
  color: var(--ft-dark);
}

.ft-badge--leader {
  background: #f6e7ea;
  color: var(--ft-garnet-dark);
}

.ft-badge--muted {
  background: #f3efe6;
  color: var(--ft-text-muted);
}

/* Join code and invitation */
.ft-keyvals {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin-bottom: 14px;
}

.ft-keyvals dt {
  font-weight: 600;
  color: var(--ft-text-muted);
}

.ft-keyvals dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.ft-code,
.ft-input--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.03em;
}

.ft-code {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ft-dark);
}

.ft-invitation {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ft-text);
  background: #faf7f0;
  border: 1px solid var(--ft-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  resize: vertical;
}

/* People table */
.ft-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.ft-table th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ft-text-muted);
  padding: 8px 8px 8px 0;
  border-bottom: 1px solid var(--ft-border);
}

.ft-table td {
  padding: 12px 8px 12px 0;
  border-bottom: 1px solid var(--ft-border);
  vertical-align: middle;
}

.ft-table__email {
  color: var(--ft-text-muted);
  overflow-wrap: anywhere;
}

.ft-table__actions {
  text-align: right;
  white-space: nowrap;
}

.ft-table__actions form {
  display: inline-block;
  margin-left: 6px;
}

/* Forms */
.ft-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.ft-form + .ft-form {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--ft-border);
}

.ft-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 480px;
  border: 0;
  padding: 0;
  margin: 0;
}

.ft-field label,
.ft-field legend {
  font-weight: 600;
  color: var(--ft-dark);
}

.ft-field input[type="text"],
.ft-field input[type="email"] {
  font: inherit;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #b9b0a0;
  border-radius: 8px;
  background: var(--ft-white);
  color: var(--ft-text);
}

.ft-field input:focus,
.ft-invitation:focus {
  outline: 3px solid rgba(143, 0, 26, 0.25);
  outline-offset: 1px;
  border-color: var(--ft-garnet);
}

.ft-field__hint {
  font-size: 0.88rem;
  color: var(--ft-text-muted);
  line-height: 1.5;
}

.ft-field__error {
  width: 100%;
  font-weight: 600;
  color: #7a1b16;
  background: #fbeaea;
  border: 1px solid #e7b3b0;
  border-radius: 8px;
  padding: 10px 14px;
}

.ft-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  width: 100%;
}

.ft-field-row .ft-field {
  flex: 1 1 200px;
}

.ft-choice label {
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.ft-details {
  width: 100%;
  max-width: 480px;
}

.ft-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ft-garnet);
  min-height: 32px;
  display: list-item;
}

.ft-details[open] summary {
  margin-bottom: 8px;
}

.ft-danger__title {
  font-size: 1rem;
  font-weight: 700;
  color: #7a1b16;
}

.ft-danger .ft-panel__text {
  margin-bottom: 0;
}

.ft-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

@media (max-width: 640px) {
  .ft-main--admin {
    padding-top: 20px;
  }

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

  .ft-panel {
    padding: 20px 18px;
  }

  /* The people table becomes one block per person. */
  .ft-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .ft-table tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--ft-border);
  }

  .ft-table td {
    display: block;
    padding: 2px 0;
    border: 0;
  }

  .ft-table__actions {
    text-align: left;
    white-space: normal;
    padding-top: 8px !important;
  }

  .ft-table__actions form {
    margin: 4px 6px 0 0;
  }

  .ft-keyvals {
    grid-template-columns: minmax(0, 1fr);
  }
}
