/* ==========================================================================
   Buddi Help Center — styles
   Brand tokens are pulled from the official Buddi design tokens
   (buddi-website/tailwind.config.ts) and the ripple palette from the
   official icon mark (buddi-icon.svg). Nothing here is invented.
   ========================================================================== */

/* ---- Type (self-hosted Inter, one clean family throughout) ------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter-700.woff2") format("woff2");
}

/* ---- Design tokens ------------------------------------------------------ */
:root {
  /* One clean, neutral sans-serif for the whole page. */
  --font-brand: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Brand color — exact hex from buddi-website design tokens. */
  --blue: #0c5283;        /* buddi.DEFAULT (navy / wordmark) */
  --blue-hover: #094268;  /* buddi.hover */
  --blue-ink: #073454;    /* buddi.800 */
  --teal: #2494dc;        /* buddi.500 — bright accent / inner ring */

  /* Ripple palette — exact fills from the official icon mark. */
  --ring-1: #2494dc;
  --ring-2: #34a7e4;
  --ring-3: #5bc6ec;
  --ring-4: #98e4f1;
  --ring-5: #cbf4f6;

  /* Neutrals — from the same token file. */
  --white: #fefefe;
  --surface: #fafbff;
  --surface-muted: #f4f6fb;
  --off-white: #f6f8fa;
  --line: #e6ebf2;
  --ink: #0a0a0a;
  --ink-600: #4d4d4d;
  --ink-500: #6b7280;

  --radius: 16px;
  --radius-sm: 12px;
  --shadow-card: 0 1px 3px rgba(12, 82, 131, 0.06), 0 0 0 1px rgba(12, 82, 131, 0.05);
  --shadow-lift: 0 12px 32px rgba(12, 82, 131, 0.14);
  --maxw: 1200px;
  --header-h: 60px;
}

/* ---- Reset / base ------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--white);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- Top bar ------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 clamp(16px, 4vw, 32px);
  background: rgba(254, 254, 254, 0.78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__logo { height: 26px; width: auto; }
.topbar__divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}
.topbar__title {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--blue-ink);
}

/* ---- Layout ------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}

/* ---- Hero --------------------------------------------------------------- */
.hero {
  text-align: center;
  padding: clamp(40px, 6vw, 72px) 0 clamp(24px, 4vw, 40px);
}
.hero__eyebrow {
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 14px;
}
.hero__title {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.5vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--blue-ink);
  margin: 0 0 14px;
}
.hero__sub {
  max-width: 560px;
  margin: 0 auto;
  color: var(--ink-600);
  font-size: clamp(1rem, 2.4vw, 1.15rem);
}

/* ---- Search ------------------------------------------------------------- */
.search {
  position: relative;
  max-width: 560px;
  margin: clamp(24px, 4vw, 36px) auto 0;
}
.search__icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--ink-500);
  pointer-events: none;
}
.search__input {
  width: 100%;
  height: 56px;
  padding: 0 52px 0 48px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search__input::placeholder { color: var(--ink-500); }
/* Hide the browser's native type=search clear control — we ship our own. */
.search__input::-webkit-search-cancel-button,
.search__input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search__input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(36, 148, 220, 0.15);
}
.search__clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: none;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--ink-600);
}
.search__clear:hover { background: var(--line); color: var(--ink); }
.search__clear.is-visible { display: inline-flex; }

/* ---- Sections / grid ---------------------------------------------------- */
main { padding-bottom: clamp(48px, 8vw, 96px); }
.section { margin-top: clamp(36px, 5vw, 56px); }
.section[hidden] { display: none; }
.section__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.section__title {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  letter-spacing: -0.01em;
  color: var(--blue-ink);
  margin: 0;
}
.section__count {
  font-size: 0.85rem;
  color: var(--ink-500);
  font-weight: 500;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(14px, 2vw, 24px);
}
@media (max-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { .grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- Card (portrait 9:16) ---------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  border: none;
  padding: 0;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card[hidden] { display: none; }
.card--playable:hover,
.card--playable:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}
.card__thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  background: var(--surface-muted);
  overflow: hidden;
}
.card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(254, 254, 254, 0.92);
  box-shadow: 0 4px 16px rgba(7, 52, 84, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, background 0.18s ease;
}
.card__play svg { width: 22px; height: 22px; margin-left: 3px; color: var(--blue); }
.card--playable:hover .card__play,
.card--playable:focus-visible .card__play {
  transform: scale(1.08);
  background: var(--white);
}
.card__duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--white);
  background: rgba(7, 52, 84, 0.82);
  border-radius: 6px;
  letter-spacing: 0.01em;
}
.card__body {
  padding: 14px 14px 16px;
}
.card__title {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.3;
  color: var(--blue-ink);
  margin: 0;
}

/* Branded placeholder tile (youtubeId === null) */
.card--placeholder .card__thumb {
  background: linear-gradient(165deg, #eaf6fd 0%, #f4f6fb 100%);
}
.card--placeholder .card__ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--blue);
}
.card--placeholder .card__ph-rings {
  position: relative;
  width: 88px;
  height: 88px;
  opacity: 0.85;
}
.card--placeholder .card__ph-rings span {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  border: 2px solid var(--ring-1);
}
.card--placeholder .card__ph-rings span:nth-child(1) { width: 30%; height: 30%; border-color: var(--ring-1); }
.card--placeholder .card__ph-rings span:nth-child(2) { width: 60%; height: 60%; border-color: var(--ring-3); }
.card--placeholder .card__ph-rings span:nth-child(3) { width: 90%; height: 90%; border-color: var(--ring-5); }
.card__ph-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-500);
}

/* ---- Empty state -------------------------------------------------------- */
.empty {
  display: none;
  text-align: center;
  padding: clamp(40px, 8vw, 72px) 16px;
}
.empty.is-visible { display: block; }
.empty__rings {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  opacity: 0.6;
}
.empty__rings span {
  position: absolute; inset: 0; margin: auto; border-radius: 50%; border: 2px solid var(--ring-3);
}
.empty__rings span:nth-child(1) { width: 34%; height: 34%; border-color: var(--ring-1); }
.empty__rings span:nth-child(2) { width: 67%; height: 67%; border-color: var(--ring-3); }
.empty__rings span:nth-child(3) { width: 100%; height: 100%; border-color: var(--ring-5); }
.empty__text {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--blue-ink);
  margin: 0;
}
.empty__text b { color: var(--teal); }

/* ---- Footer ------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
  padding: 40px 16px;
}
.footer__tag {
  font-family: var(--font-brand);
  font-weight: 700;
  color: var(--blue-ink);
  margin: 0 0 8px;
}
.footer__mail { color: var(--blue); text-decoration: none; }
.footer__mail:hover { text-decoration: underline; }

/* ---- Modal (vertical player) ------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 52, 84, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal.is-open { display: flex; }
.modal__dialog {
  position: relative;
  width: min(420px, 92vw);
  max-height: 92vh;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}
.modal__dialog iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.modal__close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--white);
  color: var(--blue-ink);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal__close:hover { background: var(--off-white); }
@media (max-width: 480px) {
  .modal { padding: 16px; }
  .modal__close { top: 8px; right: 8px; background: rgba(254,254,254,0.92); }
}

/* ---- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .card--playable:hover, .card--playable:focus-visible { transform: none; }
}
