/*
 * site.css: the only stylesheet for theolivegarden.co.uk.
 *
 * Sections, in order:
 *   1. Tokens        colours, fonts, spacing (custom properties)
 *   2. Fonts         @font-face for self-hosted Montserrat
 *   3. Base          reset and element defaults
 *   4. Layout        page wrapper, content column
 *   5. Components    one block per component: "=== Component: <name> ==="
 *   6. Pages         rare page-specific rules: "=== Page: <path> ==="
 *   7. Utilities     a handful of helpers
 *
 * Breakpoints (from the original app4clean theme; media queries can't use custom properties):
 *   mobile-small  ≤ 460px   (logo shrinks, home tiles stack to one column)
 *   mobile/tablet ≤ 768px   (hamburger menu, smaller type, home tiles 2 + 1)
 *   desktop       ≥ 769px
 *
 * Editing: change tokens to restyle the site; add new components as new blocks;
 * add modifier classes (.trio__tile--order) instead of changing a component for one page.
 */

/* ============ 1. Tokens ============ */
:root {
  /* Colours (from the original's theme options and computed styles) */
  --color-text: #555555;
  --color-heading: #555555;
  --color-bg: #ffffff;
  --color-link: #89972d;
  --color-link-hover: #b0b520;
  --color-primary: #89972d;      /* header bar, footer */
  --color-primary-contrast: #ffffff;
  --color-tile: #abaa16;         /* home tiles (address tile background) */
  --color-accent: #478779;       /* coloured address segments in the address tile */
  --color-divider: #555555;
  --color-dark: #000000;         /* mobile menu bar */
  --color-hover-shade: rgb(0 0 0 / 0.5);

  /* Typography */
  --font-body: "Montserrat", sans-serif;
  --font-heading: var(--font-body);
  --text-base: 16px;             /* 14px at ≤768 */
  --text-h1: 46px;               /* 32px at ≤768 */
  --text-h2: 35px;               /* 28px at ≤768 */
  --text-h3: 28px;               /* 21px at ≤768 */
  --leading: 1.5;
  --leading-heading: 1.25;       /* 1.3 at ≤768 */

  /* Spacing and shape */
  --container: 1000px;           /* #page-content max-width */
  --gutter: 20px;                /* side padding around the content column */
  --header-height: 60px;         /* fixed top bar; content is offset by this */
  --tile-gap: 30px;              /* 20px at ≤768 */

  /* Motion (match the original's timings) */
  --duration: 200ms;             /* hover transitions: .2s linear */
  --ease: linear;
  --duration-menu: 200ms;        /* SlickNav slideDown default */
  --ease-menu: cubic-bezier(0.45, 0, 0.55, 1); /* close to jQuery "swing" */
}

@media (max-width: 768px) {
  :root {
    --text-base: 14px;
    --text-h1: 32px;
    --text-h2: 28px;
    --text-h3: 21px;
    --leading-heading: 1.3;
    --tile-gap: 20px;
  }
}

/* ============ 2. Fonts ============ */
/* Montserrat (Google Fonts, OFL), self-hosted: latin subset, one variable file covering 300–700. */
@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/montserrat-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ============ 3. Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, video, iframe { max-width: 100%; }
img, video { height: auto; display: block; }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 400; line-height: var(--leading-heading); color: var(--color-heading); margin: 0; }
h1 { font-size: var(--text-h1); margin-bottom: 12px; }
h2 { font-size: var(--text-h2); margin-bottom: 9px; }
h3 { font-size: var(--text-h3); margin-bottom: 9px; }
p { margin: 0 0 18px; }
a { color: var(--color-link); text-decoration: none; }
a:hover, a:focus { color: var(--color-link-hover); }
ul { margin: 0; padding: 0; list-style: none; }
a:focus-visible, button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* ============ 4. Layout ============ */
/* <main> carries the original #main-content side padding; .page-content is the 1000px column. */
.site-main { padding: 0 var(--gutter); }
.page-content { display: flow-root; width: 100%; max-width: var(--container); margin: 0 auto; }

/* ============ 5. Components ============ */

/* === Component: skip-link === */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 2000; padding: 8px 16px; background: var(--color-bg); color: var(--color-text); }
.skip-link:focus { left: 16px; top: 8px; }

/* === Component: site-header (fixed top bar + centred logo) ===
 * Desktop: green bar, uppercase links left (no hover change, as on the original).
 * ≤768: black bar with a hamburger right; the menu slides down over the page.
 */
.site-header { padding: var(--header-height) var(--gutter) 0; }
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 var(--gutter);
  background: var(--color-primary);
}
.topbar__inner { position: relative; width: 100%; max-width: var(--container); margin: 0 auto; }

.site-nav__list { text-align: left; }
.site-nav__list li { display: inline-block; margin-right: 20px; }
.site-nav__list a,
.site-nav__list a:hover,
.site-nav__list a:focus {
  display: block;
  padding: 20px 0;
  font-size: 13px;
  line-height: 20px;
  text-transform: uppercase;
  color: var(--color-primary-contrast);
}

.nav-toggle { display: none; }

@media (max-width: 768px) {
  .topbar { padding: 0; background: var(--color-dark); }
  .topbar__inner { display: grid; grid-template-columns: 1fr auto; grid-template-rows: var(--header-height) auto; max-width: none; }

  .nav-toggle {
    display: block;
    grid-column: 2;
    grid-row: 1;
    padding: 20px 20px 21px;
    background: none;
    border: 0;
    cursor: pointer;
  }
  .nav-toggle__icon { display: block; width: 26px; }
  .nav-toggle__icon span { display: block; height: 3px; border-radius: 1px; background: #ffffff; }
  .nav-toggle__icon span + span { margin-top: 5px; }

  /* Slide-down: grid row 0fr → 1fr. align-items: stretch keeps the list clipped while it animates. */
  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-rows: 0fr;
    align-items: stretch;
    visibility: hidden;
    transition: grid-template-rows var(--duration-menu) var(--ease-menu), visibility 0s linear var(--duration-menu);
  }
  .site-nav.is-open { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows var(--duration-menu) var(--ease-menu), visibility 0s; }
  .site-nav__list { min-height: 0; overflow: hidden; text-align: center; font-size: 0.875em; }
  .site-nav__list li { display: block; margin: 0; border-bottom: 1px solid #ffffff; }
  .site-nav__list li:last-child { border-bottom: 0; }
  .site-nav__list a,
  .site-nav__list a:hover,
  .site-nav__list a:focus { padding: 12px; font-size: inherit; line-height: 1.5; text-transform: none; }

  /* Without JavaScript the menu can't toggle: show it in a bar that scrolls away. */
  html:not(.js) .topbar { position: absolute; }
  html:not(.js) .nav-toggle { display: none; }
  html:not(.js) .site-nav { grid-template-rows: 1fr; visibility: visible; }
}

/* === Component: logo (centred logo on white, 256px; 192px at ≤460) === */
.logo { display: block; width: 256px; max-width: 100%; margin: 40px auto; }
@media (max-width: 460px) {
  .logo { width: 192px; }
}

/* === Component: divider (2px grey rule under the logo on inner pages) === */
.divider { display: block; width: 100%; max-width: var(--container); height: 2px; margin: 0 auto 40px; background: var(--color-divider); }

/* === Component: entry (inner page title and body copy) === */
.entry__title { margin-bottom: 40px; text-align: center; }
.entry__content--center { text-align: center; }

/* === Component: map (keyless Google Maps iframe, full column width) === */
.map { display: block; width: 100%; height: 250px; margin-bottom: 40px; border: 0; }

/* === Component: hero (home: boxed image with dark overlay, heading and Order Now button) === */
.hero { position: relative; display: block; padding: 20% 20px; background-color: #eeeeee; background-size: cover; background-position: center; text-align: center; }
.hero::before { content: ""; position: absolute; inset: 0; background: #000000; opacity: 0.4; }
.hero__content { position: relative; }
.hero__title {
  position: relative;
  margin-bottom: 60px;
  font-size: 1.5em;
  line-height: 1;
  font-weight: 400;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 2px 2px 5px rgb(0 0 0 / 0.6);
}
.hero__title::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -30px;
  width: 50px;
  height: 3px;
  margin-left: -25px;
  background: #ffffff;
  box-shadow: 2px 2px 5px rgb(0 0 0 / 0.6);
}

/* === Component: order-button (outlined white, darkens on hover) === */
.order-button {
  display: block;
  box-sizing: content-box;  /* original: 140px + padding + border = 152px */
  width: 140px;
  margin: 0 auto;
  padding: 5px;
  border: 1px solid #ffffff;
  color: #ffffff;
  font-size: 0.8em;
  text-transform: uppercase;
  transition: all var(--duration) var(--ease);
}
.order-button:hover, .order-button:focus { color: #ffffff; background-color: rgb(0 0 0 / 0.3); }

/* === Component: trio (home: three tiles; address text scaled to fill, image tiles with labels) ===
 * Replaces BigText.js and the theme's sizing script (decision d7). Each tile is a size container;
 * the address lines use cqi so each line fills the inner width exactly as BigText did.
 * Rows are 1fr so every tile is as tall as the address tile, as the original's JS made them.
 */
.trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: var(--tile-gap);
  margin-top: 30px;
}
.trio__tile {
  position: relative;
  display: block;
  container-type: inline-size;
  background-color: var(--color-tile);
  background-size: cover;
  background-position: center;
  color: #ffffff;
}
a.trio__tile {
  box-shadow: inset 0 0 0 1000px rgb(0 0 0 / 0);
  transition: box-shadow var(--duration) var(--ease);
}
a.trio__tile:hover, a.trio__tile:focus { color: #ffffff; box-shadow: inset 0 0 0 1000px var(--color-hover-shade); }

.trio__address { padding: 20px 15%; line-height: 0.9; }
.trio__line { display: block; white-space: nowrap; }
.trio__accent { color: var(--color-accent); }
/* Line size = BigText fit to the inner width (70% of the tile), measured with Montserrat 400. */
.trio__line--0 { font-size: 10.78cqi; }
.trio__line--1 { font-size: 9.35cqi; }
.trio__line--2 { font-size: 8.9cqi; }
.trio__line--3 { font-size: 16.72cqi; }
.trio__line--4 { font-size: 11.46cqi; }

.trio__label {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  line-height: 0;
  text-align: center;
  text-transform: uppercase;
}
.trio__tile--order .trio__label { font-size: 12.8cqi; }
.trio__tile--find .trio__label { top: 70%; font-size: 6.4cqi; }
.trio__tile--find::before {
  content: "";
  position: absolute;
  top: 20%;
  left: 50%;
  width: 10%;
  height: 30%;
  margin-left: -5%;
  background: url("/assets/images/map-marker.png") no-repeat top center / 100% auto;
}
.trio__tile--find::after {
  content: "";
  position: absolute;
  top: 54%;
  left: 50%;
  width: 20%;
  height: 3px;
  margin-left: -10%;
  background: #ffffff;
}
.trio__tile--order { background-image: url("/wp-content/uploads/2017/12/burger.jpg"); }
.trio__tile--find { background-image: url("/wp-content/uploads/2017/12/map.png"); }

@media (max-width: 768px) {
  .trio { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 20px; }
  .trio__tile--find { grid-column: 1 / -1; }
  /* The original sized "Find Us" from the half-width Order tile: 0.064 × (full width − gap) / 2. */
  .trio__tile--find .trio__label { font-size: calc((100cqi - 20px) * 0.032); }
  .trio__tile--find::before { width: 5%; margin-left: -2.5%; }
}
@media (max-width: 460px) {
  .trio { grid-template-columns: minmax(0, 1fr); }
  .trio__address { padding: 20px 25%; }
  /* Inner width is 50% of the tile here: 50/70 of the desktop ratios. */
  .trio__line--0 { font-size: 7.7cqi; }
  .trio__line--1 { font-size: 6.68cqi; }
  .trio__line--2 { font-size: 6.36cqi; }
  .trio__line--3 { font-size: 11.94cqi; }
  .trio__line--4 { font-size: 8.19cqi; }
  .trio__tile--find .trio__label { font-size: 6.4cqi; }
  .trio__tile--find::before { width: 8%; margin-left: -4%; }
}

/* === Component: site-footer (green bar, centred copyright + OrderYOYO credit) === */
.site-footer { margin-top: 50px; padding: 20px; background: var(--color-primary); color: #ffffff; text-align: center; }
.site-footer__copyright { margin: 0; font-size: 0.8em; line-height: 1.5; }
.site-footer a, .site-footer a:hover, .site-footer a:focus { color: #ffffff; }

/* === Component: contact-email (not used: the site has no forms; kept for future use) ===
 * Styled like the theme's grey contact-form area and its white button. */
.contact-email { display: grid; gap: 12px; justify-items: center; padding: 4%; margin-top: 40px; background: #cccccc; text-align: center; }
.contact-email__address { font-weight: 700; word-break: break-word; }
.button {
  display: inline-block;
  padding: 12px 26px;
  border: 2px solid #ffffff;
  background: #ffffff;
  color: #555555;
  font: inherit;
  line-height: 26px;
  text-transform: uppercase;
  transition: all var(--duration) var(--ease);
}
.button:hover, .button:focus { background: var(--color-primary); color: #ffffff; }

/* ============ 6. Pages ============ */

/* === Page: / === */
.hero--home { background-image: url("/wp-content/uploads/2017/12/pizza.jpg"); }

/* ============ 7. Utilities ============ */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-center { text-align: center; }

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
