/* ============================================================
   Jim's Pool Care — Drop 01
   Design 3a (Option E): one page, six parts, order here.
   ============================================================ */

:root {
  --blue:       #114a94;
  --blue-dark:  #0b3163;
  --ink:        #111110;
  --paper:      #ffffff;
  --stone:      #f1f0ea;
  --rule:       #e4e4de;
  --muted:      #8a8a80;

  --mono:  'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans:  Archivo, Helvetica, Arial, sans-serif;
  --black: 'Archivo Black', Archivo, Helvetica, sans-serif;

  /* Fluid page gutter: 20px on a phone, 40px on a desktop. */
  --gutter: clamp(1.25rem, 3vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  /* Nothing in this layout should ever scroll sideways. */
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
}
.skip-link:focus { left: 0; color: #fff; }

/* ─────────────────────────  HERO  ───────────────────────── */

.hero {
  position: relative;
  background: #a9c3d6;
  overflow: hidden;
  /* Tall enough to read on a phone, capped so it never eats a laptop screen. */
  height: clamp(15rem, 42vw, 38.125rem);
}

.hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 55%;
}

/* Shown only when the photo is missing — see store.js. */
.hero__fallback {
  display: none;
  position: absolute;
  inset: 0;
  margin: 0;
  align-items: flex-end;
  padding: var(--gutter);
  background:
    repeating-linear-gradient(45deg,
      rgba(17, 74, 148, .12) 0 12px,
      rgba(17, 74, 148, 0) 12px 24px);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--blue);
}
.hero.is-missing .hero__img { display: none; }
.hero.is-missing .hero__fallback { display: flex; }

/* ─────────────────────────  TICKER  ───────────────────────── */

.ticker {
  background: var(--blue);
  color: #fff;
  padding: 1rem 0;
  overflow: hidden;
  white-space: nowrap;
}

.ticker__track {
  display: inline-flex;
  gap: 3.5rem;
  padding-right: 3.5rem;
  animation: tick 26s linear infinite;
  will-change: transform;
}

.ticker__item {
  font-family: var(--mono);
  font-size: clamp(0.75rem, 1.6vw, 0.9375rem);
  letter-spacing: .16em;
  text-transform: uppercase;
}

@keyframes tick {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ─────────────────────────  SHOP GRID  ───────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

/* Kill the right rule on the last column so the grid edge stays clean. */
.card:nth-child(3n) { border-right: none; }

.card__media {
  position: relative;
  aspect-ratio: 1;
  background: var(--stone);
  overflow: hidden;
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Hatched stand-in for a product shot that hasn't landed yet. */
.card__media.is-missing {
  background:
    repeating-linear-gradient(45deg,
      rgba(17, 74, 148, .09) 0 10px,
      rgba(17, 74, 148, 0) 10px 20px),
    var(--stone);
}
.card__media.is-missing .card__img { display: none; }

.card__shot {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  margin: 0;
  background: rgba(255, 255, 255, .9);
  color: var(--blue);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: .1em;
  padding: 0.3125rem 0.5rem;
}

/* Carousel arrows — injected by store.js only when a card has 2+ frames. */
.card__arrows {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem;
  pointer-events: none;
}

.card__arrow {
  pointer-events: auto;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.card__arrow:hover { background: var(--blue); color: #fff; }

/* Sits opposite .card__shot so the two never collide. */
.card__count {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  background: rgba(17, 17, 16, .82);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: .1em;
  padding: 0.25rem 0.5rem;
}

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.card__name {
  margin: 0;
  font-family: var(--black);
  font-size: clamp(1.125rem, 2.2vw, 1.5rem);
  letter-spacing: -.01em;
  text-transform: uppercase;
}

.card__price {
  margin: 0;
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  color: var(--blue);
  white-space: nowrap;
}

.card__spec {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Keeps the 2px black frame of the original quantity stepper. */
.card__order {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 2px solid var(--ink);
  padding: 0.875rem 1.25rem;
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  min-height: 3rem;
  transition: background .15s, color .15s;
}
.card__order:hover {
  background: var(--ink);
  color: #fff;
}

/* Flags a Payment Link that still holds its placeholder value. */
.card__order.is-unconfigured {
  border-color: #c2410c;
  color: #c2410c;
  cursor: not-allowed;
}
.card__order.is-unconfigured:hover {
  background: #c2410c;
  color: #fff;
}

/* ─────────────────────────  ORDER BAR  ───────────────────────── */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: clamp(1.25rem, 3vw, 1.625rem) var(--gutter);
  background: var(--ink);
  color: #fff;
}

.bar__meta {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(0.75rem, 1.5vw, 0.9375rem);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .65);
}

.bar__buy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.bar__total {
  margin: 0;
  font-family: var(--black);
  font-size: clamp(1.75rem, 4vw, 2.375rem);
  letter-spacing: -.02em;
}

.bar__order {
  background: var(--blue);
  color: #fff;
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(0.8125rem, 1.6vw, 1rem);
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: 1.125rem 2.5rem;
  min-height: 3rem;
  display: flex;
  align-items: center;
  transition: background .15s, color .15s;
}
.bar__order:hover { background: #fff; color: var(--ink); }

.bar__order.is-unconfigured { background: #c2410c; }
.bar__order.is-unconfigured:hover { background: #9a3412; color: #fff; }

/* ─────────────────────────  FINE PRINT  ───────────────────────── */

.fine {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 2.5rem;
  padding: 2.5rem var(--gutter) 3rem;
  border-top: 2px solid var(--ink);
  font-family: var(--mono);
  color: #6c6c64;
}

/* The disclaimer only works if it's actually readable. 13px, sentence case,
   generous line-height — not 10px grey caps. */
.fine__legal {
  font-size: 0.8125rem;
  line-height: 1.65;
  max-width: 68ch;
}

.fine__legal p { margin: 0; }

.fine__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
  font-size: 0.75rem;
  line-height: 1.7;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.fine__meta p { margin: 0; }

.fine__ig {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  letter-spacing: .12em;
}
.fine__ig:hover { color: var(--ink); }

/* ─────────────────────────  BREAKPOINTS  ───────────────────────── */

/* Tablet — two across. */
@media (max-width: 56.25rem) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .card:nth-child(3n) { border-right: 1px solid var(--rule); }
  .card:nth-child(2n) { border-right: none; }
}

/* Phone — one across, and the bar stacks. */
@media (max-width: 35rem) {
  .grid { grid-template-columns: 1fr; }
  .card { border-right: none; }
  .card:nth-child(3n),
  .card:nth-child(2n) { border-right: none; }

  .bar,
  .bar__buy {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  .bar__buy { justify-content: space-between; }
  .bar__order { justify-content: center; }
}

/* The footer's two columns collapse earlier than the grid does — the
   disclaimer needs its measure long before the cards need to stack. */
@media (max-width: 46rem) {
  .fine { grid-template-columns: 1fr; gap: 2rem; }
}

/* ─────────────────────────  PREFERENCES  ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .ticker, .card__arrows { display: none; }
  body { color: #000; }
}
