/* ==========================================================================
   Clean, Sharp Editorial Guide UI — Revolt Electric
   High-contrast warm paper surface (#F5F3EE) with crisp dark hero & borders
   ========================================================================== */

html:has(.installation-story-page) {
  background: #f5f3ee;
  color: #171918;
}

.installation-story-page {
  background: #f5f3ee;
  color: #171918;
  font-family: Jakarta, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.story-width {
  width: min(1080px, 90%);
  margin-inline: auto;
}

/* Sticky Top Bar */
.story-nav {
  min-height: 76px;
  padding: 14px max(5%, calc((100% - 1080px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #141515;
  color: #f5f2eb;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 25;
}

.story-back {
  font-size: 13px;
  font-weight: 600;
  color: #f5f2eb;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  transition: background 150ms ease, border-color 150ms ease;
}

.story-back:hover {
  background: rgba(253, 103, 18, 0.15);
  border-color: #fd6712;
}

.story-back span {
  color: #fd6712;
}

/* Sharp Dark Hero Band (Preserves required hero background check) */
.story-opening.story-width {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: center;
  grid-template-columns: minmax(0, 56%) 1fr;
  width: 100%;
  min-height: clamp(440px, 52vh, 580px);
  margin: 0;
  padding: clamp(56px, 6vw, 88px) max(5%, calc((100% - 1080px) / 2));
  background-color: #141515;
  color: #f5f2eb;
  border-bottom: 3px solid #fd6712;
}

.story-opening::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 46%;
  background:
    linear-gradient(90deg, #141515 0%, rgba(20, 21, 21, 0.88) 18%, rgba(20, 21, 21, 0.25) 58%, rgba(20, 21, 21, 0.5) 100%),
    url("/img/installation-story/01-finished-charger.jpg") center 68% / cover no-repeat;
}

.story-opening > div {
  grid-column: 1;
}

.story-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fd6712;
  margin: 0 0 16px;
}

.story-opening h1 {
  font-size: clamp(38px, 4.2vw, 58px);
  line-height: 1.08;
  letter-spacing: -1.5px;
  margin: 0;
  color: #ffffff;
}

.story-opening h1 em {
  font-size: 1.08em;
  display: inline-block;
  margin-top: 4px;
  color: #f0e6d8;
}

.story-opening-copy {
  padding-top: 22px;
  max-width: 560px;
}

.story-opening-copy .story-deck {
  font-size: clamp(18px, 1.45vw, 21px);
  line-height: 1.5;
  color: #ffffff;
  font-weight: 600;
  margin: 0 0 16px;
}

.story-opening-copy p {
  font-size: 16px;
  line-height: 1.72;
  max-width: 540px;
  color: #d6d3cb;
  margin: 0 0 14px;
}

.story-opening-copy p:last-child {
  margin-bottom: 0;
}

/* Crisp White Spec Sheet Strip */
.story-specs {
  margin-top: 40px;
  margin-bottom: 48px;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #ffffff;
  border: 1px solid #dcd9d0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(17, 20, 19, 0.05);
}

.spec-cell {
  padding: 22px 20px;
  border-right: 1px solid #e6e3db;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-cell:last-child {
  border-right: 0;
}

.spec-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #c44900;
  margin-bottom: 2px;
}

.spec-cell strong {
  font-size: 17px;
  color: #141615;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.spec-cell span:not(.spec-label) {
  font-size: 13.5px;
  color: #4a504c;
  line-height: 1.5;
}

/* Section Headings */
.story-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 2px solid #171918;
}

.story-section-heading h2 {
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.8px;
  color: #141615;
  margin: 0;
}

.story-section-heading > span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #5a605c;
  white-space: nowrap;
}

/* Clean White Photo Cards (Uncropped & Sharp) */
.story-photography {
  padding: 0 0 56px;
}

.installation-story-page :is(.story-photography, .story-inline-gallery) .gallery-controls,
.installation-story-page :is(.story-photography, .story-inline-gallery) .gallery-heading {
  display: none;
}

.story-photography .gallery-track {
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-columns: unset;
  gap: 20px;
  overflow: visible;
}

.installation-story-page :is(.story-photography, .story-inline-gallery) .gallery-item {
  background: #ffffff;
  border: 1px solid #dcd9d0;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: default;
  box-shadow: 0 4px 14px rgba(17, 20, 19, 0.05);
}

.installation-story-page :is(.story-photography, .story-inline-gallery) .photo-frame {
  aspect-ratio: 3 / 4;
  background: #181a19;
  border: 1px solid #e2dfd7;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.installation-story-page :is(.story-photography, .story-inline-gallery) .photo-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.installation-story-page :is(.story-photography, .story-inline-gallery) .photo-number {
  z-index: 2;
  top: 8px;
  left: 8px;
  background: #141515;
  padding: 3px 7px;
  border-radius: 4px;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
}

.installation-story-page :is(.story-photography, .story-inline-gallery) .gallery-item .photo-caption {
  font-size: 15px;
  color: #141615;
  margin-top: 14px;
  padding: 0 4px 4px;
  line-height: 1.4;
}

.installation-story-page :is(.story-photography, .story-inline-gallery) .gallery-item .photo-caption strong {
  color: #141615;
  font-weight: 600;
}

.installation-story-page :is(.story-photography, .story-inline-gallery) .gallery-item .photo-subcaption {
  display: block;
  font-size: 13.5px;
  color: #4a504c;
  margin-top: 6px;
  line-height: 1.55;
  font-weight: 400;
}

/* Inline Detail Photos inside Guide Sections */
.installation-story-page .story-inline-gallery {
  margin: 28px 0;
  max-width: 440px;
}

.installation-story-page .story-inline-gallery .gallery-track {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-flow: row;
  grid-auto-columns: unset;
  gap: 0;
  overflow: visible;
}

.installation-story-page .story-inline-gallery .photo-frame {
  height: auto;
  aspect-ratio: 3 / 4;
}

.installation-story-page .story-inline-gallery[data-gallery-photos*=","] {
  max-width: none;
}

.installation-story-page .story-inline-gallery[data-gallery-photos*=","] .gallery-track {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

/* Centered, High-Readability Guide Chapters (Like a Modern Blog Post) */
.story-reading {
  background: #ffffff;
  border: 1px solid #dcd9d0;
  border-radius: 10px;
  padding: clamp(32px, 4.5vw, 52px);
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 40px;
  box-shadow: 0 4px 16px rgba(17, 20, 19, 0.04);
}

.story-margin {
  border-top: 3px solid #fd6712;
  padding-top: 12px;
  align-self: start;
}

.story-margin span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #c44900;
}

.story-margin p {
  font-size: 14px;
  font-weight: 600;
  margin: 6px 0 0;
  color: #171918;
  line-height: 1.45;
}

.story-prose {
  max-width: 720px;
}

.story-prose h2 {
  font-size: clamp(28px, 2.8vw, 36px);
  line-height: 1.18;
  letter-spacing: -0.8px;
  margin: 0 0 20px;
  color: #141615;
}

.story-prose h2 em {
  color: #2e4036;
}

.story-prose p {
  font-size: 17px;
  line-height: 1.8;
  color: #2c322e;
  margin: 0 0 18px;
}

.story-prose p strong {
  color: #141615;
  font-weight: 600;
}

.story-prose ul {
  margin: 22px 0 28px;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.story-prose li {
  margin: 0;
  padding: 18px 22px;
  background: #f8f7f3;
  border: 1px solid #e2dfd7;
  border-left: 4px solid #fd6712;
  border-radius: 6px;
  color: #2c322e;
  font-size: 16px;
  line-height: 1.72;
}

.story-prose li strong {
  color: #141615;
  font-weight: 600;
}

/* Crisp Step-by-Step Route Diagram */
.route-stepper {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 8px;
  margin: 28px 0 4px;
  padding: 18px;
  background: #f8f7f3;
  border: 1px solid #dcd9d0;
  border-radius: 8px;
}

.route-step {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e4e1d9;
  border-radius: 6px;
}

.route-step span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #c44900;
}

.route-step strong {
  font-size: 14px;
  color: #141615;
}

.route-step small {
  font-size: 12.5px;
  color: #4a504c;
  line-height: 1.45;
}

.route-arrow {
  color: #c44900;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  padding: 0 2px;
}

/* Action Links */
.story-inline-link {
  background: none;
  border: 0;
  border-bottom: 2px solid #fd6712;
  color: #141615;
  font: 600 14px/1.5 Jakarta, sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  text-align: left;
  min-height: 44px;
  cursor: pointer;
  margin-top: 6px;
}

.story-inline-link span {
  color: #c44900;
  transition: transform 160ms ease;
}

.story-inline-link:hover span {
  transform: translateX(4px);
}

/* Sharp Customer Review Card */
.story-testimonial {
  margin: 16px auto 56px;
  padding: clamp(32px, 4.5vw, 52px);
  background: #181a19;
  color: #f5f2eb;
  border-left: 5px solid #fd6712;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(17, 20, 19, 0.12);
}

.story-testimonial .story-kicker {
  color: #fd6712;
}

.story-testimonial blockquote {
  margin: 0;
  max-width: 860px;
}

.story-testimonial blockquote p {
  font: 500 clamp(22px, 2.3vw, 30px)/1.45 Cormorant, Georgia, serif;
  font-style: italic;
  color: #ffffff;
  letter-spacing: -0.2px;
  margin: 0 0 20px;
}

.story-testimonial blockquote footer {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
  align-items: baseline;
  color: #f5f2eb;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.story-testimonial blockquote footer span {
  font-size: 13px;
  color: #b8b5ac;
}

.story-testimonial .story-inline-link {
  margin-top: 16px;
  color: #ffffff;
}

.story-testimonial .story-inline-link span {
  color: #fd6712;
}

/* Bottom Q&A Grid */
.story-questions {
  padding: 0 0 56px;
}

.story-question-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.story-question-grid article {
  background: #ffffff;
  border: 1px solid #dcd9d0;
  border-radius: 8px;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: 0 4px 14px rgba(17, 20, 19, 0.04);
}

.story-question-number {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #c44900;
  display: block;
  margin-bottom: 12px;
}

.story-question-grid h3 {
  font-size: 20px;
  line-height: 1.32;
  letter-spacing: -0.3px;
  margin: 0 0 12px;
  color: #141615;
}

.story-question-grid p {
  font-size: 15px;
  line-height: 1.7;
  color: #363c38;
  margin: 0 0 18px;
}

.story-question-grid .story-inline-link {
  margin-top: auto;
}

/* Closing Call-to-Action Card */
.story-closing {
  margin: 0 auto 48px;
  padding: clamp(32px, 4vw, 48px);
  background: #141515;
  color: #f5f2eb;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.story-closing h2 {
  font-size: clamp(34px, 3.5vw, 48px);
  line-height: 1.08;
  color: #ffffff;
  margin: 0;
}

.story-closing p:not(.story-kicker) {
  font-size: 16px;
  line-height: 1.7;
  max-width: 420px;
  color: #d6d3cb;
  margin: 0 0 20px;
}

.story-primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  border: 1px solid #fd6712;
  border-radius: 6px;
  background: #fd6712;
  color: #141515;
  font-size: 14px;
  font-weight: 600;
  min-height: 50px;
  transition: background 160ms ease;
}

.story-primary span {
  color: #141515;
}

.story-primary:hover {
  background: #ff7828;
}

/* Footer */
.story-footer {
  border-top: 1px solid #d6d3c9;
  padding: 28px 0 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.story-footer > a {
  font-size: 13px;
  font-weight: 600;
  color: #141615;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #c8c5bc;
  background: #ffffff;
}

.story-footer > a span {
  color: #c44900;
}

.story-footer p {
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
  color: #555b57;
}

@media (max-width: 900px) {
  .spec-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .spec-cell {
    border-bottom: 1px solid #e6e3db;
  }
  .story-reading {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .story-margin {
    display: flex;
    align-items: baseline;
    gap: 12px;
  }
  .story-margin p {
    margin: 0;
  }
  .route-stepper {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .route-arrow {
    display: none;
  }
}

@media (max-width: 800px) {
  .story-width {
    width: auto;
    margin-inline: 18px;
  }
  .story-nav {
    padding: 12px 18px;
    min-height: 68px;
  }
  .story-opening.story-width {
    --photo-height: clamp(240px, 64vw, 360px);
    display: block;
    min-height: 0;
    margin: 0;
    padding: calc(var(--photo-height) - 36px) 18px 36px;
  }
  .story-opening::before {
    inset: 0 0 auto;
    height: var(--photo-height);
    background:
      linear-gradient(to bottom, transparent 40%, rgba(20, 21, 21, 0.5) 68%, #141515 95%),
      url("/img/installation-story/01-finished-charger.jpg") center 70% / cover no-repeat;
  }
  .story-opening h1 {
    font-size: clamp(34px, 8vw, 48px);
  }
  .spec-grid {
    grid-template-columns: 1fr;
  }
  .spec-cell {
    border-right: 0;
  }
  .story-section-heading {
    display: block;
  }
  .story-section-heading h2 {
    font-size: 26px;
    margin-bottom: 6px;
  }
  .story-photography .gallery-track {
    grid-template-columns: 1fr;
  }
  .story-reading {
    padding: 24px 20px;
  }
  .story-prose h2 {
    font-size: 26px;
  }
  .story-prose p {
    font-size: 16px;
  }
  .route-stepper {
    grid-template-columns: 1fr;
  }
  .story-testimonial {
    margin: 12px 18px 40px;
    padding: 28px 22px;
  }
  .story-testimonial blockquote p {
    font-size: 22px;
  }
  .story-question-grid {
    grid-template-columns: 1fr;
  }
  .story-closing {
    margin: 0 18px 36px;
    padding: 28px 22px;
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .story-primary {
    width: 100%;
  }
  .story-footer {
    display: block;
    padding: 24px 0 36px;
  }
  .story-footer p {
    margin-top: 14px;
  }
}

@media (max-width: 600px) {
  .installation-story-page .story-inline-gallery[data-gallery-photos*=","] .gallery-track {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-inline-link span,
  .story-primary {
    transition: none;
  }
}
