@import url('https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* ══════════════════════════════════════════════
   OPUS Flooring — Product Catalogue
   css/main.css — Design tokens, layout, typography, print
   ══════════════════════════════════════════════ */

/* ──────────────────────────────────────────────
   Section 2 — CSS Custom Properties
   ────────────────────────────────────────────── */

:root {
  /* Brand colours */
  --color-primary:          #6e2001;
  --color-primary-light:    #8b3008;
  --color-gold:             #d5b270;
  --color-gold-medium:      #c99d49;
  --color-gold-light:       #e1c797;
  --color-cream:            #f9ebdf;
  --color-white:            #ffffff;
  --color-text:             #1a1a1a;
  --color-text-secondary:   #4a4a4a;
  --color-border:           #d5b270;
  --color-border-light:     #e8e0d5;

  /* Semantic / state colours */
  --color-focus:            #6e2001;
  --color-focus-outline:    #d5b270;
  --color-link:             #6e2001;
  --color-link-visited:     #8b3008;

  /* Typography tokens */
  --font-primary:       'Exo 2', 'Trebuchet MS', sans-serif;
  --font-size-xs:       0.75rem;    /*  12px */
  --font-size-sm:       0.875rem;   /*  14px */
  --font-size-base:     1rem;       /*  16px */
  --font-size-md:       1.125rem;   /*  18px */
  --font-size-lg:       1.25rem;    /*  20px */
  --font-size-xl:       1.5rem;     /*  24px */
  --font-size-2xl:      2rem;       /*  32px */
  --font-size-3xl:      2.5rem;     /*  40px */
  --font-weight-normal: 400;
  --font-weight-semi:   600;
  --font-weight-bold:   700;
  --line-height-tight:  1.2;
  --line-height-base:   1.6;
  --line-height-loose:  1.8;
  --letter-spacing-heading: 0.04em;
  --letter-spacing-label:   0.08em;

  /* Spacing tokens */
  --space-xs:   0.25rem;   /*  4px */
  --space-sm:   0.5rem;    /*  8px */
  --space-md:   1rem;      /* 16px */
  --space-lg:   1.5rem;    /* 24px */
  --space-xl:   2rem;      /* 32px */
  --space-2xl:  3rem;      /* 48px */
  --space-3xl:  4rem;      /* 64px */

  /* Layout tokens */
  --max-width:       1200px;
  --content-padding: var(--space-lg);
  --radius-sm:       2px;
  --radius-md:       4px;
  --radius-lg:       8px;
  --shadow-sm:       0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md:       0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Breakpoints (mobile-first):
   --bp-sm:   480px
   --bp-md:   768px
   --bp-lg:   1024px
   --bp-xl:   1200px
*/

/* ──────────────────────────────────────────────
   Section 3 — Box-Sizing and Global Reset
   ────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 100%; /* respect user browser font-size preference */
}

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, canvas, svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

ul, ol {
  list-style: none;
}

a {
  color: var(--color-link);
  text-decoration: underline;
}

a:visited {
  color: var(--color-link-visited);
}

a:hover,
a:focus {
  color: var(--color-primary-light);
}

a:focus-visible {
  outline: 2px solid var(--color-focus-outline);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

table {
  border-collapse: collapse;
  width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* Prevent long strings from overflowing containers.
   break-word: only break mid-word when a single word is wider than its container.
   Never break in the middle of a normal word just to fill a narrow column. */
p, li, td, th, caption {
  overflow-wrap: break-word;
}

/* Flex/grid children: prevent overflow */
.flex-child,
.grid-child {
  min-width: 0;
}

/* ──────────────────────────────────────────────
   Section 4 — Base Typography
   ────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-heading);
  text-transform: uppercase;
  color: var(--color-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-md); }
h6 { font-size: var(--font-size-base); }

@media (max-width: 768px) {
  h1 { font-size: var(--font-size-2xl); }
  h2 { font-size: var(--font-size-xl); }
  h3 { font-size: var(--font-size-lg); }
}

p {
  margin-bottom: var(--space-md);
  max-width: 72ch; /* Optimal reading line length */
}

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: var(--font-weight-semi);
}

small {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* ──────────────────────────────────────────────
   Section 5 — Page Layout
   ────────────────────────────────────────────── */

/* Content Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--content-padding);
}

@media (max-width: 480px) {
  .container {
    padding-inline: var(--space-md);
  }
}

/* Site Header */
.site-header {
  background-color: var(--color-white);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

/* Transparent outline so focus indicator works in forced-colors mode */
.site-header a:focus-visible {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px var(--color-focus-outline);
}

@media (forced-colors: active) {
  .site-header {
    border-bottom: 1px solid ButtonBorder;
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding-block: var(--space-md);
}

.site-header__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.site-header__logo img {
  width: auto;
  height: 48px;
  min-width: 120px;
}

@media (max-width: 480px) {
  .site-header__logo img {
    height: 36px;
    min-width: 100px;
  }
}

/* Site Navigation */
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.site-nav__link {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semi);
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-text);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color 0.15s, background-color 0.15s;
  white-space: nowrap;
}

.site-nav__link:hover,
.site-nav__link:focus {
  color: var(--color-primary);
  background-color: var(--color-cream);
}

.site-nav__link[aria-current="page"] {
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-gold);
}

/* Mobile nav toggle button */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: var(--space-sm);
  color: var(--color-text);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--color-focus-outline);
  outline-offset: 2px;
}

.nav-toggle__icon {
  display: block;
  width: 24px;
  height: 2px;
  background-color: currentColor;
  position: relative;
  transition: background-color 0.15s;
}

.nav-toggle__icon::before,
.nav-toggle__icon::after {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background-color: currentColor;
  position: absolute;
  transition: transform 0.2s;
}

.nav-toggle__icon::before { top: -7px; }
.nav-toggle__icon::after  { top:  7px; }

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .site-nav__list {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-white);
    border-top: 1px solid var(--color-border-light);
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
    z-index: 99;
  }

  .site-nav__list.is-open {
    display: flex;
  }

  .site-nav__link {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
  }
}

@media (forced-colors: active) {
  .site-nav__link[aria-current="page"] {
    border-bottom: 2px solid ButtonText;
  }
}

/* Main Content Area */
main {
  min-height: 60vh;
}

/* Page intro / cover area */
.page-intro {
  background-color: var(--color-primary);
  color: var(--color-white);
  padding-block: var(--space-3xl);
}

.page-intro h1 {
  color: var(--color-white);
  margin-bottom: var(--space-md);
}

.page-intro p {
  color: var(--color-gold-light);
  font-size: var(--font-size-md);
  max-width: 60ch;
}

/* Standard page section */
.page-section {
  padding-block: var(--space-2xl);
}

.page-section--cream {
  background-color: var(--color-cream);
}

.page-section--dark {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* Site Footer */
.site-footer {
  background-color: var(--color-primary);
  color: var(--color-gold-light);
  padding-block: var(--space-2xl);
  margin-top: var(--space-3xl);
  font-size: var(--font-size-sm);
}

.site-footer__inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-xl);
}

.site-footer__heading {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  color: var(--color-white);
  margin-bottom: var(--space-md);
}

.site-footer__link {
  color: var(--color-gold-light);
  text-decoration: none;
}

.site-footer__link:visited {
  color: var(--color-gold-light);
}

.site-footer__link:hover,
.site-footer__link:focus {
  color: var(--color-white);
  text-decoration: underline;
}

.site-footer__bottom {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(213, 178, 112, 0.3);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: var(--font-size-xs);
  color: var(--color-gold-light);
}

.site-footer__nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.site-footer__address {
  font-style: normal;
  font-size: var(--font-size-sm);
  line-height: 1.8;
}

@media (forced-colors: active) {
  .site-footer {
    border-top: 1px solid ButtonBorder;
  }
  .site-footer__bottom {
    border-top: 1px solid ButtonBorder;
  }
}

/* ──────────────────────────────────────────────
   Section 6 — Skip Link and Screen-Reader Utility
   ────────────────────────────────────────────── */

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-primary);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  border-radius: var(--radius-md);
  z-index: 9999;
  /* Hidden until focused */
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
  width: 1px;
}

.skip-link:focus,
.skip-link:active {
  clip: auto;
  clip-path: none;
  height: auto;
  overflow: visible;
  width: auto;
}

/* Visually hidden but accessible to screen readers */
.sr-only:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* ──────────────────────────────────────────────
   Section 7 — Utility Classes
   ────────────────────────────────────────────── */

/* Text utilities */
.text-primary   { color: var(--color-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-gold      { color: var(--color-gold-medium); }
.text-small     { font-size: var(--font-size-sm); }
.text-uppercase { text-transform: uppercase; letter-spacing: var(--letter-spacing-label); }
.text-tabular   { font-variant-numeric: tabular-nums; }

/* Layout utilities */
.flex           { display: flex; }
.flex-wrap      { flex-wrap: wrap; }
.flex-center    { align-items: center; }
.gap-sm         { gap: var(--space-sm); }
.gap-md         { gap: var(--space-md); }
.gap-lg         { gap: var(--space-lg); }

/* Spacing utilities */
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mt-xl  { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }
.mb-xl  { margin-bottom: var(--space-xl); }

/* Display utilities */
.hidden         { display: none; }

/* Overflow handling for long technical strings */
.break-anywhere { overflow-wrap: anywhere; }

/* ──────────────────────────────────────────────
   Section 8 — Print Stylesheet
   ────────────────────────────────────────────── */

@media print {
  /* Reset colours for B&W print */
  *,
  *::before,
  *::after {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Remove non-content elements */
  .site-header,
  .site-nav,
  .nav-toggle,
  .skip-link,
  .cta-button,
  .cta-section,
  .cat-nav,
  .breadcrumb {
    display: none !important;
  }

  /* Ensure main content uses full width */
  .container {
    max-width: 100%;
    padding-inline: 1cm;
  }

  /* Page layout for print */
  body {
    font-size: 10pt;
    line-height: 1.4;
  }

  h1 { font-size: 18pt; }
  h2 { font-size: 14pt; }
  h3 { font-size: 12pt; }
  h4 { font-size: 10pt; }

  /* Tables: show borders, prevent cell splitting across pages */
  table {
    border-collapse: collapse;
    width: 100%;
  }

  th, td {
    border: 1px solid #000;
    padding: 4pt 6pt;
    font-size: 9pt;
  }

  thead {
    display: table-header-group; /* repeat header on each page */
  }

  tr {
    page-break-inside: avoid;
  }

  /* Product entries: keep together */
  .product-entry {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .product-entry + .product-entry {
    margin-top: 1.5cm;
  }

  /* Section headings: avoid orphaned headings */
  h2, h3 {
    page-break-after: avoid;
  }

  /* Show full href for links */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #555;
  }

  /* But not for internal anchor links */
  a[href^="#"]::after {
    content: "";
  }

  /* Footer on print */
  .site-footer {
    display: block !important;
    margin-top: 2cm;
    padding-top: 0.5cm;
    border-top: 1pt solid #000;
    font-size: 8pt;
    color: #333 !important;
  }
}
