/*
 * Design tokens and the layer order. This file loads first.
 *
 * Every theme rule sits in a layer, in this order (later layers win):
 *   reset → base → type → layout → components → sections → utilities
 * Plugin stylesheets (WooCommerce, Forminator) are not in a layer, so they beat any layered rule.
 * The few rules that restyle plugin markup are therefore left out of layers on purpose (see plugins/).
 *
 * Breakpoints can't be custom properties, so media queries use these values directly:
 *   40rem (640px) small, 48rem (768px) medium, 64rem (1024px) large
 *
 * The look follows the old Enfold site: Raleway at a light weight, grey body text, a mid grey for the
 * header bar, footer and dark sections, and very light grey bands.
 * Mirror the colours in theme_palette() in includes/helpers.php.
 */

@layer reset, base, type, layout, components, sections, utilities;

/* Raleway, self-hosted. One variable file per subset covers every weight (100 to 900).
   The licence is in assets/fonts/OFL.txt. The latin file is preloaded (includes/theme.php). */
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/raleway-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/raleway-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Colours. Contrast ratios are for text at its usual size.
     ink: headings and dark text. text: body text. paper: light sections. line: rules and borders.
     grey: the header bar, footer and dark sections. charcoal: the bar at the very bottom.
     accent: buttons (the fill of a primary button, the outline of a secondary one).
     focus: the keyboard focus ring (white on dark surfaces, see base.css).
     ink-fixed: ink that stays dark on dark surfaces and photos, which set --color-ink to white (a white button's text). */
  --color-ink: #222;
  --color-ink-fixed: var(--color-ink); /* worked out here, so a surface's own --color-ink doesn't change it */
  --color-text: #767676; /* 4.5:1 on white */
  --color-text-on-paper: #6a6a6a; /* 4.5:1 on paper and paper-light; the old #767676 fails there */
  --color-black: #000; /* backgrounds only, behind a photo; text uses ink */
  --color-paper: #ebebeb;
  --color-paper-light: #f8f8f8;
  --color-line: #ebebeb;
  --color-grey: #706f6f; /* white text on it is 5:1 */
  --color-charcoal: #282b2e;
  --color-on-grey: #f3f3f3; /* footer text, 4.5:1 on grey; the old #e8e8e8 is 4.1:1 */
  --color-line-on-grey: #a9a9a9; /* the short rules under the footer headings: white at 40% over the grey */
  --color-accent: #666; /* 5.7:1 on white */
  --color-accent-hover: var(--color-ink);
  --color-white: #fff;
  --color-muted: var(--color-text);
  --color-icon: var(--color-text); /* the small header icons: the body grey, also on light and dark sections */
  --color-field-border: var(--color-ink);
  --color-star: #fbbc05;
  --color-error: #b3261e;
  --color-focus: var(--color-ink);
  --color-focus-halo: var(--color-white); /* fills the gap inside the focus ring, so it shows on any background */
  --color-hover: var(--color-paper); /* the background of a hovered link in a list */
  --color-menu: var(--color-paper-light); /* a hovered nav link, an open nav item and its mega menu */
  /* Black shades over photos and pages */
  --color-shade-light: rgb(0 0 0 / 0.2); /* behind a white button on a photo or dark section */
  --color-shade: rgb(0 0 0 / 0.3); /* behind the open mobile menu, and the hero's slide buttons */
  --color-shade-dark: rgb(0 0 0 / 0.5); /* the hero's slide buttons on hover */
  /* The overlay over a hero or call to action photo. White text over it passes 4.5:1 even on a white
     photo: at its lightest (0.56 black) a white pixel shows as #707070, 4.9:1 with white. */
  --scrim: linear-gradient(rgb(0 0 0 / 0.56), rgb(0 0 0 / 0.62));

  /* Type. Raleway's light look comes from the regular weight in grey, not from a thin weight. */
  --font-sans: "Raleway", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --text-2xsmall: 0.75rem;
  --text-xsmall: 0.8125rem; /* table cells, dropdown menus and the sale badge, 13px as on the old site */
  --text-small: 0.9375rem;
  --text-base: 1rem;
  --text-nav: 0.875rem;
  --text-button: var(--text-small); /* 15px; the old site's 18px looked large beside the 16px body text */
  --text-lead: clamp(1.125rem, 1rem + 0.6vw, 1.375rem); /* 18px on phones to 22px */
  --text-question: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem); /* an accordion question: 17px on phones to 18px */
  --text-h3: 1.25rem;
  --text-h2: clamp(1.6rem, 1.4rem + 0.6vw, 2rem);
  --text-h1: clamp(1.875rem, 1.6rem + 0.8vw, 2.375rem); /* page titles: 30px on phones to 38px, clearly above h2 */
  --text-stat: 2.5rem;
  --text-quote: clamp(1.4rem, 1.2rem + 0.6vw, 1.75rem); /* pull quotes: 28px on large screens, as on the old site */
  --text-quote-small: clamp(1.0625rem, 0.95rem + 0.4vw, 1.3rem); /* a review in the testimonials slider */
  --leading: 1.65; /* body text */
  --leading-tight: 1.2; /* buttons and controls */
  --leading-heading: 1.3;
  --leading-snug: 1.45; /* the lead, labels and card details */
  --tracking-heading: 0.0625rem;
  --tracking-label: 0.04em; /* small labels and buttons in capitals */
  --weight-normal: 400;
  --weight-bold: 600;

  /* Space */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-section: clamp(3rem, 2rem + 3vw, 5rem); /* 48px on phones to 80px on large screens */
  --space-head: var(--space-xl); /* between a section's heading (and intro) and its content */
  --flow-space: 0.85em; /* between paragraphs of text */
  --list-indent: 1.25rem;

  /* Layout. --wrap-max is the width of the content, inside the gutters. */
  --wrap-max: 75.625rem;
  --wrap-gutter: clamp(1rem, 7.5vw, 4rem);
  --measure: 44rem; /* the longest comfortable line of text, and the centred column of the old site */
  --form-width: 32rem; /* a single column of fields: the account login */
  --form-width-wide: 50rem; /* a centred form section's form, two columns of fields on large screens */
  --column-gap: 6%; /* between cards and figures, as on the old site */
  --bar-height: 3.125rem; /* the grey menu bar */
  --logo-height: 8.5rem; /* the logo row on large screens: a 104px logo (the old site's row was 150px) */
  --logo-height-small: 4.5rem; /* the header on phones and tablets: a 56px logo */
  --header-height: var(--bar-height); /* the part of the header that stays on screen */
  --hero-height: clamp(25rem, 42vw, 40rem); /* the home page's slider */
  --hero-height-short: clamp(20rem, 30vw, 32rem); /* a hero with a photo on every other page: 320px on phones to 512px */
  --table-columns: 4; /* set on each table (table.php), so a table with many columns scrolls instead of squeezing them */
  --table-column-min: 6.5rem; /* the narrowest a table column gets before the table scrolls sideways */
  --rule-width: 4.6875rem; /* the short dark rule under section text (components.css) */
  --radius: 3px;

  /* Controls: buttons, fields and icons */
  --target-size: 2.75rem; /* the smallest height (and width) of anything clicked or tapped: 44px */
  --button-height: var(--target-size); /* 44px on touch screens; 40px with a mouse (below) */
  --button-padding: 0.5rem 1.375rem;
  --hero-control-width: 2.25rem; /* the hero slider's previous and next buttons */
  --control-size: var(--target-size); /* the small square previous and next buttons: 44px on touch screens, 24px with a mouse */
  --button-min-width: 10rem; /* shop buttons: "Add to basket", "Load more" */
  --field-padding: var(--space-2xs) var(--space-xs); /* every text field, select and textarea */
  --field-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231a1a1a' stroke-width='1.5'/%3E%3C/svg%3E"); /* the arrow on a select */
  --field-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 11'%3E%3Cpath d='M1 5.5l4 4 8-8' fill='none' stroke='%231a1a1a' stroke-width='1.5'/%3E%3C/svg%3E"); /* the tick by the chosen sort order */
  --field-gap: 0.375rem; /* between a label and its field */
  --form-gap: var(--space-s); /* between the rows of every form (Forminator and WooCommerce) */
  --icon-xs: 0.625rem;
  --icon-s: 1.125rem;
  --icon-m: 1.375rem; /* the default */
  --icon-l: 1.75rem;
  --focus-width: 3px; /* the focus ring */
  --focus-offset: 3px;

  /* Shadows */
  --shadow-small: 0 1px 3px rgb(0 0 0 / 0.25); /* text on photos, a round button over an image */
  --shadow-panel: 0 8px 24px rgb(0 0 0 / 0.08); /* panels that open over the page */
  --shadow-panel-strong: 0 10px 28px rgb(0 0 0 / 0.18); /* the header dropdowns, which open over the white header */

  /* Shop */
  --shop-panel-light: var(--color-paper-light); /* the light box behind the add to basket form, basket totals and order summary */
  --shop-aside: 24rem; /* the totals column on the basket and checkout; wider on big screens (below) */
  --shop-thumbs: 4; /* gallery thumbnails visible in the row */

  /* Motion. Three durations and one easing for things that move, so the whole site moves the same way.
     Only opacity, transforms and colours are animated. Visitors who ask for reduced motion get none of the
     movement: transitions end at once (base.css), and reveals, zooms and nudges are switched off.
     s: small feedback, such as a hover colour, a chevron, a menu opening.
     m: a photo zooming inside its frame.
     l: content arriving, such as a section fading in or the hero's text. */
  --duration-s: 0.2s;
  --duration-m: 0.4s;
  --duration-l: 0.6s;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1); /* quick to start, gentle to stop */
  --transition: var(--duration-s) ease; /* the usual hover and focus transition */
  --nudge: 0.125rem; /* how far an arrow moves on hover */
  --zoom: 1.04; /* how far a card's photo grows on hover */
  --reveal-distance: 1rem; /* how far content rises as it fades in */
  --hero-shift: clamp(2rem, 5vw, 4.5rem); /* how far the hero's title and intro slide in from the sides */
  --reveal-stagger: 70ms; /* between items that arrive together, such as the cards in a row */
  --appear-distance: 0.5rem; /* how far a menu, answer or notice drops as it fades in */
}

/* With a mouse or trackpad, buttons can be a little shorter than the 44px touch target (WCAG asks for 24px) */
@media (pointer: fine) {
  :root { --button-height: 2.5rem; --control-size: 1.5rem; }
}

/* The basket's and checkout's totals column has more room on big screens */
@media (min-width: 80rem) {
  :root { --shop-aside: 28rem; }
}
