/* ============================================================
   BaristaNotes — custom styles beyond Tailwind
   ============================================================ */

:root {
  --steam-opacity: 0.35;
}
.dark {
  --steam-opacity: 0.2;
}

html {
  scroll-behavior: smooth;
}

::selection {
  background: #8a9a86;
  color: #f5efe6;
}

/* ---- focus states ---------------------------------------- */
:focus-visible {
  outline: 2px solid #8a9a86;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- skip link -------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #2b1b17;
  color: #f5efe6;
  padding: 0.75rem 1.25rem;
  z-index: 100;
  font-weight: 600;
  border-radius: 0 0 8px 0;
}
.skip-link:focus {
  left: 0;
}

/* ---- reveal on scroll ------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ---- 3D book mockup --------------------------------------- */
.book-scene {
  perspective: 1100px;
}
.book {
  position: relative;
  transform: rotateY(-22deg) rotateX(5deg);
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.book-scene:hover .book {
  transform: rotateY(-10deg) rotateX(2deg) translateY(-6px);
}
.book-cover {
  position: relative;
  z-index: 2;
  border-radius: 4px 10px 10px 4px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 40%),
    linear-gradient(165deg, #38231d 0%, #2b1b17 55%, #1d110e 100%);
  box-shadow: inset 3px 0 6px rgba(255, 255, 255, 0.08),
    inset -2px 0 4px rgba(0, 0, 0, 0.35);
}
.book-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 22px;
  transform: rotateY(-84deg) translateX(-11px);
  transform-origin: left center;
  background: linear-gradient(180deg, #241512, #170d0a);
  border-radius: 3px 0 0 3px;
}
.book-pages {
  position: absolute;
  top: 4px;
  bottom: 4px;
  right: -9px;
  width: 10px;
  transform: rotateY(24deg) translateZ(-2px);
  transform-origin: left center;
  background: repeating-linear-gradient(
    90deg,
    #f5efe6 0px,
    #f5efe6 2px,
    #d9cdb8 3px
  );
  border-radius: 0 3px 3px 0;
}
.book-shadow {
  position: absolute;
  left: 8%;
  right: 0;
  bottom: -26px;
  height: 26px;
  background: radial-gradient(
    ellipse at center,
    rgba(20, 10, 8, 0.45),
    transparent 68%
  );
  filter: blur(5px);
}

/* ---- coffee steam ------------------------------------------ */
.steam {
  position: relative;
}
.steam::before,
.steam::after {
  content: '';
  position: absolute;
  bottom: 100%;
  width: 6px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(to top, rgba(245, 239, 230, 0), rgba(245, 239, 230, var(--steam-opacity)));
  filter: blur(4px);
  animation: steam-rise 3.2s ease-in-out infinite;
}
.steam::before {
  left: 38%;
}
.steam::after {
  left: 56%;
  animation-delay: 1.6s;
}
@keyframes steam-rise {
  0% {
    transform: translateY(6px) scaleX(1);
    opacity: 0;
  }
  35% {
    opacity: 1;
  }
  100% {
    transform: translateY(-26px) scaleX(1.8);
    opacity: 0;
  }
}

/* ---- range inputs ------------------------------------------ */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, #8a9a86 var(--fill, 50%), rgba(138, 154, 134, 0.25) var(--fill, 50%));
  cursor: pointer;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f5efe6;
  border: 6px solid #2b1b17;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: grab;
}
input[type='range']::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f5efe6;
  border: 6px solid #2b1b17;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: grab;
}

/* ---- accordion --------------------------------------------- */
details.acc summary {
  list-style: none;
  cursor: pointer;
}
details.acc summary::-webkit-details-marker {
  display: none;
}
details.acc summary .acc-icon {
  transition: transform 0.3s ease;
}
details.acc[open] summary .acc-icon {
  transform: rotate(45deg);
}
details.acc .acc-body {
  animation: acc-open 0.35s ease;
}
@keyframes acc-open {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- segmented control -------------------------------------- */
.seg {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(43, 27, 23, 0.08);
}
.dark .seg {
  background: rgba(245, 239, 230, 0.08);
}
.seg button {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: inherit;
  opacity: 0.65;
  transition: all 0.25s ease;
}
.seg button.active {
  background: #2b1b17;
  color: #f5efe6;
  opacity: 1;
  box-shadow: 0 3px 10px rgba(43, 27, 23, 0.3);
}
.dark .seg button.active {
  background: #8a9a86;
  color: #1a1a1a;
}

/* ---- timeline (pour schedule) -------------------------------- */
.timeline-step {
  position: relative;
  padding-left: 2.25rem;
}
.timeline-step::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 26px;
  bottom: -14px;
  width: 2px;
  background: linear-gradient(to bottom, #8a9a86, rgba(138, 154, 134, 0.15));
}
.timeline-step:last-child::before {
  display: none;
}
.timeline-dot {
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f5efe6;
  border: 5px solid #8a9a86;
  box-shadow: 0 2px 6px rgba(43, 27, 23, 0.25);
}

/* ---- ratio dial gauge ---------------------------------------- */
.gauge-arc {
  transition: stroke-dasharray 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- toast ---------------------------------------------------- */
#bn-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 80px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 90;
  pointer-events: none;
}
#bn-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* ---- skeleton loading for catalog ------------------------------ */
.skeleton {
  background: linear-gradient(
    100deg,
    rgba(138, 154, 134, 0.12) 40%,
    rgba(138, 154, 134, 0.28) 50%,
    rgba(138, 154, 134, 0.12) 60%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---- ticker (reviews marquee) ----------------------------------- */
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}
.marquee-track {
  display: flex;
  gap: 1.5rem;
  width: max-content;
  animation: marquee 42s linear infinite;
}
.marquee:hover .marquee-track {
  animation-play-state: paused;
}
@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

/* ---- number flip on output --------------------------------------- */
.flip {
  animation: flip-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes flip-in {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}
