/* /blocks/ — landing page for the free Vibe Engineering Blocks book.
   Builds on books.css (the .bk3d hovering book, .book-peek, the .bkr reader)
   and the studio tokens. Everything here is prefixed .blx-. */

.blx { --blx-max: 72rem; color: var(--ink); }
.blx-wrap { max-width: var(--blx-max); margin: 0 auto; padding: 0 1.25rem; }
.blx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* type */
.blx-kicker {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-strong); margin-bottom: 0.7rem;
}
.blx-h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1.02;
  font-size: clamp(2.5rem, 5.4vw, 4.1rem); margin: 0.9rem 0 1rem; color: var(--ink);
}
.blx-h2 {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.12;
  font-size: clamp(1.6rem, 3vw, 2.3rem); margin: 0 0 0.9rem; color: var(--ink);
}
.blx-lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); line-height: 1.55; color: var(--muted); max-width: 34rem; margin: 0 0 1.75rem; }
.blx-p { font-size: 1.02rem; line-height: 1.65; color: var(--muted); max-width: 40rem; margin: 0; }
.blx-eyebrow { font-weight: 600; letter-spacing: 0.01em; }

/* ------------------------------------------------------------- hero */
.blx-hero {
  position: relative;
  padding: 3rem 0 3.5rem;
  background:
    radial-gradient(1200px 620px at 72% -10%, rgba(99, 102, 241, 0.16), transparent 62%),
    var(--c-paper);
  overflow: hidden;
}
.blx-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(#e7e3da 1.5px, transparent 1.5px);
  background-size: 46px 46px; opacity: 0.45;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.blx-hero__grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 2rem 3.5rem; align-items: center;
}
.blx-hero__copy { max-width: 36rem; }
.blx-hero__art {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 1rem 0 0.5rem;
}
.blx-hero__art .bk3d { width: min(100%, 350px); }
.blx-hero__art[data-bkr] { cursor: pointer; }
/* .book-peek (the "Look inside" pill on the cover) comes from books.css */

/* form */
.blx-form { max-width: 34rem; }
/* the row/note are flex boxes — a bare [hidden] would lose to display:flex */
.blx-form [hidden], .blx-sticky[hidden] { display: none !important; }
.blx-form__row { display: flex; gap: 0.6rem; align-items: stretch; }
.blx-input {
  flex: 1 1 auto; min-width: 0;
  font-size: 1rem; padding: 0.85rem 1.15rem;
  background: #fff;
}
.blx-submit { flex: 0 0 auto; padding: 0.85rem 1.35rem; font-size: 1rem; white-space: nowrap; }
.blx-form__note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  margin: 0.8rem 0 0; font-size: 0.85rem; color: var(--muted); line-height: 1.4;
}
.blx-form__note svg { color: var(--signal); flex: 0 0 auto; }
.blx-form__note b { color: var(--ink); font-weight: 600; }
.blx-form__error { margin: 0.7rem 0 0; font-size: 0.88rem; font-weight: 600; color: var(--danger); }
.blx-form.is-busy .blx-submit { opacity: 0.75; pointer-events: none; }

/* post-submit state card (built by landing.js) */
.blx-form__state {
  margin-top: 0.25rem; padding: 1.15rem 1.25rem;
  border: 1px solid color-mix(in srgb, var(--signal) 45%, var(--line));
  border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm);
}
.blx-state__head { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.35rem; font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: var(--ink); }
.blx-state__head svg { color: var(--signal); flex: 0 0 auto; }
.blx-state__p { margin: 0; font-size: 0.93rem; line-height: 1.55; color: var(--muted); }
.blx-state__p b { color: var(--ink); font-weight: 600; }
.blx-state__actions { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin-top: 0.9rem; }
.blx-state__link { background: none; border: 0; padding: 0; font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--accent-strong); cursor: pointer; text-decoration: none; }
.blx-state__link:hover { text-decoration: underline; }
.blx-state__again { font-size: 0.82rem; color: var(--muted); }
.blx-state__again button { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }

/* dark variant (final band) */
.blx-form--dark .blx-input { background: rgba(255, 255, 255, 0.96); border-color: transparent; }
.blx-form--dark .blx-form__note { color: rgba(255, 255, 255, 0.72); }
.blx-form--dark .blx-form__note b { color: #fff; }
.blx-form--dark .blx-form__error { color: #ffb4b4; }
.blx-form--dark .blx-form__state { border-color: rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06); box-shadow: none; }
.blx-form--dark .blx-state__head { color: #fff; }
.blx-form--dark .blx-state__p { color: rgba(255, 255, 255, 0.78); }
.blx-form--dark .blx-state__p b { color: #fff; }
.blx-form--dark .blx-state__link { color: #c7c9ff; }
.blx-form--dark .blx-state__again, .blx-form--dark .blx-state__again button { color: rgba(255, 255, 255, 0.6); }

/* ---------------------------------------------------------- sections */
.blx-section { padding: 4.5rem 0; }
.blx-section__head { max-width: 40rem; margin-bottom: 2.25rem; }
.blx-section + .blx-section { border-top: 1px solid var(--line); }

/* one page per block */
.blx-anatomy { background: var(--surface-2); }
.blx-anatomy__grid {
  display: grid; grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  gap: 3rem 4rem; align-items: center;
}
.blx-sheet { margin: 0; }
.blx-sheet img {
  display: block; width: 100%; height: auto;
  border-radius: 6px; background: #fff;
  box-shadow: 0 1px 0 rgba(26, 26, 46, 0.06), 0 22px 50px -18px rgba(26, 26, 46, 0.35), 0 8px 18px -8px rgba(26, 26, 46, 0.18);
  transform: rotate(-1.2deg);
}
.blx-sheet figcaption { margin-top: 1rem; font-size: 0.8rem; color: var(--muted); text-align: center; }
.blx-anatomy__list { list-style: none; margin: 1.75rem 0 0; padding: 0; display: grid; gap: 1.1rem; }
.blx-anatomy__list li { display: flex; gap: 0.9rem; align-items: flex-start; }
.blx-anatomy__list b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 0.15rem; }
.blx-anatomy__list span:not(.blx-anatomy__n) { display: block; color: var(--muted); font-size: 0.95rem; line-height: 1.55; }
.blx-anatomy__n {
  flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 0.9rem;
  background: var(--accent); color: #fff; margin-top: 0.1rem;
}

/* what's inside — parts + block chips */
.blx-parts__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
.blx-part {
  padding: 1.25rem 1.25rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  box-shadow: var(--shadow-sm);
}
.blx-part__head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.blx-part__num { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-strong); }
.blx-part__name { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.blx-part__why { margin: 0.4rem 0 0.9rem; font-size: 0.86rem; line-height: 1.5; color: var(--muted); }
.blx-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.blx-chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.6rem 0.3rem 0.45rem;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 0.82rem; font-weight: 600; color: var(--ink); line-height: 1.2;
  cursor: default; outline: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.blx-chip__n { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500; color: var(--muted); }
.blx-chip--indigo { background: #eef0fd; border-color: #d9dcfb; }
.blx-chip--indigo .blx-chip__n { color: var(--accent-strong); }
.blx-chip--teal { background: #eaf7f4; border-color: #cdebe4; }
.blx-chip--teal .blx-chip__n { color: #2a8f80; }
.blx-chip--amber { background: #fdf3e6; border-color: #f7dfbf; }
.blx-chip--amber .blx-chip__n { color: #b8721c; }
.blx-chip:hover, .blx-chip:focus-visible { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); z-index: 3; }
.blx-chip__tip {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px);
  padding: 0.4rem 0.6rem; border-radius: 8px;
  background: var(--c-ink); color: #fff; font-size: 0.75rem; font-weight: 500; line-height: 1.35;
  white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.blx-chip__tip::after { content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--c-ink); }
.blx-chip:hover .blx-chip__tip, .blx-chip:focus-visible .blx-chip__tip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* who it's for */
.blx-who__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.blx-who__card { padding: 1.5rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.blx-who__card h3 { margin: 0 0 0.5rem; font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; line-height: 1.3; color: var(--ink); }
.blx-who__card p { margin: 0; font-size: 0.95rem; line-height: 1.6; color: var(--muted); }

/* author */
.blx-author { background: var(--surface-2); }
.blx-author__row { display: flex; gap: 1.75rem; align-items: center; }
.blx-author__photo {
  flex: 0 0 auto; width: 112px; height: 112px; border-radius: 50%;
  object-fit: cover; object-position: 62% 8%;
  background: radial-gradient(circle at 50% 30%, #eceefe, #d9dcfb); box-shadow: var(--shadow);
}
.blx-author__name { margin: 0 0 0.5rem; font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; color: var(--ink); }

/* faq */
.blx-faq__wrap { max-width: 46rem; }
.blx-faq__list { display: grid; gap: 0.6rem; margin-top: 1.5rem; }
.blx-faq__item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; padding: 0 1.1rem; }
.blx-faq__item summary {
  cursor: pointer; list-style: none; padding: 0.95rem 0; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.blx-faq__item summary::-webkit-details-marker { display: none; }
.blx-faq__item summary::after {
  content: '+'; flex: 0 0 auto; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  display: grid; place-items: center; font-weight: 500; color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 10%, transparent); transition: transform 0.2s ease;
}
.blx-faq__item[open] summary::after { transform: rotate(45deg); }
.blx-faq__item p { margin: 0 0 1rem; color: var(--muted); line-height: 1.6; font-size: 0.95rem; }

/* final band */
.blx-final { padding-top: 1rem; }
.blx-final__band {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 2.5rem; align-items: center;
  padding: 2.75rem 3rem;
  border-radius: var(--radius); background: var(--surface-ink); color: var(--c-paper);
  box-shadow: var(--shadow);
}
.blx-final__band::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(700px 300px at 15% 110%, rgba(99, 102, 241, 0.35), transparent 65%);
}
.blx-final__art { position: relative; }
.blx-final__art img { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: 0 20px 40px -14px rgba(0, 0, 0, 0.6); transform: rotate(-4deg); }
.blx-final__copy { position: relative; }
.blx-final__copy h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin: 0 0 0.5rem; }
.blx-final__copy > p { color: rgba(255, 255, 255, 0.74); margin: 0 0 1.4rem; max-width: 36rem; line-height: 1.55; }

/* sticky mobile CTA */
.blx-sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: none; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
  background: rgba(255, 254, 247, 0.92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  transform: translateY(100%); transition: transform 0.25s ease;
}
.blx-sticky.is-on { transform: none; }
.blx-sticky__txt { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.blx-sticky__btn { padding: 0.6rem 1.1rem; font-size: 0.9rem; }

/* ------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .blx-parts__grid, .blx-who__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blx-anatomy__grid { grid-template-columns: minmax(220px, 340px) minmax(0, 1fr); gap: 2rem; }
}
@media (max-width: 800px) {
  .blx-hero { padding: 1rem 0 2.5rem; }
  .blx-hero__grid { grid-template-columns: 1fr; gap: 0.75rem; }
  /* Book first, but small: the form has to stay inside the first screen. */
  .blx-hero__art { order: -1; padding: 0.25rem 0 0; }
  .blx-hero__art .bk3d { width: min(42vw, 176px); }
  .blx-hero__art .book-peek { font-size: 0.74rem; padding: 0.36rem 0.7rem; bottom: 12%; }
  .blx-hero__copy { max-width: none; text-align: left; }
  .blx-h1 { font-size: clamp(2.1rem, 9.5vw, 2.6rem); margin: 0.6rem 0 0.6rem; }
  .blx-lede { font-size: 1rem; margin-bottom: 1.1rem; }
  .blx-form__note { font-size: 0.8rem; }
  .blx-form__row { flex-direction: column; }
  .blx-submit { width: 100%; }
  .blx-section { padding: 3.25rem 0; }
  .blx-anatomy__grid { grid-template-columns: 1fr; }
  .blx-sheet { max-width: 340px; margin: 0 auto; }
  .blx-final__band { grid-template-columns: 1fr; padding: 2rem 1.5rem; gap: 1.5rem; }
  .blx-final__art { display: none; }
  .blx-sticky { display: flex; }
  .blx { padding-bottom: 3.5rem; }
}
@media (max-width: 560px) {
  .blx-parts__grid, .blx-who__grid { grid-template-columns: 1fr; }
  .blx-author__row { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .blx-chip, .blx-chip__tip, .blx-sticky, .blx-faq__item summary::after { transition: none; }
}
