/* Section 12 — Instructions (standalone /instructions view).
   Layout: page header → optional hero banner → numbered step list with
   alternating zigzag (image left/right) → important note callout → CTA.
*/

.s-instr {
  --instr-num-size: 88px;
  --instr-accent: var(--accent, #e5394a);
  --instr-card-radius: 18px;
  padding-block: clamp(2.5rem, 6vw, 5rem);
}

/* Constrain inner blocks to a comfortable reading width without losing
   the section's full-bleed background. */
.s-instr .container {
  max-width: 1080px;
}

/* ---------- HEADER ---------- */
.s-instr__head {
  text-align: center;
  margin-bottom: clamp(2rem, 5vw, 3.2rem);
}
.s-instr__head .eyebrow {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--instr-accent);
}
.s-instr__title {
  font-size: clamp(2.25rem, 5.4vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0.65rem 0 1rem;
  font-weight: 800;
}
.s-instr__lead {
  margin: 0 auto;
  max-width: 660px;
  color: var(--text-muted);
  line-height: 1.65;
  font-size: clamp(1rem, 1.4vw, 1.1rem);
}

/* ---------- HERO BANNER (optional) ---------- */
.s-instr__hero {
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
  border-radius: var(--instr-card-radius);
  overflow: hidden;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  aspect-ratio: 16 / 7;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.s-instr__hero[hidden] { display: none; }
.s-instr__hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- STEPS LIST ---------- */
/* margin-block only — using shorthand `margin: 0` would override the
   margin-left/right: auto from the .container utility class and pin the
   list to the viewport's left edge (only the first ~50% would show). */
.s-instr__steps {
  list-style: none;
  margin-block: 0;
  padding: 0;
  display: grid;
  gap: clamp(1.5rem, 3.5vw, 2.4rem);
}

/* Each step is a 3-column grid: number column (auto) | content (1fr) | art (340px).
   Even-indexed steps (2nd, 4th, ...) flip art to the LEFT for visual rhythm. */
.s-instr__step {
  position: relative;
  display: grid;
  grid-template-columns: var(--instr-num-size) minmax(0, 1fr) 340px;
  gap: clamp(1rem, 2.5vw, 1.8rem);
  align-items: center;
  padding: clamp(1.5rem, 2.8vw, 2.1rem);
  border-radius: var(--instr-card-radius);
  background-color: var(--bg-elevated, #fff);
  /* Subtle gradient + ring so cards stand out on light backgrounds where
     a single 1px border barely registers. */
  background-image: linear-gradient(180deg,
                    rgba(229, 57, 74, 0.02) 0%,
                    transparent 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 6px 18px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.s-instr__step:hover {
  transform: translateY(-3px);
  border-color: rgba(229, 57, 74, 0.45);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 16px 40px rgba(229, 57, 74, 0.16);
}

/* Zigzag — every even step puts the art on the left */
.s-instr__step:nth-child(even) {
  grid-template-columns: 340px minmax(0, 1fr) var(--instr-num-size);
}
.s-instr__step:nth-child(even) .s-instr__step-num {
  order: 3;
}
.s-instr__step:nth-child(even) .s-instr__step-content {
  order: 2;
}
.s-instr__step:nth-child(even) .s-instr__step-art {
  order: 1;
}

/* ---- Number badge ---- */
.s-instr__step-num {
  width: var(--instr-num-size);
  height: var(--instr-num-size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ff5a6e 0%, var(--instr-accent) 55%, #b3142a 100%);
  color: #fff;
  box-shadow:
    0 8px 22px rgba(229, 57, 74, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  position: relative;
}
/* Subtle outer halo */
.s-instr__step-num::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(229, 57, 74, 0.18), transparent 70%);
  z-index: -1;
}
.s-instr__step-num-text {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum' 1;
}

/* ---- Step text ---- */
.s-instr__step-content { min-width: 0; }
.s-instr__step-title {
  font-size: clamp(1.2rem, 1.9vw, 1.45rem);
  margin: 0 0 0.55rem;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.s-instr__step-desc {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-muted);
}
/* Markdown-rendered children (links + bold accents from content-bridge) */
.s-instr__step-desc a {
  color: var(--instr-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  font-weight: 600;
  transition: color 0.2s ease;
}
.s-instr__step-desc a:hover { color: #ff7a8a; }
.s-instr__step-desc strong {
  color: var(--text-primary, var(--text));
  font-weight: 700;
}
.s-instr__step-desc strong.is-accent {
  color: var(--instr-accent);
}

/* ---- Per-step important note (rendered by content-bridge if step.note) ---- */
.s-instr__step-note {
  margin-top: 0.9rem;
  padding: 0.7rem 0.95rem;
  border-radius: 10px;
  background-color: rgba(229, 57, 74, 0.07);
  border-left: 3px solid var(--instr-accent);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}
.s-instr__step-note strong {
  color: var(--instr-accent);
  margin-right: 0.35rem;
  font-weight: 700;
}

/* ---- Step image ----
   Square 1:1 tile across every breakpoint so the gallery feels balanced
   no matter what the operator uploads. `object-fit: cover` guarantees
   the source image always fills the tile without distortion — portrait,
   landscape, or square sources are centred and cropped to fit. */
.s-instr__step-art {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  background-color: var(--bg-base, #0a0a0a);
  border: 1px solid var(--border);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}
.s-instr__step-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.s-instr__step-img[hidden] { display: none; }
/* Collapse art panel completely when no image is provided — keeps text-only
   steps tight without a phantom empty box. */
.s-instr__step:not(:has(.s-instr__step-img:not([hidden]))) {
  grid-template-columns: var(--instr-num-size) minmax(0, 1fr);
}
.s-instr__step:nth-child(even):not(:has(.s-instr__step-img:not([hidden]))) {
  grid-template-columns: minmax(0, 1fr) var(--instr-num-size);
}
.s-instr__step:not(:has(.s-instr__step-img:not([hidden]))) .s-instr__step-art {
  display: none;
}

/* ---------- DESCRIPTION BLOCK (Description 1 & 2) ---------- */
/* Two long-form blocks rendered between Heading→Steps and Steps→Footer.
   Vertical stack: optional Main Image hero (full-width) → markdown body
   centred for readability. Body may contain inline images via
   `![alt](url)`, rendered as full-width <figure> elements. */
.s-instr__desc {
  margin-block: clamp(2.4rem, 5vw, 3.6rem);
  max-width: 820px;
  margin-inline: auto;
}
.s-instr__desc[hidden] { display: none; }

/* ---- Main Image hero (top of desc block) ---- */
.s-instr__desc-hero {
  margin: 0 0 clamp(1.2rem, 2.5vw, 1.8rem);
  border-radius: var(--instr-card-radius);
  overflow: hidden;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}
.s-instr__desc-hero[hidden] { display: none; }
.s-instr__desc-hero-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.s-instr__desc-hero-caption {
  padding: 0.7rem 1rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  border-top: 1px solid var(--border);
  background-color: rgba(255, 255, 255, 0.02);
}
.s-instr__desc-hero-caption[hidden] { display: none; }

/* ---- Markdown body ---- */
.s-instr__desc-body {
  color: var(--text);
  font-size: clamp(1rem, 1.35vw, 1.075rem);
  line-height: 1.75;
}
.s-instr__desc-body > *:first-child { margin-top: 0; }
.s-instr__desc-body > *:last-child  { margin-bottom: 0; }
.s-instr__desc-body p {
  margin: 0 0 0.95em;
}
.s-instr__desc-body ul {
  margin: 0 0 1em;
  padding-left: 1.4rem;
  list-style: disc;
}
.s-instr__desc-body li {
  margin-bottom: 0.35em;
}
.s-instr__desc-body li:last-child { margin-bottom: 0; }
.s-instr__desc-body strong {
  color: var(--text);
  font-weight: 700;
}
.s-instr__desc-body strong.is-accent { color: var(--instr-accent); }
.s-instr__desc-body em {
  font-style: italic;
  color: var(--text);
  opacity: 0.92;
}
.s-instr__desc-body a {
  color: var(--instr-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity 0.15s ease;
}
.s-instr__desc-body a:hover { opacity: 0.78; }

/* ---- Inline images inside body (![alt](url)) ---- */
/* Block-level figure (own paragraph): full-width within reading column,
   rounded, with caption from alt text. */
.s-instr__desc-body .md-figure {
  margin: 1.6em 0;
  border-radius: 14px;
  overflow: hidden;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.s-instr__desc-body .md-figure > .md-img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.s-instr__desc-body .md-figure > figcaption {
  padding: 0.6rem 0.9rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  border-top: 1px solid var(--border);
}
/* Inline image inside a paragraph (text + image on same line) — sits
   inline-block at max line height, no figure wrapper. */
.s-instr__desc-body p > .md-img {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 0.2em 0.3em;
}

/* ---------- FOOTER NOTE CALLOUT ---------- */
.s-instr__note {
  margin-top: clamp(2rem, 4vw, 3rem);
  padding: 1.2rem 1.4rem;
  border-radius: 14px;
  background: linear-gradient(135deg,
              rgba(229, 57, 74, 0.08),
              rgba(229, 57, 74, 0.03));
  border: 1px solid rgba(229, 57, 74, 0.28);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  align-items: start;
  font-size: 0.95rem;
  line-height: 1.65;
}
.s-instr__note-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background-color: rgba(229, 57, 74, 0.15);
  color: var(--instr-accent);
  flex-shrink: 0;
}
.s-instr__note-body { color: var(--text); }
.s-instr__note-label {
  color: var(--instr-accent);
  font-weight: 700;
  margin-right: 0.4rem;
}

/* ---------- CTA BLOCK ---------- */
.s-instr__cta {
  margin-top: clamp(2.2rem, 4.5vw, 3.2rem);
  text-align: center;
}
.s-instr__cta-btn {
  min-width: 240px;
  font-size: 1rem;
  padding: 0.95rem 2.2rem;
  letter-spacing: 0.02em;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(229, 57, 74, 0.32);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.s-instr__cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(229, 57, 74, 0.42);
}
.s-instr__cta-note {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .s-instr {
    --instr-num-size: 72px;
  }
  .s-instr__desc {
    margin-block: clamp(1.8rem, 4vw, 2.5rem);
  }
  .s-instr__desc-body { font-size: 0.98rem; line-height: 1.7; }
  .s-instr__step,
  .s-instr__step:nth-child(even) {
    grid-template-columns: var(--instr-num-size) minmax(0, 1fr);
    gap: 1rem 1.2rem;
    padding: 1.3rem;
  }
  .s-instr__step-art {
    grid-column: 1 / -1;
    /* Square ratio carries over from the base rule; mobile just needs the
       full-width grid-column + visual ordering tweaks. */
    margin-top: 0.4rem;
    order: 99 !important;
  }
  .s-instr__step-num,
  .s-instr__step:nth-child(even) .s-instr__step-num {
    order: 1 !important;
  }
  .s-instr__step-content,
  .s-instr__step:nth-child(even) .s-instr__step-content {
    order: 2 !important;
  }
  .s-instr__step-num-text { font-size: 1.5rem; }
}

@media (max-width: 560px) {
  .s-instr {
    --instr-num-size: 56px;
  }
  .s-instr__step,
  .s-instr__step:nth-child(even) {
    grid-template-columns: var(--instr-num-size) minmax(0, 1fr);
    gap: 0.85rem 0.95rem;
    padding: 1.1rem;
  }
  .s-instr__step-num-text { font-size: 1.2rem; }
  .s-instr__step-title { font-size: 1.1rem; }
  .s-instr__step-desc { font-size: 0.95rem; }
  .s-instr__cta-btn { width: 100%; min-width: 0; }
  .s-instr__note {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .s-instr__note-icon { display: none; }
}

/* ---------- View switching — per-route visibility ---------- */
body[data-view="home"] #sec-12,
body[data-view="products"] #sec-12,
body[data-view="product-detail"] #sec-12,
body[data-view="before-after"] #sec-12 { display: none; }

body[data-view="instructions"] #sec-02,
body[data-view="instructions"] #sec-03,
body[data-view="instructions"] #sec-04,
body[data-view="instructions"] #sec-05,
body[data-view="instructions"] #sec-07,
body[data-view="instructions"] #sec-07b,
body[data-view="instructions"] #sec-08,
body[data-view="instructions"] #sec-09,
body[data-view="instructions"] #sec-11 { display: none; }
