/* Nathan Designs UK · brand layer (type system v1.0 + colour and themes)
   Loaded LAST on every HTML page by lib/brand.js, so it is the single source of truth for
   fonts, brand colours and light/dark tokens. Rules: docs/brand/BRAND-GUIDELINES-ADDENDUM.md
   Fonts are proprietary to Nathan Designs UK (see fonts/LICENCE.txt). */

/* ---------------------------------------------------------------- 1. Fonts */
@font-face{font-family:"ND Display";src:url("fonts/NDDisplay-Variable.woff2") format("woff2-variations"),url("fonts/NDDisplay-Variable.woff2") format("woff2");font-weight:100 900;font-style:normal;font-display:swap}
@font-face{font-family:"ND Sans";src:url("fonts/NDSans-Variable.woff2") format("woff2-variations"),url("fonts/NDSans-Variable.woff2") format("woff2");font-weight:100 900;font-style:normal;font-display:swap}
@font-face{font-family:"ND Mono";src:url("fonts/NDMono-Variable.woff2") format("woff2-variations"),url("fonts/NDMono-Variable.woff2") format("woff2");font-weight:100 900;font-style:normal;font-display:swap}
@font-face{font-family:"ND Toolpath";src:url("fonts/NDToolpath-Regular.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"ND Toolpath";src:url("fonts/NDToolpath-Bold.woff2") format("woff2");font-weight:700;font-style:normal;font-display:swap}

/* ---------------------------------------------------------------- 2. Tokens */
:root{
  /* Fonts. The ND faces have no ©, ™, •, ✓, arrows other than →, ñ, ç or ß: those characters fall back per glyph. */
  --font-display:"ND Display",ui-sans-serif,system-ui,sans-serif;
  --font-sans:"ND Sans",ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --font-mono:"ND Mono",ui-monospace,"SFMono-Regular",Menlo,Consolas,monospace;
  --font-toolpath:"ND Toolpath","ND Display",ui-sans-serif,sans-serif;

  /* Brand palette (fixed: the same in both themes) */
  --nd-c-yellow:#ffd31f;   /* Nathan Yellow: mark, buttons, highlights. Never text on light. */
  --nd-c-black:#1b1b1b;    /* Workshop Black: nav, dark panels, text on yellow */
  --nd-c-ink:#20252c;      /* Ink: headings/body on light */
  --nd-c-paper:#f5f7fa;    /* Paper: light page background */
  --nd-c-white:#ffffff;    /* cards on Paper */
  --nd-c-copy:#46515c;     /* Copy Grey: long-form text on light */
  --nd-c-muted:#5e6975;    /* Muted: captions/labels on light */
  --nd-c-brass:#786000;    /* Brass: yellow-family text on light (eyebrows) */
  --nd-c-teal:#17665d;     /* Filament Teal: links/success on light */

  /* Semantic theme tokens: light */
  --brand-bg:var(--nd-c-paper);
  --brand-surface:var(--nd-c-white);
  --brand-soft:#edf2f5;
  --brand-line:#d5dee5;
  --brand-ink:var(--nd-c-ink);
  --brand-copy:var(--nd-c-copy);
  --brand-muted:var(--nd-c-muted);
  --brand-accent:var(--nd-c-brass);
  --brand-link:var(--nd-c-teal);
  --brand-on-yellow:var(--nd-c-black);
  color-scheme:light;
}
/* .nd-band-dark: a Workshop Black band inside any page, in either theme */
:root[data-theme=dark],.nd-band-dark{
  /* Semantic theme tokens: dark (built on Workshop Black; every text token >= 4.5:1 on bg, surface and soft) */
  --brand-bg:var(--nd-c-black);
  --brand-surface:#25272b;
  --brand-soft:#30333a;
  --brand-line:#464c55;
  --brand-ink:var(--nd-c-paper);
  --brand-copy:#d0d7df;
  --brand-muted:#aeb8c3;
  --brand-accent:var(--nd-c-yellow);
  --brand-link:#8fdccb;
  color-scheme:dark;
}
/* Legacy token names from styles.css / design-system.css / workspace.css / brand-v87 / brand-v882 / experience-v89.
   They all resolve to the brand tokens above, so older stylesheets follow the palette and the theme. */
:root,:root[data-theme=dark],.nd-band-dark{
  --ui-bg:var(--brand-bg);--ui-panel:var(--brand-surface);--ui-soft:var(--brand-soft);--ui-line:var(--brand-line);
  --ui-ink:var(--brand-ink);--ui-copy:var(--brand-copy);--ui-muted:var(--brand-muted);--ui-link:var(--brand-link);--ui-accent:var(--brand-accent);
  --nd-bg:var(--brand-bg);--nd-surface:var(--brand-surface);--nd-soft:var(--brand-soft);--nd-line:var(--brand-line);
  --nd-ink:var(--brand-ink);--nd-muted:var(--brand-muted);--nd-cyan:var(--brand-link);
  --nd-yellow:var(--nd-c-yellow);--nd-dark:var(--nd-c-black);--nd-panel:var(--nd-c-black);
  --app-bg:var(--brand-bg);--app-surface:var(--brand-surface);--app-panel:var(--brand-surface);--app-input:var(--brand-soft);
  --app-ink:var(--brand-ink);--app-text:var(--brand-ink);--app-muted:var(--brand-muted);--app-border:var(--brand-line);
  --app-accent:var(--nd-c-yellow);--app-yellow:var(--nd-c-yellow);--app-nav:var(--nd-c-black);
  --yellow:var(--nd-c-yellow);--site-accent:var(--nd-c-yellow);
}

/* ---------------------------------------------------------------- 3. Families everywhere */
:root,body,button,input,select,textarea,optgroup{font-family:var(--font-sans)}
code,kbd,samp,pre,tt,var{font-family:var(--font-mono);font-variant-numeric:tabular-nums slashed-zero}

/* Headlines: ND Display Bold, letter-spacing 0 (any tracking switches Flow off). */
h1,h2,.nd-display{font-family:var(--font-display);font-weight:700;letter-spacing:0!important;font-feature-settings:"calt" 0}
h1,h2.nd-flow,.nd-flow{font-feature-settings:"calt" 1}
.nd-noflow{font-feature-settings:"calt" 0}
/* Capitals never flow into lowercase: the patched fonts use the classic N (no join) by default */
.nd-classic-caps{font-feature-settings:"ss01" 1}
.nd-flow.nd-classic-caps,h1.nd-classic-caps{font-feature-settings:"calt" 1,"ss01" 1}
/* Card titles and smaller headings: ND Sans Bold */
h3,h4,h5,h6{font-family:var(--font-sans);font-weight:700;letter-spacing:0}
/* Panel headings inside the operations, portal and studio workspaces are card titles, not headlines */
:is(.admin-panel,.portal-card,.workspace-card,.app-card,.panel,.card,.studio-panel,.comms-panel,.file-hub,.nd-drawer,.nd-dialog) h2{font-family:var(--font-sans)}
/* Big numbers: ND Display, figures aligned */
:is(.big-price,.summary-price strong,.summary-price .summary-price-value,.calculator-price strong,.calculator-price .calculator-price-value,.portal-stat-grid strong,.quote-success>strong,.quote-reviewed-price){font-family:var(--font-display);letter-spacing:0!important;font-variant-numeric:tabular-nums}

/* Toolpath: hero moments and section openers, >= 48px, on Workshop Black or Nathan Yellow only */
.nd-toolpath{font-family:var(--font-toolpath);font-weight:400;letter-spacing:0!important;line-height:1.02}
.nd-toolpath.is-bold{font-weight:700}

/* Eyebrows and labels: ND Mono 500, caps, +0.12em, 13px (12px floor) */
:is(.eyebrow,.section-kicker,.form-step,.study-label,.home-materials-label,.material-guide-tag,.benchy-figure-kicker,.side-label,.analysis-heading small,.summary-status,.studio-separation span,.footer-grid span,.journey-heading>span:first-child,.part-lab-heading,[cmdk-group-heading]){
  font-family:var(--font-mono)!important;font-weight:700!important;letter-spacing:.1em!important;text-transform:uppercase;font-size:max(12px,.875rem)!important;line-height:1.3}
/* Data, references, readouts and specs: ND Mono, tabular */
:is(.ref-chip,.portal-customer-ref,.layer-readout,.model-metrics dd,.summary-specs dd,.calculator-summary dd,.status-pill,.config-chip,.lab-stage-note,.home-proof>div>span,.cost-factors article>span,.approach-grid article>span,.quote-review-flow li>span,.journey-current>span,.journey-scene-meta,.step-number,.calc-step,.template-source,.mono,[data-mono]){
  font-family:var(--font-mono);font-variant-numeric:tabular-nums slashed-zero;letter-spacing:0}
:is(.status-pill,.ref-chip,.config-chip){letter-spacing:.06em}

/* Buttons: ND Sans 650, no tracking */
:is(button,.button,.btn,.nd-primary,input[type=submit],input[type=button]){font-family:var(--font-sans);letter-spacing:0}
:is(.button,.btn,button.primary,.nd-primary){font-weight:700}

/* Odd legacy weights now render exactly (ND Sans is variable 100-900), but cap the heaviest UI text at 800 */
:where(b,strong){font-weight:700}

/* ---------------------------------------------------------------- 4. Public site type (v1.1: bigger, bolder, Title Case, three heading voices) */
html body.public-site{font-size:18px;line-height:1.6}
@media (max-width:640px){html body.public-site{font-size:16.5px}}
/* Reading text one step heavier than 400: the monoline strokes are thin on screen */
html body.public-site :is(p,li,dd,figcaption,blockquote){font-weight:460}
html body.public-site :is(small,.caption,.footer-note){font-size:max(12px,14px);line-height:1.45;font-weight:500}
html body.public-site :is(.button,.btn,button){font-size:15.5px;line-height:1.2}
/* Header: brand name and navigation */
html body.public-site .site-header .brand{min-width:max-content}
html body.public-site .site-header .brand span{font-family:var(--font-display);font-weight:800;font-size:clamp(16px,.9vw + 7px,19px);letter-spacing:0;text-transform:none;white-space:nowrap}
html body.public-site .site-header .desktop-nav{gap:clamp(2px,1.6vw - 12px,14px)}
/* Narrow desktops: the logo and title already link home, so drop the Home link to give the title room */
@media (max-width:1099px){html body.public-site .site-header .desktop-nav a[href="/"]{display:none}}
html body.public-site .site-header .desktop-nav a{font-weight:560;font-size:clamp(13px,.55vw + 7.9px,15px);white-space:nowrap}
html body.public-site footer .footer-brand strong{font-family:var(--font-display);font-weight:800;font-size:19px;text-transform:none}

/* Every public heading is Title Case */
html body.public-site :is(h1,h2,h3){text-transform:capitalize}

/* Voice 1 · Display: ND Display 800, the default headline */
html body.public-site h1:where(:not(:is([class*=journey],[class*=card],figure,aside,dialog,.nd-drawer,.nd-dialog,.site-header) h1)){font-weight:800;font-size:clamp(42px,3.6vw + 10px,88px);line-height:1}
/* Hero headings size to their own column (container units), so they fit in about three lines at any width */
html body.public-site :is(.home-entry-copy,.page-hero .wrap){container-type:inline-size}
html body.public-site .home-entry h1{font-size:clamp(42px,12.4cqi,104px);line-height:.98;max-width:none}
html body.public-site .page-hero:not(.home-entry) h1{font-size:clamp(40px,min(3.6vw + 10px,8.6cqi),88px);max-width:20ch}
/* Even line lengths for every heading; no one-word last lines */
html body.public-site :is(h1,h2,h3){text-wrap:balance}
html body.public-site :is(p,li){text-wrap:pretty}
html body.public-site h2:where(:not(:is([class*=journey],[class*=card],figure,aside,dialog,.nd-drawer,.nd-dialog,.customer-reviews article) h2)){font-weight:800;font-size:clamp(32px,2.4vw + 14px,60px);line-height:1.04}
html body.public-site .faq-group h2{font-size:clamp(26px,1.2vw + 16px,38px)}
html body.public-site :is([class*=card],figure,section,article) h3:not(:is([class*=journey]) h3){font-weight:760;font-size:clamp(19px,.5vw + 15px,23px);line-height:1.25}

/* Voice 2 · Caption: big bold ND Sans in capitals, for feature sections and material names */
html body.public-site :is(section.section-dark:not(.page-hero,.nd-band-dark) h2:not(article h2),.material-guide-card h2){
  font-family:var(--font-sans);font-weight:850;text-transform:uppercase;letter-spacing:.01em!important;line-height:.98;font-size:clamp(32px,2.6vw + 12px,64px)}
html body.public-site .material-guide-card h2{font-size:clamp(34px,2.2vw + 14px,52px)}

/* Voice 3 · Toolpath: one moment per view, 48px and up, on Workshop Black or Nathan Yellow only */
html body.public-site .nd-band-dark{background:var(--nd-c-black);color:var(--brand-ink)}
html body.public-site .nd-band-dark .eyebrow{color:var(--nd-c-yellow)}
html body.public-site .nd-band-dark .real-work-heading h2,html body.public-site .cta h2{
  font-family:var(--font-toolpath);font-weight:400;line-height:1.02;font-size:clamp(52px,5.6vw + 8px,128px)}
html body.public-site .nd-band-dark .real-work-heading{max-width:none}
html body.public-site .nd-band-dark .real-work-heading h2{max-width:16ch;color:var(--nd-c-yellow);margin:12px 0 20px}
/* Small headings inside the demo panel: heavier so they hold up at 18-20px */
html body.public-site .journey-current h2{font-weight:760}
html body.public-site .cta h2{max-width:13ch}
/* Bold Toolpath has three walls and needs 72px; switch to it only where the heading reaches that size */
@media (min-width:1200px){html body.public-site .cta h2{font-weight:700}}

/* ---------------------------------------------------------------- 5. Readability floor: 12px for text people need to read */
small{font-size:max(12px,.8em)}
/* The Benchy demo is a scaled illustration; keep its captions, credit and controls legible */
:is(.journey-footnote,.journey-footnote *,.journey-demo-label,.journey-transport button,.journey-heading span,details.benchy-credit,details.benchy-credit *,.journey-stage-dot){font-size:max(12px,1em)!important}

/* ---------------------------------------------------------------- 6. Colour rules */
/* Yellow is a background, never text on light. On light surfaces yellow-family text is Brass. */
:root:not([data-theme=dark]) :is(.eyebrow,.section-kicker,.form-step){color:var(--nd-c-brass)}
:root[data-theme=dark] :is(.eyebrow,.section-kicker,.form-step){color:var(--nd-c-yellow)}
/* Anything on Nathan Yellow uses Workshop Black text */
:is(.button-primary,.nd-primary,button.primary,.btn-primary){background-color:var(--nd-c-yellow);color:var(--nd-c-black);border-color:var(--nd-c-yellow)}
::selection{background:var(--nd-c-yellow);color:var(--nd-c-black)}
:focus-visible{outline-color:var(--brand-link)}
a{text-decoration-thickness:from-font}

/* Logo colourways: header bars are Workshop Black in both themes; light-on-light surfaces use the ink mark */
.nd-logo-dark-only{display:none}
:root[data-theme=dark] .nd-logo-light-only{display:none}
:root[data-theme=dark] .nd-logo-dark-only{display:inline-block}

/* ---------------------------------------------------------------- 7. Fixed-dark surfaces (Workshop Black in both themes) */
/* Footer, header and dark panels: labels use dark-theme Muted so they pass 4.5:1 on Workshop Black */
body :is(footer .footer-grid span,.site-header .portal-label-short,.model-preview span,.app-studio small),body .studio-sidebar :is(small,nav a,nav button),body :is(.studio-separation p,.studio-side-actions a,.studio-brand small){color:#aeb8c3}
.studio-sidebar nav :is(a,button).active,.studio-sidebar nav :is(a,button):hover{color:#f5f7fa}
/* Operations sidebar tile and the Site Studio media top bar are always dark; older theme layers recolour their labels as if light */
.app-studio small{color:#aeb8c3!important}
.print-summary .summary-file-copy span{color:#aeb8c3}
.app-topbar .app-account>:is(a,a.button){color:#d0d7df}
/* Navigation bars are Workshop Black in every area and both themes (guidelines p.06: nav bar) */
html[data-theme] body :is(.site-header,.studio-sidebar),html[data-theme] body.workspace :is(.app-topbar,.app-sidebar){background-color:var(--nd-c-black)}

/* ---------------------------------------------------------------- 8. Cymraeg touches (rotate on every page load, lib/cymraeg.js) */
/* Hero sticker: Nathan Yellow with Workshop Black text, in both themes */
.nd-cymraeg-sticker{display:inline-flex;align-items:baseline;gap:10px;margin:6px 0 22px;padding:7px 14px 8px;border-radius:10px;background:var(--nd-c-yellow);color:var(--nd-c-black)!important;transform:rotate(-2deg);box-shadow:0 6px 18px rgba(27,27,27,.14);line-height:1.1}
.nd-cymraeg-sticker [lang=cy]{font-family:var(--font-display);font-weight:800;font-size:clamp(17px,.6vw + 13px,21px);letter-spacing:0;color:var(--nd-c-black)}
.nd-cymraeg-sticker .nd-cymraeg-en{font-family:var(--font-mono);font-weight:600;font-size:12px;letter-spacing:.06em;text-transform:uppercase;color:#3d3a2a}
@media (prefers-reduced-motion:no-preference){.nd-cymraeg-sticker{animation:nd-sticker .5s cubic-bezier(.22,1,.36,1) both}@keyframes nd-sticker{from{opacity:0;transform:rotate(-8deg) scale(.9)}to{opacity:1;transform:rotate(-2deg) scale(1)}}}
/* Footer sign-off: yellow on Workshop Black */
footer .footer-grid .nd-cymraeg-signoff{margin:14px 0 0;display:grid;gap:3px}
footer .footer-grid .nd-cymraeg-signoff [lang=cy]{font-family:var(--font-display)!important;font-weight:800!important;font-size:20px!important;letter-spacing:0!important;text-transform:none;color:var(--nd-c-yellow)}
footer .footer-grid .nd-cymraeg-signoff .nd-cymraeg-en{font-family:var(--font-mono)!important;font-weight:500!important;font-size:12px!important;letter-spacing:.06em!important;text-transform:uppercase;color:#aeb8c3}

/* ---------------------------------------------------------------- 9. Site title link: no underline, a small lift on hover */
html body .site-header .brand,html body .site-header .brand:is(:hover,:focus-visible) span{text-decoration:none!important;background:transparent}
html body .site-header .brand{transform-origin:left center}
html body .site-header .brand:focus-visible{outline:2px solid var(--nd-c-yellow);outline-offset:6px;border-radius:8px}
@media (prefers-reduced-motion:no-preference){
  html body .site-header .brand{transition:transform .28s cubic-bezier(.22,1,.36,1)}
  html body .site-header .brand:is(:hover,:focus-visible){transform:translateY(-2px) scale(1.04)}
  html body .site-header .brand .nd-logo{transition:transform .28s cubic-bezier(.22,1,.36,1)}
  html body .site-header .brand:is(:hover,:focus-visible) .nd-logo{transform:translateY(-1px) rotate(-4deg)}
}

/* ---------------------------------------------------------------- 10. Links: a small lift instead of an underline */
/* Standalone links (navigation, footer, buttons, card links): no underline; lift and scale on hover or keyboard focus.
   Links inside running text keep a thin underline (colour alone is not enough, WCAG 1.4.1) and change colour on hover.
   Big image cards keep their own hover. */
:where(html body:is(.public-site,.workspace) a:not(:is(p,blockquote,dd,td,figcaption,.prose,.faq-list .answer) a)){display:inline-block}
html body:is(.public-site,.workspace) a:not(:is(p,blockquote,dd,td,figcaption,.prose) a):not(:has(img)):not(.skip-link){text-decoration:none!important;transform-origin:left center}
html body:is(.public-site,.workspace) :is(.button,.btn){transform-origin:center}
@media (prefers-reduced-motion:no-preference){
  html body:is(.public-site,.workspace) a:not(:is(p,blockquote,dd,td,figcaption,.prose) a):not(:has(img)):not(.skip-link){transition:transform .28s cubic-bezier(.22,1,.36,1),color .2s,background-color .2s}
  html body:is(.public-site,.workspace) a:not(:is(p,blockquote,dd,td,figcaption,.prose) a):not(:has(img)):not(.skip-link):is(:hover,:focus-visible){transform:translateY(-2px) scale(1.04)}
  html body:is(.public-site,.workspace) :is(.button,.btn):is(:hover,:focus-visible){transform:translateY(-2px) scale(1.03)!important}
  /* Wide list rows: the same lift with a gentler scale */
  /* Portal and operations screens are dense: a gentler scale there */
  html body.workspace a:not(:is(p,blockquote,dd,td,figcaption,.prose) a):not(:has(img)):not(.skip-link):is(:hover,:focus-visible){transform:translateY(-1px) scale(1.02)}
  html body.workspace :is(.button,.btn):is(:hover,:focus-visible){transform:translateY(-1px) scale(1.02)!important}
  html body:is(.public-site,.workspace) .home-materials a:is(:hover,:focus-visible){transform:translateY(-2px) scale(1.015)}
}
/* Running-text links: thin underline that strengthens on hover */
html body:is(.public-site,.workspace) :is(p,blockquote,dd,td,figcaption,.prose) a{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:.2em;transition:color .2s,text-decoration-thickness .2s}
html body:is(.public-site,.workspace) :is(p,blockquote,dd,td,figcaption,.prose) a:hover{text-decoration-thickness:2px;color:var(--brand-link)}
