/* =========================================================
   Terry's Tortes & Treats — custom styles
   (Utility-first via Tailwind CDN; this file holds the
   handful of things Tailwind utilities alone don't cover)
   ========================================================= */

html {
  scroll-behavior: smooth;
}

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

body {
  font-feature-settings: 'liga' 1, 'kern' 1;
}

/* ---------- Accessibility: skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: #4a2f22;
  color: #faf5ec;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Focus visibility (never remove outline without a replacement) ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #7a4a30;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Header shadow once scrolled ---------- */
#header.is-scrolled {
  box-shadow: 0 4px 20px -8px rgba(58, 36, 25, 0.15);
}

/* ---------- Nav links with animated underline ---------- */
.nav-link {
  position: relative;
  color: #5f3823;
  padding-bottom: 0.2rem;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: #4a2f22;
  transition: width 0.25s ease;
}
.nav-link:hover::after,
.nav-link.is-active::after {
  width: 100%;
}
.nav-link.is-active {
  color: #4a2f22;
  font-weight: 600;
}

/* ---------- Primary button ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: #4a2f22;
  color: #faf5ec;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.85rem 1.75rem;
  border-radius: 9999px;
  box-shadow: 0 10px 25px -10px rgba(74, 47, 34, 0.55);
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary:hover {
  background: #5f3823;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -10px rgba(74, 47, 34, 0.6);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary svg {
  transition: transform 0.2s ease;
}
.btn-primary:hover svg {
  transform: translateX(3px);
}
.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Section eyebrow (small label with lines) ---------- */
.section-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #b98f6f;
  font-weight: 600;
}
.section-eyebrow-line {
  position: relative;
  width: 2.75rem;
  height: 1px;
  display: inline-block;
  background-image: linear-gradient(to right, transparent, #b98f6f 85%);
}
.section-eyebrow-line::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -1px;
  width: 5px;
  height: 5px;
  background: #b98f6f;
  transform: translateY(-50%) rotate(45deg);
}
.section-eyebrow-line:last-child {
  background-image: linear-gradient(to left, transparent, #b98f6f 85%);
}
.section-eyebrow-line:last-child::before {
  left: auto;
  right: -1px;
}

/* ---------- Category cards ---------- */
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}
.category-card img {
  width: 100%;
  max-width: 9rem;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 9999px;
  box-shadow: 0 8px 20px -8px rgba(74, 47, 34, 0.25);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.category-card:hover img {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 16px 28px -10px rgba(74, 47, 34, 0.35);
}
.category-card span {
  font-size: 0.85rem;
  font-weight: 500;
  color: #4a2f22;
  text-align: center;
  line-height: 1.3;
}

/* ---------- Handwritten note ---------- */
.hand-note {
  font-family: 'Caveat', cursive;
  line-height: 1.15;
}

/* ---------- Contact icon bubble ---------- */
.contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: rgba(74, 47, 34, 0.12);
  color: #4a2f22;
  flex-shrink: 0;
}

/* ---------- Form ---------- */
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #5f3823;
  margin-bottom: 0.25rem;
}
.form-input {
  width: 100%;
  border: 1px solid #e9d9cb;
  background: #fdfbf7;
  border-radius: 0.6rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  color: #3a2419;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-input::placeholder {
  color: #b3937d;
}
.form-input:focus {
  border-color: #7a4a30;
  box-shadow: 0 0 0 3px rgba(122, 74, 48, 0.15);
  outline: none;
}
.form-input.is-invalid {
  border-color: #dc2626;
}
.form-error {
  font-size: 0.75rem;
  color: #dc2626;
  margin-top: 0.2rem;
}
.form-error:empty {
  margin-top: 0;
}

/* ---------- Back to top button ---------- */
#toTop.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
#toTop:hover {
  background: #5f3823;
}

/* ---------- Reveal-on-load / reveal-on-scroll ----------
   Content is visible by default (no-JS / slow-JS safe). script.js adds
   `.js-reveal` to <html> only once it's actually observing elements and
   committed to animating them back in, so a script failure or slow
   network never leaves a section stuck invisible. */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.75s cubic-bezier(0.16, 0.84, 0.44, 1),
    transform 0.75s cubic-bezier(0.16, 0.84, 0.44, 1);
}
.js-reveal [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children: each direct child of a [data-reveal-group]
   fades/slides in in sequence once the group enters the viewport. */
.js-reveal [data-reveal-group] > * {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s cubic-bezier(0.16, 0.84, 0.44, 1),
    transform 0.7s cubic-bezier(0.16, 0.84, 0.44, 1);
}
.js-reveal [data-reveal-group].is-visible > * {
  opacity: 1;
  transform: translateY(0);
}
.js-reveal [data-reveal-group].is-visible > *:nth-child(1) { transition-delay: 0.05s; }
.js-reveal [data-reveal-group].is-visible > *:nth-child(2) { transition-delay: 0.14s; }
.js-reveal [data-reveal-group].is-visible > *:nth-child(3) { transition-delay: 0.23s; }
.js-reveal [data-reveal-group].is-visible > *:nth-child(4) { transition-delay: 0.32s; }
.js-reveal [data-reveal-group].is-visible > *:nth-child(5) { transition-delay: 0.41s; }
.js-reveal [data-reveal-group].is-visible > *:nth-child(6) { transition-delay: 0.5s; }

@media (prefers-reduced-motion: reduce) {
  .js-reveal [data-reveal],
  .js-reveal [data-reveal-group] > * {
    opacity: 1;
    transform: none;
  }
}
