/* Small additions to the Tailwind utilities (icons, page shadows, motion) */
:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);      /* strong ease-out for UI */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);  /* on-screen movement */
  interpolate-size: allow-keywords;                 /* lets <details> animate to height: auto */
}
.material-symbols-outlined {
  display: inline-block; width: 1em; height: 1em; line-height: 1 !important;
  overflow: hidden; white-space: nowrap; direction: ltr; vertical-align: middle;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.icon-fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
details summary::-webkit-details-marker { display: none; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { font-feature-settings: 'tnum' 1; }

/* Preview images cannot be selected or dragged out */
.sheet { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }

/* A document page lying on the surface */
.sheet { background: #fff; box-shadow: 0 1px 2px rgba(18, 30, 32, .10), 0 6px 20px -6px rgba(18, 30, 32, .18); border-radius: 4px; }
.sheet-stack { position: relative; }
.sheet-stack .back { position: absolute; width: 62%; top: 4%; right: 2%; transform: rotate(4deg); }
.sheet-stack .mid { position: absolute; width: 62%; top: 9%; left: 4%; transform: rotate(-3deg); }
.sheet-stack .front { position: relative; width: 62%; margin: 14% auto 0; }

/* ===== Motion ===== */

/* Press feedback: every pill button, tab and choice tile gives way slightly when pressed */
html a.rounded-full, html button.rounded-full, html [role="tab"], html .plan-btn, html .paper-btn, html .zoom-btn {
  transition-property: transform, opacity, background-color, border-color, color;
  transition-duration: 160ms;
  transition-timing-function: var(--ease-out);
}
html a.rounded-full:active, html button.rounded-full:active { transform: scale(0.97); }
html [role="tab"]:active, html .plan-btn:active, html .paper-btn:active, html .zoom-btn:active { transform: scale(0.98); }

/* Hero: content rises in once on page load (resting state is fully visible) */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.rise { animation: rise 520ms var(--ease-out) both; animation-delay: var(--d, 0ms); }

/* Hero document stack fans out a little on hover (mouse only) */
.sheet-stack .sheet { transition: transform 320ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .hero-stack:hover .sheet-stack .back { transform: rotate(7deg) translate(10px, -4px); }
  .hero-stack:hover .sheet-stack .mid { transform: rotate(-6deg) translate(-10px, -2px); }
  .hero-stack:hover .sheet-stack .front { transform: translateY(-6px); }
}

/* Cards lift slightly under the mouse to show they are interactive */
.card-lift { transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .card-lift:hover { transform: translateY(-3px); box-shadow: 0 12px 28px -16px rgba(18, 30, 32, .28); }
}

/* Touch screens (phones, tablets): the same motion without a mouse.
   - no grey tap flash, so the press feedback above is what you see
   - the hero stack fans out once when it scrolls into view (site.js adds .in-view) and while pressed
   - cards lift while pressed, like under the mouse */
html { -webkit-tap-highlight-color: transparent; }
@keyframes fan-back { 0%, 100% { transform: rotate(4deg); } 40%, 65% { transform: rotate(7deg) translate(10px, -4px); } }
@keyframes fan-mid { 0%, 100% { transform: rotate(-3deg); } 40%, 65% { transform: rotate(-6deg) translate(-10px, -2px); } }
@keyframes fan-front { 0%, 100% { transform: none; } 40%, 65% { transform: translateY(-6px); } }
@media (hover: none), (pointer: coarse) {
  .hero-stack.in-view .sheet-stack .back { animation: fan-back 1100ms var(--ease-in-out) 350ms both; }
  .hero-stack.in-view .sheet-stack .mid { animation: fan-mid 1100ms var(--ease-in-out) 350ms both; }
  .hero-stack.in-view .sheet-stack .front { animation: fan-front 1100ms var(--ease-in-out) 350ms both; }
  .hero-stack:active .sheet-stack .back { animation: none; transform: rotate(7deg) translate(10px, -4px); }
  .hero-stack:active .sheet-stack .mid { animation: none; transform: rotate(-6deg) translate(-10px, -2px); }
  .hero-stack:active .sheet-stack .front { animation: none; transform: translateY(-6px); }
  .card-lift:active { transform: translateY(-3px); box-shadow: 0 12px 28px -16px rgba(18, 30, 32, .28); transition-duration: 120ms; }
}

/* Mobile menu drops in instead of popping up */
#mobile-nav:not(.hidden) { animation: rise 220ms var(--ease-out) both; }

/* Template detail modal: backdrop fades, dialog scales up from 96 % (centered); closing is faster */
#modal-backdrop { opacity: 0; transition: opacity 150ms var(--ease-out); }
#modal-backdrop.is-open { opacity: 1; transition-duration: 220ms; }
#template-detail-modal { opacity: 0; transform: scale(0.96) translateY(8px); transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out); }
#modal-backdrop.is-open #template-detail-modal { opacity: 1; transform: none; transition-duration: 240ms; }

/* Document preview: page images cross-fade while the next page loads */
#document-sheet { transition: opacity 160ms var(--ease-out); }
#document-sheet.is-loading { opacity: 0.2; }

/* FAQ: answers open smoothly where the browser supports it (others open instantly) */
details::details-content { block-size: 0; overflow: hidden; transition: block-size 260ms var(--ease-out), content-visibility 260ms allow-discrete; }
details[open]::details-content { block-size: auto; }

/* Checkout: revealed blocks fade up */
.reveal { animation: rise 320ms var(--ease-out) both; }

/* Reduced motion: keep fades that help understanding, drop movement */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise, .reveal, #mobile-nav:not(.hidden) { animation-name: fade; animation-duration: 200ms; }
  .sheet-stack .sheet, .card-lift, #template-detail-modal { transition-property: opacity; }
  .hero-stack:hover .sheet-stack .back { transform: rotate(4deg); }
  .hero-stack:hover .sheet-stack .mid { transform: rotate(-3deg); }
  .hero-stack.in-view .sheet-stack .sheet { animation: none; }
  .hero-stack:active .sheet-stack .back { transform: rotate(4deg); }
  .hero-stack:active .sheet-stack .mid { transform: rotate(-3deg); }
  .hero-stack:hover .sheet-stack .front, .hero-stack:active .sheet-stack .front, .card-lift:hover, .card-lift:active, #template-detail-modal,
  html a.rounded-full:active, html button.rounded-full:active, html [role="tab"]:active,
  html .plan-btn:active, html .paper-btn:active, html .zoom-btn:active { transform: none; }
}
