/* ==========================================================================
   Campbell Composites — site stylesheet
   --------------------------------------------------------------------------
   Recreates the look of the original WordPress site (Twenty Twenty-Five
   theme) with plain, hand-written CSS.

   Contents
     1. Fonts
     2. Design tokens (colours, type scale, spacing)
     3. Base elements
     4. Page layout (content column + vertical rhythm)
     5. Site header and navigation
     6. Content blocks (images, lists, callouts, file download)
     7. Home page
     8. Site footer
   ========================================================================== */


/* 1. Fonts ---------------------------------------------------------------- */

/* Manrope variable font (weights 200–800), self-hosted. */
@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: fallback;
}


/* 2. Design tokens -------------------------------------------------------- */

:root {
  /* Colours */
  --color-base: #ffffff;          /* page background */
  --color-contrast: #111111;      /* text, footer background */
  --color-border: rgb(17 17 17 / 0.2);
  --color-amber: #fcb900;         /* "Use the calculator below…" callouts */
  --color-mint: #7bdcb5;          /* reminder callout */
  --color-red: #cf2e2e;           /* glossary copyright notice */
  --color-panel: #dadada;         /* home page grey band */

  /* Type scale — fluid sizes that grow with the viewport */
  --font-body: "Manrope", sans-serif;
  --text-small: 0.875rem;
  --text-medium: clamp(1rem, 1rem + ((1vw - 0.2rem) * 0.196), 1.125rem);
  --text-large: clamp(1.125rem, 1.125rem + ((1vw - 0.2rem) * 0.392), 1.375rem);
  --text-x-large: clamp(1.75rem, 1.75rem + ((1vw - 0.2rem) * 0.392), 2rem);
  --text-xx-large: clamp(2.15rem, 2.15rem + ((1vw - 0.2rem) * 1.333), 3rem);
  --text-site-title: clamp(25.984px, 1.624rem + ((1vw - 3.2px) * 1.766), 44px);

  /* Spacing */
  --space-20: 10px;
  --space-30: 20px;
  --space-40: 30px;
  --space-50: clamp(30px, 5vw, 50px);
  --space-60: clamp(30px, 7vw, 70px);
  --flow-gap: 1.2rem;              /* gap between stacked blocks */

  /* Layout widths */
  --content-width: 645px;          /* reading column */
  --wide-width: 1340px;            /* header / footer rows */
  --page-gutter: var(--space-50);  /* left/right page padding */
}


/* 3. Base elements -------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  /* In-page links (#main, #glossary…) stop below the sticky header.
     --site-header-height is kept up to date by /js/nav.js. */
  scroll-padding-top: calc(var(--site-header-height, 0px) + 16px);
}

body {
  margin: 0;
  background: var(--color-base);
  color: var(--color-contrast);
  font-family: var(--font-body);
  font-size: var(--text-large);
  font-weight: 300;
  line-height: 1.4;
  letter-spacing: -0.1px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}

h1, h2, h3, h4 {
  font-weight: 400;
  line-height: 1.125;
}
h1 { font-size: var(--text-xx-large); }
h2 { font-size: var(--text-x-large); }
h3 { font-size: var(--text-large); }
h4 { font-size: var(--text-medium); }

a {
  color: currentColor;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.1em;
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: bottom;
}

ul, ol {
  padding-left: 40px;
}
li {
  margin-top: 0.5rem;
}

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Skip link: hidden until focused */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 1em;
  background: var(--color-base);
}
.skip-link:focus {
  left: 6px;
  top: 6px;
}


/* 4. Page layout ---------------------------------------------------------- */

/* Header, main and footer are stacked with the standard block gap. */
.site-main,
.site-footer {
  margin-top: var(--flow-gap);
}

/* The home page starts straight under the header (hero image). */
.site-main--home {
  margin-top: 0;
}

/* Standard inner page: a centred reading column with generous top space. */
.page {
  margin-top: var(--space-60);
  padding: var(--space-60) var(--page-gutter);
}

/* Every direct child of .flow is limited to the reading column and
   separated from the previous one by the block gap. */
.flow > * {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}
.flow > * + * {
  margin-top: var(--flow-gap);
}

/* Page body under the <h1>. Its own block formatting context, so a list at
   the very top keeps its item spacing (as on the original site). */
.flow > .page__content {
  display: flow-root;
  max-width: none;                /* full width; its children are limited */
}


/* 5. Site header and navigation ------------------------------------------ */

/* The header stays at the top of the screen while the page scrolls. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0 var(--space-30);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-base);
  transition: box-shadow 0.2s;
}

/* Soft shadow once the page has scrolled under it (class set by nav.js) */
.site-header.is-stuck {
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.08);
}

/* Slim header once the page is scrolled down (class set by nav.js).
   Phones already have a one-line header, so this is for wider screens. */
@media (min-width: 600px) {
  .site-header.is-compact .site-header__inner {
    padding: 10px 0;
  }
  .site-header.is-compact .site-title {
    font-size: 26px;
    white-space: nowrap;
  }
}

/* On the home page the header row is narrower than the page (90%)… */
.site-header--home {
  max-width: 90%;
  margin: 0 auto;
}
/* …so a white strip behind it covers the full width while it is stuck.
   5.5556% of 90% = 5% of the page on each side. */
.site-header--home::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: -1px;
  left: -5.5556%;
  right: -5.5556%;
  z-index: -1;
  background: var(--color-base);
}
.site-header--home.is-stuck {
  box-shadow: none;
}
.site-header--home.is-stuck::before {
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.08);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--flow-gap);
  padding: var(--space-30) 0;
}

.site-title {
  font-size: var(--text-site-title);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
}
.site-title a {
  text-decoration: none;
}
.site-title a:hover {
  text-decoration: underline;
}

/* --- Navigation (desktop) --- */

.site-nav {
  font-size: var(--text-medium);
  font-weight: 700;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__item {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}

.site-nav__link {
  display: block;
  text-decoration: none;
}
.site-nav__link:hover,
.site-nav__link[aria-current="page"]:hover {
  text-decoration: underline;
}

/* Small chevron button that opens the "Calculators" sub-menu */
.site-nav__toggle {
  display: inline-flex;
  margin-left: 0.25em;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.site-nav__toggle svg {
  width: 0.6em;
  height: 0.6em;
  margin-top: 0.075em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  transition: transform 0.1s;
}

.site-nav__submenu {
  position: absolute;
  top: 100%;
  left: -1px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  width: 200px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--color-base);
  border: 1px solid rgb(0 0 0 / 0.15);
  /* hidden until opened */
  visibility: hidden;
  opacity: 0;
}
.site-nav__submenu .site-nav__item {
  margin: 0;
}
.site-nav__submenu .site-nav__item:not(:last-child) {
  margin-bottom: 3px;
}
.site-nav__submenu .site-nav__link {
  padding: 0.5em 1em;
}

/* Open on hover (mouse) or when toggled (keyboard / touch) */
.site-nav__item--parent:hover > .site-nav__submenu,
.site-nav__item--parent.is-open > .site-nav__submenu {
  visibility: visible;
  opacity: 1;
}
.site-nav__item--parent:hover > .site-nav__link,
.site-nav__item--parent.is-open > .site-nav__link {
  text-decoration: underline;
}
.site-nav__item--parent:hover .site-nav__toggle svg,
.site-nav__item--parent.is-open .site-nav__toggle svg {
  transform: rotate(180deg);
}

/* Hamburger / close buttons — mobile only */
.site-nav__open,
.site-nav__close {
  display: none;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.site-nav__open svg,
.site-nav__close svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* --- Navigation (mobile, below 600px): full-screen overlay --- */

@media (max-width: 599px) {
  .site-nav__open {
    display: block;
  }

  .site-nav__panel {
    display: none;
  }

  .site-nav.is-open .site-nav__panel {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: block;
    overflow: auto;
    padding: 16px 30px;
    background: var(--color-base);
  }

  .site-nav.is-open .site-nav__close {
    position: absolute;
    top: 16px;
    right: 30px;
    display: block;
  }

  .site-nav__list {
    flex-direction: column;
    flex-wrap: nowrap;
    padding-top: 56px;
  }

  .site-nav__item {
    display: block;
  }

  /* Sub-menu is always expanded inside the overlay */
  .site-nav__toggle {
    display: none;
  }
  .site-nav__submenu {
    position: static;
    width: auto;
    min-width: 0;
    padding: var(--flow-gap) 2rem 0;
    border: 0;
    visibility: visible;
    opacity: 1;
  }
  .site-nav__item--parent:hover > .site-nav__link {
    text-decoration: none;
  }
}

/* Lock page scroll while the mobile menu is open */
body.has-menu-open {
  overflow: hidden;
}


/* 6. Content blocks ------------------------------------------------------- */

/* Coloured callout paragraph ("Use the calculator below…") */
.callout {
  box-sizing: content-box;
  padding: 1.25em 2.375em;
}
.callout--amber { background: var(--color-amber); }
.callout--mint  { background: var(--color-mint); }

/* Large decorative first letter (reminder callout) */
.drop-cap::after {                /* keep the floated letter inside the box */
  content: "";
  display: table;
  clear: both;
  padding-top: 14px;
}
.drop-cap::first-letter {
  float: left;
  margin: 0.05em 0.1em 0 0;
  font-size: 8.4em;
  font-weight: 100;
  line-height: 0.68;
  text-transform: uppercase;
}

/* Centred red notice (glossary copyright line) */
.notice {
  color: var(--color-red);
  text-align: center;
}

/* Inline highlighted words */
.text-blue {
  color: #3366ff;
}

/* File link with a "Download" button next to it */
.file-download {
  font-size: 0.8em;
  line-height: 1.4;
}
.file-download__button {
  display: inline-block;
  margin-left: 0.75em;
  padding: 0.5em 1em;
  border-radius: 2em;
}


/* 7. Home page ------------------------------------------------------------ */

.home-hero img {
  display: block;
  width: 100%;
}

/* Grey band with the intro (left) and info cards (right) */
.home-panel {
  padding: var(--space-30) var(--space-40);
  background: var(--color-panel);
}

.home-panel__columns {
  display: flex;
  gap: var(--space-50);
}
.home-panel__main  { flex: 0 1 66.66%; }
.home-panel__aside { flex: 0 1 33.33%; }

/* Below 782px the columns stack */
@media (max-width: 781px) {
  .home-panel__columns { flex-direction: column; }
  .home-panel__main,
  .home-panel__aside { flex-basis: auto; }
}

.home-intro {
  padding: 1.25em 2.375em;
  background: var(--color-base);
  font-weight: 700;
}

/* White info cards (Contact Info, LinkedIn, clock) */
.card {
  padding: var(--space-30);
  background: var(--color-base);
}
.card + .card {
  margin-top: var(--flow-gap);
}
.card > * + * {
  margin-top: var(--flow-gap);
}
.card__title {
  text-align: center;
}
.card a {
  overflow-wrap: anywhere;      /* long e-mail / URL wraps inside the card */
}

.nz-clock {
  font-weight: 700;
  text-align: center;
}


/* 8. Site footer ---------------------------------------------------------- */

.site-footer {
  padding: var(--space-50) var(--page-gutter);
  background: var(--color-contrast);
  color: var(--color-base);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--flow-gap);
  max-width: var(--wide-width);
  margin: 0 auto;
}

.site-footer__title {
  font-size: var(--text-xx-large);
  font-weight: 700;
  line-height: 1.125;
  letter-spacing: -0.5px;
}
.site-footer__title a {
  text-decoration: none;
}
.site-footer__title a:hover {
  text-decoration: underline;
}
