/*
 * Base of every page: reset, type, links, the focus ring, the 1200 px grid and the layout bands.
 * Values come from tokens.css; this file holds no colour and no font size of its own.
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* The browser's text size decides: every size below is in rem. */
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font-family-stack);
  font-weight: var(--font-weight-regular);
  font-size: var(--font-size-16);
  line-height: var(--line-height-24);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Long unbroken words (URLs, e-mail addresses, compound names) wrap instead of overflowing (WCAG 1.4.10). */
main,
footer {
  overflow-wrap: anywhere;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

/* Only the weights of the design: 400, 500 and 600 */
strong,
b,
th,
optgroup,
summary,
dt {
  font-weight: var(--font-weight-semibold);
}

th {
  font-weight: var(--font-weight-medium);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--spacing-16);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

/* LT-9: headings break into even lines, and a lead or a card text never ends on a lone word */
h1,
h2,
h3 {
  text-wrap: balance;
}

.lead,
.card-text {
  text-wrap: pretty;
}

.display {
  font-size: var(--font-size-48);
  line-height: var(--line-height-56);
  letter-spacing: var(--letter-spacing-display);
  font-weight: var(--font-weight-semibold);
}

.h1,
.h2,
.h3,
.h4 {
  font-weight: var(--font-weight-semibold);
}

h1,
.h1 {
  font-size: var(--font-size-40);
  line-height: var(--line-height-48);
  letter-spacing: var(--letter-spacing-h1);
}

/* LT-2, the page-head rule: a centred page head (About ONVV, Events, Write to us, the legal pages, Wineries and wines, and every page
   head that holds the section switch: the ONVV pages, news, producers, wines; R-SWITCHER) has an H1 48/56; every left head (search,
   map, 404, cabinet, programmes, and the heads with an image: regions, professionals) has the H1 above, 40/48. Both are 32/40 under
   768 px. /dev/components says it in one line. */
.events-head h1,
.about-head h1,
.producers-head h1,
.section-head h1 {
  font-size: var(--font-size-48);
  line-height: var(--line-height-56);
  letter-spacing: var(--letter-spacing-display);
}

.about-head.team-head:not(.section-head) h1 {
  font-size: var(--font-size-40);
  line-height: var(--line-height-48);
  letter-spacing: var(--letter-spacing-h1);
}

h2,
.h2 {
  font-size: var(--font-size-32);
  line-height: var(--line-height-40);
  letter-spacing: var(--letter-spacing-h2);
}

/* H3 is the card title: 20/28 */
h3,
.h3 {
  font-size: var(--font-size-20);
  line-height: var(--line-height-28);
  letter-spacing: var(--letter-spacing-h4);
}

h4,
.h4 {
  font-size: var(--font-size-18);
  line-height: var(--line-height-26);
  letter-spacing: var(--letter-spacing-h5);
}

h5,
h6 {
  font-size: var(--font-size-16);
  line-height: var(--line-height-24);
}

@media (max-width: 767.98px) {
  h1,
  .h1,
  .events-head h1,
  .about-head h1,
  .about-head.team-head h1,
  .producers-head h1,
  .section-head h1 {
    font-size: var(--font-size-32);
    line-height: var(--line-height-40);
  }

  h2,
  .h2 {
    font-size: var(--font-size-28);
    line-height: var(--line-height-36);
  }
}

p {
  margin: 0 0 var(--spacing-16);
}

.lead {
  font-size: var(--font-size-18);
  line-height: var(--line-height-28);
}

.text-small {
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

.caption {
  font-size: var(--font-size-12);
  line-height: var(--line-height-16);
  font-weight: var(--font-weight-medium);
}

.eyebrow {
  margin: 0 0 var(--spacing-8);
  color: var(--color-action);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
  font-weight: var(--font-weight-regular);
  text-transform: uppercase;
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-muted {
  color: var(--color-text-muted);
}

/* Links on the public pages are burgundy and underlined */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

a:hover {
  color: var(--color-action-hover);
  text-decoration-thickness: var(--border-width-2);
}

a:active {
  color: var(--color-action-active);
}

/* The MUD focus ring, 2px white + 5px burgundy, on every link, button and field on keyboard focus: this is the one rule that draws it
   (code-19, FS-8). Its list holds the places the generic selector cannot reach: a clickable card shows the ring on the card (the :is() is
   forgiving, so a browser without :has() drops that selector alone; the doubled class outranks the card's hover shadow, and the card's
   stretched link shows none, components.css), and a selected map pin keeps the ring over its own shadow. The toast's buttons are buttons,
   so they take it as any button. The transparent outline keeps a visible ring in forced-colours mode. */
:is(a, button, input, select, textarea, summary, [tabindex]):focus {
  outline: none;
}

:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
:is(.card.card:has(a.stretched:focus-visible)),
:is(.map-pin.is-selected, .map-pin[aria-pressed="true"]):focus-visible,
.is-focus {
  outline: var(--border-width-2) solid transparent;
  outline-offset: var(--border-width-2);
  box-shadow: var(--focus-ring);
  transition: none; /* the ring appears at once (M4-MOTION, MO-1) */
}

/* A region that script focuses (the error summary, a heading) needs no ring of its own */
[tabindex="-1"]:focus {
  outline: none;
}

hr {
  height: 0;
  margin: var(--spacing-24) 0;
  border: 0;
  border-top: var(--border-width-1) solid var(--color-border);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: calc(var(--border-width-1) * -1);
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--spacing-8);
  left: var(--spacing-8);
  z-index: 100;
  padding: var(--spacing-12) var(--spacing-16);
  border-radius: var(--border-radius-8);
  background: var(--color-surface);
  color: var(--color-link);
  font-weight: var(--font-weight-medium);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Layout: a 1200 px content grid, margins 24 px (16 px on phones) */
.container {
  width: 100%;
  max-width: calc(var(--container-width) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.gallery-head,
.news-head,
.ow-head,
.press-head,
.pro-head,
.region-head {
  position: relative;
}

/* LT-3: the line under a page head is drawn inside the container's gutters, so it spans the content box
   (x = 120 to 1320 at 1440) and not the container's border box */
.gallery-head::after,
.news-head::after,
.ow-head::after,
.press-head::after,
.pro-head::after,
.region-head::after {
  content: "";
  position: absolute;
  inset-block-end: 0;
  inset-inline: var(--gutter);
  border-bottom: var(--border-width-1) solid var(--color-border);
}

.band {
  background: var(--color-background-band);
  padding-block: var(--spacing-48);
}

.section {
  padding-block: var(--spacing-48);
}

.stack > * + * {
  margin-top: var(--spacing-16);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-12);
}

/* One column under 768 px, two at 768-1023 px, three from 1024 px */
.grid {
  display: grid;
  gap: var(--spacing-24);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------- Motion (M4-MOTION, MO-1, OWN-3): links, buttons, fields, cards, tabs, segments and summaries ----------
   Every interactive element moves its colour, background, border and shadow over --motion-duration-fast with
   --motion-easing-standard. :where() keeps the rule at no specificity, so a component that animates more (the chevron's
   transform, the image fade) says so in its own rule. The keyboard ring appears at once: an element in :focus-visible
   has no transition (set in the focus rule above), so nothing delays the ring (it fades out when focus leaves). Under reduced motion the token is 0 ms. */
:where(a, button, input, select, textarea, summary, label, [role="tab"], [role="button"], .card) {
  transition:
    color var(--motion-duration-fast) var(--motion-easing-standard),
    background-color var(--motion-duration-fast) var(--motion-easing-standard),
    border-color var(--motion-duration-fast) var(--motion-easing-standard),
    box-shadow var(--motion-duration-fast) var(--motion-easing-standard);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
