/* Home page, info pages with the contact form, and the blog.
   Built on the tokens and components of base.css (see docs/architecture.md). */

/* ---------- Home: page rhythm ---------- */

.home {
  --on-photo: #fff;                       /* text laid over a darkened photo */
  --scrim: color-mix(in srgb, var(--brand-dark) 82%, transparent);
  display: flex;
  flex-direction: column;
  gap: var(--s6);
  padding-bottom: var(--s7);
}
.home > .home-block:first-child { margin-top: var(--s5); }
.home .section { margin-block: 0; padding-block: 0; }   /* spacing comes from .home's gap */
.home-block { width: 100%; }

/* ---------- Home: hero slider ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.hero-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.hero-track::-webkit-scrollbar { display: none; }
.hero-slide {
  position: relative;
  flex: 0 0 100%;
  aspect-ratio: 16 / 6;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.hero-link {
  position: absolute;
  inset: 0;
  display: block;
  color: var(--on-photo);
  text-decoration: none;
}
.hero-link:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-caption {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: var(--s3);
  padding: var(--s6) clamp(var(--s5), 6vw, 80px);
  background: linear-gradient(90deg, var(--scrim) 0%, color-mix(in srgb, var(--brand-dark) 40%, transparent) 42%, transparent 70%);
}
.hero-title {
  max-width: 20ch;
  font-size: clamp(1.375rem, 3.4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
}
.hero-subtitle {
  max-width: 44ch;
  font-size: clamp(0.9375rem, 1.5vw, 1.1875rem);
  line-height: 1.45;
  opacity: 0.92;
}
.hero-button { margin-top: var(--s2); pointer-events: none; }

.hero-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.2s, background-color 0.2s, color 0.2s;
}
.hero-arrow[hidden], .hero-dots[hidden] { display: none; }
.hero-prev { left: var(--s4); }
.hero-next { right: var(--s4); }
.hero:hover .hero-arrow, .hero:focus-within .hero-arrow { opacity: 1; }
.hero-arrow:hover { background: var(--brand); color: var(--on-photo); }
.hero-arrow:focus-visible { opacity: 1; outline: 3px solid var(--brand); outline-offset: 2px; }

.hero-dots {
  position: absolute;
  right: 0;
  bottom: var(--s3);
  left: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: var(--s2);
  pointer-events: none;
}
.hero-dot {
  position: relative;
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent);
  cursor: pointer;
  pointer-events: auto;
  transition: width 0.25s, background-color 0.25s;
}
.hero-dot::after { content: ""; position: absolute; inset: -8px -4px; }   /* larger tap area */
.hero-dot[aria-current="true"] { width: 28px; background: var(--brand); }
.hero-dot:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

@media (max-width: 991px) {
  .hero-slide { aspect-ratio: 16 / 7; }
  .hero-arrow { display: none; }          /* swiping does the job on touch screens */
}
@media (max-width: 639px) {
  .hero-wrap { padding-inline: 0; }
  .home > .hero-wrap:first-child { margin-top: 0; }
  .hero { border-radius: 0; }
  /* A slide whose text is painted into the picture stays whole (16:7, as it was drawn);
     only a slide with its own caption gets the taller phone shape. */
  .hero-slide:has(.hero-caption) { aspect-ratio: 16 / 9; }
  .hero-caption {
    justify-content: flex-end;
    padding: var(--s5) var(--s4) var(--s6);
    background: linear-gradient(180deg, transparent 20%, var(--scrim) 100%);
  }
}

/* ---------- Home: welcome band (shown while there are no slides) ---------- */

.welcome {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(60% 120% at 100% 0%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%),
    linear-gradient(135deg, var(--brand-soft), var(--bg) 75%);
}
.welcome-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s4);
  padding-block: clamp(var(--s6), 7vw, 88px);
}
.welcome-eyebrow {
  margin: 0;
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.welcome-title {
  max-width: 30ch;
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(1.625rem, 4vw, 2.75rem);
  line-height: 1.18;
  text-wrap: balance;
}
.welcome-text { max-width: 62ch; margin: 0; font-size: 1.0625rem; }
.welcome-actions { margin-top: var(--s2); }
.welcome-points {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  margin: var(--s2) 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.9375rem;
}
.welcome-points li { display: inline-flex; align-items: center; gap: var(--s2); }
.welcome-points .icon { color: var(--brand); }
.welcome-points a { color: inherit; }

/* ---------- Home: picture tiles and banners ---------- */

.tile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s4);
}
@media (min-width: 640px) {
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .tile-grid-1 { grid-template-columns: minmax(0, 1fr); }
  .tile-grid-2, .tile-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
  .tile-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.tile {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  isolation: isolate;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--on-photo);
  text-decoration: none;
}
@media (max-width: 639px) {
  .tile { aspect-ratio: 16 / 9; }
  /* Three or more tiles would make a long column on a phone: swipe through them instead. */
  .tile-grid-swipe {
    display: flex;
    overflow-x: auto;
    gap: var(--s3);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .tile-grid-swipe::-webkit-scrollbar { display: none; }
  .tile-grid-swipe > .tile { flex: 0 0 80%; aspect-ratio: 4 / 3; scroll-snap-align: start; }
}
.tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}
a.tile:hover .tile-img { transform: scale(1.04); }
a.tile:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.tile.has-text::after {            /* darkens the lower part so the title stays readable */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 40%, var(--scrim) 100%);
}
.tile-text {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  padding: var(--s5);
}
.tile-title { font-size: clamp(1.0625rem, 1.6vw, 1.375rem); font-weight: 700; line-height: 1.25; text-wrap: balance; }
.tile-subtitle { font-size: 0.9375rem; line-height: 1.4; opacity: 0.92; }
.tile-more {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  margin-top: var(--s2);
  color: var(--brand);
  font-size: 0.875rem;
  font-weight: 600;
}

/* A tile without its own picture borrows a product photo: shown whole on a soft background. */
.tile-product { color: var(--brand-dark); }
.tile-product.has-text::after { display: none; }
.tile-product .tile-img {
  inset: auto var(--s4) var(--s4) auto;
  width: 54%;
  height: 78%;
  object-fit: contain;
  object-position: right bottom;
  mix-blend-mode: multiply;        /* lets a white photo background melt into the tile */
}
.tile-product:not(.has-text) .tile-img { inset: var(--s4); width: auto; height: auto; max-width: calc(100% - 2 * var(--s4)); max-height: calc(100% - 2 * var(--s4)); margin: auto; object-position: center; }
.tile-product .tile-text { top: 0; bottom: auto; max-width: 62%; }
.tile-product .tile-title { overflow-wrap: normal; word-break: normal; hyphens: none; }
@media (max-width: 991px) {
  /* Narrow tiles: the title gets the full width, the photo sits smaller underneath it. */
  .tile-product .tile-text { max-width: none; padding: var(--s4); }
  .tile-product .tile-img { width: 46%; height: 56%; inset: auto var(--s3) var(--s3) auto; }
}
a.tile-product:hover .tile-title { color: var(--brand); }

/* A tile with a title but no picture at all. */
.tile-plain { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.tile-plain.has-text::after { display: none; }

/* Wide banners */
.tile-grid-wide .tile { aspect-ratio: 2 / 1; }
/* One banner with its text painted in: shown whole on phones (8:3), not cropped at the sides. */
.tile-grid-wide.tile-grid-1 .tile:not(.has-text) { aspect-ratio: 8 / 3; }
@media (min-width: 640px) {
  .tile-grid-wide.tile-grid-1 .tile { aspect-ratio: 16 / 5; }
}

/* ---------- Home: product row with a side banner ---------- */

.home-row.has-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s4);
}
.home-row-products { min-width: 0; }
.row-banner { aspect-ratio: 16 / 9; }
@media (min-width: 640px) and (max-width: 991px) { .row-banner { aspect-ratio: 3 / 1; } }
@media (min-width: 992px) {
  .home-row.has-banner { grid-template-columns: 270px minmax(0, 1fr); gap: var(--s5); align-items: stretch; }
  .row-banner { aspect-ratio: auto; height: 100%; min-height: 340px; }
}

/* ---------- Home: category grid (shown while there are no top tiles) ---------- */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) { .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); } }
@media (min-width: 992px) { .cat-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  height: 100%;
  padding: var(--s5) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.cat-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.cat-card:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.cat-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}
.cat-icon img { width: 38px; height: 38px; object-fit: contain; }
.cat-name { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.cat-count { color: var(--muted); font-size: 0.8125rem; }

/* ---------- Info pages ---------- */

.page-info .prose img, .page-blog-post .prose img { max-width: 100%; height: auto; }
.page-info .prose iframe, .page-blog-post .prose iframe { max-width: 100%; }
.page-info .prose, .page-blog-post .prose { overflow-wrap: break-word; }

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s5);
  align-items: start;
  scroll-margin-top: var(--s7);
}
@media (min-width: 992px) {
  .contact { grid-template-columns: minmax(0, 1fr) 300px; }
}
.contact-info > h2 { margin: 0 0 var(--s4); }
.contact-list {
  display: grid;
  gap: var(--s4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.contact-list li { display: flex; align-items: flex-start; gap: var(--s3); }
.contact-list .icon { flex: none; margin-top: 3px; color: var(--brand); }
.contact-list li > span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.contact-label { color: var(--muted); font-size: 0.8125rem; }
.contact-list a { color: var(--ink); font-weight: 600; text-decoration: none; }
.contact-list a:hover { color: var(--brand); }
.contact-socials {            /* the icons themselves are base.css's .socials */
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}

/* ---------- Blog ---------- */

.post-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s5);
}
@media (min-width: 640px) { .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.page-blog .pagination { margin-top: var(--s6); }

.post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.post-card:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: var(--shadow); }
.post-card-media {
  display: block;
  text-decoration: none;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--brand-soft);
}
.post-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}
.post-card:hover .post-card-media img { transform: scale(1.04); }
.post-card-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: color-mix(in srgb, var(--brand) 45%, transparent);
  font-size: 1.5rem;
  font-weight: 700;
}
.post-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s4) var(--s5) var(--s5);
}
.post-date {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--muted);
  font-size: 0.8125rem;
}
.post-card-title { margin: 0; font-size: 1.125rem; line-height: 1.35; }
.post-card-title a { color: var(--ink); text-decoration: none; }
.post-card-title a:hover { color: var(--brand); }
.post-card-text {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  font-size: 0.9375rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.post { display: flex; flex-direction: column; gap: var(--s5); }
.post-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  border-radius: var(--radius);
  object-fit: cover;
}
.post-back { margin: var(--s2) 0 0; }
.post-more { margin-top: var(--s7); }

@media (prefers-reduced-motion: reduce) {
  .tile-img, .post-card-media img, .cat-card, .hero-dot, .hero-arrow { transition: none; }
  a.tile:hover .tile-img, .post-card:hover .post-card-media img { transform: none; }
  .cat-card:hover { transform: none; }
}
