/* ============================================================
   Saraya Events — site styles (layout, responsive, motion).
   Tokens come from colors_and_type.css.
   ============================================================ */
:root { --page-gutter: 64px; }

html { scroll-behavior: smooth; }
body { background: var(--bg-canvas); color: var(--fg-primary); overflow-x: hidden; }
::selection { background: var(--gold-light); color: var(--espresso); }

/* ---------- skip to content (keyboard a11y) ---------- */
.saraya-skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--espresso); color: #fff; padding: 8px 14px;
  border-radius: 8px; font-family: var(--font-body); font-size: 14px;
  text-decoration: none;
}
.saraya-skip-link:focus { left: 8px; top: 8px; }

/* ---------- buttons ---------- */
.saraya-btn:hover { filter: brightness(1.04); box-shadow: var(--shadow-soft); }
.saraya-btn[style*="--espresso"]:hover { background: var(--espresso-soft) !important; }
.saraya-btn:active { transform: translateY(1px); }

/* ---------- cards ---------- */
.saraya-lift { transition: transform 240ms var(--ease-out), box-shadow 240ms var(--ease-out); }
.saraya-lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.saraya-lift:hover .saraya-arrow { transform: translateX(4px); }
.saraya-arrow { transition: transform 220ms var(--ease-out); }
[dir="rtl"] .saraya-lift:hover .saraya-arrow { transform: translateX(-4px); }

.saraya-navlink:hover { color: var(--gold-deep) !important; }
.saraya-footlink:hover { color: var(--ivory) !important; }
.saraya-quicklink { transition: background 180ms var(--ease-out), border-color 180ms; }
.saraya-quicklink:hover { background: rgba(250,246,240,0.08); border-color: var(--gold-light) !important; }

/* ---------- grids ---------- */
.saraya-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.saraya-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.saraya-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.saraya-tilegrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ---------- gallery (spanning mosaic) ---------- */
.saraya-gallery, .saraya-gallery-full { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 230px; gap: 18px; }
.saraya-g-wide { grid-column: span 2; }
.saraya-g-tall { grid-row: span 2; }
.saraya-g-sq { grid-column: span 1; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { :root { --page-gutter: 40px; } }
/* Vendor sidebar: mobile nav toggle is hidden on desktop, nav list always shown */
.saraya-vd-navtoggle { display: none; }
.saraya-vd-navlist { display: block; }

/* hand off to the hamburger a little early so the 9-item nav never crowds */
@media (max-width: 1080px) {
  .saraya-desktop-nav { display: none !important; }
  .saraya-mobile-nav { display: flex !important; }
}
@media (max-width: 960px) {
  .saraya-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .saraya-grid-4 { grid-template-columns: repeat(3, 1fr); }
  .saraya-split { grid-template-columns: 1fr !important; gap: 36px !important; }
  .saraya-checkout-grid { grid-template-columns: 1fr !important; }
     .saraya-rfq-band { grid-template-columns: 1fr !important; }
       .saraya-vd-shell { flex-direction: column !important; }
   .saraya-vd-sidebar { width: 100% !important; position: static !important; top: auto !important; padding: 8px !important; }
   .saraya-vd-navtoggle { display: flex !important; }
   .saraya-vd-navtitle { display: none !important; }
   .saraya-vd-navlist { display: none; margin-top: 8px; }
   .saraya-vd-navlist.open { display: block; }
   table { display: block; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 760px) {
  :root { --page-gutter: 24px; }
  .saraya-grid-2 { grid-template-columns: 1fr; }
   
  .saraya-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .saraya-tilegrid { grid-template-columns: repeat(3, 1fr); }
  .saraya-gallery, .saraya-gallery-full { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 200px; }
  .saraya-g-wide { grid-column: span 2; }
  .saraya-g-tall { grid-row: span 1; }
  .saraya-step-label { display: none; }
}
@media (max-width: 520px) {
  .saraya-grid-3, .saraya-grid-4 { grid-template-columns: 1fr; }
  .saraya-tilegrid { grid-template-columns: repeat(2, 1fr); }
  .saraya-gallery, .saraya-gallery-full { grid-template-columns: 1fr; }
  .saraya-g-wide, .saraya-g-tall { grid-column: span 1; grid-row: span 1; }
}

/* desktop default: hide mobile chrome */
.saraya-mobile-nav { display: none; }

/* ---------- admin mode ---------- */
.saraya-img-overlay:hover { opacity: 1 !important; }
.saraya-admin-cardtools { opacity: 0; transition: opacity 160ms var(--ease-out); }
.saraya-lift:hover .saraya-admin-cardtools,
[style*="position: relative"] > .saraya-admin-cardtools:hover { opacity: 1; }
.saraya-admin-cardtools:hover { opacity: 1; }
div:hover > .saraya-admin-cardtools { opacity: 1; }
/* opacity kept at 1 so the (already-muted #9a918b) inline colour stays ≥4.5:1
   (WCAG AA). A reduced opacity here compounds with the colour, dropping it to
   ~2.6:1. Hover is handled inline in JS since the inline colour wins over CSS. */
.saraya-admin-access { opacity: 1; }

/* hide scrollbar on category bar */
.saraya-catbar::-webkit-scrollbar { display: none; }
.saraya-catbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ---------- mobile fixes ---------- */
/* footer columns: 2-col at 760px, 1-col at 480px */
@media (max-width: 760px)  { .saraya-footer-grid { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 480px)  { .saraya-footer-grid { grid-template-columns: 1fr !important; } }

/* inline 2-col form grids inside modals / forms → stack on small screens */
@media (max-width: 640px)  { .saraya-form-2col  { grid-template-columns: 1fr !important; } }

/* checkout card detail 3-col → 1-col at 640px */
@media (max-width: 960px)  { .saraya-card-3col  { grid-template-columns: 1fr 1fr !important; } }
@media (max-width: 480px)  { .saraya-card-3col  { grid-template-columns: 1fr !important; } }

/* payment method buttons row → wrap gracefully */
@media (max-width: 480px)  { .saraya-pay-methods { flex-wrap: wrap !important; } }

/* "how it works" auto-fit grid: shrink min from 280px to 240px on mobile */
@media (max-width: 640px)  { .saraya-hiw-grid { grid-template-columns: 1fr !important; } }

/* page-level split grids that are not saraya-split (showroom hero, page-core hero) */
@media (max-width: 900px)  { .saraya-hero-split { grid-template-columns: 1fr !important; } }

/* modal padding responsive — reduce horizontal pad on tiny screens */
@media (max-width: 480px)  { .saraya-modal-body { padding-left: 18px !important; padding-right: 18px !important; } }

/* vendor dashboard status pipeline */
.saraya-vd-pipeline { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- motion ---------- */
@keyframes sarayaPop { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes sarayaFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sarayaSlideIn { from { transform: translateX(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
[dir="rtl"] @keyframes sarayaSlideIn { from { transform: translateX(-40px); } to { transform: none; } }
@keyframes sarayaStep { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sarayaSpin { to { transform: rotate(360deg); } }
.saraya-spin { animation: sarayaSpin 0.8s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- mobile robustness (responsive/a11y audit — 20260803) ---------- */
/* prevent inputs/controls from overflowing their containers on small screens */
input, select, textarea, button { box-sizing: border-box; }
input, select, textarea { max-width: 100%; }
/* media never overflows its column */
img, video { max-width: 100%; height: auto; }
/* long words / urls / emails wrap instead of forcing horizontal scroll */
.saraya-vd-shell, .saraya-modal-body, p, li, td, th, dd, dt, figcaption, blockquote { overflow-wrap: break-word; }
/* generic inline 2-col grids collapse to a single column on phones */
@media (max-width: 560px) {
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:1fr 1fr"]  { grid-template-columns: 1fr !important; }
}
/* touch targets: minimum comfortable tap size for actionable controls on touch devices */
@media (max-width: 560px) {
  button, a[role="button"], .saraya-btn, [class*="saraya-btn"] { min-height: 44px; }
}
/* iOS Safari auto-zooms on focus when input font-size < 16px — force 16px on phones */
@media (max-width: 560px) {
  input, select, textarea { font-size: 16px !important; }
}
/* upload triggers are <label>s wrapping a hidden file input (styled as buttons) —
   the generic button rule above doesn't reach them; give them a comfortable tap size on phones.
   :has() is well-supported on iOS 15.4+/modern Chrome. Only matches labels that actually contain a file input. */
@media (max-width: 560px) {
  label:has(> input[type="file"]),
  label:has(input[type="file"]) {
    display: inline-flex !important;
    align-items: center;
    min-height: 44px;
  }
}

/* ---------- rental-only image frames (RentalImageFrame) ---------- */
/* Rentals only. Do not use for product/service/marketplace images.
   Furniture/items are shown in full (contain), centered, never cropped,
   on a consistent pale-gold wash so every rental card lines up. */
.rental-image-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f7f0df;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rental-image-frame > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.rental-detail-image-frame {
  width: 100%;
  max-height: 520px;
  aspect-ratio: 1 / 1;
  background: #f7f0df;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rental-detail-image-frame > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
/* fallback placeholder (icon tile) fills the frame too */
.rental-image-frame > *, .rental-detail-image-frame > * { max-width: 100%; max-height: 100%; }
