/*
 * Futuro Theme CSS Overrides — Paper White palette.
 * Loaded only when Store#theme == "futuro" (via theme_overrides_stylesheet).
 *
 * IMPORTANT: This file is intentionally minimal. All theme styling lives in
 * Phlex components under `app/views/themes/futuro/` and
 * `app/components/themes/futuro/`, expressed as Tailwind utility classes
 * inline on each element. Color tokens come from ThemeSetting::FUTURO_DEFAULTS
 * and are injected as CSS variables at the :root level.
 *
 * Do not add cascading rules here that target element tags or default-theme
 * selectors — that would leak across pages and break component encapsulation.
 * If a piece of styling is repeated across components, lift it into a Phlex
 * helper or a per-component class file, not into this global sheet.
 */

/*
 * Homepage marquee strip (used by Views::Themes::Futuro::Home::Index
 * #render_marquee_band). The category list is rendered twice in the
 * markup so translating the track by -50% loops the animation
 * seamlessly. Pauses on hover so users can read a label.
 */
@keyframes futuro-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.animate-\[futuro-marquee_28s_linear_infinite\]:hover {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .animate-\[futuro-marquee_28s_linear_infinite\] {
    animation: none;
  }
}

/*
 * Mobile footer accordion (rendered by Views::Themes::Futuro::Layouts::Storefront
 * #render_futuro_footer_mobile_accordion). Hides the default browser
 * disclosure triangle on <summary> elements and swaps the design's `+`
 * marker to `−` when the section is open. Zero-JS, native <details>.
 */
.futuro-footer-accordion > summary {
  list-style: none;
}
.futuro-footer-accordion > summary::-webkit-details-marker,
.futuro-footer-accordion > summary::marker {
  display: none;
  content: "";
}
.futuro-footer-accordion[open] > summary .futuro-footer-accordion__marker {
  /* Visually flip `+` to `−` by hiding the vertical stroke via clip. The
     glyph is rendered as plain text, so we tilt to align the cross with
     the baseline and clip the bottom half. */
}
.futuro-footer-accordion[open] > summary .futuro-footer-accordion__marker::after {
  content: "−";
}
.futuro-footer-accordion[open] > summary .futuro-footer-accordion__marker {
  font-size: 0;
}
.futuro-footer-accordion[open] > summary .futuro-footer-accordion__marker::after {
  font-size: 22px;
}

/*
 * Product detail page accordion (Views::Themes::Futuro::Products::Show
 * #render_futuro_details_accordion). Same zero-JS native <details>
 * pattern as the mobile footer accordion, restyled for ink-on-paper:
 * hide the browser disclosure triangle, swap `+` → `−` when [open].
 */
.futuro-product-accordion > summary {
  list-style: none;
}
.futuro-product-accordion > summary::-webkit-details-marker,
.futuro-product-accordion > summary::marker {
  display: none;
  content: "";
}
.futuro-product-accordion[open] > summary .futuro-product-accordion__marker {
  font-size: 0;
}
.futuro-product-accordion[open] > summary .futuro-product-accordion__marker::after {
  content: "−";
  font-size: 18px;
}

/*
 * Listing toolbar — sharp edges + Inter body font on the search input
 * inherited from the default theme's render_filters_form. Higher
 * specificity (id selector) beats Tailwind's `.rounded-lg` utility
 * without needing `!important`. The sort dropdown is rebuilt as a
 * native <select> in the Futuro Phlex views so its styling lives in
 * Tailwind classes, not here.
 */
input#search {
  border-radius: 0;
  font-family: "Inter", system-ui, sans-serif;
}
input#search:focus {
  border-radius: 0;
}

/*
 * Futuro toast — editorial note-card slide.
 *
 * The shared `toast` Stimulus controller adds `.toast-enter` / `.toast-exit`
 * classes on connect/dismiss. Application.css ships a vertical drop-in for
 * the default theme; we override that *only* for Futuro toasts (scoped via
 * the `.futuro-toast` class on the card) so the motion reads sideways into
 * the top-right rail instead of dropping in from the top. The result is a
 * quieter, more editorial entrance that pairs with the hairline note-card.
 */
@keyframes futuro-toast-slide-in {
  from { transform: translateX(16px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes futuro-toast-slide-out {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(16px); opacity: 0; }
}
.futuro-toast.toast-enter {
  animation: futuro-toast-slide-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.futuro-toast.toast-exit {
  animation: futuro-toast-slide-out 0.22s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

/* Mobile (no top-right rail) — fall back to a soft top drop. */
@media (max-width: 767px) {
  @keyframes futuro-toast-slide-in-mobile {
    from { transform: translateY(-8px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  @keyframes futuro-toast-slide-out-mobile {
    from { transform: translateY(0);    opacity: 1; }
    to   { transform: translateY(-8px); opacity: 0; }
  }
  .futuro-toast.toast-enter {
    animation: futuro-toast-slide-in-mobile 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .futuro-toast.toast-exit {
    animation: futuro-toast-slide-out-mobile 0.2s cubic-bezier(0.4, 0, 0.6, 1) forwards;
  }
}

@media (prefers-reduced-motion: reduce) {
  .futuro-toast.toast-enter,
  .futuro-toast.toast-exit {
    animation: none;
  }
}

/*
 * Poster personalizer — Futuro Editorial Split modal.
 *
 * The form fields inside the modal are injected at runtime by the shared
 * `poster_personalizer_controller.js` (the same Stimulus controller used by
 * the default theme), and that JS hardcodes Tailwind utility classes meant
 * for the default theme's rounded / gray-bordered chrome. Rather than fork
 * the controller per theme, we scope a few editorial overrides under the
 * `.futuro-personalizer` wrapper so the injected labels, inputs, character
 * counters, font selects, and color swatches inherit the sharp-edged,
 * tracked-caps Paper White treatment shown in the design canvas.
 */
.futuro-personalizer .futuro-personalizer__panel {
  /* placeholder hook for future expansion */
}

.futuro-personalizer [data-poster-personalizer-target="fieldContainer"] label {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.futuro-personalizer [data-poster-personalizer-target="fieldContainer"] input[type="text"] {
  width: 100%;
  border-radius: 0;
  border: 1px solid var(--border);
  background: var(--background);
  padding: 12px 14px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s ease;
}
.futuro-personalizer [data-poster-personalizer-target="fieldContainer"] input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  border-width: 1.5px;
  padding: 11.5px 13.5px;
}

.futuro-personalizer [data-poster-personalizer-target="fieldContainer"] input::placeholder {
  font-style: italic;
  color: var(--text-muted);
}

.futuro-personalizer [data-poster-personalizer-target="fieldContainer"] select {
  width: 100%;
  border-radius: 0;
  border: 1px solid var(--border);
  background: var(--background);
  padding: 10px 12px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
}
.futuro-personalizer [data-poster-personalizer-target="fieldContainer"] select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Character counter — `.text-xs` paragraph the JS adds under each input. */
.futuro-personalizer [data-poster-personalizer-target="fieldContainer"] [data-poster-personalizer-target^="counter_"] {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Color swatches — JS renders rounded-full buttons; we square them up to
   match the Paper White chip language. */
.futuro-personalizer [data-poster-personalizer-target="fieldContainer"] button[data-action*="selectColor"] {
  border-radius: 0 !important;
  width: 28px !important;
  height: 28px !important;
}

/* ── Editorial prose ────────────────────────────────────────────────────────
   Styles raw rendered Markdown (CMS pages, blog posts) with Futuro tokens:
   Cormorant display headings, Inter body, hairline rules, accent links. */
.futuro-prose > :first-child { margin-top: 0; }
.futuro-prose > :last-child { margin-bottom: 0; }
.futuro-prose h2 {
  font-family: var(--font-display), "Cormorant Garamond", Georgia, serif;
  font-weight: 400;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 1.8em 0 0.5em;
}
.futuro-prose h3 {
  font-family: var(--font-display), "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.15;
  color: var(--text);
  margin: 1.5em 0 0.4em;
}
.futuro-prose h4 {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1.6em 0 0.5em;
}
.futuro-prose p { margin: 0 0 1.1em; }
.futuro-prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.futuro-prose a:hover { color: var(--text); }
.futuro-prose ul, .futuro-prose ol { margin: 0 0 1.1em; padding-left: 1.3em; }
.futuro-prose li { margin: 0.3em 0; }
.futuro-prose ul > li { list-style: none; position: relative; }
.futuro-prose ul > li::before {
  content: "—";
  position: absolute;
  left: -1.3em;
  color: var(--accent);
}
.futuro-prose blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.1em;
  margin: 1.4em 0;
  font-family: var(--font-display), "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1.2em;
  color: var(--text);
}
.futuro-prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.futuro-prose img { width: 100%; height: auto; margin: 1.4em 0; }
.futuro-prose strong { font-weight: 600; }
