/* Joe Builds Systems — homepage styles. Tokens follow the JBS Brand Design System. */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/nunito-normal-5.woff2") format('woff2');
}

@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/nunito-sans-normal-5.woff2") format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-normal-6.woff2") format('woff2');
}

:root {
  --jbs-deep-navy: #1B2A3B;
  --jbs-dark-slate: #0F1C2B;
  --jbs-teal: #4DD9C0;
  --jbs-teal-bright: #6FE4CF;
  --jbs-sky: #5BCFEA;
  --jbs-periwinkle: #8B9FD4;
  --jbs-navy-900: #0B1622;
  --jbs-navy-500: #243A4F;
  --jbs-teal-008: rgba(77, 217, 192, 0.08);
  --jbs-teal-020: rgba(77, 217, 192, 0.20);
  --jbs-teal-040: rgba(77, 217, 192, 0.40);
  --jbs-teal-060: rgba(77, 217, 192, 0.60);
  --jbs-peri-020: rgba(139, 159, 212, 0.20);
  --jbs-gradient-accent: linear-gradient(90deg, var(--jbs-teal) 0%, var(--jbs-periwinkle) 100%);

  --bg-canvas: var(--jbs-deep-navy);
  --surface-card: var(--jbs-dark-slate);
  --text-primary: #FFFFFF;
  --text-secondary: #A8B8CC;
  --text-muted: #8496AB;
  --border-hairline: rgba(168, 184, 204, 0.20);

  --font-display: "Nunito", system-ui, -apple-system, sans-serif;
  --font-sans: "Nunito Sans", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --container: 1100px;
  --gutter: 20px;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-canvas);
  background-image: radial-gradient(rgba(168, 184, 204, 0.05) 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--text-secondary);
  font: 400 16px/1.6 var(--font-sans);
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: var(--jbs-teal); }
h1, h2, h3, p { margin: 0; }

:focus-visible { outline: 2px solid var(--jbs-sky); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--container); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.narrow { max-width: 680px; margin-left: auto; margin-right: auto; }

.eyebrow {
  font: 700 11px/1 var(--font-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.eyebrow--teal { color: var(--jbs-teal); }

/* ------------------------------------------------------------ Header --- */
.masthead { padding: 48px 0 0; text-align: center; }
.masthead__logo { width: 96px; height: auto; border-radius: 16px; margin: 0 auto; }
.masthead h1 {
  font: 800 30px/1.15 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-top: 16px;
}
.masthead__handle { font: 400 14px/1.4 var(--font-mono); color: var(--text-muted); margin-top: 4px; }
.masthead__bio { max-width: 520px; margin: 18px auto 0; font-size: 17px; }
.masthead__bio strong { color: var(--text-primary); font-weight: 700; }
.masthead__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px;
  font: 700 15px/1 var(--font-sans);
  text-decoration: none;
  border: 2px solid transparent; border-radius: 8px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn--primary { background: var(--jbs-teal); color: var(--jbs-deep-navy); }
.btn--primary:hover { background: var(--jbs-teal-bright); }
.btn--ghost { border-color: var(--jbs-teal-040); color: var(--jbs-teal); }
.btn--ghost:hover { border-color: var(--jbs-teal); }
.btn svg { width: 18px; height: 18px; }

.rule { height: 2px; border: 0; margin: 32px auto 0; max-width: 680px; background: var(--jbs-gradient-accent); border-radius: 999px; opacity: 0.55; }

/* ----------------------------------------------------------- Sections --- */
section { padding-top: 56px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2, .prose h2 {
  font: 800 24px/1.2 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.section-head p { font-size: 14px; margin-top: 4px; }
.section-head__more { font: 700 14px/1.2 var(--font-sans); white-space: nowrap; text-decoration: none; }
.section-head__more:hover { text-decoration: underline; }
.subhead { font: 800 16px/1.2 var(--font-display); color: var(--text-primary); margin: 28px 0 14px; }

/* --------------------------------------------------------------- Hero --- */
.start { padding-top: 28px; }
.hero-card {
  position: relative; display: block; text-decoration: none;
  padding: 24px; border-radius: 12px;
  background: var(--surface-card);
  border: 1px solid var(--jbs-teal-040);
  box-shadow: 0 0 0 1px var(--jbs-teal-008), 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: border-color 160ms ease-out, transform 160ms ease-out;
}
.hero-card::before {
  content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 2px;
  background: var(--jbs-gradient-accent); border-radius: 2px;
}
.hero-card:hover { border-color: var(--jbs-teal-060); transform: translateY(-1px); }
.hero-card__title { display: block; font: 800 21px/1.3 var(--font-display); color: var(--text-primary); margin-top: 10px; }
.hero-card__text { display: block; font-size: 14.5px; margin-top: 6px; color: var(--text-secondary); }
.hero-card__cta { display: inline-block; margin-top: 14px; font: 700 14px/1 var(--font-sans); color: var(--jbs-teal); }
.escape { display: block; text-align: center; margin-top: 14px; font-size: 13px; color: var(--text-muted); text-decoration: none; }
.escape span { color: var(--jbs-teal); font-weight: 600; border-bottom: 1px solid var(--jbs-teal-040); }

/* ----------------------------------------------------------- Carousel --- */
.rail-wrap { position: relative; }
.rail {
  display: flex; gap: 16px;
  margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter) 14px;
  list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-left: var(--gutter);
  scrollbar-width: thin; scrollbar-color: var(--jbs-navy-500) transparent;
}
.rail > li { flex: 0 0 78%; max-width: 300px; scroll-snap-align: start; }
.rail--shorts > li { flex: 0 0 40%; max-width: 168px; }

.rail-btn {
  display: none;
  position: absolute; top: 34%; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  align-items: center; justify-content: center;
  background: var(--jbs-navy-900); color: var(--text-primary);
  border: 1px solid var(--jbs-teal-040); cursor: pointer;
}
.rail-btn:hover { border-color: var(--jbs-teal); color: var(--jbs-teal); }
.rail-btn[disabled] { opacity: 0; pointer-events: none; }
.rail-btn--prev { left: -18px; }
.rail-btn--next { right: -18px; }
.rail-btn svg { width: 18px; height: 18px; }

.card {
  display: flex; flex-direction: column; height: 100%;
  text-decoration: none; overflow: hidden;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline); border-radius: 12px;
  transition: border-color 160ms ease-out, transform 160ms ease-out;
}
.card:hover { border-color: var(--jbs-teal-060); transform: translateY(-2px); }
.card__media { position: relative; aspect-ratio: 16 / 9; background: var(--jbs-navy-900); }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card--short .card__media { aspect-ratio: 9 / 16; }
.card__play {
  position: absolute; right: 10px; bottom: 10px;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11, 22, 34, 0.82); color: var(--jbs-teal);
  border: 1px solid var(--jbs-teal-040);
}
.card__play svg { width: 14px; height: 14px; margin-left: 2px; }
.card__body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; }
.card__title {
  font: 800 15.5px/1.35 var(--font-display); color: var(--text-primary);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card__desc {
  font-size: 13px; line-height: 1.5; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card__date { margin-top: auto; padding-top: 4px; font: 400 12px/1 var(--font-mono); color: var(--text-muted); }
.card--short .card__body { padding: 10px 12px 12px; }
.card--short .card__title { font-size: 13px; }

.subscribe-strip {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 12px; padding: 18px 20px;
  background: var(--surface-card); border: 1px solid var(--jbs-teal-020); border-radius: 12px;
}
.subscribe-strip p { flex: 1 1 260px; font-size: 14.5px; }
.subscribe-strip strong { color: var(--text-primary); }

/* -------------------------------------------------------------- Tools --- */
.tools { display: grid; gap: 16px; list-style: none; margin: 0; padding: 0; }
.tool {
  display: flex; flex-direction: column; height: 100%; gap: 8px;
  padding: 20px; text-decoration: none;
  background: var(--surface-card); border: 1px solid var(--border-hairline); border-radius: 12px;
  transition: border-color 160ms ease-out, transform 160ms ease-out;
}
.tool:hover { border-color: var(--jbs-teal-060); transform: translateY(-1px); }
.tool--paid { border-color: var(--jbs-teal-020); }
.tool__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tool__name { font: 800 17px/1.3 var(--font-display); color: var(--text-primary); }
.tool__price { font: 700 14px/1 var(--font-sans); color: var(--jbs-teal); white-space: nowrap; }
.tool__price--free { color: var(--jbs-periwinkle); font-weight: 600; }
.tool__text { font-size: 14px; line-height: 1.55; color: var(--text-secondary); }
.tool__kind { margin-top: auto; padding-top: 6px; }

/* ------------------------------------------------------ About and FAQ --- */
.prose p { margin-top: 14px; }
.prose p strong, .prose a { font-weight: 700; }
.prose strong { color: var(--text-primary); }
.sites { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.sites li { padding: 12px 16px; background: var(--surface-card); border: 1px solid var(--border-hairline); border-radius: 10px; font-size: 14.5px; }
.sites a { font-weight: 700; text-decoration: none; }
.sites a:hover { text-decoration: underline; }

.faq { margin-top: 18px; display: grid; gap: 10px; }
.faq details { background: var(--surface-card); border: 1px solid var(--border-hairline); border-radius: 10px; }
.faq summary {
  cursor: pointer; list-style: none; padding: 16px 44px 16px 18px; position: relative;
  font: 800 16px/1.35 var(--font-display); color: var(--text-primary);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font: 400 22px/1 var(--font-mono); color: var(--jbs-teal);
}
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 18px 18px; font-size: 15px; }

/* ------------------------------------------------------------- Footer --- */
.footer { margin-top: 64px; padding: 36px 0 44px; border-top: 1px solid var(--jbs-navy-500); text-align: center; }
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; }
.footer a { color: var(--text-secondary); text-decoration: none; font-size: 14px; display: inline-flex; align-items: center; min-height: 32px; }
.footer a:hover { color: var(--jbs-teal); }
.footer__sites { margin-bottom: 14px; }
.footer__social { gap: 6px 22px; }
.footer__social a { gap: 8px; min-height: 40px; }
.footer__social svg { width: 18px; height: 18px; flex: none; }
.footer__sites a { color: var(--text-primary); font-weight: 700; }
.footer__note { margin-top: 22px; font-size: 12.5px; color: var(--text-muted); letter-spacing: 0.04em; }

/* --------------------------------------------------------- Breakpoints --- */
@media (min-width: 560px) {
  .rail > li { flex-basis: 300px; }
  .rail--shorts > li { flex-basis: 168px; }
  .tools { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  :root { --gutter: 32px; }
  .masthead { padding-top: 64px; }
  .masthead h1 { font-size: 40px; }
  .section-head h2, .prose h2 { font-size: 28px; }
  section { padding-top: 72px; }
  .start { padding-top: 32px; }
  .tools { grid-template-columns: repeat(3, 1fr); }
  .sites { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) and (hover: hover) {
  .rail-btn { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
