/* ---------- reveal utility (used on every page) ----------
   Driven by Reveal.js (IntersectionObserver). Views stagger a group by
   setting --reveal-delay per item — see blog/index.php. A custom property
   rather than an inline transition-delay so a media query can still cancel
   the stagger; an inline declaration would outrank every stylesheet. */
.reveal{
  opacity:0;
  transform: translateY(22px);
  transition:
    opacity var(--dur-slow) var(--ease-glass),
    transform var(--dur-slow) var(--ease-glass);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal-visible{ opacity:1; transform: translateY(0); }

/* ---------- media loading frame ----------
   A frosted skeleton that shimmers until the photo inside has actually
   decoded, then cross-fades to it. Both classes are added by MediaLoader.js,
   never by the markup: if the JS never runs, the image is simply visible
   from the start rather than stuck at opacity 0. */
.media-frame{
  position:relative;
  overflow:hidden;
  background: linear-gradient(120deg, var(--glass-bg) 25%, var(--glass-bg-2) 37%, var(--glass-bg) 63%);
  background-size: 400% 100%;
  animation: glass-shimmer 1.6s ease-in-out infinite;
}
.media-frame.is-loaded{ animation:none; background:none; }
.media-frame > img{
  opacity:0;
  transition: opacity var(--dur-slow) var(--ease-glass), transform var(--dur-slow) var(--ease-glass);
}
.media-frame.is-loaded > img{ opacity:1; }
@keyframes glass-shimmer{
  0%{ background-position: 100% 0; }
  100%{ background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce){
  .media-frame{ animation:none; background:none; }
  .media-frame > img{ opacity:1; transition:none; }
}

/* ---------- product card ---------- */
.product-card{
  position:relative;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
}
.product-card:hover{
  transform: translateY(-6px);
  border-color: rgba(232,163,61,0.35);
  box-shadow: 0 18px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(232,163,61,0.08), 0 0 32px rgba(232,163,61,0.12);
}
/* Glass "shine" sweep on hover — a light streak crossing the whole card. */
.product-card::before{
  content:"";
  position:absolute; inset:0; z-index:2;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,0.16) 50%, transparent 58%);
  background-size:250% 250%;
  background-position: 130% 130%;
  transition: background-position .9s ease;
  pointer-events:none;
}
.product-card:hover::before{ background-position: -30% -30%; }

/* The shimmer skeleton and the fade-in now come from .media-frame, which
   MediaLoader.js adds here at runtime — so this only owns the shape. */
.product-card-media{
  position:relative;
  display:block;
  aspect-ratio: 4/5;
  overflow:hidden;
}
.product-card-media::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(180deg, transparent 55%, rgba(20,16,13,0.55) 100%);
  pointer-events:none;
}
.product-card-media img{ width:100%; height:100%; object-fit:cover; }
.product-card:hover .product-card-media img{ transform: scale(1.06); }
@media (prefers-reduced-motion: reduce){
  .product-card::before{ display:none; }
}
.product-card-category{
  position:absolute;
  top:12px; left:12px;
  font-family: var(--font-mono);
  font-size:.62rem;
  text-transform:uppercase;
  letter-spacing:.08em;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(20,16,13,0.6);
  backdrop-filter: blur(6px);
  border: 1px solid var(--glass-border);
}
.product-card-lowstock{
  position:absolute;
  bottom:12px; left:12px;
  font-family: var(--font-mono);
  font-size:.62rem;
  text-transform:uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(194,59,34,0.75);
  color: var(--bone);
}
.product-card-outstock{
  background: rgba(20,16,13,0.85);
  border: 1px solid var(--glass-border);
}
.product-card-body{
  padding: 18px 18px 20px;
  display:flex;
  flex-direction:column;
  gap: 6px;
  flex:1;
}
.product-card-body h4{
  font-size:1.02rem;
  margin:0;
}
.product-card-price{
  font-family: var(--font-mono);
  color: var(--kiln-light);
  font-size:.88rem;
  margin: 0 0 10px;
}
.product-card-actions{
  display:flex;
  gap: 8px;
  margin-top:auto;
}
.product-card-actions .btn{
  flex:1;
  padding: .7em 1em;
  font-size:.68rem;
  justify-content:center;
}

.product-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}
@media (max-width: 980px){
  .product-grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px){
  .product-grid{ grid-template-columns: 1fr 1fr; gap: 14px; }
}

/* ---------- carousel ---------- */
.carousel{
  position:relative;
  width:100%; height:100%;
  overflow:hidden;
}
.carousel-track{
  position:relative;
  width:100%; height:100%;
}
.carousel-slide{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:cover;
  opacity:0;
  transform: scale(1.04);
  transition: opacity 1s ease, transform 6s ease;
  filter: saturate(1.05) contrast(1.05);
}
.carousel-slide.active{
  opacity:1;
  transform: scale(1);
  z-index:1;
}

.carousel-arrow{
  position:absolute; top:50%; z-index:2;
  transform: translateY(-50%);
  display:flex; align-items:center; justify-content:center;
  width:38px; height:38px;
  border-radius:999px;
  background: var(--glass-bg-2);
  border:1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--bone);
  cursor:pointer;
  opacity:0;
  transition: opacity .25s ease, background .25s ease, transform .25s ease;
}
.carousel:hover .carousel-arrow,
.carousel:focus-within .carousel-arrow{ opacity:1; }
.carousel-arrow:hover{ background: var(--glass-bg); transform: translateY(-50%) scale(1.06); }
.carousel-arrow-prev{ left:14px; }
.carousel-arrow-next{ right:14px; }

.carousel-dots{
  position:absolute; left:0; right:0; bottom:16px; z-index:2;
  display:flex; justify-content:center; gap:8px;
}
.carousel-dot{
  width:8px; height:8px; border-radius:999px;
  background: rgba(244,236,221,0.35);
  border:1px solid var(--glass-border);
  cursor:pointer;
  padding:0;
  transition: background .25s ease, width .25s ease;
}
.carousel-dot.active{
  background: var(--kiln-light);
  width:22px;
}

@media (max-width: 560px){
  .carousel-arrow{ width:32px; height:32px; opacity:1; }
  .carousel-dots{ bottom:10px; }
}

/* ---------- generic modal ---------- */
.modal-scrim{
  position:fixed; inset:0; z-index:400;
  background: rgba(0,0,0,0.6);
  display:flex; align-items:center; justify-content:center;
  padding: 20px;
  opacity:0;
  pointer-events:none;
  transition: opacity .25s ease;
}
.modal-scrim.open{ opacity:1; pointer-events:auto; }
.modal{
  width: 100%; max-width: 520px;
  max-height: 88vh;
  overflow-y:auto;
  padding: 30px;
  background: rgba(20,16,13,0.95);
  transform: translateY(16px) scale(.97);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.modal-scrim.open .modal{ transform: translateY(0) scale(1); }
.modal h3{ margin: 0 0 18px; }
.modal-actions{ display:flex; justify-content:flex-end; gap: 10px; margin-top: 20px; }

/* ---------- cookie consent banner ----------
   Named .site-notice, not .cookie-banner: content blockers hide the latter by
   selector. See app/Views/partials/site-notice.php. */
.site-notice{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 500; /* above the cart drawer, below a modal scrim (400 vs 600) */
  padding: 16px;
  background: rgba(20,16,13,0.97);
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
  transform: translateY(100%);
  transition: transform var(--dur) var(--ease-glass);
}
.site-notice.is-visible{ transform: translateY(0); }

/* Respects a system "reduce motion" setting — a banner sliding up from the
   bottom is exactly the kind of movement that setting exists for. */
@media (prefers-reduced-motion: reduce){
  .site-notice{ transition: none; }
}

.site-notice-inner{
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-notice-copy h2{
  font-size: 1rem;
  margin: 0 0 4px;
}
.site-notice-copy p{
  margin: 0;
  font-size: .86rem;
  line-height: 1.55;
  color: var(--bone-dim);
  max-width: 74ch;
}
.site-notice-copy a{ color: var(--teal-text); text-underline-offset: 3px; }

.site-notice-actions{
  display: flex;
  gap: 10px;
  flex: none;
  margin-left: auto;
}
/* Both buttons are the same size and weight on purpose — see the note in
   partials/site-notice.php. Declining must not be the harder option. */
.site-notice-actions .btn{ white-space: nowrap; }

@media (max-width: 780px){
  .site-notice-inner{
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .site-notice-actions{ margin-left: 0; }
  .site-notice-actions .btn{ flex: 1; }
}

/* The footer's "Cookie settings" control is a button (it opens a dialog), so
   it needs to be made to look like the two links beside it. */
.footer-legal-btn{
  font: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.footer-legal-btn:hover{ text-decoration: underline; }

/* ---------- share dialog (ShareSheet.js) ---------- */
.share-modal{ max-width: 420px; text-align: center; }

/* Sized before the QR renders so the rest of the dialog doesn't jump when it
   arrives, and given a white ground because a QR only scans reliably as dark
   modules on a light field — the dialog itself is near-black. */
.share-qr{
  width: 172px; height: 172px;
  margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 12px; padding: 8px;
}
.share-qr:empty{ background: rgba(255,255,255,0.06); }
.share-qr svg{ width: 100%; height: 100%; display: block; }

.share-link-row{ display: flex; gap: 8px; align-items: stretch; }
.share-link-input{
  flex: 1; min-width: 0;
  font-family: inherit; font-size: .82rem; color: var(--bone);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; padding: 10px 12px;
  text-overflow: ellipsis;
}
.share-link-input:focus{ outline: none; border-color: var(--kiln); }
.share-copy{ flex: none; padding: .6em 1.1em; }

.share-targets{
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-top: 16px;
}
.share-target{
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 4px; border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: var(--bone); text-decoration: none;
  font-size: .7rem; font-weight: 600;
  transition: background .15s ease, transform .15s ease;
}
.share-target:hover{ background: rgba(255,255,255,0.1); transform: translateY(-1px); }
.share-target svg{ flex: none; }

/* Four across is tight on a narrow phone in the browser (the app has its own
   share sheet), so they fold to two rows rather than shrinking further. */
@media (max-width: 380px){
  .share-targets{ grid-template-columns: repeat(2, 1fr); }
}

/* ---------- "Rate us" star picker (navbar popup) ---------- */
.review-stars{ display:flex; gap:6px; margin:6px 0 16px; }
.review-star{
  background:none; border:none; padding:2px; cursor:pointer;
  color: var(--bone-dim); transition: color .15s ease, transform .15s ease;
}
.review-star:hover{ transform: scale(1.1); }
.review-star.is-filled{ color: var(--kiln); }
.review-star.is-filled svg{ fill: currentColor; }
.modal-confirm-icon{
  width:48px; height:48px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background: rgba(194,59,34,0.18);
  /* The tinted circle behind this icon lifts the effective background, which
     pushes plain --clay below even the 3:1 that non-text needs. */
  color: var(--clay-text);
  margin-bottom: 16px;
}

/* ============ Advanced loader (top progress bar + overlay spinner) ============ */
.app-progress{
  position:fixed; top:0; left:0; right:0; height:3px;
  z-index: 9999;
  opacity:0; pointer-events:none;
  transition: opacity .2s ease;
}
.app-progress.active{ opacity:1; }
.app-progress-bar{
  height:100%; width:0%;
  background: linear-gradient(90deg, var(--clay), var(--kiln));
  box-shadow: 0 0 10px rgba(232,163,61,.6);
  transition: width .3s ease;
}
.app-progress.active .app-progress-bar{ width:78%; transition: width 2.2s cubic-bezier(.15,.8,.3,1); }
.app-progress.done .app-progress-bar{ width:100%; transition: width .2s ease; }

.app-loader-overlay{
  position:fixed; inset:0; z-index:9998;
  display:flex; align-items:center; justify-content:center;
  background: rgba(20,16,13,0.55);
  backdrop-filter: blur(4px);
  opacity:0; pointer-events:none;
  transition: opacity .2s ease;
}
.app-loader-overlay.active{ opacity:1; pointer-events:auto; }
.app-loader-spinner{ display:flex; gap:8px; }
.app-loader-spinner span{
  width:12px; height:12px; border-radius:50%;
  background: var(--kiln);
  animation: app-loader-bounce 1s ease-in-out infinite;
}
.app-loader-spinner span:nth-child(2){ background: var(--clay); animation-delay:.15s; }
.app-loader-spinner span:nth-child(3){ background: var(--teal); animation-delay:.3s; }
@keyframes app-loader-bounce{
  0%, 80%, 100%{ transform: scale(.6); opacity:.5; }
  40%{ transform: scale(1); opacity:1; }
}

/* ============ Product quick-view modal ============ */
.modal.product-modal{
  max-width: 780px;
  padding: 0;
  display:grid;
  grid-template-columns: 1fr 1fr;
  position:relative;
}
@media (max-width: 700px){
  .modal.product-modal{ grid-template-columns: 1fr; max-height: 92vh; }
}
.product-modal-close{
  position:absolute; top:14px; right:14px; z-index:2;
  width:36px; height:36px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background: rgba(20,16,13,0.55); backdrop-filter: blur(6px);
  border: 1px solid var(--glass-border); color: var(--bone);
  cursor:pointer;
}
.product-modal-media{ aspect-ratio: 1/1; overflow:hidden; }
.product-modal-media img{ width:100%; height:100%; object-fit:cover; }
.product-modal-info{ padding: 30px; overflow-y:auto; }
.product-modal-info h2{ font-size: 1.4rem; margin: .3em 0 .3em; }
.product-modal-actions{ display:flex; gap: 14px; align-items:center; margin-bottom: 18px; }
.product-modal-fullpage{
  display:inline-block; font-family: var(--font-mono); font-size:.76rem;
  color: var(--teal-text); margin-top: 4px;
}
.product-modal-loading{
  display:flex; align-items:center; justify-content:center; gap:8px;
  padding: 90px 20px; grid-column: 1/-1;
}
.product-modal-loading span{
  width:9px; height:9px; border-radius:50%; background: var(--kiln);
  animation: app-loader-bounce 1s ease-in-out infinite;
}
.product-modal-loading span:nth-child(2){ background: var(--clay); animation-delay:.15s; }
.product-modal-loading span:nth-child(3){ background: var(--teal); animation-delay:.3s; }
.product-modal-error{ padding: 60px 30px; text-align:center; color: var(--clay-text); grid-column: 1/-1; }

/* ============ PWA install banner ============ */
.install-banner{
  position:fixed; left:16px; right:16px; bottom:16px; z-index:500;
  display:flex; align-items:center; gap:12px;
  padding:14px 16px;
  background: rgba(20,16,13,0.97);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  max-width:420px; margin:0 auto;
  opacity:0; transform: translateY(16px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events:none;
}
.install-banner.is-visible{ opacity:1; transform:translateY(0); pointer-events:auto; }
.install-banner img{ width:40px; height:40px; border-radius:10px; flex:none; }
.install-banner-copy{ display:flex; flex-direction:column; gap:2px; flex:1; min-width:0; }
.install-banner-copy strong{ font-size:.86rem; }
.install-banner-copy span{ font-size:.74rem; color: var(--bone-dim); }
.install-banner .btn{ padding:.6em 1em; font-size:.76rem; flex:none; }
.install-banner-close{
  background:none; border:none; color: var(--bone-dim); font-size:1.1rem;
  cursor:pointer; padding:4px; flex:none;
}

/* Guided product tour (Tour.js) */
.tour-overlay{ position:fixed; inset:0; z-index:9999; }
.tour-highlight{
  position:fixed; border-radius:12px;
  box-shadow: 0 0 0 9999px rgba(10,8,6,.72);
  transition: top .35s ease, left .35s ease, width .35s ease, height .35s ease;
  pointer-events:none;
}
.tour-tooltip{
  position:fixed; z-index:10000; width:320px; max-width:calc(100vw - 24px);
  background: var(--ink, #1b1512); color: var(--bone, #F4ECDD);
  border:1px solid var(--glass-border, rgba(244,236,221,0.14));
  border-radius:14px; padding:16px 18px; box-shadow:0 20px 50px rgba(0,0,0,.45);
  transition: top .35s ease, left .35s ease;
}
.tour-tooltip-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.tour-step-count{ font-family: var(--font-mono, monospace); font-size:.68rem; text-transform:uppercase; letter-spacing:.04em; color: var(--kiln-light, #F4C468); }
.tour-close{
  background:none; border:none; color: var(--bone-dim, #CFC2AC); font-size:1.2rem; line-height:1;
  cursor:pointer; padding:2px 4px;
}
.tour-title{ margin:0 0 6px; font-size:1rem; }
.tour-text{ margin:0 0 12px; font-size:.86rem; line-height:1.5; color: var(--bone-dim, #CFC2AC); }
.tour-dots{ display:flex; gap:5px; margin-bottom:14px; }
.tour-dot{ width:6px; height:6px; border-radius:50%; background: var(--glass-border, rgba(244,236,221,0.14)); }
.tour-dot.is-active{ background: var(--kiln, #E8A33D); }
.tour-actions{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.tour-skip{
  background:none; border:none; color: var(--bone-dim, #CFC2AC); font-size:.78rem;
  cursor:pointer; padding:6px 0; text-decoration:underline; text-underline-offset:2px;
}
.tour-nav{ display:flex; gap:8px; }
.tour-nav button{
  font-family: inherit; font-size:.8rem; padding:.55em 1.1em; border-radius:999px; cursor:pointer;
  border:1px solid var(--glass-border, rgba(244,236,221,0.14));
}
.tour-prev{ background:none; color: var(--bone, #F4ECDD); }
.tour-next{ background: var(--kiln, #E8A33D); color:#1b1512; border-color:transparent; font-weight:600; }
@media (max-width: 560px){
  .tour-tooltip{ width:calc(100vw - 24px); }
}

/* Refresh button on the maintenance page (maintenance-refresh.js) — same
   shake+bounce cue used for the mobile app's own refresh icons. */
.is-refreshing{ animation: refreshShakeBounce .8s ease-in-out infinite; }
@keyframes refreshShakeBounce{
  0%   { transform: translateY(0) rotate(0deg); }
  15%  { transform: translateY(-5px) rotate(-12deg); }
  30%  { transform: translateY(0) rotate(10deg); }
  45%  { transform: translateY(-3px) rotate(-8deg); }
  60%  { transform: translateY(0) rotate(6deg); }
  75%  { transform: translateY(-4px) rotate(0deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
