/* =========================================
   1) Design Tokens
   ========================================= */
:root {
  --dark-blue: #3A5170;
  /* rgb(58,81,112) */
  --green: #549CAE;
  /* rgb(84,156,174) */
  --white: #ffffff;
  --light-gray: #f8f9fa;
  --dark-text: #333333;
  --error-red: #D8000C;
  --border-color: #e0e0e0;

  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .08);
  --shadow-lg: 0 8px 20px rgba(0, 0, 0, .10);

  --maxw: 1100px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 24px;
}

/* =========================================
   2) Base / Reset
   ========================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--white);
  color: var(--dark-text);
  line-height: 1.5;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
}

/* =========================================
   3) Page Layout
   ========================================= */
main {
  flex: 1 1 auto;
  padding: var(--space-5) 0;
}

.container,
.page-section,
.page-wrapper {
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
  box-sizing: border-box;
}

/* Page titles (unify appearance across pages like FAQ, Contact, etc.) */
.page-wrapper h1 {
  color: var(--dark-blue);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
  margin-top: 0;
  margin-bottom: 16px;
}

/* Optional: consistent spacing for text pages */
.page-wrapper p {
  margin-bottom: 15px;
  line-height: 1.6;
}

.hero {
  background: linear-gradient(0deg, #fff, #fff), var(--light-gray);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow-sm);
}

/* =========================================
   4) Header & Navigation
   ========================================= */
header {
  background: var(--white);
  border-bottom: 1px solid var(--border-color);
}

.header-container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo img {
  height: 48px;
  display: block;
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 20px;
  align-items: center;
}

nav a {
  text-decoration: none;
  color: var(--dark-text);
  font-weight: 500;
  padding: 6px 2px;
  transition: color .2s ease;
}

nav a:hover,
nav a:focus-visible {
  color: var(--green);
  outline: none;
}

nav a.login-button,
button.login-button {
  background: var(--dark-blue);
  color: var(--white);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
}

nav a.login-button:hover,
nav a.login-button:focus-visible,
button.login-button:hover,
button.login-button:focus-visible {
  filter: brightness(0.95);
  outline: none;
}

/* Hamburger (mobile) */
.hamburger-menu {
  display: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}

.hamburger-menu .bar {
  width: 26px;
  height: 3px;
  background: var(--dark-blue);
  border-radius: 3px;
}

/* =========================================
   5) Footer
   ========================================= */
footer {
  background-color: #3A5170;
  color: #fff;
  padding: 20px 0;
  text-align: center;
  width: 100%;
  position: relative;
}

.footer-container {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

.footer-links {
  list-style: none;
  display: flex;
  gap: 15px;
  padding: 0;
  margin: 0;
}

.footer-links a {
  color: #549CAE;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  text-decoration: underline;
  outline: none;
}

/* =========================================
   6) Cards / Panels
   ========================================= */
.card {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

.card+.card {
  margin-top: var(--space-4);
}

/* =========================================
   7) Buttons & Links
   ========================================= */
.cta-button,
button.cta-button {
  display: inline-block;
  background: var(--dark-blue);
  color: var(--white);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 16px;
  cursor: pointer;
  transition: transform .02s ease, filter .2s ease;
}

.cta-button:hover,
.cta-button:focus-visible {
  filter: brightness(0.96);
  outline: none;
}

.cta-button:active {
  transform: scale(0.99);
}

.cta-button.subtle {
  background: #6c757d;
  color: #fff;
}

.link-button {
  background: transparent;
  border: none;
  color: var(--dark-blue);
  cursor: pointer;
  text-decoration: underline;
}

/* Generic .btn variant set (used on summaries etc.) */
.btn,
button.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--dark-blue);
  background: #fff;
  color: var(--dark-blue);
  transition: filter .2s ease, transform .02s ease;
}

.btn:hover,
.btn:focus-visible {
  filter: brightness(0.96);
  outline: none;
}

.btn:active {
  transform: scale(0.99);
}

.btn.primary {
  background: var(--dark-blue);
  color: #fff;
  border-color: var(--dark-blue);
}

.btn.secondary {
  background: #fff;
  color: var(--dark-blue);
  border-color: var(--dark-blue);
}

/* Keyboard focus ring */
.btn:focus-visible,
.cta-button:focus-visible,
.link-button:focus-visible,
nav a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--dark-blue) 40%, transparent);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff;
}

/* =========================================
   8) Forms
   ========================================= */
.form-group {
  margin-bottom: 14px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  box-sizing: border-box;
  background: #fff;
}

.error-text {
  color: var(--error-red);
  margin: 8px 0;
  text-align: left;
}

/* =========================================
   9) Test UI helpers (progress, grid, options)
   ========================================= */
.flex-space-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.progress {
  background: #eceff1;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress .progress-fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  transition: width .25s ease;
}

.qgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 6px;
}

.qgrid .qcell {
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: 8px;
  padding: 6px 0;
  text-align: center;
  cursor: pointer;
}

.qgrid .qcell.current {
  outline: 2px solid var(--dark-blue);
}

.qgrid .qcell.correct {
  background: #e8f7ea;
}

/* green tint */
.qgrid .qcell.wrong {
  background: #fde8ea;
}

/* red tint */

.opt {
  display: block;
  margin: 10px 0;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.opt input {
  margin-right: 8px;
}

.opt.correct {
  background-color: #e8f7ea;
  /* Green tint */
  border: 1px solid #c3e6cb;
  color: #155724;
}

.opt.wrong {
  background-color: #fde8ea;
  /* Red tint */
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.qtext {
  font-size: 1.05rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* Summary actions row */
.summary-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* =========================================
   10) Entitlement Toggling
   (ONLY the marked sections switch)
   ========================================= */
html[data-entitled="true"] [data-entitlement="gate"] {
  display: none !important;
}

html[data-entitled="false"] [data-entitlement="paid"] {
  display: none !important;
}

html[data-entitled="checking"] [data-entitlement="paid"] {
  visibility: hidden;
}

/* =========================================
   11) Cookie Banner (optional hooks)
   ========================================= */
.cookie-banner {
  position: fixed;
  inset: auto 0 0 0;
  background: var(--dark-blue);
  color: #fff;
  padding: 12px var(--space-5);
  display: none;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

.cookie-banner.show {
  display: flex;
}

.cookie-banner p {
  margin: 0;
  flex: 1;
}

.cookie-banner .actions {
  display: flex;
  gap: 8px;
}

.cookie-banner .actions .btn {
  border-color: #fff;
  color: #fff;
}

.cookie-banner .actions .btn.primary {
  background: #fff;
  color: var(--dark-blue);
}

/* =========================================
   12) Utilities
   ========================================= */
.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-5 {
  margin-top: var(--space-5);
}

.text-center {
  text-align: center;
}

/* =========================================
   13) Responsive
   ========================================= */
@media (max-width: 992px) {
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  main {
    padding: var(--space-4) 0;
  }

  .container,
  .page-section,
  .page-wrapper {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .header-container {
    padding: 10px var(--space-3);
  }

  nav ul {
    display: none;
    /* hidden by default; opened via .active */
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 10;
  }

  nav ul.active {
    display: flex;
  }

  nav li {
    text-align: center;
    padding: 10px 0;
  }

  .hamburger-menu {
    display: flex;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Tiny phones (kept for slider hooks if used elsewhere) */
@media (max-width: 768px) {
  .slider {
    margin: 36px auto;
  }

  .slide {
    padding: 40px 16px;
  }
}

@media (max-width: 480px) {
  .slider {
    width: min(1000px, calc(100% - 16px));
    margin: 28px auto;
  }

  .slide {
    padding: 32px 14px;
  }
}

/* Cookie Banner */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #222;
  color: #fff;
  padding: 15px;
  font-size: 14px;
  z-index: 9999;
  display: flex;
  justify-content: center;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.3);
}

.cookie-content {
  max-width: 900px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.cookie-content p {
  margin: 0;
  flex: 1;
}

.cookie-buttons {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.cookie-buttons button {
  background: var(--accent-color, #4caf50);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.cookie-buttons button#reject-cookies {
  background: #888;
}

/* =========================================
   Cookie Banner — FRCSQ Balanced Compact
   ========================================= */
#cookie-banner {
  position: fixed;
  inset: auto 0 0 0;
  background: var(--dark-blue);
  color: #fff;
  font-size: 15px;
  /* match site body text */
  z-index: 9999;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(100%);
  animation: bannerSlideUp 0.35s ease forwards;
}

@keyframes bannerSlideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cookie-content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 6px var(--space-5);
  /* light vertical padding */
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  /* more gap between text and buttons */
  box-sizing: border-box;
  line-height: 1.45;
}

.cookie-content p {
  margin: 0;
  flex: 1 1 70%;
}

.cookie-content a {
  color: var(--green);
  text-decoration: underline;
}

.cookie-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cookie-buttons button {
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

/* Accept button — FRCSQ green */
.cookie-buttons button#accept-cookies {
  background: var(--green);
  color: #fff;
}

.cookie-buttons button#accept-cookies:hover {
  background: color-mix(in srgb, var(--green) 90%, black 10%);
  transform: scale(1.03);
}

/* Reject button — subtle gray */
.cookie-buttons button#reject-cookies {
  background: #6c757d;
  color: #fff;
}

.cookie-buttons button#reject-cookies:hover {
  background: #5a6268;
  transform: scale(1.03);
}

/* Mobile layout */
@media (max-width: 700px) {
  .cookie-content {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 10px var(--space-4);
    gap: 8px;
  }

  .cookie-buttons {
    justify-content: flex-start;
  }
}

/* =========================================
   14) App Mode (Mobile)
   ========================================= */
.app-mode #main-header,
.app-mode #site-header,
.app-mode #header-placeholder,
.app-mode #main-footer,
.app-mode #site-footer,
.app-mode #footer-placeholder,
.app-mode #cookie-banner {
  display: none !important;
}

.app-mode main {
  padding-bottom: 80px;
  /* Space for bottom nav */
}

#bottom-nav {
  display: none;
  /* Hidden by default */
}

.app-mode #bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid #e0e0e0;
  height: 60px;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  padding-bottom: env(safe-area-inset-bottom);
  /* iPhone X+ safe area */
}

.app-mode #bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #666;
  font-size: 11px;
  flex: 1;
  height: 100%;
}

.app-mode #bottom-nav .nav-item .icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.app-mode #bottom-nav .nav-item.active {
  color: var(--dark-blue);
  font-weight: 600;
}