/* ══════════ Mobile-first refinements (most visitors are on phones) ══════════
   Loaded after styles.css so these rules win. */
html { -webkit-text-size-adjust: 100%; }
a, button, summary, label { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Photo slider (all sizes) */
.pd-slider-wrap { position: relative; }
.pd-slider { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; border-radius: 22px; aspect-ratio: 4 / 3; background: var(--navy); box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .55); }
.pd-slider::-webkit-scrollbar { display: none; }
.pd-slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.pd-slide img { width: 100%; height: 100%; object-fit: contain; }
.pd-count { position: absolute; top: 12px; right: 12px; padding: .25em .75em; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; font-size: .78rem; backdrop-filter: blur(6px); }
.pd-dots { display: none; justify-content: center; gap: 6px; margin-top: 12px; }
.pd-dots i { width: 7px; height: 7px; border-radius: 999px; background: rgba(255, 255, 255, .35); transition: width .25s, background .25s; }
.pd-hero:not(.navy) .pd-dots i { background: var(--line); }
.pd-dots i.on { width: 22px; background: var(--gold-2); }

/* Read more */
.read-more { display: block; width: 100%; margin: 6px 0 4px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font: inherit; font-weight: 600; color: var(--forest); cursor: pointer; }
.pd-desc-body.collapsed { max-height: 620px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }

/* Bottom tab bar */
.tabbar { display: none; }

/* Admin extras */
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.quick-btn { display: flex; align-items: center; gap: 10px; padding: 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); text-decoration: none; font-weight: 600; font-size: .92rem; color: var(--ink); transition: transform .15s, box-shadow .2s; }
.quick-btn .ic { color: var(--wine); }
.quick-btn:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.cloud-status { margin: 0 0 18px; }
.upload-status { margin-bottom: 16px; padding: 12px 16px; border-radius: 10px; background: var(--gold-soft); color: #7A5B1E; font-weight: 600; font-size: .92rem; }
@media (max-width: 900px) {
  body.admin { grid-template-columns: minmax(0, 1fr); }
  .admin-main, .admin-main > * { min-width: 0; }
  .flash, code { overflow-wrap: anywhere; }
  .quick { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .quick-btn { padding: 14px; font-size: .88rem; }
  .admin-main { padding: 18px 14px 40px; }
  .admin-top h1 { font-size: 1.5rem; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat strong { font-size: 1.35rem; }
  .panel { padding: 16px; border-radius: 14px; }
  .admin-side .logo-sub { display: none; }
  .admin-side nav a { padding: 9px 12px; font-size: .88rem; }
  .table { font-size: .85rem; }
  .form-actions { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0; margin-bottom: -16px; }
  .form-actions .btn { flex: 1; }
}

@media (max-width: 900px) {
  .section { padding: 48px 0; }

  /* Header: compact, app-like */
  .site-header .header-row { height: 58px; }
  .logo-mark { width: 36px; height: 36px; border-radius: 10px; }
  .logo-name { font-size: 1.25rem; }
  .logo-sub { display: none; }
  .has-tabbar .header-my { display: none; }

  /* Tab bar */
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 2px; text-decoration: none; font-size: .7rem; font-weight: 600; color: var(--muted); }
  .tabbar .ic { box-sizing: content-box; padding: 4px 18px; border-radius: 999px; transition: background .2s; }
  .tabbar a.active { color: var(--forest); }
  .tabbar a.active .ic { background: var(--gold-soft); stroke-width: 2; }
  .tabbar a:active .ic { background: var(--tint); }
  body.has-tabbar { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

  /* Home */
  .intro { padding: 28px 0 22px; }
  .intro h1 { font-size: clamp(1.7rem, 7vw, 2.3rem); margin-bottom: .4em; }
  .intro .lead { font-size: .98rem; margin-bottom: 18px; }
  .intro-points { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; }
  .intro-points::-webkit-scrollbar { display: none; }
  .intro-points span { flex-shrink: 0; font-size: .8rem; }
  .promo { margin-bottom: 22px; }
  .center-tabs { position: sticky; top: 58px; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin-bottom: 18px; box-shadow: 0 6px 18px -10px rgba(27, 26, 23, .25); }
  .center-tabs .tab { text-align: center; padding: .7em .5em; }
  .shop { padding-bottom: 36px; }
  .how-simple { grid-template-columns: repeat(3, 1fr); gap: 8px; padding-bottom: 36px; }
  .how-simple > div { flex-direction: column; gap: 6px; padding: 14px 6px; text-align: center; font-size: .82rem; justify-content: center; }
  .simple-footer { padding: 20px 0; }
  .simple-footer-row { flex-direction: column; align-items: center; text-align: center; gap: 8px; }

  /* Product: hero */
  .pd-hero { padding: 0 0 28px; }
  .pd-hero .crumbs { display: none; }
  .pd-hero .pd-grid { gap: 20px; }
  .pd-left { margin: 0 -20px; }
  .pd-slider { border-radius: 0; box-shadow: none; }
  .pd-thumbs { display: none; }
  .pd-dots { display: flex; }
  .pd-info h1, .navy .pd-info h1 { font-size: clamp(1.9rem, 8vw, 2.5rem); }
  .navy .pd-subtitle { font-size: 1.12rem; }
  .pd-hook { font-size: 1rem; margin: 10px 0 14px; }
  .pd-checks li { font-size: .93rem; }
  .product-price { margin: 12px 0 16px; }
  .product-price .price { font-size: 2rem; }
  .pd-share { margin: 14px 0 12px; }
  .share-btn { width: 42px; height: 42px; }
  .trust { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 16px; padding-bottom: 4px; font-size: .82rem; }
  .trust span { flex-shrink: 0; }

  /* Product: sections become swipeable rows */
  .pd-gallery .gallery-grid { display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 84%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -20px; padding: 4px 20px 10px; gap: 12px; }
  .pd-gallery .gallery-grid::-webkit-scrollbar { display: none; }
  .gallery-item { scroll-snap-align: center; border-radius: 16px; }
  .band { padding: 52px 0; }
  .band h2 { font-size: clamp(1.5rem, 6.4vw, 2rem); margin-bottom: 22px; }
  .glass { padding: 14px 16px; font-size: .98rem; }
  .pd-body { margin-top: 0; gap: 16px; }
  .pd-desc { padding: 24px 18px; border-radius: 18px; font-size: .98rem; }
  .pd-desc h2 { font-size: 1.4rem; }
  .pd-final { flex-direction: column; align-items: stretch; }
  .pd-final .buy-form { min-width: 0; }
  .pd-side { border-radius: 18px; padding: 20px 18px; }
  .quote-band { padding: 36px 18px; border-radius: 20px; }
  .quote-band blockquote { font-size: clamp(1.3rem, 5.6vw, 1.8rem); }
  .quote-band .qmark { font-size: 4rem; }
  .section-tint .grid-4 { display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 62%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -20px; padding: 4px 20px 12px; gap: 12px; }
  .section-tint .grid-4::-webkit-scrollbar { display: none; }
  .section-tint .grid-4 .card { scroll-snap-align: start; }

  /* Sticky buy bar — slides in once the main buy button is out of view */
  .sticky-buy { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 -10px 30px -12px rgba(0, 0, 0, .25); transform: translateY(110%); transition: transform .3s ease; }
  .sticky-buy.show { transform: translateY(0); }
  .sticky-info { display: grid; min-width: 0; line-height: 1.3; }
  .sticky-info strong { font-family: var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sticky-info span { color: var(--wine); font-weight: 700; }
  .sticky-buy .buy-chip { width: auto; padding: 13px 26px; font-size: 1rem; border-radius: 999px; }
  .sticky-buy .buy-form { width: auto; flex-shrink: 0; }
  body:has(.sticky-buy) .simple-footer { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* Admin on phones: avoid iOS zoom on focus */
  .form input:not([type=checkbox]), .form select, .form textarea, .login-card input { font-size: 16px; }
}

@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }
  .pd-left, .pd-gallery .gallery-grid, .section-tint .grid-4 { margin-inline: -16px; }
  .pd-gallery .gallery-grid, .section-tint .grid-4 { padding-inline: 16px; }
  .grid, .shop .grid { gap: 12px 10px; }
  .card { padding: 7px; border-radius: 14px; }
  .card-media { padding: 14px 15%; border-radius: 10px; }
  .card-info { padding: 10px 3px 2px; }
  .card h3 { font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .card-meta { font-size: .64rem; }
  .card-author { font-size: .78rem; }
  .price { font-size: .98rem; }
  .card-foot { gap: 8px; padding-top: 10px; }
  .buy-chip { min-height: 42px; border-radius: 10px; }
  .promo-cta { font-size: .9rem; padding: .85em 1em; }
}

@media (hover: none) {
  .card:hover, .card:hover .book, .gallery-item:hover img, .promo-banner:hover img { transform: none; }
  .card:active { transform: scale(.985); }
  .btn:active, .buy-chip:active { transform: scale(.97); }
}
