/* flashcards_new.css
   Clean, calm flashcards page — main focus is the flashcard UI.
*/

:root{
  --bg: #e9ecef;
  --panel: #ffffff;
  --panel-2: #f3f4f6;

  --text: #0b1220;
  --muted: #374151;
  --muted-2: #4b5563;

  --border: rgba(17,24,39,0.14);
  --border-strong: rgba(17,24,39,0.20);

  --shadow: 0 10px 26px rgba(17,24,39,0.12);
  --shadow-hover: 0 16px 40px rgba(17,24,39,0.16);

  --radius: 18px;
  --radius-sm: 12px;

  --accent: #dc2626;
  --accent-hover: #b91c1c;
  --accent-soft: rgba(220, 38, 38, 0.10);

  --focus: rgba(220, 38, 38, 0.30);

  --t: 160ms;
  --ease: cubic-bezier(.2,.8,.2,1);

  --max: 1060px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }

body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a{ color: inherit; text-decoration: none; }
a:hover{ text-decoration: underline; text-underline-offset: 3px; }

.container{
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

/* Accessibility */
.skip-link{
  position: absolute;
  left: -999px;
  top: 12px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  box-shadow: var(--shadow);
}
.skip-link:focus{
  left: 12px;
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ================= HEADER ================= */
.site-header{
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(233,236,239,0.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 10px;
}

.brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-mark{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: transparent;
  border: none;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.brand-mark img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.35);
}

.brand-name{ font-size: 0.98rem; }

/* Nav */
.site-nav{
  display: none;
  gap: 8px;
  align-items: center;
}

.nav-link{
  padding: 10px 10px;
  border-radius: 12px;
  color: var(--text);
  transition: background var(--t) var(--ease), transform var(--t) var(--ease);
}
.nav-link:hover{
  background: rgba(17,24,39,0.06);
  text-decoration: none;
  transform: translateY(-1px);
}
.nav-link:active{ transform: translateY(0px); }
.nav-link-muted{ color: var(--muted); }

.nav-toggle{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.70);
  cursor: pointer;
  transition: background var(--t) var(--ease), transform var(--t) var(--ease);
}
.nav-toggle:hover{
  background: rgba(255,255,255,0.95);
  transform: translateY(-1px);
}
.nav-toggle:active{ transform: translateY(0px); }
.nav-toggle:focus{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.nav-toggle-bars{
  width: 18px;
  height: 2px;
  background: var(--text);
  position: relative;
  border-radius: 2px;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after{
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.nav-toggle-bars::before{ top: -6px; }
.nav-toggle-bars::after{ top: 6px; }

.site-nav.is-open{
  display: grid;
  position: absolute;
  top: 64px;
  left: 16px;
  right: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.98);
  box-shadow: var(--shadow);
}

/* ================= TYPOGRAPHY ================= */
.h1{
  font-size: clamp(1.7rem, 5.2vw, 2.45rem);
  line-height: 1.10;
  margin: 0 0 10px;
  letter-spacing: -0.015em;
  font-weight: 750;
}
.h2{
  font-size: clamp(1.25rem, 3.8vw, 1.65rem);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  font-weight: 750;
}
.h3{
  font-size: 1.03rem;
  margin: 0 0 6px;
  font-weight: 700;
}

.p{ margin: 0; color: var(--muted); }
.lead{ margin-bottom: 18px; max-width: 60ch; }

.subhead{
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 55ch;
}

.micro{
  margin: 12px 0 0;
  color: var(--muted-2);
  font-size: 0.92rem;
}

.tiny{ font-size: 0.88rem; color: var(--muted-2); }
.muted{ color: var(--muted-2); }

/* ================= BUTTONS ================= */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.85);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  min-height: 46px;
  transition:
    background var(--t) var(--ease),
    border-color var(--t) var(--ease),
    transform var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}
.btn:hover{
  text-decoration: none;
  background: rgba(255,255,255,0.98);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.btn:active{
  transform: translateY(0px);
  box-shadow: none;
}
.btn:focus{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.btn-primary{
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.btn-primary:hover{
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-hover);
}

.btn-outline{
  background: rgba(255,255,255,0.80);
  border-color: rgba(17,24,39,0.20);
}
.btn-outline:hover{ background: rgba(255,255,255,0.98); }

.btn-ghost{
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover{
  background: rgba(17,24,39,0.06);
  border-color: rgba(17,24,39,0.10);
  box-shadow: none;
}

.btn-full{ width: 100%; }

/* Smaller utility buttons */
.btn.mini{
  padding: 10px 12px;
  min-height: 40px;
  font-weight: 650;
}

/* ================= SECTIONS ================= */
.section{ padding: 36px 0 46px; }

/* HERO — minimal, no wasted space */
.hero{
  padding: 22px 0 14px;
  background: linear-gradient(to bottom, #f3f4f6, var(--bg));
}
.hero-grid{
  display: grid;
  gap: 12px;
}

/* If any hero-card remains in HTML, hide it */
.hero-card{ display: none !important; }

.cta-row{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 14px 0 8px;
}

.trust-chips{
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip{
  font-size: 0.88rem;
  color: var(--muted);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  transition: transform var(--t) var(--ease), background var(--t) var(--ease);
}
.chip:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.98);
}

/* ================= MAIN FLASHCARD PANEL ================= */
.panel-head{
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.topic-wrap{
  display: grid;
  gap: 6px;
  align-content: start;
}

.select{
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
  font-weight: 650;
  color: var(--text);
  outline: none;
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
.select:focus{
  border-color: rgba(220,38,38,0.35);
  box-shadow: 0 0 0 4px var(--focus);
}

.flash-shell{
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.94);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* The flashcard itself is the hero */
.card-box{
  position: relative;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(17,24,39,0.14);
  background: rgba(255,255,255,0.98);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

@media (min-width: 720px){
  .card-box{
    min-height: 260px;
    padding: 22px;
  }
}

.card-box.visible{
  animation: fadeIn .35s ease-out forwards;
}
@keyframes fadeIn{
  from{ opacity: 0; transform: translateY(6px); }
  to{ opacity: 1; transform: translateY(0); }
}

.card-box.revealed{
  border-color: rgba(34,197,94,0.45);
  box-shadow: 0 12px 26px rgba(17,24,39,0.10);
}

.question{
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
}

.answer{
  display: none;
  font-size: 1.05rem;
  font-weight: 600;
  color: #166534;
  margin-top: 12px;
  line-height: 1.5;
}
.card-box.revealed .answer{ display: block; }

/* Controls */
.controls{
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.bar-row{
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.progress{
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(17,24,39,0.10);
  overflow: hidden;
}
.progress span{
  height: 100%;
  display: block;
  width: 0%;
  background: linear-gradient(90deg, rgba(220,38,38,0.95), rgba(220,38,38,0.70));
  transition: width var(--t) var(--ease);
}

/* Utility controls */
.misc-controls{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;   /* CENTER */
  align-items: center;
}


.flag-btn.active{
  background: rgba(250,204,21,0.30) !important;
  border-color: rgba(250,204,21,0.60) !important;
  color: var(--text) !important;
}

/* Paywall buttons */
.paywall-actions{
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

/* Callout */
.callout{
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(220,38,38,0.22);
  background: rgba(220,38,38,0.08);
  text-align: center;        /* CENTER TEXT */
}

.callout-title{
  margin: 0 0 6px;
  font-weight: 700;
}

.callout-body{
  margin: 0;
  color: var(--muted);
}

/* ================= FOOTER ================= */
.site-footer{
  padding: 30px 0 40px;
  border-top: 1px solid var(--border);
  background: rgba(233,236,239,0.65);
}
.footer-grid{
  display: grid;
  gap: 14px;
  align-items: start;
}
.footer-links{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links a{
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 12px;
  transition: background var(--t) var(--ease), transform var(--t) var(--ease);
}
.footer-links a:hover{
  background: rgba(17,24,39,0.06);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ================= RESPONSIVE ================= */
@media (min-width: 720px){
  .nav-toggle{ display: none; }
  .site-nav{ display: inline-flex; }
  .site-nav.is-open{
    position: static;
    display: inline-flex;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .cta-row{
    grid-template-columns: auto auto;
    justify-content: start;
  }

  .panel-head{
    grid-template-columns: 1fr 320px;
    align-items: end;
  }

  .controls{
    grid-template-columns: 1fr 1fr 1fr;
  }

  .misc-controls{
    justify-content: flex-start;
  }

  .footer-grid{
    grid-template-columns: 1fr auto;
    justify-content: space-between;
  }
}

@media (max-width: 560px){
  .misc-controls{ flex-direction: column; }
  .btn.mini{ width: 100%; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; scroll-behavior: auto !important; }
}

::selection{
  background: rgba(220,38,38,0.18);
}

/* Constrain inner content so buttons truly centre */
.flash-shell{
  display: flex;
  flex-direction: column;
  align-items: center; /* KEY */
}

.card-box{
  width: 100%;
  max-width: 760px;   /* visual centre column */
}

.controls{
  width: 100%;
  max-width: 760px;   /* same as card */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  justify-content: center;
}

.controls .btn{
  width: 100%;
}

.bar-row{
  width: 100%;
  max-width: 760px;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.progress{
  width: 100%;
}

.misc-controls{
  width: 100%;
  max-width: 760px;
  display: flex;
  justify-content: center; /* THIS is the fix */
  align-items: center;
  gap: 16px;
}

.callout{
  width: 100%;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.card-box{
  justify-content: center;
}

.card-box{
  scroll-margin-top: 80px; /* fallback safety */
}

/* Outline button style for utility controls */
.misc-controls .btn{
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(17,24,39,0.25);
  background: rgba(255,255,255,0.75);
  font-weight: 650;
  font-size: 0.95rem;
  box-shadow: none;
  transition:
    background var(--t) var(--ease),
    border-color var(--t) var(--ease),
    transform var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}

.misc-controls .btn:hover{
  background: rgba(255,255,255,0.95);
  border-color: rgba(17,24,39,0.45);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Active flag state (keep star but make it clear) */
.flag-btn.active{
  background: rgba(250,204,21,0.25) !important;
  border-color: rgba(250,204,21,0.75) !important;
  color: #92400e !important;
}

/* Main navigation buttons (Previous / Reveal / Next) */
.controls .btn{
  min-height: 54px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 16px;
}

/* Make Reveal the visual anchor */
.controls .btn-primary{
  min-width: 160px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

/* Balance Previous / Next so they feel equal */
.controls .btn-outline{
  min-width: 180px;
}

/* ---------- Mobile fixes for main controls ---------- */
@media (max-width: 560px){
  /* Stack the 3 main buttons nicely */
  .controls{
    grid-template-columns: 1fr;  /* one per row */
    gap: 10px;
  }

  /* Remove desktop min-width so they don't overflow */
  .controls .btn,
  .controls .btn-primary,
  .controls .btn-outline{
    min-width: 0 !important;
    width: 100%;
  }

  /* Slightly smaller + more finger-friendly */
  .controls .btn{
    min-height: 48px;
    font-size: 1rem;
    border-radius: 14px;
    padding: 12px 14px;
  }
}

/* ---------- Tablet: keep 3 columns but avoid huge widths ---------- */
@media (min-width: 561px) and (max-width: 820px){
  .controls .btn-primary{ min-width: 0; }
  .controls .btn-outline{ min-width: 0; }
}

/* ---------- Flashcard text layout improvements ---------- */

/* Centre content inside the card */
.card-box{
  text-align: center;
  justify-content: center;
}

/* Question text */
.question{
  max-width: 48ch;          /* prevents super wide lines */
  margin: 0 auto;
  font-size: 1.15rem;
  line-height: 1.45;
  font-weight: 700;
}

/* Answer text */
.answer{
  max-width: 52ch;
  margin: 16px auto 0;
  font-size: 1.05rem;
  line-height: 1.5;
  font-weight: 600;
  color: #166534;
}

/* Slight spacing polish on small screens */
@media (max-width: 560px){
  .question{
    font-size: 1.05rem;
  }
  .answer{
    font-size: 1rem;
  }
}

/* ---------- Answer panel (more prominent, still calm) ---------- */

.card-box{
  cursor: pointer;
}

/* Subtle hint before reveal */
.card-box::after{
  content: "Tap to reveal";
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  font-size: 0.9rem;
  color: rgba(55,65,81,0.75);
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(17,24,39,0.12);
  padding: 6px 10px;
  border-radius: 999px;
  opacity: 1;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
  pointer-events: none;
}

.card-box.revealed::after{
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
}

/* Make answer a distinct panel */
.answer{
  display: block;               /* keep it in layout for animation */
  max-width: 56ch;
  margin: 16px auto 0;
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid rgba(34,197,94,0.28);
  background: rgba(34,197,94,0.08);
  color: #14532d;
  font-weight: 650;
  line-height: 1.55;

  opacity: 0;
  transform: translateY(6px);
  max-height: 0;
  overflow: hidden;
  transition:
    opacity var(--t) var(--ease),
    transform var(--t) var(--ease),
    max-height 220ms var(--ease);
}

/* When revealed, expand the panel */
.card-box.revealed .answer{
  opacity: 1;
  transform: translateY(0);
  max-height: 240px; /* enough for most answers */
}

/* Keep question centred and balanced */
.question{
  max-width: 52ch;
  margin: 0 auto;
  line-height: 1.5;
}

/* Accessibility: show focus ring on card */
.card-box:focus{
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Mobile tweak: remove hint if you prefer less clutter */
@media (max-width: 560px){
  .card-box::after{
    font-size: 0.85rem;
    bottom: 12px;
  }
}

/* Two-button layout after removing Reveal */
.controls{
  grid-template-columns: 1fr 1fr;
}

.controls .btn{
  min-height: 52px;
}

/* Paywall card: allow the answer panel to fully expand */
.card-box.paywall .answer{
  max-height: 1000px;   /* big enough for all content */
  overflow: visible;
}

/* Also remove the "Tap to reveal" pill on paywall */
.card-box.paywall::after{
  display: none;
}

/* Paywall should ALWAYS show full content (even if user never reveals) */
.card-box.paywall .answer{
  display: block !important;
  opacity: 1 !important;
  transform: none !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Optional: hide the “Tap to reveal” hint on paywall */
.card-box.paywall::after{
  display: none !important;
}



