/* Dolce Orso — phone and tablet layout layer (loaded on every page, after the page's own styles).
   Pages are built with inline styles, so rules here use !important where they must win.
   ≤1023px = phones + tablets, ≤767px = phones only, (pointer:coarse) = any touch screen. Mouse desktops are untouched. */

/* ============ phones + tablets + any touch screen (incl. landscape iPads) ============ */
@media (max-width: 1023px), (pointer: coarse) {
  /* readable minimum: nothing below 11px (the bag counter bubble keeps its size) */
  [style*="font-size:10px"]:not([data-bagcount]),
  [style*="font-size: 10px"]:not([data-bagcount]) { font-size: 11px !important; }

  /* finger-sized hit areas, same look */
  header nav a { display: inline-flex !important; align-items: center; min-height: 40px; padding-left: 4px; padding-right: 4px; }
  nav[style*="JetBrains"] a, .do-tl, .do-sec a { display: inline-block; padding-top: 10px !important; padding-bottom: 10px !important; margin-top: -10px; margin-bottom: -10px; }
  footer a { padding-top: 4px; padding-bottom: 4px; }
}

/* =========================== phones + tablets =========================== */
@media (max-width: 1023px) {
  /* product cards: names always take two lines, so prices line up across each row */
  a[href^="product?p="] > div:last-child > p:first-child,
  .do-card > div:last-child > p:first-child {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    min-height: 2.6em;
    line-height: 1.3 !important;
  }

  /* footer: the blade sits below the "Crafted for little ones" label instead of on top of it */
  footer div:has(+ [data-slot="footer-panda"]) { justify-content: center; margin-bottom: clamp(72px, 12vw, 120px) !important; }
}

/* =========================== tablets only =========================== */
@media (min-width: 768px) and (max-width: 1023px) {
  /* wardrobe: four columns stay, labels sized so name and arrow never touch */
  .dco-section { margin-left: 8px !important; margin-right: 8px !important; }   /* same gutter as the banners below */
  .dco-stage { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .dco-label { column-gap: 8px !important; margin-left: 12px !important; margin-right: 12px !important; }
  .dco-label em { white-space: nowrap; }
  .dco-label em { font-size: 19px !important; }
  .dco-label b { width: 32px !important; font-size: 14px !important; }

  a[href^="product?p="] > div:last-child > p:first-child { font-size: 14px !important; }
}

/* =========================== phones only =========================== */
@media (max-width: 767px) {
  /* header: the icon groups stay clear of the centred logo */
  header > div:first-child > div:first-child,
  header > div:first-child > div:last-child { gap: 0 !important; }
  header > div:first-child > a { white-space: nowrap; }

  /* cards: name then price. The size line is the same on every piece (XXXS – XXL), so phones skip it */
  a[href^="product?p="] > div:last-child > p:first-child,
  .do-card > div:last-child > p:first-child { font-size: 14px !important; }
  a[href^="product?p="] > div:last-child > p:nth-child(2):not(:last-child),
  .do-card > div:last-child > p:nth-child(2) { display: none !important; }

  /* home: one even 8px page gutter for every block (hero is full-bleed by design) */
  .dco-section { margin-left: 8px !important; margin-right: 8px !important; margin-top: 8px !important; }
  /* wardrobe: single column stack so each object is bigger */
  .dco-stage { grid-template-columns: 1fr !important; }
  .dco-label { margin-left: 16px !important; margin-right: 16px !important; column-gap: 14px !important; }
  .dco-label em { font-size: clamp(16px, 5.4vw, 22px) !important; white-space: nowrap; }
  .dco-label b { width: clamp(30px, 9vw, 36px) !important; }

  /* home: each category's products become a swipeable rail instead of a 4-screen-tall grid */
  .do-rail {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 8px;
    margin: 0 -8px;
    padding: 2px 8px 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .do-rail::-webkit-scrollbar { display: none; }
  .do-rail > a { flex: 0 0 calc(58% - 14px) !important; scroll-snap-align: start; min-width: 0; }
  .do-rail + div { margin-top: 10px !important; flex-direction: column !important; align-items: center !important; }
  .do-rail + div::before { content: 'Swipe to see more →'; display: block; margin-bottom: 10px; text-align: center; font: 500 9px 'JetBrains Mono', monospace; letter-spacing: .06em; text-transform: uppercase; color: #bbb; }

  /* footer link categories: divider lines between each section */
  footer div:has(> h4) + div:has(> h4) { border-top: 1px solid rgba(255,255,255,.1) !important; padding-top: clamp(28px,4vw,40px) !important; }

  /* footer bottom bar: copyright on its own centered row */
  footer div[style*="border-top"] > p { width: 100% !important; }
  /* even rhythm: banner → products → "View all" → next banner */
  section:has(> .do-rail) { padding-bottom: 16px !important; }

  /* bag lines: quantity on its own row, the two text actions side by side under it */
  .do-act { display: grid !important; grid-template-columns: max-content max-content; column-gap: 22px !important; row-gap: 14px !important; align-items: center; }
  .do-act > .do-qty { grid-column: 1 / -1; justify-self: start; }

  /* listing pages: filter chips in one row, sort centred below */
  #products { flex-direction: column; align-items: stretch !important; gap: 10px !important; }
  #products > div:first-child { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px !important; width: 100%; overflow: visible !important; }
  #products > div:first-child > button { padding: 0 6px !important; justify-content: center; display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
  #products > div:nth-child(2) { justify-content: center; }
  #products button { min-height: 40px; }
}

/* product card shine flash — 7s cycle, ~3s slow sweep, all cards in sync */
@keyframes doCardShine {
  0%   { transform: translateX(-120%); }
  45%  { transform: translateX(120%); }
  100% { transform: translateX(120%); }
}
a[href^="product?p="] > div:first-child::after,
.do-card > div:first-child::after {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(
    110deg,
    transparent 0% 30%,
    rgba(255,255,255,.32) 33%,
    transparent 36%,
    transparent 39%,
    rgba(255,255,255,.18) 41%,
    transparent 44%,
    transparent 47%,
    rgba(255,255,255,.10) 49%,
    transparent 51%,
    transparent 100%
  );
  transform: translateX(-120%);
  animation: doCardShine 7s ease-in-out infinite;
  z-index: 3;
}

/* footer: the line under the newsletter runs edge to edge, like the one above the copyright */
footer div[style*="border-bottom: 1px solid rgba"] { border-bottom: 0 !important; position: relative; }
footer div[style*="border-bottom: 1px solid rgba"]::after {
  content: ""; position: absolute; bottom: 0; left: calc(-1 * clamp(16px,3vw,48px)); right: calc(-1 * clamp(16px,3vw,48px));
  height: 1px; background: rgba(255,255,255,.1); pointer-events: none;
}

/* very narrow phones (iPhone SE / mini): keep the header roomy */
@media (max-width: 360px) {
  header > div:first-child > a { font-size: 11px !important; letter-spacing: .02em; }
  header > div:first-child > div > * { min-width: 34px !important; }
  header > div:first-child { padding-left: 8px !important; padding-right: 8px !important; }
}

/* ===== footer link columns (all pages) — numbered headings, column rules, hover arrow =====
   The grid is the footer block whose children each hold an <h4> heading + a list of links. */
footer div:has(> div > h4) { counter-reset: fcol; }
footer div:has(> h4) { counter-increment: fcol; gap: 22px !important; }
footer div:has(> h4) > h4 {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.88) !important; letter-spacing: .16em !important;
}
footer div:has(> h4) > h4::before {
  content: counter(fcol, decimal-leading-zero);
  color: rgba(255,255,255,.32); letter-spacing: .06em;
}
footer div:has(> h4) > h4::after {               /* short rule after the heading */
  content: ""; flex: 0 0 28px; height: 1px; background: rgba(255,255,255,.18);
}
footer div:has(> h4) > div { gap: 13px !important; }
footer div:has(> h4) > div > a {
  position: relative; display: inline-block; width: max-content; max-width: 100%;
  font-size: 15px !important; letter-spacing: -.005em;
  transition: color .25s ease, transform .35s cubic-bezier(.2,.75,.2,1) !important;
}
footer div:has(> h4) > div > a::after {          /* arrow slides in on hover */
  content: "\2197"; position: absolute; left: calc(100% + 6px); top: 50%; margin-top: -.55em; font-size: 12px; opacity: 0; transform: translate(-6px, 2px);   /* outside the text box: centred links stay centred */
  transition: opacity .25s ease, transform .35s cubic-bezier(.2,.75,.2,1);
}
footer div:has(> h4) > div > a::before {         /* hairline underline grows from the left */
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px;
  background: rgba(255,255,255,.55); transform: scaleX(0); transform-origin: left;
  transition: transform .4s cubic-bezier(.2,.75,.2,1);
}
@media (hover: hover) {
  footer div:has(> h4) > div > a:hover { color: #fff !important; transform: translateX(4px); }
  footer div:has(> h4) > div > a:hover::after { opacity: 1; transform: translate(0, 0); }
  footer div:has(> h4) > div > a:hover::before { transform: scaleX(1); }
}
/* tablets + desktops: hairline column rules so the four groups read as one composed block */
/* phones: the four groups sit in a compact 2 x 2 grid (was one tall centred stack, ~1000px of scrolling) */
@media (max-width: 767px) {
  footer div:has(> div > h4) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; column-gap: 20px !important; row-gap: 0 !important; text-align: left !important; }
  footer div:has(> h4), footer div:has(> h4) + div:has(> h4) { align-items: flex-start !important; padding-top: 28px !important; padding-bottom: 28px !important; border-top: 0 !important; }
  footer div:has(> h4) + div:has(> h4):nth-child(n+3) { border-top: 1px solid rgba(255,255,255,.1) !important; }
  footer div:has(> h4) > h4::after { display: none; }
  footer div:has(> h4) > div > a { font-size: 14px !important; }
}
/* tablets: narrower columns, so the heading keeps to one line */
@media (min-width: 768px) and (max-width: 1023px) {
  footer div:has(> h4) > h4 { white-space: nowrap; }
  footer div:has(> h4) > h4::after { display: none; }
}
/* the blade must never cut through the "Crafted for little ones" label above it */
@media (min-width: 1024px) {
  footer div:has(+ [data-slot="footer-panda"]) { margin-bottom: clamp(56px, 6.5vw, 120px) !important; }
}
/* tablets: a row of exactly four products shows as four columns, never 3 + 1 orphan */
@media (min-width: 768px) and (max-width: 1023px) {
  .do-grid:has(> :nth-child(4):last-child),
  [style*="grid-template-columns"]:has(> a:nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}
@media (min-width: 768px) {
  footer div:has(> h4) + div:has(> h4) { border-left: 1px solid rgba(255,255,255,.08); padding-left: clamp(18px, 2.4vw, 40px); }
}

/* ================= Nov 12: phone polish pass ================= */

/* 1. inputs are 16px on touch screens: iPhone Safari zooms the whole page in when you tap a smaller field */
@media (max-width: 1023px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
  select, textarea { font-size: 16px !important; }
}

/* 2. finger-sized tap areas (looks stay the same: the extra room is invisible padding) */
@media (max-width: 1023px), (pointer: coarse) {
  /* logo in the header */
  header > div:first-child > a { padding: 14px 0; margin: -14px 0; }
  /* category strip under the header: wider invisible tap area, same look */
  header nav a[style*="font-size:11px"] { position: relative; }
  header nav a[style*="font-size:11px"]::after { content: ""; position: absolute; inset: -4px -7px; }
  /* footer links: same spacing, 38px-tall tap area */
  footer div:has(> h4) > div { gap: 0 !important; }
  footer div:has(> h4) > div > a { padding-top: 10px !important; padding-bottom: 10px !important; display: block; }
  /* "View all" under the home rails, FAQ questions, quick add (+) */
  .do-rail + div a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; }
  details.do-q summary { min-height: 44px; align-items: center; }
  .do-szs button { min-height: 38px; }
  .do-wc .do-szs button { height: 38px; }
}
@media (max-width: 767px) {
  /* "Swipe to see more" hint was 9px */
  .do-rail + div::before { font-size: 10.5px; }
  /* rows of cards: room under each price so it never touches the next card */
  .do-grid { row-gap: 22px !important; }
  /* wishlist cards: name on top, price under it (the two crowded each other in a half-width card) */
  .do-wc > div[style*="space-between"] { flex-direction: column; align-items: flex-start !important; gap: 4px !important; }
  /* concierge: the banner gets room for its label and headline, the form sits right under it */
  .do-auth:not(.do-solo) .do-auth-form { margin-top: 12px !important; }
}

/* text pages (about, delivery, FAQ, size guide, forms ...): 16px side gutter like the header; pages built around product grids keep the 8px gallery gutter */
@media (max-width: 767px) {
  #dolce-main:not(:has(.do-grid)) .do-in { padding-left: 16px; padding-right: 16px; }
}

/* phones in either orientation + tablets */
@media (max-width: 1023px), (pointer: coarse) {
  .sg-h { min-height: 44px; padding-top: 0 !important; padding-bottom: 0 !important; }
  .hs-tag { font-size: 11px !important; }
  /* footer bottom row: currency and back-to-top */
  footer div[style*="border-top"] button, footer div[style*="border-top"] a { min-height: 40px; display: inline-flex; align-items: center; }
}
