/*
Theme Name: W Web Design
Theme URI: https://wwebdesign.co.uk
Author: W Web Design & Hosting
Author URI: https://wwebdesign.co.uk
Description: Lean custom theme for W Web Design & Hosting — code-registered ACF blocks, no build step. Dark editorial design system.
Version: 2.0.0
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: wwd
*/

/* ============================================================
   Design tokens — dark editorial
   ============================================================ */
:root {
  /* Media scrim: the gradient laid over a photograph so text on top of it stays
     readable. A contrast control rather than a design one, so it lives here as
     one token instead of being retyped per card — it was declared twice with the
     same value before, and only one of the two copies ever got corrected.
     Over a worst-case white photo, white text breaks even at alpha .56 and the
     grey summary at .72; this holds .78 or more across the whole text block. */
  --wwd-scrim: linear-gradient(to top,
    rgba(8,12,10,.95) 0%,
    rgba(8,12,10,.88) 38%,
    rgba(8,12,10,.78) 52%,
    rgba(8,12,10,.34) 72%,
    transparent 100%);

  /* Brand greens */
  --wwd-green:        #5dbd59;
  --wwd-green-bright: #7ee06f;   /* accent on dark */
  --wwd-green-deep:   #3f9a44;
  --wwd-slate:        #2f4e5f;
  --wwd-slate-deep:   #233b48;

  /* Surfaces */
  --wwd-bg:        #0e1411;   /* page — warm near-black, faint green */
  --wwd-bg-2:      #141c18;   /* raised dark section */
  --wwd-bg-3:      #1b2520;   /* cards on dark */
  --wwd-cream:     #f1ede1;   /* contrast panel */
  --wwd-cream-2:   #e7e2d3;

  /* Ink (on cream) */
  --wwd-ink:    #14140f;
  --wwd-ink-soft: #4d4c43;

  /* Text on dark */
  --wwd-text:   #edf1ee;
  --wwd-body:   #b7c2bd;
  --wwd-muted:  #7f8d87;
  --wwd-line:   rgba(255,255,255,.10);
  --wwd-line-strong: rgba(255,255,255,.16);

  /* Gradient — brand DNA */
  --wwd-grad: linear-gradient(150deg, var(--wwd-green-bright) 0%, var(--wwd-green) 45%, var(--wwd-slate) 110%);

  /* Type */
  --wwd-font-head: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wwd-font-body: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Layout */
  --wwd-content-max: 1440px; /* single site-wide container width — keep equal to --wide */
  --wwd-content-wide: 1440px;
  --wwd-gutter: clamp(1.15rem, 4vw, 3.25rem);
  --wwd-header-height: 92px;
  --wwd-radius: 16px;
  --wwd-radius-sm: 10px;
  --wwd-radius-lg: 26px;
  --wwd-radius-xl: 36px;

  --wwd-shadow: 0 30px 70px -30px rgba(0,0,0,.6);
  --wwd-shadow-sm: 0 10px 30px -16px rgba(0,0,0,.5);

  --wwd-ease: cubic-bezier(.22, .61, .36, 1);
}

/* ============================================================
   Reset / base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--wwd-font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--wwd-body);
  background: var(--wwd-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 {
  font-family: var(--wwd-font-head);
  color: var(--wwd-text);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -.025em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.6rem, 6.5vw, 5.5rem); }
h2 { font-size: clamp(2rem, 4.6vw, 3.6rem); }
h3 { font-size: clamp(1.3rem, 2.2vw, 1.75rem); font-weight: 500; }

p { margin: 0 0 1.1em; }
a { color: var(--wwd-text); text-decoration: none; transition: color .25s var(--wwd-ease); }
a:hover { color: var(--wwd-green-bright); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { margin: 0; padding: 0; }
strong { color: var(--wwd-text); font-weight: 600; }

/* ============================================================
   Layout helpers
   ============================================================ */
.wwd-wrap { width: 100%; max-width: var(--wwd-content-max); margin-inline: auto; padding-inline: var(--wwd-gutter); }
.wwd-wrap--wide { max-width: var(--wwd-content-wide); }
.wwd-section { padding-block: clamp(4rem, 9vw, 9rem); }
.wwd-section--tight { padding-block: clamp(2.5rem, 5vw, 4.5rem); }

/* Numbered / labelled eyebrow — signature editorial label */
.wwd-eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--wwd-font-head); font-weight: 500;
  font-size: .82rem; letter-spacing: .04em; color: var(--wwd-muted);
  margin: 0 0 1.4rem;
}
.wwd-eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--wwd-green-bright); flex-shrink: 0; }
/* "--light" = light text, for eyebrows sitting on a DARK surface. Do not set this
   to --wwd-ink-soft: that is the cream-panel ink and scores 2.15:1 on --wwd-bg
   (WCAG 1.4.3 needs 4.5:1). Cream panels get their ink from .wwd-hf--dark below. */
.wwd-eyebrow--light { color: var(--wwd-body); }
.wwd-eyebrow--light::before { background: var(--wwd-green-bright); }

/* Gradient / accent text */
.wwd-grad-text { color: var(--wwd-green-bright); }
.wwd-ink .wwd-grad-text, .wwd-on-cream .wwd-grad-text { color: var(--wwd-green-deep); }

/* ============================================================
   Buttons — lime pill with arrow chip
   ============================================================ */
.wwd-btn {
  display: inline-flex; align-items: center; gap: .65rem;
  font-family: var(--wwd-font-head); font-weight: 600; font-size: 1rem; line-height: 1;
  padding: .5rem .55rem .5rem 1.35rem; border: 0; border-radius: 999px; cursor: pointer;
  color: var(--wwd-ink); background: var(--wwd-green-bright);
  transition: background .3s var(--wwd-ease), transform .3s var(--wwd-ease), color .3s var(--wwd-ease);
}
/* Trailing svg becomes a circular arrow chip automatically */
.wwd-btn svg {
  box-sizing: content-box; width: 16px; height: 16px; padding: 9px; border-radius: 50%;
  background: var(--wwd-ink); color: var(--wwd-green-bright); transition: transform .3s var(--wwd-ease);
}
.wwd-btn:hover { background: #fff; color: var(--wwd-ink); transform: translateY(-2px); }
.wwd-btn:hover svg { transform: rotate(-45deg); }

/* Solid dark button (used on cream panels) */
.wwd-btn--dark { background: var(--wwd-ink); color: var(--wwd-cream); }
.wwd-btn--dark svg { background: var(--wwd-green-bright); color: var(--wwd-ink); }
.wwd-btn--dark:hover { background: #000; color: #fff; }

/* Outline button */
.wwd-btn--ghost { background: transparent; color: var(--wwd-text); box-shadow: inset 0 0 0 1px var(--wwd-line-strong); }
.wwd-btn--ghost svg { background: transparent; box-shadow: inset 0 0 0 1px var(--wwd-line-strong); color: var(--wwd-text); }
.wwd-btn--ghost:hover { background: var(--wwd-green-bright); color: var(--wwd-ink); box-shadow: none; }
.wwd-btn--ghost:hover svg { background: var(--wwd-ink); color: var(--wwd-green-bright); box-shadow: none; }

/* Light button → on dark, becomes cream */
.wwd-btn--light { background: var(--wwd-cream); color: var(--wwd-ink); }
.wwd-btn--light svg { background: var(--wwd-ink); color: var(--wwd-cream); }
.wwd-btn--light:hover { background: #fff; }

/* Plain arrow link */
.wwd-arrow-link {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--wwd-font-head); font-weight: 500; font-size: .98rem; color: var(--wwd-green-bright);
}
.wwd-arrow-link svg { width: 1em; height: 1em; transition: transform .3s var(--wwd-ease); }
.wwd-arrow-link:hover { color: #fff; }
.wwd-arrow-link:hover svg { transform: translate(3px,-3px); }

/* Rotated sticker badge */
.wwd-sticker {
  display: inline-flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center;
  width: 116px; height: 116px; border-radius: 50%; padding: 1rem;
  background: var(--wwd-green-bright); color: var(--wwd-ink);
  font-family: var(--wwd-font-head); font-weight: 600; font-size: .92rem; line-height: 1.1;
  transform: rotate(-12deg); transition: transform .4s var(--wwd-ease);
}
.wwd-sticker:hover { transform: rotate(0deg) scale(1.05); color: var(--wwd-ink); }
.wwd-sticker svg { width: 20px; height: 20px; }

/* Pill tag */
.wwd-tag {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--wwd-font-head); font-weight: 500; font-size: .76rem; letter-spacing: .02em;
  color: var(--wwd-text); background: rgba(255,255,255,.07); border: 1px solid var(--wwd-line);
  padding: .35em .85em; border-radius: 999px;
}

/* ============================================================
   Shared content chrome (page header, prose, cta, pagination)
   ============================================================ */
.wwd-page-hero { padding-block: calc(var(--wwd-header-height) + clamp(2.5rem,6vw,5rem)) clamp(2rem,5vw,4rem); }
.wwd-page-hero__sub { font-size: 1.2rem; color: var(--wwd-body); max-width: 56ch; }

/* Prose */
.wwd-prose { max-width: 760px; color: var(--wwd-body); font-size: 1.08rem; line-height: 1.8; }
.wwd-prose > *:first-child { margin-top: 0; }
.wwd-prose p { margin: 0 0 1.45rem; }
.wwd-prose h2 { color: var(--wwd-text); font-size: clamp(1.55rem, 2.8vw, 2.1rem); line-height: 1.15; letter-spacing: -.01em; margin: 3rem 0 1rem; }
.wwd-prose h3 { color: var(--wwd-text); font-size: clamp(1.2rem, 2vw, 1.45rem); margin: 2.4rem 0 .8rem; }
.wwd-prose h4 { color: var(--wwd-text); margin: 2rem 0 .6rem; }
.wwd-prose a { color: var(--wwd-green-bright); text-decoration: underline; text-underline-offset: 3px; }
.wwd-prose ul, .wwd-prose ol { margin: 0 0 1.6rem 1.3rem; }
.wwd-prose li { margin-bottom: .65rem; line-height: 1.7; padding-left: .2rem; }
.wwd-prose img { border-radius: var(--wwd-radius); margin: 1.8rem 0; }
.wwd-prose blockquote { margin: 2.2rem 0; padding: 1.4rem 1.8rem; border-left: 3px solid var(--wwd-green-bright); background: var(--wwd-bg-2); border-radius: 0 12px 12px 0; font-size: 1.12rem; }
.wwd-prose blockquote p { margin: 0; }
.wwd-prose blockquote cite { display: block; margin-top: .9rem; font-size: .92rem; font-style: normal; color: var(--wwd-muted); }

/* Shared cream CTA strip (single posts/projects) */
.wwd-cta-strip { background: var(--wwd-cream); color: var(--wwd-ink); border-radius: var(--wwd-radius-xl); margin-inline: var(--wwd-gutter); margin-block: clamp(2.5rem, 6vw, 4.5rem); padding-block: 0; }
.wwd-cta-strip__inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; padding: clamp(2.25rem, 4vw, 3.25rem) clamp(2rem, 4vw, 3.5rem); }
.wwd-cta-strip h2 { color: var(--wwd-ink); margin: 0; font-size: clamp(1.8rem, 3.5vw, 2.8rem); }

/* Pagination */
.wwd-pagination { margin-top: 3.5rem; }
.wwd-pagination .nav-links { display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.wwd-pagination a, .wwd-pagination .current {
  display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 .85rem; border-radius: 999px;
  font-family: var(--wwd-font-head); font-weight: 500; background: var(--wwd-bg-3); border: 1px solid var(--wwd-line); color: var(--wwd-text);
}
.wwd-pagination .current { background: var(--wwd-green-bright); color: var(--wwd-ink); border-color: transparent; }
.wwd-pagination a:hover { border-color: var(--wwd-green-bright); color: var(--wwd-green-bright); }

/* a11y */
/* Parked at 1x1 and clipped rather than at left:-9999px. Both hide it, but the
   off-screen version is a focusable element laid out outside the viewport, which
   is what an auditor flags under 2.4.3 on every page. The :focus half is the
   point of the control and must survive any tidy-up of this rule. */
.wwd-skip {
  position: absolute; top: 0; left: 0; z-index: 1000;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  background: var(--wwd-green-bright); color: var(--wwd-ink); border-radius: 0 0 8px 0; font-weight: 600;
}
.wwd-skip:focus {
  width: auto; height: auto; padding: .8rem 1.2rem; margin: 0;
  overflow: visible; clip: auto; clip-path: none; white-space: normal;
}
:focus-visible { outline: 2px solid var(--wwd-green-bright); outline-offset: 3px; border-radius: 4px; }

/* CookieYes ships a 10x10px close control — under the 24x24 minimum of
   WCAG 2.2 SC 2.5.8. Plugin CSS loads after the theme, hence !important. */
.cky-btn-close {
  min-width: 24px !important; min-height: 24px !important;
  display: grid !important; place-items: center !important;
}
.cky-btn-close img { width: 10px; height: 10px; }

/* Section heading helper used by many blocks */
.wwd-shead { max-width: 720px; margin-bottom: clamp(2.2rem, 4vw, 3.5rem); }
.wwd-shead h2 { margin: 0; }
.wwd-shead__sub { margin-top: 1rem; font-size: 1.12rem; color: var(--wwd-body); }

/* When the custom cursor is active it shows a "View" pill on work cards, so the
   in-card "View project" text is redundant — hide it (touch devices keep it). */
html.wwd-cursor-on .wwd-work-card__cta { display: none; }

/* Lenis smooth-scroll helpers (init in assets/scroll.js) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* Breadcrumbs (RankMath) — sits inside the padded hero of each template */
.wwd-breadcrumbs { margin-bottom: 1.1rem; font-size: .82rem; line-height: 1.5; }
.wwd-breadcrumbs .rank-math-breadcrumb p { margin: 0; color: var(--wwd-muted); }
/* Underline is load-bearing: colour alone does not distinguish these links from the
   surrounding crumb text (WCAG 1.4.1). */
.wwd-breadcrumbs a { color: var(--wwd-text); text-decoration: underline; text-underline-offset: 3px; transition: color .25s var(--wwd-ease); }
.wwd-breadcrumbs a:hover { color: var(--wwd-green-bright); }
.wwd-breadcrumbs .separator { margin: 0 .45rem; opacity: .5; }

/* Internal-linking block on blog posts (links through to service pages) */
.wwd-related-services { margin-block: clamp(2.5rem, 5vw, 3.5rem); padding: clamp(1.4rem, 3vw, 2rem); background: var(--wwd-bg-2); border: 1px solid var(--wwd-line); border-radius: var(--wwd-radius-lg); }
.wwd-related-services h2 { margin: 0 0 1.1rem; font-size: 1.15rem; }
.wwd-related-services__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.wwd-related-services__link { display: inline-block; padding: .5rem .95rem; border: 1px solid var(--wwd-line); border-radius: 999px; font-size: .9rem; color: var(--wwd-text); text-decoration: none; transition: border-color .25s var(--wwd-ease), color .25s var(--wwd-ease); }
.wwd-related-services__link:hover { border-color: var(--wwd-green-bright); color: var(--wwd-green-bright); }
