/* ==========================================================================
   strona-glowna-5.css — proposal 5 "Co się dzieje z Twoim autem?"
   Adds to assets/css/carpoint.css only: every rule is scoped to .sg5-* classes
   (or body.sg5) and uses the site's theme tokens, so light / dark / high
   contrast all work without extra colour definitions.
   ========================================================================== */

/* --- WCAG 2.5.8 / brief: every target at least 44px (site .btn--sm is 40px). */
body.sg5 .btn--sm,
body.sg5 main .link-arrow {
  min-height: 44px;
}

/* ==========================================================================
   1. Hero: question + tiles on the light subtle surface
   ========================================================================== */
.sg5-hero {
  padding-block: clamp(2rem, 4.5vw, 3.75rem) var(--section-y);
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.sg5-hero__head {
  max-width: 46rem;
  margin-bottom: var(--sp-6);
}

.sg5-hero__head h1 {
  font-size: var(--fs-5xl);
  margin-bottom: var(--sp-4);
}

/* Tile grid: 2 columns on phones, 4 on desktop. */
.sg5-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 62rem) {
  .sg5-tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--sp-4);
  }
}

.sg5-tiles > li {
  display: flex;
  min-width: 0;
}

/* A tile is an <a> without JS and a <button> with JS: reset both. */
.sg5-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-2);
  width: 100%;
  min-height: 44px;
  padding: var(--sp-4);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font: inherit;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.sg5-tile:hover {
  border-color: var(--brand-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Selected state: not colour alone — thicker inset edge + check badge. */
.sg5-tile[aria-expanded="true"] {
  background: var(--brand-tint);
  border-color: var(--brand-strong);
  box-shadow: inset 0 0 0 2px var(--brand-strong);
}

.sg5-tile[aria-expanded="true"]::after {
  content: "";
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--brand-strong)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E")
    center / 14px no-repeat;
}

.sg5-tile__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--brand-tint);
  color: var(--brand-deep);
}

.sg5-tile[aria-expanded="true"] .sg5-tile__icon {
  background: var(--bg-elevated);
}

.sg5-tile__title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-tight);
}

.sg5-tile__hint {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.4;
}

/* Phones: denser tiles so all eight fit in about one and a half screens. */
@media (max-width: 39.99rem) {
  .sg5-tile {
    gap: var(--sp-1);
    padding: var(--sp-3);
  }
  .sg5-tile__icon {
    width: 36px;
    height: 36px;
    margin-bottom: var(--sp-1);
  }
  .sg5-tile__icon svg {
    width: 22px;
    height: 22px;
  }
  .sg5-tile__hint {
    font-size: var(--fs-xs);
  }
  .sg5-answer .lede {
    font-size: var(--fs-md);
  }
}

@media (min-width: 62rem) {
  .sg5-tile {
    padding: var(--sp-5);
  }
  .sg5-tile__title {
    font-size: var(--fs-lg);
  }
}

[data-theme="hc"] .sg5-tile {
  border: 2px solid #ffffff;
}

[data-theme="hc"] .sg5-tile[aria-expanded="true"] {
  background: #1a1700;
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px var(--brand);
}

[data-theme="hc"] .sg5-tile[aria-expanded="true"]::after {
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E");
}

[data-theme="hc"] .sg5-tile__icon {
  background: #000000;
  border: 2px solid var(--brand);
  color: var(--brand);
}

@media (prefers-reduced-motion: reduce) {
  .sg5-tile,
  .sg5-tile:hover {
    transition: none;
    transform: none;
  }
}

/* "Inna sprawa?" — secondary link chips. */
.sg5-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-5);
}

.sg5-more__label {
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--text);
}

.sg5-more__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg5-more__list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--link);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sg5-more__list a:hover {
  border-color: var(--brand-strong);
  color: var(--link-hover);
}

[data-theme="hc"] .sg5-more__list a {
  border-width: 2px;
  background: #000000;
}

/* ==========================================================================
   2. Answer panels
   ========================================================================== */
.sg5-answers {
  display: grid;
  gap: var(--sp-5);
  margin-top: var(--sp-6);
}

/* With JS only the chosen answer is visible; [hidden] keeps the rest out
   of the accessibility tree too. */
.sg5-answers:not(:has(.sg5-answer:not([hidden]))) {
  margin-top: 0;
}

.sg5-answer {
  scroll-margin-top: calc(var(--header-h) + 1rem);
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

[data-theme="hc"] .sg5-answer {
  border: 2px solid #ffffff;
}

/* Entry fade for a newly opened answer (skipped with reduced motion). */
@media (prefers-reduced-motion: no-preference) {
  .sg5-answer.is-entering {
    animation: sg5-in var(--dur) var(--ease-out);
  }
  @keyframes sg5-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }
}

.sg5-answer__grid {
  display: grid;
  gap: var(--sp-6);
}

.sg5-answer__grid > * {
  min-width: 0;
}

@media (min-width: 56rem) {
  .sg5-answer__grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: var(--sp-7);
  }
}

.sg5-answer h2 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-3);
}

.sg5-answer .lede {
  margin-bottom: var(--sp-5);
}

.sg5-answer .feature-list {
  margin-bottom: var(--sp-5);
}

.sg5-price {
  margin-bottom: var(--sp-5);
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: var(--tr-tight);
  color: var(--text);
}

.sg5-price small {
  display: block;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-muted);
}

.sg5-answer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3) var(--sp-5);
}

/* The link-arrow next to the button also needs a 44px hit area. */
.sg5-answer__links .link-arrow {
  min-height: 44px;
}

.sg5-answer__where {
  align-self: start;
  padding: var(--sp-5);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

[data-theme="hc"] .sg5-answer__where {
  border-width: 2px;
}

.sg5-answer__where img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  margin-bottom: var(--sp-4);
  border-radius: var(--radius-sm);
}

.sg5-answer__where h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-2);
}

.sg5-answer__where p {
  margin-bottom: var(--sp-4);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.sg5-answer__where .cta-lines {
  margin-bottom: 0;
}

.sg5-answer__where .cta-line {
  min-height: 44px;
  background: var(--bg-elevated);
}

.sg5-where__extra {
  margin-top: var(--sp-4);
  margin-bottom: 0 !important;
}

.sg5-where__extra a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--link);
  font-weight: 600;
}

/* "Wybierz inną sytuację" — added by JS under each open answer. */
.sg5-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: var(--sp-5);
  color: var(--link);
  font-weight: 600;
}

/* Prices nested in a bold list label keep the label's size and colour
   (carpoint.css styles every span in .feature-list__body as the sub-line). */
.sg5 .feature-list__body strong span {
  display: inline;
  font-size: inherit;
  color: inherit;
}

/* Split-section headings need the gap that .section-head gives elsewhere. */
.sg5 .split h2 {
  margin-bottom: var(--sp-4);
}

/* Closing contact block: light brand tint instead of the dark band. */
.sg5-contact {
  background: var(--brand-tint);
  border-top: 1px solid var(--border);
}

.sg5-contact .split {
  align-items: center;
}

[data-theme="hc"] .sg5-contact {
  background: #000000;
  border-top: 2px solid #ffffff;
}

/* ==========================================================================
   3. Fixed proposal label (bottom-left; to-top button lives bottom-right)
   ========================================================================== */
.sg5-proposal {
  position: fixed;
  left: var(--sp-3);
  bottom: var(--sp-3);
  z-index: 140;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: calc(100% - 5.5rem);
  padding: var(--sp-2) var(--sp-4);
  background: var(--brand-strong); /* white on it ≥ 5.1:1 in light and dark */
  color: var(--on-brand);
  border: 2px solid var(--bg-elevated); /* keeps the pill visible over the dark footer */
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

/* Two-tone ring: readable whether the label sits over white content or the dark footer. */
.sg5-proposal:focus-visible {
  outline: 3px solid #2f2f2e;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #ffffff;
}

[data-theme="hc"] .sg5-proposal:focus-visible {
  outline-color: #ffffff;
  box-shadow: 0 0 0 2px #000000;
}

.sg5-proposal:hover {
  text-decoration: underline;
}

[data-theme="hc"] .sg5-proposal {
  background: #000000;
  color: var(--brand);
  border: 2px solid var(--brand);
}

/* Room for the fixed label so it never covers the footer's last line. */
body.sg5 .site-footer {
  padding-bottom: 4.5rem;
}
