/* Home page body (templates/index.html), after the owner's phone mockup. Loaded only on the home page, after style.css
   and shop.css. Sizes on phones are mockup pixels times --u (style.css: the 300 px mockup scaled to the phone, up to
   412 px). Colours are theme tokens only, so the light theme follows. The phone header is not styled here; the bottom
   bar is in style.css. */

/* ---- Section heads: a title and an "All" link ------------------------------------- */
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0 0 0.5rem; }
body.site main .home-head h2 { margin: 0; font-size: 1.1rem; line-height: 1.3; }
.home-head-link { flex: none; display: inline-flex; align-items: center; min-height: 44px; font-size: 0.85rem; white-space: nowrap; }

/* ---- Banner: a <picture> per slide; text, dots and the pause/play icon inside the frame -- */
.banner-slide picture { display: block; width: 100%; height: 100%; }
.banner-slider .banner-caption { display: none; }
.banner-text {
  position: absolute; inset: auto 0 0; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 2.2rem 1rem 2.6rem; text-align: center; color: #fff; pointer-events: none;
  background: linear-gradient(to top, rgba(3, 7, 17, 0.72), rgba(3, 7, 17, 0));
}
.banner-kicker { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.72rem; letter-spacing: 0.04em; opacity: 0.85; }
.banner-title { max-width: 100%; white-space: normal; overflow-wrap: break-word; font-size: 1.15rem; font-weight: 500;
  line-height: 1.25; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
.banner-slider .banner-dots {
  position: absolute; left: 0; right: 0; bottom: 4px; z-index: 2; display: flex; justify-content: center; gap: 0; margin: 0;
}
.banner-slider .banner-dot {
  position: relative; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
}
.banner-slider .banner-dot::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; border-radius: 50%;
  transform: translate(-50%, -50%); background: rgba(255, 255, 255, 0.5);
}
.banner-slider .banner-dot.active::after { width: 16px; border-radius: 4px; background: var(--accent); }
.banner-slider .banner-autoplay {
  position: absolute; right: 8px; bottom: 8px; z-index: 3; display: grid; place-items: center;
  width: 32px; height: 32px; margin: 0; padding: 0; border: 0; border-radius: 50%;
  background: rgba(3, 7, 17, 0.55); color: #fff; cursor: pointer;
}
.banner-slider .banner-autoplay::before { content: ""; position: absolute; inset: -6px; }  /* a 44 px tap target */
.banner-slider .banner-autoplay svg { width: 55%; height: 55%; fill: none; stroke: currentColor; stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round; }
.banner-slider .banner-autoplay .icon-play { display: none; fill: currentColor; stroke-width: 1.5; }
.banner-slider .banner-autoplay.is-paused .icon-play { display: block; }
.banner-slider .banner-autoplay.is-paused .icon-pause { display: none; }
.banner-slider .banner-autoplay:hover, .banner-slider .banner-autoplay:focus-visible { background: rgba(3, 7, 17, 0.8); color: var(--accent); }

/* ---- Services: frameless items (icon above a one-line label) in one sideways row, or a 4x2 grid -- */
.home-svc { min-width: 0; margin: 0 0 1rem; }
.home-svc-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.home-svc-row > li { min-width: 0; }
.home-svc-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-sizing: border-box; width: 100%; min-height: 94px; padding: 12px 8px;
  color: var(--text); text-align: center; text-decoration: none; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-glass); transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}
.home-svc-item:hover, .home-svc-item:focus-visible { color: var(--accent); text-decoration: none; border-color: rgba(var(--accent-rgb), .55); transform: translateY(-2px); }
.home-svc-icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; color: var(--accent); }
.home-svc-icon svg.service-icon { width: 100%; height: 100%; stroke: currentColor; }
.home-svc-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.home-svc-name {
  display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.75rem; line-height: 1.25; font-weight: 500;
}
.home-svc--grid .home-svc-row { gap: 10px; }

/* ---- Top products: the compact card ------------------------------------------------- */
.home-top { min-width: 0; margin: 0 0 1.25rem; }
.hp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hp {
  display: flex; flex-direction: column; min-width: 0; padding: 8px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-glass);
}
.hp:hover, .hp:focus-within { border-color: rgba(var(--accent-rgb), 0.55); }
.hp-link { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.hp-link:hover { text-decoration: none; }
.hp-media {
  position: relative; display: grid; place-items: center; height: 120px; overflow: hidden; border-radius: 8px;
  background: #f1f3f6;  /* a light neutral tile in both themes: product photos are shot on white */
}
.hp-img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.hp-off {
  /* the own picture sits to the right, so the badge (top-left) never covers it (the owner noticed it hid a TV's
     "-20%" icon) */
  position: absolute; top: 4px; right: 4px; left: auto; padding: 1px 5px; border-radius: 6px; background: #c8213a;  /* 4.5:1 with white */
  color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 1.4;
}
.hp-name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  height: 2.6em; font-size: 0.85rem; line-height: 1.3; font-weight: 500; color: var(--text); overflow-wrap: anywhere;
}
.hp-buy { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 6px; }
.hp-buy form { flex: none; margin: 0; }
.hp-price { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; font-weight: 700;
  color: #ffb547; }
:where(html[data-theme="light"]) .hp-price { color: #9a5800; }
/* A 44 px tap target around the round accent button (its visible size follows the mockup) */
.hp-btn {
  display: grid; place-items: center; width: 44px; height: 44px; margin: -8px -6px -8px 0; padding: 0;
  border: 0; border-radius: 50%; background: none; box-shadow: none; cursor: pointer;
}
.hp-btn:hover { box-shadow: none; }
.hp-btn-dot { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--accent);
  background: transparent; color: var(--accent); box-sizing: border-box; }
.hp-btn-dot svg { width: 56%; height: 56%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hp-btn:hover .hp-btn-dot, .hp-btn:focus-visible .hp-btn-dot { background: rgba(var(--accent-rgb), 0.12); }
.hp-btn:disabled { cursor: not-allowed; }
.hp-btn:disabled .hp-btn-dot { border-color: var(--border); color: var(--muted); }
@media (min-width: 768px) { .hp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } .hp-media { height: 172px; } }
@media (min-width: 1200px) { .hp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .hp-media { height: 190px; } }

/* ---- Phones: the mockup's sizes, scaled with --u --------------------------------------- */
@media (max-width: 767px) {
  body.home-v2 main { padding-left: calc(12 * var(--u)); padding-right: calc(12 * var(--u)); }
  body.site main .home-head h2 { font-size: calc(14 * var(--u)); }
  .home-head-link { font-size: calc(12 * var(--u)); }
  .home-head { margin-bottom: calc(4 * var(--u)); }

  .home-hero-row .banner-slide { border-radius: calc(12 * var(--u)); }
  .banner-text { padding: calc(28 * var(--u)) calc(12 * var(--u)) calc(30 * var(--u)); }
  .banner-kicker { font-size: calc(9 * var(--u)); }
  .banner-title { font-size: calc(16 * var(--u)); }
  .banner-slider .banner-arrow { display: none; }
  .banner-slider .banner-autoplay { right: calc(8 * var(--u)); bottom: calc(8 * var(--u)); width: calc(28 * var(--u)); height: calc(28 * var(--u)); }
  .banner-slider .banner-autoplay::before { inset: calc((28 * var(--u) - 44px) / 2); }
  /* the dots' row shares the pause icon's centre line */
  .banner-slider .banner-dots { bottom: calc(22 * var(--u) - 22px); }

  /* A label may be wider than its 58u item (e.g. "კომპიუტერი"): it is never cut; it spills into the 22u gap,
     so two neighbouring labels never touch, and the row's side padding keeps the first and last whole */
  /* the 22u gap is for the labels inside the row: it also keeps the next tile far enough from the edge that its
     icon does not peek in; the row keeps the screen's own margins */
  .home-svc-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(8 * var(--u)); }
  .home-svc-item { min-height: max(74px, calc(78 * var(--u))); gap: calc(5 * var(--u)); padding: calc(8 * var(--u)) calc(5 * var(--u)); border-radius: calc(12 * var(--u)); }
  .home-svc-icon { width: calc(28 * var(--u)); height: calc(28 * var(--u)); }
  .home-svc-name { width: auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: normal; font-size: calc(10.5 * var(--u)); line-height: 1.25; }

  .hp-grid { gap: calc(8 * var(--u)); }
  .hp { padding: calc(6 * var(--u)); border-radius: calc(10 * var(--u)); }
  .hp-link { gap: calc(5 * var(--u)); }
  .hp-media { height: calc(62 * var(--u)); border-radius: calc(6 * var(--u)); }
  .hp-off { font-size: calc(8.5 * var(--u)); top: calc(3 * var(--u)); right: calc(3 * var(--u)); left: auto; }
  .hp-name { font-size: calc(11.5 * var(--u)); }
  .hp-buy { padding-top: calc(5 * var(--u)); }
  .hp-price { font-size: calc(13 * var(--u)); }
  /* the 44 px target reaches into the card padding, never past the card's edge */
  .hp-btn { margin: calc((28 * var(--u) - 44px) / 2) calc(-6 * var(--u)) calc((28 * var(--u) - 44px) / 2) 0; }
  .hp-btn-dot { width: calc(28 * var(--u)); height: calc(28 * var(--u)); }
}

/* ---- Phones and tablets (< 900px): introduction, services and a short shop preview ---- */
@media (max-width: 899px) {
  .home-page { display: flex; flex-direction: column; min-width: 0; }
  .home-page > * { order: 10; min-width: 0; }
  .home-page > .home-intro { order: 1; }
  .home-page > .home-hero-row { order: 2; margin-bottom: 0.35rem; }
  .home-page > .home-kpi { order: 3; }
  .home-page > .home-svc { order: 4; }
  .home-page > .home-sale { order: 5; }
  .home-page > .home-top { order: 6; }
  .home-page > .home-projects { order: 7; }

  /* Banner: the full content width, about 16:9. A phone image fills it; the normal wide one is shown whole. */
  .home-hero-row .banner-slider { margin-bottom: 0; }
  .home-hero-row .banner-slide {
    aspect-ratio: 16 / 9; max-height: 24rem; overflow: hidden; background: var(--surface-glass);
  }
  /* A phone image fills the 16:9 frame. The normal (wide) image is shown whole over the blurred, darkened copy
     that fills the frame, and a slide with the words on top (v3) keeps them there instead. */
  .home-hero-row .banner-slide img {
    position: relative; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; object-fit: contain;
    border: none; border-radius: 0;
  }
  .home-hero-row .banner-slide.has-mobile img,
  .home-hero-row .banner-slide.has-text img { object-fit: cover; }
  .home-hero-row .banner-slide:not(.has-mobile)::before {
    content: ""; position: absolute; inset: -24px; background: var(--slide-img) center / cover no-repeat;
    filter: blur(18px) brightness(0.45); transform: scale(1.05);
  }
  .home-hero-row .banner-slide.has-text::before { content: none; }
  .home-hero-row .banner-slide picture { position: relative; z-index: 0; }
}
@media (min-width: 768px) and (max-width: 899px) { .home-hero-row .banner-slide { border-radius: 12px; } }

/* ---- Desktop (900px+): the hero is the full width and the phone's service row is the service row (v3) ---- */
@media (min-width: 900px) {
  /* v3: the hero owns the full width (the banner is the band and the numbers follow it), and the service column
     that used to sit on the left is not shown: its place is taken by the phone's equal, frameless tiles, laid out
     under the numbers in as many rows as they need — nothing scrolls sideways and no label is ever cut. */
  .home-page > .home-hero-row { margin-bottom: 0.4rem; }
  .home-page.has-sidebar .home-svc { display: block; }
  .home-svc-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 0; }
  .home-svc-name { width: auto; max-width: 100%; white-space: normal; }
  /* the old left column stays in the markup for phones (they open it as a drawer); a desktop simply does not show
     it. Its flex direction is kept as it was, so a phone-width screen sees exactly the layout it always had. */
  .home-hero-row .home-sidebar { display: none; }
  .home-hero-row .banner-slider { width: 100%; }
  .home-top { margin-top: 1.25rem; }
}

/* ---- The numbers (v3): figures read from the database, under the hero --------------------------- */
.home-kpi {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 0.75rem;
  margin: 0.9rem 0 0.35rem; padding: 0; list-style: none;
}
.home-kpi-item {
  display: flex; flex-direction: column; gap: 0.2rem; min-width: 0;
  padding: 0.9rem 1rem; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-glass);
}
.home-kpi-item b {
  font-size: clamp(1.25rem, 1.6vw, 1.75rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.02em;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.home-kpi-item span { color: var(--muted); font-size: 0.82rem; line-height: 1.25; overflow-wrap: anywhere; }
@media (max-width: 899px) {
  .home-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(8 * var(--u)); margin: calc(10 * var(--u)) 0 0; }
  .home-kpi-item { padding: calc(9 * var(--u)) calc(11 * var(--u)); border-radius: calc(12 * var(--u)); gap: calc(1 * var(--u)); }
  .home-kpi-item b { font-size: calc(17 * var(--u)); }
  .home-kpi-item span { font-size: calc(10 * var(--u)); }
}

/* The site's general button rules (padding, height, shadow) do not apply to these icon buttons */
body.site main .home-page .hp-btn,
body.site main .home-page .banner-autoplay,
body.site main .home-page .banner-dot { padding: 0; min-height: 0; min-width: 0; box-shadow: none; transform: none; }
/* ---- The words over the picture (v3) -------------------------------------------------------------
   The admin types a title, a subtitle and a button into a banner; the picture is only the ground the words stand
   on. So a slide with words gives the picture its corners and the words take their own room under it: the frame can
   be 7:2, 16:9 or anything else and nothing is ever cut — in Georgian, English or Russian. A slide with no words
   keeps the old look exactly (the words drawn in the picture, see style.css/glass.css). */
.banner-slide.has-text { background: var(--surface, #0a1428); }
.banner-slider .banner-text { max-width: none; }
.banner-slider .banner-text .banner-kicker { display: block; color: var(--accent, #00d4ff); font-size: 0.72rem;
  font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; opacity: 1; }
.banner-slider .banner-title { font-size: clamp(1.1rem, 1.15vw + 0.55rem, 1.9rem); font-weight: 800; line-height: 1.16;
  color: var(--text, #e6f1ff); text-shadow: none; }
.banner-slider .banner-subtitle { max-width: 46rem; overflow-wrap: anywhere; color: var(--muted, #7a92b8);
  font-size: 0.95rem; line-height: 1.3; }
.banner-slider .banner-cta {
  display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.45rem; padding: 0.42rem 0.95rem;
  border-radius: 999px; border: 1px solid var(--accent, #00d4ff); background: rgba(var(--accent-rgb, 0, 212, 255), 0.14);
  color: var(--accent, #00d4ff); font-size: 0.9rem; font-weight: 700;
}
/* Desktop: the words are a panel of their own under the picture, in the slide's dark ground */
@media (min-width: 900px) {
  /* the pictures of the slides stretch to the tallest one (a worded slide is taller), so one slide is not cut */
  #bannerSlider[style*="--slide-h"] .banner-slide:not(.has-text) img { height: 100%; }
  /* must outrank glass.css `.home-hero-row .banner-text` (a frosted chip), which loads after this file */
  .home-hero-row .banner-slider .banner-text {
    position: relative; inset: auto; left: auto; right: auto; bottom: auto; width: auto; transform: none;
    z-index: 1; align-items: flex-start; gap: 0.3rem; text-align: left;
    padding: 1.1rem 1.5rem 1.35rem; border-radius: 0;
    background: var(--surface, #0a1428);   /* a colour, not a token path: a gradient here would blur the words */
    backdrop-filter: none; -webkit-backdrop-filter: none; border: 0;
  }
}
/* Phones and tablets: the 16:9 frame is the whole slide, so the words sit on a soft shade at its foot */
@media (max-width: 899px) {
  .home-hero-row .banner-slider .banner-text {
    position: absolute; inset: auto 0 0; left: 0; right: 0; bottom: 0; width: auto; transform: none;
    z-index: 1; align-items: flex-start; gap: calc(2 * var(--u)); text-align: left;
    max-width: none; padding: calc(30 * var(--u)) calc(13 * var(--u)) calc(44 * var(--u)); border-radius: 0;
    border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
    background: linear-gradient(to top, rgba(3, 7, 17, 0.94) 45%, rgba(3, 7, 17, 0.7) 76%, rgba(3, 7, 17, 0));
  }
  .banner-slider .banner-text .banner-kicker { font-size: calc(9 * var(--u)); letter-spacing: 0.14em; }
  .banner-slider .banner-title { font-size: calc(16 * var(--u)); }
  .banner-slider .banner-subtitle { font-size: calc(11 * var(--u)); }
  /* a small pill instead of a chip inside the text, so a three-line title on a 320 px phone still fits */
  .banner-slider .banner-cta { margin-top: calc(3 * var(--u)); padding: calc(3 * var(--u)) calc(9 * var(--u));
    font-size: calc(10.5 * var(--u)); }
}
