/* Global typography and accessibility baseline (Option A: System UI stack) */
:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --text-color: #222;
  --bg-color: #fff;

  /* Type scale */
  --fs-900: clamp(2rem, 4vw, 2.75rem); /* h1 */
  --fs-800: clamp(1.5rem, 3vw, 2rem);  /* h2 */
  --fs-700: clamp(1.25rem, 2.4vw, 1.5rem); /* h3 */
  --fs-600: 1.125rem; /* h4 */
  --fs-500: 1rem;     /* body */
  --fs-400: 0.95rem;  /* buttons / small UI */
  --fs-300: 0.875rem; /* small */

  --lh-tight: 1.2;
  --lh-title: 1.25;
  --lh-body: 1.6;
}

html { font-size: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-color);
  background: var(--bg-color);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Comfortable reading width helper */
.container-readable {
  max-width: 70ch;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Headings */
h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  font-weight: 600;
}

h1 { font-size: var(--fs-900); line-height: var(--lh-tight); font-weight: 700; }
h2 { font-size: var(--fs-800); line-height: var(--lh-title); }
h3 { font-size: var(--fs-700); line-height: var(--lh-title); }
h4 { font-size: var(--fs-600); line-height: 1.35; }

/* Text */
p, li { font-size: var(--fs-500); }
small { font-size: var(--fs-300); }

/* Links */
a { color: inherit; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }

/* Buttons */
.btn, button, [role="button"] {
  font: inherit;
  font-size: var(--fs-400);
  font-weight: 600;
  line-height: 1;
}

/* Dark header keeps high contrast while inheriting global font */
header { font-family: var(--font-sans); color: #fff; }

/* Ticker */
.ticker__item {
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: var(--fs-400);
  color: #fff;
}

/* Homepage product cards (index.html) */
.product-card .product-link,
.product-card .product-link:hover {
  text-decoration: none; /* prevent underline on name and price */
}

.product-card h4,
.product-card p {
  font-size: var(--fs-400); /* slightly smaller than body */
}

/* Product page (produit.html) */
#produit-nom {
  font-size: var(--fs-800); /* down from default h1 */
  line-height: var(--lh-title);
  margin-bottom: 0.25rem; /* tighter spacing above price */
}

#produit-prix {
  font-size: var(--fs-700); /* down from default h2 */
  line-height: 1.35;
  margin-top: 0.1rem; /* reduce gap from name */
}

/* Product page section separator and title */
.section-separator {
  border: 0;
  height: 1px;
  background: #e5e5e5;
  margin: 1rem 0 0.75rem;
}

.product-section-title {
  font-size: var(--fs-600);
  line-height: 1.35;
  margin: 0 0 0.5rem;
}

/* Product page accordion */
.product-accordion-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  margin: 0;
  font-size: var(--fs-500); /* smaller title */
}

/* Container adds bottom separator and spacing so the line is under the panel when open,
   and still leaves breathing room when closed */
.product-accordion {
  position: relative;
  padding-bottom: 0.75rem; /* space above bottom line (visible even when closed) */
  margin-bottom: 0.75rem;  /* space below the bottom line */
}
.product-accordion::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: #e5e5e5; /* bottom separator under the whole section */
}

/* Arrow indicator */
.product-accordion-title::after {
  content: '▾';
  font-size: 0.9em;
  margin-left: 0.5rem;
  transition: transform 0.2s ease;
}

#product-desc-title[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* Animated panel */
.product-accordion-panel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

/* Expand when title is expanded */
#product-desc-title[aria-expanded="true"] + #product-desc-panel {
  max-height: 600px;
  opacity: 1;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .product-accordion-title::after { transition: none; }
  .product-accordion-panel { transition: none; }
}

/* Accessible focus */
:focus-visible {
  outline: 2px solid #0b5fff;
  outline-offset: 2px;
}
