/* ==========================================================================
   MyRoomTool — home preview (hub services)
   Scoped overrides on top of blog foundation. Does not load styles.css.
   ========================================================================== */

.home-preview {
  --home-container-max: 1300px;
  --home-card-media-ratio: 630 / 370;
}

.home-preview .site-header__ask {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: none;
  min-width: 0;
  padding: var(--space-xs) var(--space-s);
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--duration-normal) var(--ease-standard),
    color var(--duration-normal) var(--ease-standard),
    border-color var(--duration-normal) var(--ease-standard);
}

/* Author display above must not defeat the HTML hidden attribute. */
.home-preview .site-header__ask[hidden] {
  display: none !important;
}

.home-preview .site-header__ask:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Header socials: desktop sits next to logo; mobile joins tools row. */
.home-preview .site-header__social {
  display: inline-flex;
  flex-shrink: 0;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  margin: 0;
  margin-inline-start: calc(var(--space-s) + 18px);
  padding: 0;
  list-style: none;
}

.home-preview .site-header__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  transition: opacity var(--duration-normal) var(--ease-standard);
}

.home-preview .site-header__social-link:hover {
  opacity: 0.8;
}

.home-preview .site-header__social-icon {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.home-preview .site-header__link-short {
  display: none;
}

@media (max-width: 768px) {
  .home-preview .site-header__bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand brand"
      "social tools"
      "nav nav";
    align-items: center;
    column-gap: var(--space-s);
    row-gap: var(--space-s);
  }

  .home-preview .site-header__brand {
    grid-area: brand;
  }

  .home-preview .site-header__social {
    grid-area: social;
    justify-self: start;
    align-self: center;
    margin-inline-start: 0;
    padding-inline-start: 0;
  }

  .home-preview .site-header__tools {
    grid-area: tools;
    justify-self: end;
    margin-inline-start: 0;
    gap: 6px;
  }

  .home-preview .site-header__nav {
    grid-area: nav;
    flex: none;
    order: unset;
    width: 100%;
    min-width: 0;
  }

  .home-preview .site-header__list {
    justify-content: space-between;
    gap: 4px 8px;
    flex-wrap: nowrap;
  }

  .home-preview .site-header__item {
    min-width: 0;
  }

  .home-preview .site-header__link {
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
  }

  .home-preview .site-header__link-full {
    display: none;
  }

  .home-preview .site-header__link-short {
    display: inline;
  }

  .home-preview .site-header__ask {
    width: auto;
    font-size: 12px;
    line-height: 1.25;
    padding: 6px 8px;
  }

  /* Equal gaps on the group; each hit-target hugs its icon (no per-icon offsets). */
  .home-preview .site-header__social {
    gap: 8px;
  }

  .home-preview .site-header__social-link {
    box-sizing: border-box;
    width: 16px;
    height: 28px;
    min-width: 0;
    padding: 0;
    justify-content: center;
  }

  .home-preview .site-header__social-icon {
    width: 16px;
    height: 16px;
  }
}

.home-preview .container {
  max-width: var(--home-container-max);
}

.home-preview__main {
  padding: var(--space-xl) 0 var(--space-xxl);
}

.home-preview__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-l);
  align-items: stretch;
}

.service-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  min-width: 0;
}

.service-card__media {
  position: relative;
  aspect-ratio: var(--home-card-media-ratio);
  overflow: hidden;
  background: var(--color-surface-muted);
}

.service-card__media img:not(.service-card__sale-banner),
.service-card__slide {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Horizontal example slideshow (3D plan + photo design). Badge + dots stay above track. */
.service-card__media--slider {
  --home-slide-duration: 0.55s;
}

.service-card__track {
  display: flex;
  height: 100%;
  width: 100%;
  transform: translateX(0);
  transition: transform var(--home-slide-duration) ease-in-out;
  will-change: transform;
}

.service-card__media--slider .service-card__slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.service-card__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.service-card__dot {
  pointer-events: auto;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.service-card__dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.service-card__dot.is-active::after,
.service-card__dot[aria-current="true"]::after {
  background: #fff;
  transform: scale(1.2);
}

.service-card__dot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -10px;
}

.service-card__promo {
  position: absolute;
  top: 26px;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: min(46%, 220px);
  pointer-events: none;
}

.service-card__badge {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 20px;
  background: rgba(34, 50, 69, 0.78);
  color: var(--color-on-secondary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: var(--font-semibold);
  line-height: 1.25;
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
  white-space: nowrap;
}

/* Standalone badges (free / soon) stay pinned without .service-card__promo. */
.service-card__media > .service-card__badge {
  position: absolute;
  top: 26px;
  left: 0;
  z-index: 2;
}

.service-card__badge--soon {
  background: rgba(121, 129, 138, 0.92);
}

.service-card__badge--sale {
  width: max-content;
  max-width: 100%;
}

.service-card__price-old {
  font-size: 0.88em;
  font-weight: var(--font-medium, 500);
  color: rgba(255, 255, 255, 0.72);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.service-card__price-new {
  font-size: 1.12em;
  font-weight: var(--font-bold, 700);
  color: #fff;
  letter-spacing: 0.01em;
}

.service-card__sale-banner {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left top;
  pointer-events: none;
  user-select: none;
}

.service-card__sale-banner[hidden] {
  display: none !important;
}

.service-card__promo:not(.is-sale) {
  gap: 0;
}

.service-card__price-old[hidden] {
  display: none !important;
}

/* Wide: copy ~2/3 | CTA ~1/3 side by side */
.service-card__body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(8.5rem, 1fr);
  gap: var(--space-m) var(--space-l);
  align-items: center;
  flex: 1 1 auto;
  padding: var(--space-m);
  min-width: 0;
}

.service-card__copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  min-width: 0;
}

.service-card__title {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: var(--text-h3-size);
  font-weight: var(--font-bold);
  line-height: var(--text-h3-leading);
}

.service-card__text {
  margin: 0;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--text-h5-size);
  font-weight: var(--font-regular);
  line-height: var(--text-h5-leading);
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.service-card__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  align-self: center;
  justify-self: stretch;
  width: 100%;
  min-width: 0;
}

.service-card__cta {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  line-height: 1.25;
  padding-left: 12px;
  padding-right: 12px;
}

/* Primary CTAs: uppercase at former how-it-works size (h6 = 14px) */
.home-preview .service-card__cta.btn {
  text-transform: uppercase;
  font-size: var(--text-h6-size);
  letter-spacing: 0.4px;
}

.service-card__cta.btn:disabled,
.service-card__cta.btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--color-text-muted);
  border-color: transparent;
  color: var(--color-on-secondary);
}

/* Matches site .btn-how-it-works (#223245) without loading styles.css */
.service-card__how {
  width: 100%;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-secondary);
  color: var(--color-on-secondary);
  font-family: var(--font-body);
  /* Sentence case, quieter than primary CTA (h6 → h7) */
  font-size: var(--text-h7-size);
  font-weight: var(--font-semibold);
  letter-spacing: 0.15px;
  text-transform: none;
  line-height: 1.3;
  white-space: normal;
  cursor: pointer;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.service-card__how:hover {
  background: var(--color-secondary-hover);
}

.service-card__how:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Scoped video modal (same idea as index video-modal, local only) */
.home-preview-video-modal {
  display: none;
  position: fixed;
  z-index: 1001;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.75);
  overflow-x: hidden;
}

.home-preview-video-modal.is-open {
  display: flex;
}

body.home-preview-video-open {
  overflow: hidden;
}

.home-preview-video-modal__close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 1002;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  padding: 0 8px;
}

/* Desktop: ~60vw, cap 1000px; mobile/tablet: full width minus safe inset */
.home-preview-video-modal__dialog {
  position: relative;
  box-sizing: border-box;
  width: min(60vw, 1000px);
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.home-preview-video-modal__video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  max-height: min(70vh, calc(90vh - 48px));
  border-radius: 12px;
  display: block;
  background: #000;
  object-fit: contain;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .home-preview-video-modal__dialog {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }

  .home-preview-video-modal__video {
    max-height: min(56.25vw, calc(90vh - 48px));
  }
}

/* Same content block as index.html .how-it-works-more (scoped copy; styles.css not loaded). */
.home-preview-video-modal .how-it-works-more {
  background: #fff;
  border: 1px solid #e4e2dc;
  border-radius: 12px;
  box-shadow: 0 2px 8px -1px rgba(34, 50, 69, 0.13);
  padding: 15px;
  text-align: left;
  flex-shrink: 0;
}

.home-preview-video-modal .how-it-works-more[hidden] {
  display: none !important;
}

.home-preview-video-modal .how-it-works-more__title {
  margin: 0 0 8px;
  font-family: "Carlito", var(--font-body), sans-serif;
  font-size: 16px;
  font-weight: bold;
  line-height: 1.35;
  color: #223245;
}

.home-preview-video-modal .how-it-works-more__text {
  margin: 0 0 14px;
  font-family: "Carlito", var(--font-body), sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: #223245;
}

.home-preview-video-modal .how-it-works-more__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 16px;
  border-radius: 20px;
  background: #223245;
  color: #fff;
  font-family: "Carlito", var(--font-body), sans-serif;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  white-space: normal;
  line-height: 1.3;
  transition: background 0.2s;
}

.home-preview-video-modal .how-it-works-more__link:hover {
  background: #162232;
}

.home-preview-video-modal__status {
  margin: 0;
  padding: var(--space-m);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-h5-size);
  line-height: var(--text-h5-leading);
  text-align: center;
}

/* Compact legal-only footer (home-preview only; blog footer untouched). */
.home-preview .site-footer--compact {
  padding-block: var(--space-m);
  overflow-x: hidden;
}

/*
 * Footer legal bar (home-preview only).
 *
 * Wide: one row, labels in auto columns, sep tracks grow/shrink (1fr) so
 * dots stay centered between neighbors while gaps tighten as width shrinks.
 *
 * Compact (container narrow): flex-wrap with tight leading-dot separators;
 * overflow clips the line-start dots so · never appears at the start of a row.
 */
.home-preview .site-footer--compact .container {
  container-type: inline-size;
  container-name: home-footer;
}

.home-preview .site-footer__bottom--solo {
  --footer-sep-pad: 0.55em;
  display: grid;
  grid-template-columns:
    auto minmax(0.35rem, 1fr)
    auto minmax(0.35rem, 1fr)
    auto minmax(0.35rem, 1fr)
    auto minmax(0.35rem, 1fr)
    auto;
  align-items: center;
  width: 100%;
  margin: 0;
  padding-top: 0;
  border-top: none;
}

.home-preview .site-footer__copy {
  margin: 0;
  white-space: nowrap;
}

.home-preview .site-footer__legal {
  display: contents;
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-preview .site-footer__legal > li {
  margin: 0;
  padding: 0;
  min-width: 0;
}

.home-preview .site-footer__legal-link {
  white-space: nowrap;
  color: var(--color-text-muted);
}

.home-preview .site-footer__sep {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  height: 100%;
  min-height: 1em;
  pointer-events: none;
}

.home-preview .site-footer__sep::before {
  content: "";
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: var(--color-text-muted);
  flex-shrink: 0;
}

/* Compact / wrapping layout when the footer container is too narrow for one row */
@container home-footer (max-width: 520px) {
  .home-preview .site-footer__bottom--solo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    column-gap: 0;
    row-gap: 6px;
    width: calc(100% + var(--footer-sep-pad));
    max-width: none;
    margin-inline-start: calc(-1 * var(--footer-sep-pad));
    overflow: hidden;
  }

  .home-preview .site-footer__sep {
    display: none;
  }

  .home-preview .site-footer__copy,
  .home-preview .site-footer__legal > li:not(.site-footer__sep) {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding-inline-start: var(--footer-sep-pad);
    white-space: nowrap;
  }

  .home-preview .site-footer__copy::before,
  .home-preview .site-footer__legal > li:not(.site-footer__sep)::before {
    content: "";
    position: absolute;
    left: 0.15em;
    top: 50%;
    transform: translateY(-50%);
    width: 4.5px;
    height: 4.5px;
    border-radius: 50%;
    background: var(--color-text-muted);
    pointer-events: none;
  }
}

@media (max-width: 768px) {
  .home-preview .site-footer--compact {
    padding-block: var(--space-s);
  }
}

@media (max-width: 1024px) {
  .home-preview {
    --home-container-max: 960px;
  }

  .service-card__title {
    font-size: var(--text-h4-size);
    line-height: var(--text-h4-leading);
  }

  .service-card__text {
    font-size: var(--text-h6-size);
    line-height: var(--text-h6-leading);
  }

  .service-card__promo {
    top: 22px;
    max-width: min(48%, 200px);
    gap: 6px;
  }

  .service-card__badge {
    padding: 9px 18px;
    font-size: 15px;
    gap: 8px;
  }

  .service-card__media > .service-card__badge {
    top: 22px;
  }
}

/* Narrow cards / phones: CTA under copy */
@media (max-width: 768px) {
  .home-preview__main {
    padding: var(--space-l) 0 var(--space-xl);
  }

  .home-preview__grid {
    grid-template-columns: 1fr;
    gap: var(--space-m);
  }

  .service-card__body {
    grid-template-columns: 1fr;
    gap: var(--space-m);
    padding: var(--space-s) var(--space-m) var(--space-m);
    align-items: stretch;
  }

  .service-card__actions {
    gap: var(--space-s);
  }

  .service-card__cta,
  .service-card__how {
    width: 100%;
    min-height: 48px;
  }

  .service-card__promo {
    top: 16px;
    max-width: min(52%, 180px);
    gap: 6px;
  }

  /* Sale banner smaller on phones only (~28% vs desktop); desktop size unchanged. */
  .service-card__sale-banner {
    width: 72%;
    max-width: 72%;
    height: auto;
  }

  .service-card__badge {
    padding: 8px 14px;
    font-size: 14px;
    gap: 8px;
  }

  .service-card__media > .service-card__badge {
    top: 16px;
    padding: 9px 16px;
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .service-card__media--slider {
    --home-slide-duration: 0s;
  }

  .service-card__dot::after {
    transition: none;
  }
}
