/**
 * Style Purpose: Products page — page-scoped layout, walkthrough sticky-scroll,
 *                quiz card, deployment tiles, CTA. All scoped
 *                under .products-wrapper or page-specific class names.
 * Author: By Default
 * Created: 2026-05-02
 * Version: 0.1.0
 * Last Updated: 2026-05-02
 *
 * Tokens only — no primitives, no hardcoded radii.
 * Square corners across new components per design direction.
 */


/* ------ PAGE HERO ------ */

.products-intro .page-title,
.products-quiz .page-title,
.products-deployment .page-title {
  letter-spacing: -0.01em;
}


/* ------ WALKTHROUGH (sticky-scroll image swap) ------ */

.products-walkthrough .section-content {
  align-items: start;
}

/* -- Text column -- */
.walkthrough-text {
  display: flex;
  flex-direction: column;
}

.product-section {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
  scroll-margin-top: calc(var(--studio-bar-height) + var(--space-l));
  padding: 0 var(--space-2xl);
}

/* -- Mobile inline video (hidden on desktop) -- */
.walkthrough-mobile-image {
  display: none;
  background-color: var(--background-black);
  padding: var(--space-m);
  border-radius: var(--radius-s);
  margin-bottom: var(--space-xl);
}

/* -- Product number (label-styled chapter mark above heading) -- */
.product-number {
  margin: 0;
}

.product-name {
  margin: 0;
  font-size: var(--headline-size);
  font-weight: var(--headline-weight);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.product-tagline {
  margin: 0;
  font-size: var(--font-3xl);
  font-weight: var(--font-weight-light);
  line-height: 1.2;
  color: var(--text-secondary);
}

.product-description {
  max-width: 45ch;
}

/* Use-case list — disc marker swapped for the brand check icon.
   Source: assets/images/svg-icons/check.svg (also #check in the sprite). */
.use-case-list {
  list-style: none;
  padding-left: 0;
}

.use-case {
  display: flex;
  align-items: baseline;
  gap: var(--space-s);
}

.use-case::before {
  content: "";
  flex: 0 0 0.9em;
  align-self: center;
  height: 0.9em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M9.54998 18L3.84998 12.3L5.27498 10.875L8.13576 13.7358C8.91681 14.5168 10.1831 14.5168 10.9642 13.7358L18.725 5.97501L20.15 7.40001L9.54998 18Z'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M9.54998 18L3.84998 12.3L5.27498 10.875L8.13576 13.7358C8.91681 14.5168 10.1831 14.5168 10.9642 13.7358L18.725 5.97501L20.15 7.40001L9.54998 18Z'/></svg>") center / contain no-repeat;
}

/* -- Action row (single CTA per product) -- */
.product-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

/* -- Sticky image column (desktop) -- */
.walkthrough-image-col {
  position: sticky;
  top: calc(var(--studio-bar-height) + var(--studio-gap));
  height: calc(100vh - var(--studio-bar-height) - var(--studio-gap) * 2);
  align-self: start;
}

.walkthrough-image-stack {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--background-black);
  overflow: hidden;
  border-radius: var(--radius-s);
}

/* Each slot is a centring frame on black — its video sits full-width at its
   native ratio, vertically centred, with inside padding. Slots crossfade via
   .is-active (opacity), driven by initWalkthrough in products.js. */
.walkthrough-image {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  opacity: 0;
  transition: opacity var(--duration-m) var(--ease-out);
}

.walkthrough-image.is-active {
  opacity: 1;
}

/* Walkthrough video — full width, native aspect ratio kept (height:auto) so the
   whole video is always visible, never cropped. Centred by the flex parent on
   desktop; on mobile it defines the inline media height. */
.walkthrough-video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-s);
}

/* ------ QUIZ ------ */

/* Card is split into three vertical zones:
   .quiz-progress (top), .quiz-content (middle, flex-grow), .quiz-footer (bottom).
   Result: progress and footer never move when state changes; only the content
   panel swaps in/out. */


/* Full-width visual panel inside the section's inset. Holds the colour fill
   and rounded corners; the quiz-card inside is constrained for content. */
.products-quiz-wrapper {
  background-color: var(--background-faded);
  border-radius: var(--radius-s);
}

.quiz-card {
  padding: var(--space-3xl) var(--space-2xl);
  display: flex;
  flex-direction: column;
  text-align: center;
  align-items: center;
  /* Single width-constraint at the card level — inner zones flow to this. */
  max-width: 56rem;
  margin-inline: auto;
}

/* -- Progress stages -- */
.quiz-progress {
  display: flex;
  gap: var(--space-s);
  align-items: center;
  width: 100%;
}

.quiz-progress .stage {
  flex: 1;
  height: 2px;
  background-color: var(--background-darker);
  transition: background-color var(--duration-2xs) var(--ease-out);
}

.quiz-progress .stage.is-active {
  background-color: var(--text-primary);
}

/* -- Content + footer zones -- */
.quiz-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding-block: var(--space-2xl);
  /* Floor sized to the tallest pane (Q2 with 6 options + question + sublabel,
     ~16rem). Gives headroom so the active pane sits visually centred without
     the surrounding zones (progress / footer) shifting between states. */
  min-height: 24rem;
}

.quiz-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* -- Pane visibility — show only the pane matching the card's data-state. */
.quiz-card:not([data-state="idle"])   [data-quiz-pane="idle"],
.quiz-card:not([data-state="quiz"])   [data-quiz-pane="quiz"],
.quiz-card:not([data-state="result"]) [data-quiz-pane="result"] {
  display: none;
}

/* Within the quiz state, JS toggles [hidden] on individual .quiz-step
   elements so only the active step renders. */
.quiz-step[hidden] {
  display: none;
}

/* -- Idle -- */
.quiz-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-l);
  width: 100%;
}

.quiz-intro .page-title {
  margin: 0;
  font-size: var(--font-8xl);
}

/* -- Question + options -- */
.quiz-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
  width: 100%;
}

.quiz-question {
  margin: 0;
  font-size: var(--font-4xl);
  font-weight: var(--font-weight-light);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  max-width: 36rem;
}

/* Sub-label sits tight under the question — clarifies single vs multi. */
.quiz-sublabel {
  margin: calc(-1 * var(--space-m)) 0 0;
  font-size: var(--font-s);
  color: var(--text-faded);
}

/* Grid layout — column count per step. The .quiz-step min-height (above)
   keeps the .quiz-nav row at the same Y across questions; the options
   container itself sizes to its rows. */
.quiz-options {
  display: grid;
  gap: var(--space-m);
  width: 100%;
}

/* Per-step grid — chosen so every step lays out as a clean rectangle. The
   "Not sure yet" filler in Q2 + Q4 keeps the grid full (no orphans). */
.quiz-step[data-step="1"] .quiz-options,
.quiz-step[data-step="4"] .quiz-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* 4 items → 2×2 */
}

.quiz-step[data-step="2"] .quiz-options,
.quiz-step[data-step="3"] .quiz-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));   /* Q2: 6 items → 3×2; Q3: 3 items → 1×3 */
}

.quiz-option {
  appearance: none;
  display: flex;
  align-items: center;
  gap: var(--space-m);
  padding: var(--space-l) var(--space-xl);
  /* Floor so 1-line and 2-line labels render at the same height in a row. */
  min-height: 5rem;
  background-color: var(--background-plain);
  border: var(--border-s) solid var(--border-faded);
  border-radius: var(--radius-s);
  font-family: var(--font-primary);
  font-size: var(--font-m);
  text-align: left;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--duration-s) var(--ease-out),
              border-color var(--duration-s) var(--ease-out),
              color var(--duration-s) var(--ease-out);
}

/* Indicator — uses brand icons via mask-image so its colour follows the
   button's selection state. Mask shape is per-mode: circled (circle ring)
   for single-select, squared (square ring) for multi-select. Selected state
   swaps to check-circled / check-squared (ring shape stays present, check
   added inside). The mask shape is the entire visual — no border on
   ::before. Honors the form-field convention (square = pick many, circle =
   pick one) before the user reads the sublabel. */
.quiz-option::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background-color: var(--border-faded);
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  transition: background-color var(--duration-2xs) var(--ease-out);
}

/* Single-select unselected: circled (circle ring). */
.quiz-step[data-select="single"] .quiz-option::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M22 12C22 6.47713 17.5229 1.99998 12 1.99998C6.47715 1.99998 2 6.47714 2 12C2 17.5229 6.47715 22 12 22C17.5229 22 22 17.5229 22 12ZM24 12C24 18.6275 18.6275 24 12 24C5.37259 24 0 18.6275 0 12C0 5.37257 5.37258 0 12 0C18.6275 0 24 5.37257 24 12Z' fill='black'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M22 12C22 6.47713 17.5229 1.99998 12 1.99998C6.47715 1.99998 2 6.47714 2 12C2 17.5229 6.47715 22 12 22C17.5229 22 22 17.5229 22 12ZM24 12C24 18.6275 18.6275 24 12 24C5.37259 24 0 18.6275 0 12C0 5.37257 5.37258 0 12 0C18.6275 0 24 5.37257 24 12Z' fill='black'/></svg>");
}

/* Multi-select unselected: squared (square ring). */
.quiz-step[data-select="multi"] .quiz-option::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M22 4C22 2.89543 21.1046 2 20 2H4C2.89543 2 2 2.89543 2 4V20C2 21.1046 2.89543 22 4 22H20C21.1046 22 22 21.1046 22 20V4ZM24 24H0V0H24V24Z' fill='black'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M22 4C22 2.89543 21.1046 2 20 2H4C2.89543 2 2 2.89543 2 4V20C2 21.1046 2.89543 22 4 22H20C21.1046 22 22 21.1046 22 20V4ZM24 24H0V0H24V24Z' fill='black'/></svg>");
}

.quiz-option:hover {
  border-color: var(--text-primary);
}

.quiz-option:focus-visible {
  outline: var(--border-s) solid var(--text-primary);
  outline-offset: 2px;
}

/* Selected fill — applies to both single (aria-checked) and multi (aria-pressed). */
.quiz-option.is-selected,
.quiz-option[aria-checked="true"],
.quiz-option[aria-pressed="true"] {
  background-color: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--background-plain);
}

/* Single-select selected indicator: check-circled (filled circle with check). */
.quiz-step[data-select="single"] .quiz-option[aria-checked="true"]::before {
  background-color: var(--background-plain);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M19.1504 8.40039L10.5498 17L5.84961 12.2998L7.27539 10.875L9.13574 12.7354C9.91679 13.5164 11.1828 13.5164 11.9639 12.7354L17.7246 6.97461L19.1504 8.40039Z' fill='black'/><path fill-rule='evenodd' clip-rule='evenodd' d='M12 0C18.6274 0 24 5.37258 24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z' fill='black'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M19.1504 8.40039L10.5498 17L5.84961 12.2998L7.27539 10.875L9.13574 12.7354C9.91679 13.5164 11.1828 13.5164 11.9639 12.7354L17.7246 6.97461L19.1504 8.40039Z' fill='black'/><path fill-rule='evenodd' clip-rule='evenodd' d='M12 0C18.6274 0 24 5.37258 24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z' fill='black'/></svg>");
}

/* Multi-select selected indicator: check-squared (square ring + check). */
.quiz-step[data-select="multi"] .quiz-option[aria-pressed="true"]::before {
  background-color: var(--background-plain);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M19.1504 8.40039L10.5498 17L5.84961 12.2998L7.27539 10.875L9.13574 12.7354C9.91679 13.5164 11.1828 13.5164 11.9639 12.7354L17.7246 6.97461L19.1504 8.40039Z' fill='black'/><path fill-rule='evenodd' clip-rule='evenodd' d='M24 24H0V0H24V24ZM4 2C2.89543 2 2 2.89543 2 4V20C2 21.1046 2.89543 22 4 22H20C21.1046 22 22 21.1046 22 20V4C22 2.89543 21.1046 2 20 2H4Z' fill='black'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M19.1504 8.40039L10.5498 17L5.84961 12.2998L7.27539 10.875L9.13574 12.7354C9.91679 13.5164 11.1828 13.5164 11.9639 12.7354L17.7246 6.97461L19.1504 8.40039Z' fill='black'/><path fill-rule='evenodd' clip-rule='evenodd' d='M24 24H0V0H24V24ZM4 2C2.89543 2 2 2.89543 2 4V20C2 21.1046 2.89543 22 4 22H20C21.1046 22 22 21.1046 22 20V4C22 2.89543 21.1046 2 20 2H4Z' fill='black'/></svg>");
}

/* -- Shared Prev/Next row -- */
.quiz-nav {
  display: flex;
  gap: var(--space-m);
  justify-content: center;
  flex-wrap: wrap;
}

/* -- Result -- */
.quiz-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
  width: 100%;
}

.result-intro {
  margin: 0;
  font-size: var(--font-l);
  color: var(--text-faded);
}

/* Adaptive product grid — 1, 2, or 3 cards via data-count. */
.quiz-result-products {
  display: grid;
  gap: var(--space-l);
  width: 100%;
}

.quiz-result-products[data-count="1"] {
  grid-template-columns: 1fr;
  max-width: 24rem;
  margin-inline: auto;
}

.quiz-result-products[data-count="2"] {
  grid-template-columns: repeat(2, 1fr);
}

.quiz-result-products[data-count="3"] {
  grid-template-columns: repeat(3, 1fr);
}

/* Recommended card — horizontal thumb + stacked text on the right. */
.recommended-card {
  padding: var(--space-m);
  background-color: var(--background-plain);
  border: var(--border-s) solid var(--border-faded);
  display: flex;
  align-items: center;
  gap: var(--space-m);
  text-align: left;
}

.recommended-card .card-thumb {
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  background-color: var(--background-darker);
  overflow: hidden;
}

.recommended-card .card-thumb > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recommended-card .card-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.recommended-card .name {
  font-size: var(--font-xl);
  font-weight: var(--font-weight-light);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.recommended-card .tagline {
  margin: 0;
  font-size: var(--font-s);
  line-height: var(--line-height-l);
  color: var(--text-secondary);
}

/* Asset advice + deployment summary sentence. */
.quiz-result-advice {
  margin: 0;
  font-size: var(--font-m);
  line-height: var(--line-height-l);
  color: var(--text-secondary);
  max-width: 50ch;
}

/* Footer actions — same layout for idle (1 button), quiz (Prev/Next),
   and result (Start a project / Start over). */
.quiz-actions {
  display: flex;
  gap: var(--space-m);
  flex-wrap: wrap;
  justify-content: center;
}


/* ------ DEPLOYMENT TILES ------ */

.deployment-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: var(--studio-gap);
  row-gap: var(--space-xl);
}

.deployment-tile {
  padding: var(--space-2xl);
  border-right: var(--border-s) solid var(--border-faded);
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

.deployment-tile-title {
  margin: 0;
  font-size: var(--font-3xl);
  font-weight: var(--font-weight-light);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.deployment-tile-copy {
  margin: 0;
  font-size: var(--font-m);
  line-height: var(--line-height-l);
  color: var(--text-secondary);
}


/* ------ MOBILE OVERRIDES ------ */

@media (max-width: 768px) {
  .walkthrough-image-col {
    display: none;
  }

  .walkthrough-mobile-image {
    display: block;
  }

  .product-section {
    min-height: auto;
    padding: var(--space-3xl) 0;
    gap: var(--space-m);
  }

  .product-name {
    font-size: var(--font-5xl);
  }

  .product-tagline {
    font-size: var(--font-2xl);
  }

  .quiz-card {
    padding: var(--space-2xl) var(--space-l);
    /* Phone screens are taller than wide — drop the desktop floor so the
       card sizes to its content. Q2's 5 stacked options fill it anyway. */
    min-height: 0;
  }

  /* Collapse all per-step grids to a single column on mobile. */
  .quiz-step[data-step="1"] .quiz-options,
  .quiz-step[data-step="2"] .quiz-options,
  .quiz-step[data-step="3"] .quiz-options,
  .quiz-step[data-step="4"] .quiz-options {
    grid-template-columns: 1fr;
  }

  /* Reset the Q2 orphan span so the 5th option behaves like the rest. */
  .quiz-step[data-step="2"] .quiz-options > .quiz-option:last-child:nth-child(odd) {
    grid-column: auto;
    justify-self: stretch;
    width: 100%;
  }

  .quiz-option {
    width: 100%;
  }

  .quiz-result-products,
  .quiz-result-products[data-count="2"],
  .quiz-result-products[data-count="3"] {
    grid-template-columns: 1fr;
    max-width: 24rem;
    margin-inline: auto;
  }

  .deployment-tiles {
    grid-template-columns: 1fr;
  }

  .deployment-tile {
    padding: var(--space-xl);
  }
}
