/* ============================================================
   Just the Factoids — global styles
   Loads AFTER Bootstrap; theme overrides + custom components.
   Fonts: Inter (UI) · Lora (display) — served locally from /fonts
   Palette: yellow #F3E14C · ink #1D1B17 · paper #F7F6F2
   ============================================================ */

/* ---------- Local fonts ---------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("../fonts/lora-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("../fonts/lora-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("../fonts/lora-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Theme tokens (override Bootstrap defaults) ---------- */
:root {
  --brand-yellow: #f3e14c;
  --brand-yellow-strong: #c9b51a;
  --brand-ink: #1d1b17;
  --brand-ink-soft: #6f6c64;
  --brand-paper: #f7f6f2;
  --brand-card: #ffffff;
  --brand-line: #e6e4dc;

  --bs-body-bg: var(--brand-paper);
  --bs-body-color: var(--brand-ink);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-weight: 400;
  --bs-heading-font-family: "Lora", Georgia, "Times New Roman", serif;
  --bs-heading-font-weight: 700;
  --bs-primary: var(--brand-ink);
  --bs-primary-rgb: 29, 27, 23;
  --bs-dark: var(--brand-ink);
  --bs-dark-rgb: 29, 27, 23;
  --bs-link-color: var(--brand-ink);
  --bs-link-hover-color: #000000;
  --bs-border-color: var(--brand-line);
}

/* ---------- Base ---------- */
img {
  max-width: 100%;
  height: auto;
}

a {
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1.5px;
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--brand-yellow-strong);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2000;
  padding: 0.6rem 1rem;
  background: var(--brand-ink);
  color: #ffffff;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-250%);
  transition: transform 0.15s ease;
}
.skip-link:focus {
  transform: translateY(0);
  color: #ffffff;
}

/* ---------- Shared accent highlight ---------- */
.brand-accent {
  font-style: normal;
  background: linear-gradient(transparent 62%, var(--brand-yellow) 62%);
  padding: 0 0.08em;
}
em.brand-accent {
  font-style: italic;
}

/* ---------- Header / navigation ---------- */
.site-header {
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--brand-line);
  box-shadow: 0 1px 2px rgba(29, 27, 23, 0.04);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--bs-heading-font-family);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--brand-ink);
}
.site-brand:hover {
  color: var(--brand-ink);
}

.site-brand__logo {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
}

.navbar .nav-link {
  font-weight: 600;
  color: var(--brand-ink);
  padding-inline: 0.75rem;
  border-radius: 0.5rem;
}
.navbar .nav-link:hover {
  color: #000000;
  background: var(--brand-paper);
}
.navbar .nav-link.active,
.navbar .nav-link[aria-current="page"] {
  color: var(--brand-ink);
  box-shadow: inset 0 -3px 0 var(--brand-yellow);
}

/* ---------- Hero (index) ---------- */
.hero {
  position: relative;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
  text-align: center;
  background-color: var(--brand-paper);
  background-image: url("../img/jtf_background.svg");
  background-size: cover;
  background-position: center;
  border-top: 1px solid var(--brand-line);
  border-bottom: 1px solid var(--brand-line);
}

.hero__logo {
  display: block;
  width: clamp(3.5rem, 8vw, 5rem);
  height: auto;
  margin: 0 auto 1.25rem;
}

.hero__kicker {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #3b382f; /* darkened — stays legible over the hero background art */
}

.hero__title {
  font-family: var(--bs-heading-font-family);
  font-size: clamp(2.6rem, 8vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}

.hero__lede {
  margin: 0 auto 1.75rem;
  max-width: 34rem;
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: #3b382f; /* darkened — stays legible over the hero background art */
}

.hero__actions {
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-primary {
  --bs-btn-bg: var(--brand-ink);
  --bs-btn-border-color: var(--brand-ink);
  --bs-btn-hover-bg: #000000;
  --bs-btn-hover-border-color: #000000;
}

/* ---------- Follow (social icon links) ---------- */
.follow {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.5rem 0.3rem 0.9rem;
  border: 1px solid var(--brand-ink);
  border-radius: 0.375rem;
  background: transparent;
}

.follow__label {
  margin-right: 0.5rem;
  padding-right: 0.6rem;
  border-right: 1px solid var(--brand-line);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--brand-ink);
}

.follow__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  color: var(--brand-ink);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.follow__link:hover {
  color: var(--brand-ink);
  background: var(--brand-yellow);
  transform: translateY(-1px);
}
.follow__link:focus-visible {
  outline: 3px solid var(--brand-yellow-strong);
  outline-offset: 2px;
}

.follow__icon {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
}

/* ---------- Sub-page header (contact) ---------- */
.page-head {
  position: relative;
  padding: clamp(3rem, 7vw, 5rem) 0 clamp(2rem, 4vw, 3rem);
  text-align: center;
  background-color: var(--brand-paper);
  background-image: url("../img/jtf_background.svg");
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--brand-line);
}

/* Background art scrim (hero + page-head)
   jtf_background.svg is busiest at its center, exactly where the headline
   and lede sit. A light radial paper scrim softens the art behind the text
   (the headline/lede use a darker tone for contrast) while letting the
   yellow-brain artwork show through toward the edges. */
.hero::before,
.page-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 85% 85% at 50% 45%,
    rgba(247, 246, 242, 0.78) 0%,
    rgba(247, 246, 242, 0.6) 55%,
    rgba(247, 246, 242, 0.3) 100%
  );
  pointer-events: none;
}

.hero > .container,
.page-head > .container {
  position: relative;
  z-index: 1;
}

.page-title {
  font-family: var(--bs-heading-font-family);
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

/* ---------- Content sections ---------- */
.factoids-section,
.contact-section {
  background: var(--brand-paper);
}

.about-section {
  background: #fdfcf9;
  border-top: 1px solid var(--brand-line);
}

.factoids-section,
.about-section,
.contact-section {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}

/* The daily factoid card leads the page, so the section sits higher
   than a regular section — the card is the first thing on screen. */
.factoids-section--lead {
  padding-top: clamp(1.5rem, 3.5vw, 2.5rem);
}

.section-title {
  font-family: var(--bs-heading-font-family);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  margin: 0 0 1.75rem;
  padding-left: 0.9rem;
  border-left: 5px solid var(--brand-yellow);
}

.about-section__text {
  max-width: 42rem;
  color: var(--brand-ink-soft);
  font-size: 1.05rem;
  margin: 0;
}

/* ---------- Placeholder block (no-JS / empty fallback) ---------- */
.factoid-cards__empty {
  border: 2px dashed var(--brand-line);
  border-radius: 1rem;
  background: var(--brand-card);
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
  color: var(--brand-ink-soft);
  margin: 0;
}

/* ---------- Contact form ---------- */
.contact-section__intro {
  max-width: 34rem;
  margin: 0 0 2rem;
  font-size: 1.05rem;
  color: var(--brand-ink-soft);
}

.contact-form-wrap {
  max-width: 46rem;
  margin-inline: auto;
}

.contact-form .form-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--brand-ink);
  margin-bottom: 0.4rem;
}

.contact-form__required {
  color: var(--brand-yellow-strong);
}

.contact-form__optional {
  color: var(--brand-ink-soft);
  font-weight: 400;
  font-size: 0.8rem;
}

.contact-form .form-control {
  border: 1px solid var(--brand-line);
  border-radius: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: var(--brand-card);
  color: var(--brand-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.contact-form .form-control:focus {
  border-color: var(--brand-yellow-strong);
  box-shadow: 0 0 0 0.25rem rgba(201, 181, 26, 0.25);
}
.contact-form .form-control::placeholder {
  color: #a29e93;
}
.contact-form .form-control.is-invalid {
  border-color: #c0392b;
  box-shadow: none;
}

.contact-form__error {
  min-height: 1.4rem;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #c0392b;
}

.contact-form__status {
  margin: 1rem 0;
}

.contact-form__submit {
  min-width: 12rem;
}

.contact-form__note {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--brand-ink-soft);
}


/* ---------- Footer ---------- */
.site-footer {
  background: var(--brand-ink);
  color: #c9c6bd;
  padding: clamp(2.75rem, 6vw, 4.5rem) 0 1.5rem;
}

.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--bs-heading-font-family);
  font-weight: 700;
  font-size: 1.4rem;
  color: #ffffff;
  margin: 0 0 0.5rem;
}

.site-footer__logo {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  filter: brightness(0) invert(1); /* white brain mark on the ink footer */
}

.site-footer__blurb {
  margin: 0;
  max-width: 24rem;
  font-size: 0.95rem;
}

.site-footer__heading {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8f8c83;
}

.site-footer__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-footer__list li {
  margin-bottom: 0.4rem;
}
.site-footer__list a {
  color: #d8d5cc;
  text-decoration: none;
}
.site-footer__list a:hover {
  color: var(--brand-yellow);
  text-decoration: underline;
}

.site-footer__rule {
  border-color: rgba(255, 255, 255, 0.12);
  margin: 2rem 0 1.25rem;
}

.site-footer__copyright {
  margin: 0;
  font-size: 0.85rem;
  color: #8f8c83;
}

.site-footer__credit {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #8f8c83;
}
.site-footer__credit a {
  color: #d8d5cc;
  text-decoration: none;
}
.site-footer__credit a:hover {
  color: var(--brand-yellow);
  text-decoration: underline;
}

/* ---------- Today's factoid card ---------- */
.factoid-cards {
  margin-inline: auto;
}

.factoid-card {
  border: 1px solid var(--brand-line);
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(29, 27, 23, 0.05), 0 12px 32px rgba(29, 27, 23, 0.08);
  transition: transform 0.22s ease, opacity 0.22s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.factoid-card:hover {
  transform: translateY(-4px);
  border-color: #d9d6cd;
  box-shadow: 0 2px 4px rgba(29, 27, 23, 0.06), 0 22px 48px rgba(29, 27, 23, 0.12);
}

/* ---------- Card navigation (prev / next) ---------- */
.factoid-card-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 2.5vw, 1.5rem);
}

.factoid-card-nav__stage {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 46rem;
}

.factoid-card-nav__btn {
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid var(--brand-line);
  background: var(--brand-card);
  color: var(--brand-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(29, 27, 23, 0.05), 0 6px 16px rgba(29, 27, 23, 0.08);
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.factoid-card-nav__btn svg {
  width: 1.5rem;
  height: 1.5rem;
}
.factoid-card-nav__btn:hover {
  background: var(--brand-yellow);
  border-color: transparent;
  transform: translateY(-2px);
}
.factoid-card-nav__btn:active {
  transform: translateY(0);
}

/* Transition states for prev/next navigation: the current card slides
   out in the travel direction, the next card slides in from the other
   side. (More specific than the hover rule so transforms don't clash.) */
.factoid-card-nav__stage .factoid-card.is-leaving-left,
.factoid-card-nav__stage .factoid-card.is-leaving-right {
  opacity: 0;
}
.factoid-card-nav__stage .factoid-card.is-leaving-left {
  transform: translateX(-32px);
}
.factoid-card-nav__stage .factoid-card.is-leaving-right {
  transform: translateX(32px);
}
.factoid-card-nav__stage .factoid-card.is-entering-left {
  transform: translateX(-32px);
  opacity: 0;
}
.factoid-card-nav__stage .factoid-card.is-entering-right {
  transform: translateX(32px);
  opacity: 0;
}

/* Text-only cards get a yellow accent bar at the top so they read as
   intentional, not like a photo card that is missing its picture. */
.factoid-card--nophoto {
  border-top: 5px solid var(--brand-yellow);
}

.factoid-card__img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.factoid-card__body {
  padding: clamp(1.5rem, 4vw, 2.25rem);
}

.factoid-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.factoid-card .badge {
  background: var(--brand-yellow);
  color: var(--brand-ink);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.45em 0.95em;
  border-radius: 999px;
}

.factoid-card__date {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-ink-soft);
}

.factoid-card__text {
  font-family: var(--bs-heading-font-family);
  font-weight: 600;
  font-size: clamp(1.35rem, 3.5vw, 1.8rem);
  line-height: 1.45;
  letter-spacing: -0.01em;
  margin: 0;
}

.factoid-card__sources {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--brand-line);
}

.factoid-card__sources-label {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brand-ink-soft);
}

.factoid-card__sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.factoid-card__source-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.45rem;
  border-radius: 0.45rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--brand-ink);
  text-decoration: underline;
  text-decoration-color: var(--brand-yellow);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease, background-color 0.15s ease, text-decoration-color 0.15s ease;
}
.factoid-card__source-link:hover {
  color: #000000;
  text-decoration-color: var(--brand-yellow-strong);
  background: var(--brand-paper);
}
.factoid-card__source-link:focus-visible {
  outline: 3px solid var(--brand-yellow-strong);
  outline-offset: 2px;
}

.factoid-card__external-icon {
  width: 1em;
  height: 1em;
  flex: none;
  opacity: 0.85;
}

/* ---------- Share control + popover ---------- */
.factoid-card__share {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--brand-line);
}

.share-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.05rem;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  background: var(--brand-card);
  color: var(--brand-ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.15s ease;
}
.share-toggle:hover {
  background: var(--brand-yellow);
  border-color: transparent;
  transform: translateY(-1px);
}
.share-toggle:active {
  transform: translateY(0);
}
.share-toggle__icon {
  width: 1.05em;
  height: 1.05em;
  flex: none;
}

/* The popover is appended to <body> (the card clips its contents), so it is
   fixed to the viewport and positioned next to the toggle by js/share.js. */
.share-menu {
  position: fixed;
  z-index: 1600;
  width: max-content;
  min-width: 12rem;
  max-width: calc(100vw - 1rem);
  max-height: calc(100vh - 1rem);
  overflow-y: auto;
  padding: 0.4rem;
  background: var(--brand-card);
  border: 1px solid var(--brand-line);
  border-radius: 0.85rem;
  box-shadow: 0 2px 6px rgba(29, 27, 23, 0.08), 0 18px 44px rgba(29, 27, 23, 0.18);
  transform-origin: top left;
  animation: share-menu-pop 0.16s ease;
}
@keyframes share-menu-pop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.share-menu__list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

.share-menu__item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: var(--brand-ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.share-menu__item:hover {
  background: var(--brand-paper);
}
.share-menu__icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
}

/* Clipboard feedback toast (used for Copy link / TikTok fallback). */
.share-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 2000;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: var(--brand-ink);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(29, 27, 23, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.5rem);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.share-toast--show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* On phones the flanking buttons float over the card's left/right edges
   (there isn't room to keep them outside a near-full-width card). */
@media (max-width: 575.98px) {
  .factoid-card-nav {
    position: relative;
    gap: 0;
  }
  .factoid-card-nav__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 2.75rem;
    height: 2.75rem;
  }
  .factoid-card-nav__btn--prev {
    left: -1rem;
  }
  .factoid-card-nav__btn--next {
    right: -1rem;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .skip-link,
  .factoid-card,
  .factoid-card-nav__btn,
  .follow__link,
  .share-toggle,
  .share-toast {
    transition: none;
  }
  .share-menu {
    animation: none;
  }
  .factoid-card:hover,
  .share-toggle:hover {
    transform: none;
  }
}
