/* ==========================================================================
   BASE STYLE SHEET
   One file for the whole site. Part 1 (brand colours, fonts and a few "feel"
   settings) and Part 10 (project-specific styles) are the only parts that
   change between clients. Everything else uses the Part 1 values and should
   stay the same. Styles used only by the style guide page are in a <style>
   block in src/style-guide.njk, not here.
   ========================================================================== */


/* ==========================================================================
   PART 1: BRAND (change these per client)
   These are Moo Digital's values.
   ========================================================================== */

/* @font-face rules for this project's fonts go here.
   Self-host the fonts (nothing loads from Google) and write the urls as
   ../fonts/name.woff2, which resolves from src/css/ to src/fonts/. Use font-display:swap. Give each
   family a latin file and, if the content needs accented letters (Welsh,
   Polish and so on), a latin-ext file with its unicode-range, so the browser
   only downloads it when a page uses it. Include a file for every weight and
   style the site uses: a missing one is faked by the browser. */

@font-face{font-family:Archivo;font-style:normal;font-weight:900;font-display:swap;src:url(../fonts/archivo-900.woff2) format('woff2')}
@font-face{font-family:Inter;font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/inter-400.woff2) format('woff2')}
@font-face{font-family:Inter;font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/inter-600.woff2) format('woff2')}

/* CHOOSING COLOURS. The roles matter more than the hues, because the shared
   parts below assume them:
   --accent    must work as TEXT on --ink (4.5:1), must take --on-accent text
               on top of it (4.5:1), and should reach 3:1 as large text on
               --accent-2 (headings and links in .on-accent-2 sections use it).
               In practice: a light, bright colour.
   --accent-2  must take --on-accent-2 text (4.5:1) and must itself read as a
               link on --paper (4.5:1). In practice: a dark colour.
   If the brand's main colour is dark (a deep green or navy), make it
   --accent-2 and pick a light accent. Do not make a dark colour --accent:
   nav links, buttons and headings on ink will fail. */

:root{
  /* Core colours */
  --ink:#0a0a0a;          /* main text, dark sections */
  --paper:#f1eee6;        /* page background */
  --accent:#00ff00;       /* main accent: big backgrounds, highlights */
  --accent-2:#0000ff;     /* second accent: links, focus rings, second feature colour */
  --on-accent:#0a0a0a;    /* text that sits on --accent */
  --on-accent-2:#ffffff;  /* text that sits on --accent-2 */

  /* Supporting colours */
  --muted:#5a564d;        /* secondary text on paper */
  --line:#c2bdb1;         /* faint rules and borders on paper */
  --ink-muted:#a8a8a8;    /* secondary text on ink */
  --ink-line:#333333;     /* rules on ink */
  --white:#ffffff;
  --disabled-bg:#c8c5bc;  /* greyed-out buttons */
  --disabled-text:#5a564d;

  /* Status colours: bright bars plus a pale tint, always with a word as well */
  --ok:#00a63e;   --ok-tint:#dcf6e2;
  --warn:#ff9f00; --warn-tint:#ffefc7;
  --bad:#e5002b;  --bad-tint:#fde0e5;
  --info-tint:#e0e0ff;
  --bad-text:#b00020;     /* red used for words on paper */

  /* Fonts */
  --font-display:Archivo,Impact,"Arial Black",sans-serif;
  --font-body:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;
  --font-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;

  /* Feel */
  --radius:0;             /* boxes: 0 is sharp and bold */
  --radius-pill:999px;    /* buttons and tags */
  --border:3px;           /* the heavy border used on cards and inputs */

  /* Font weights. Set these to weights the font files actually include. A
     display font with one weight (400) must not be asked for 900. */
  --weight-display:900;   /* headings */
  --weight-bold:600;      /* bold text, buttons, labels */
}


/* ==========================================================================
   PART 2: SHARED SCALES (the same everywhere)
   ========================================================================== */

:root{
  --space-xs:.25rem; --space-sm:.5rem; --space-md:1rem; --space-lg:1.5rem;
  --space-xl:2rem;   --space-2xl:3rem; --space-3xl:5rem;
  --wrap:1100px;
  --measure:34em;         /* comfortable line length for reading */
}


/* ==========================================================================
   PART 3: BASE
   ========================================================================== */

*,*::before,*::after{box-sizing:border-box}
*{margin:0}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
body{font:400 18px/1.6 var(--font-body);color:var(--ink);background:var(--paper);min-height:100vh;display:flex;flex-direction:column}
main{flex:1}
img,svg{max-width:100%;height:auto;display:block}
a{color:var(--accent-2);text-underline-offset:.2em}
a:hover{text-decoration-thickness:3px}
:focus-visible{outline:4px solid var(--accent-2);outline-offset:4px}
.on-dark :focus-visible,.on-accent-2 :focus-visible,.on-accent :focus-visible{outline-color:var(--accent)}
.on-accent :focus-visible{outline-color:var(--ink)}
::selection{background:var(--accent);color:var(--ink)}

.wrap{max-width:var(--wrap);margin:0 auto;padding:0 24px}
section{padding:var(--space-3xl) 0}
.skip{position:absolute;left:-999px;top:0;background:var(--accent);color:var(--ink);padding:12px 20px;font-weight:var(--weight-bold);z-index:100}
.skip:focus{left:0}
.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Section colour themes */
.on-dark{background:var(--ink);color:var(--white)}
.on-accent-2{background:var(--accent-2);color:var(--on-accent-2)}
.on-accent{background:var(--accent);color:var(--on-accent)}
/* On a page too short to fill the screen, main is stretched taller than its
   content. This colours that leftover strip so it runs into the footer
   rather than showing as a band of paper. Set it to match the last section. */
.page-ink{background:var(--ink)}
/* :where() keeps these rules weak so buttons and tags can set their own colours */
.on-dark :where(a),.on-accent-2 :where(a){color:var(--accent)}
.on-accent :where(a){color:var(--ink)}


/* ==========================================================================
   PART 4: TYPOGRAPHY
   Weights come from --weight-display and --weight-bold in Part 1. Change
   them there to suit the fonts, not here.
   ========================================================================== */

h1,h2,h3,h4{font-family:var(--font-display);font-weight:var(--weight-display);letter-spacing:-.03em;line-height:1}
h1{font-size:clamp(42px,8.6vw,114px)}
h2{font-size:clamp(34px,6vw,72px);margin-bottom:var(--space-lg)}
h3{font-size:clamp(26px,3.4vw,38px);margin-bottom:var(--space-md)}
h4{font-size:clamp(20px,2.4vw,26px);margin-bottom:var(--space-sm);letter-spacing:-.02em}
.on-dark h2,.on-accent-2 h2{color:var(--accent)}
.lead{font-size:clamp(19px,2.2vw,24px);line-height:1.5;max-width:var(--measure)}
.small{font-size:15px;color:var(--muted)}
.on-dark .small,.on-accent-2 .small{color:var(--ink-muted)}
.on-accent-2 .small{color:var(--white)}
.on-accent .small{color:var(--ink)}
.eyebrow{font:var(--weight-bold) 14px/1 var(--font-body);letter-spacing:.12em;text-transform:uppercase;margin-bottom:var(--space-md)}
strong,b{font-weight:var(--weight-bold)}
p+p{margin-top:1.1em}


/* ==========================================================================
   PART 5: BUTTONS
   ========================================================================== */

.btn{display:inline-block;font:var(--weight-bold) 18px/1.2 var(--font-body);text-decoration:none;padding:16px 28px;border:var(--border) solid var(--ink);border-radius:var(--radius-pill);background:var(--ink);color:var(--accent);cursor:pointer;overflow-wrap:anywhere}
.btn:hover{background:var(--accent-2);border-color:var(--accent-2);color:var(--on-accent-2);text-decoration:none}
.btn-outline{background:transparent;color:var(--ink)}
.btn-outline:hover{background:var(--ink);border-color:var(--ink);color:var(--accent)}
.btn-accent{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.btn-accent:hover{background:var(--white);border-color:var(--white);color:var(--ink)}
.btn-small{font-size:15px;padding:10px 20px}
.btn[disabled],.btn[aria-disabled=true]{background:var(--disabled-bg);border-color:var(--disabled-bg);color:var(--disabled-text);cursor:not-allowed;pointer-events:none}
/* on dark or accent-2 sections, buttons flip */
.on-dark .btn,.on-accent-2 .btn{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.on-dark .btn:hover,.on-accent-2 .btn:hover{background:var(--white);border-color:var(--white);color:var(--ink)}
.on-dark .btn-outline,.on-accent-2 .btn-outline{background:transparent;color:var(--white);border-color:var(--white)}
.on-dark .btn-outline:hover,.on-accent-2 .btn-outline:hover{background:var(--white);color:var(--ink)}
.on-accent .btn:hover{background:var(--accent-2);border-color:var(--accent-2);color:var(--on-accent-2)}
.btn-row{display:flex;flex-wrap:wrap;gap:var(--space-md);align-items:center}


/* ==========================================================================
   PART 6: NAVIGATION AND FOOTER
   ========================================================================== */

.bar{background:var(--ink);padding:16px 0}
.bar .wrap{display:flex;align-items:center;gap:var(--space-lg);flex-wrap:wrap}
.bar .brand{display:flex;align-items:center;gap:14px;text-decoration:none}
.bar .brand img{height:34px;width:auto}
.bar .brand svg{height:34px;width:auto;fill:var(--accent)}
.bar .brand span{font:var(--weight-display) 22px/1 var(--font-display);letter-spacing:-.02em;color:var(--white)}
.bar nav{margin-left:auto}
.bar nav ul{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:var(--space-sm) var(--space-lg)}
.bar nav a{color:var(--accent);font-weight:var(--weight-bold);font-size:16px;text-decoration:none;padding:6px 0;border-bottom:3px solid transparent}
.bar nav a:hover{color:var(--white);border-bottom-color:var(--white)}
.bar nav a[aria-current=page]{color:var(--white);border-bottom-color:var(--accent)}
/* Sticky variant. Pages that have their own sticky sub-nav (the style
   guide) leave it off so the two don't stack on top of each other. */
.bar-sticky{position:sticky;top:0;z-index:10}

.crumbs{font-size:15px;color:var(--muted)}
.crumbs ol{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:var(--space-sm)}
.crumbs li+li::before{content:"/";margin-right:var(--space-sm)}

footer{background:var(--ink);color:var(--ink-muted);font-size:14px;padding:0 0 32px}
footer .inner{border-top:1px solid var(--ink-line);padding-top:24px}
footer a{color:var(--ink-muted)}
footer a:hover{color:var(--white)}


/* ==========================================================================
   PART 7: FORMS
   ========================================================================== */

.field{margin-bottom:var(--space-lg)}
label,legend{display:block;font-weight:var(--weight-bold);margin-bottom:var(--space-sm)}
.hint{display:block;font-size:15px;color:var(--muted);margin:-.25rem 0 var(--space-sm)}
input,textarea,select{font:400 18px/1.4 var(--font-body);color:var(--ink);background:var(--white);border:var(--border) solid var(--ink);border-radius:var(--radius);padding:12px 14px;width:100%;max-width:36em}
textarea{min-height:9em;resize:vertical}
input:focus-visible,textarea:focus-visible,select:focus-visible{outline:4px solid var(--accent-2);outline-offset:2px}
input::placeholder,textarea::placeholder{color:var(--muted)}
input[type=checkbox],input[type=radio]{width:1.4em;height:1.4em;accent-color:var(--accent-2);vertical-align:middle;margin-right:var(--space-sm)}
.check{display:flex;align-items:center;font-weight:400}
.field-error input{border-color:var(--bad)}
.error-text{color:var(--bad-text);font-weight:var(--weight-bold);margin-top:var(--space-sm)}
.error-text::before{content:"Problem: "}
fieldset{border:0;padding:0}


/* ==========================================================================
   PART 8: COMPONENTS
   ========================================================================== */

/* Two columns side by side, stacking on a phone (Part 11). */
.cols{display:grid;grid-template-columns:1fr 1fr;gap:56px;align-items:start}
/* Sits the shorter column against the middle of the taller one. */
.cols-middle{align-items:center}

/* Tags */
.tags{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:var(--space-sm)}
.tag{display:inline-block;font:var(--weight-bold) 14px/1 var(--font-body);padding:8px 14px;border-radius:var(--radius-pill);background:var(--accent);color:var(--on-accent);text-decoration:none}
a.tag:hover{background:var(--ink);color:var(--accent)}
/* tags on accent flip to ink so they stay visible */
.on-accent .tag{background:var(--ink);color:var(--accent)}
.on-accent a.tag:hover{background:var(--accent-2);color:var(--on-accent-2)}
.on-accent .tag-outline{background:transparent;color:var(--ink);border-color:var(--ink)}
.tag-outline{background:transparent;border:2px solid var(--ink);color:var(--ink);padding:6px 12px}

/* Cards */
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:var(--space-lg)}
.card{background:var(--white);border:var(--border) solid var(--ink);border-radius:var(--radius);padding:var(--space-lg);display:flex;flex-direction:column;gap:var(--space-sm)}
.card h3,.card h4{margin-bottom:0}
.card a{color:inherit}
.card .more{margin-top:auto;font-weight:var(--weight-bold)}
.card-accent{background:var(--accent)}
.card-accent-2{background:var(--accent-2);color:var(--on-accent-2)}
.card-accent-2 h3,.card-accent-2 h4{color:var(--accent)}
.card-link:hover{box-shadow:8px 8px 0 var(--ink);transform:translate(-4px,-4px)}
@media (prefers-reduced-motion:no-preference){.card-link{transition:box-shadow .15s,transform .15s}}

/* Alerts: always carry a word as well as colour */
.alert{border:var(--border) solid var(--ink);padding:var(--space-md) var(--space-lg) var(--space-md) calc(var(--space-lg) + 12px);background:var(--white);border-radius:var(--radius)}
.alert strong:first-child{display:block;margin-bottom:var(--space-xs)}
.alert-ok{box-shadow:inset 12px 0 0 var(--ok);background:var(--ok-tint)}
.alert-warn{box-shadow:inset 12px 0 0 var(--warn);background:var(--warn-tint)}
.alert-bad{box-shadow:inset 12px 0 0 var(--bad);background:var(--bad-tint)}
.alert-info{box-shadow:inset 12px 0 0 var(--accent-2);background:var(--info-tint)}
.alerts{display:grid;gap:var(--space-md);max-width:var(--measure)}

/* Side note */
.note{border-left:12px solid var(--accent-2);padding:4px 0 4px 24px}
/* A heading in a note belongs to the paragraph under it, so the space sits
   above the heading rather than below it. */
.note h3{margin-top:var(--space-xl);margin-bottom:var(--space-sm)}
.note>h3:first-child{margin-top:0}

/* Tables */
.table-wrap{overflow-x:auto}
table{border-collapse:collapse;width:100%;min-width:30em}
th,td{text-align:left;padding:12px 16px;border-bottom:2px solid var(--line);vertical-align:top}
th{font-weight:var(--weight-bold)}
thead th{border-bottom:var(--border) solid var(--ink)}

/* Pagination */
.pager{display:flex;justify-content:space-between;gap:var(--space-md);flex-wrap:wrap}


/* ==========================================================================
   PART 9: BLOG / PROSE
   ========================================================================== */

.prose{font-size:clamp(19px,2.1vw,22px)}
.prose>*{max-width:var(--measure)}
.prose>*+*{margin-top:1.1em}
.prose h2{font-size:clamp(30px,4.4vw,48px);margin:2em 0 .6em}
.prose h3{font-size:clamp(24px,3vw,32px);margin:1.8em 0 .5em}
.prose h2+*,.prose h3+*{margin-top:0}
.prose ul,.prose ol{padding-left:1.4em}
.prose li+li{margin-top:.4em}
.prose blockquote{border-left:12px solid var(--accent);padding:4px 0 4px 24px;font-size:1.15em;font-weight:var(--weight-bold)}
.prose blockquote footer{background:none;padding:0;margin-top:var(--space-sm);font-size:.8em;font-weight:400;color:var(--muted)}
.prose hr{border:0;border-top:var(--border) solid var(--ink);margin:2.5em 0}
.prose figure{max-width:none}
.prose figure img{border:var(--border) solid var(--ink);width:100%}
.prose figcaption{font-size:15px;color:var(--muted);margin-top:var(--space-sm);max-width:var(--measure)}
code,kbd{font:400 .88em var(--font-mono);background:var(--white);border:1px solid var(--line);padding:.1em .4em;border-radius:4px}
pre{background:var(--ink);color:var(--white);padding:var(--space-lg);overflow-x:auto;font:400 15px/1.6 var(--font-mono);border-radius:var(--radius)}
pre code{background:none;border:0;padding:0;font-size:inherit}

/* Post header and list */
.post-meta{margin-bottom:var(--space-sm);font-size:15px;color:var(--muted);display:flex;flex-wrap:wrap;gap:var(--space-xs) var(--space-md)}
.post-meta .tags{margin-left:0}
.post-list{list-style:none;padding:0;border-top:var(--border) solid var(--ink)}
.post-list>li{padding:var(--space-lg) 0;border-bottom:2px solid var(--line)}
.post-list h3{margin-bottom:var(--space-sm)}
.post-list h3 a{color:inherit;text-decoration:none}
.post-list h3 a:hover{text-decoration:underline;text-decoration-thickness:6px;text-decoration-color:var(--accent-2)}
.author{display:flex;gap:var(--space-lg);align-items:flex-start;border-top:var(--border) solid var(--ink);padding-top:var(--space-lg)}


/* ==========================================================================
   PART 10: PROJECT-SPECIFIC STYLES
   Anything only this project needs (a hero, a contact block, artwork, a
   back-to-top button and so on). Build it from the Part 1 tokens and the
   Part 2 scales, and add it to the style guide page as well.
   ========================================================================== */

/* Header bar: the email address in place of a nav, pushed to the right. */
.bar-mail{margin-left:auto;color:var(--accent);font-weight:var(--weight-bold);font-size:16px;text-decoration:none;white-space:nowrap}
.bar-mail:hover{color:var(--white);text-decoration:underline;text-underline-offset:4px}

/* Hero. Colour comes from .on-accent. */
.hero{padding:72px 0 88px}
.hero h1{max-width:11em}
.hero .lead{margin-top:var(--space-xl)}
.hero .btn{margin-top:40px}
/* Artwork set beside a hero's words, as on the 404 page. Centred in its
   column so it sits under the text once the two stack. */
.hero-art{width:100%;max-width:380px;margin-inline:auto}
/* It drifts, because it is adrift. Holds still if the visitor asks it to. */
@media (prefers-reduced-motion:no-preference){
  .hero-art{animation:drift 7s ease-in-out infinite alternate}
  @keyframes drift{from{transform:translateY(-10px) rotate(-1.5deg)}to{transform:translateY(10px) rotate(1.5deg)}}
}

/* A faint pattern of logo bars behind a section. Put .has-pattern on the
   section and .pattern as its first child; add .rev to fade it in from the
   right instead of the left. The stroke is --line, written out in full
   because a data URI cannot read a custom property. */
.has-pattern{position:relative;overflow:hidden}
.has-pattern .wrap{position:relative}
.pattern{position:absolute;inset:0;background:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='128' viewBox='0 0 240 128' fill='none' stroke='%23c2bdb1' stroke-width='1.5'><rect x='0.75' y='0.75' width='98.5' height='14.5' rx='7.25'/><rect x='116.75' y='0.75' width='98.5' height='14.5' rx='7.25'/><rect x='0.75' y='32.75' width='168.5' height='14.5' rx='7.25'/><rect x='186.75' y='32.75' width='38.5' height='14.5' rx='7.25'/><rect x='30.75' y='64.75' width='208.5' height='14.5' rx='7.25'/><rect x='0.75' y='96.75' width='58.5' height='14.5' rx='7.25'/><rect x='76.75' y='96.75' width='98.5' height='14.5' rx='7.25'/><rect x='192.75' y='96.75' width='34.5' height='14.5' rx='7.25'/></svg>") repeat left top/240px 128px;-webkit-mask-image:linear-gradient(to right,transparent 0,rgba(0,0,0,.5) 75%);mask-image:linear-gradient(to right,transparent 0,rgba(0,0,0,.5) 75%)}
.pattern.rev{-webkit-mask-image:linear-gradient(to left,transparent 0,rgba(0,0,0,.5) 75%);mask-image:linear-gradient(to left,transparent 0,rgba(0,0,0,.5) 75%)}

/* Portrait in the "Who's behind Moo Digital" note. Held well under the
   column width so the face stays a comfortable size next to the copy. */
.portrait{width:100%;max-width:400px}

/* Closing contact block. Colour comes from .on-dark. */
.contact{padding-bottom:96px}
.contact h2{font-size:clamp(48px,11vw,150px);margin-bottom:var(--space-xl)}
.contact p{max-width:30em}
.mail{display:inline-block;margin-top:var(--space-xl);font:var(--weight-display) clamp(26px,5.2vw,64px)/1.1 var(--font-display);letter-spacing:-.02em;color:var(--accent);text-decoration-thickness:6px;text-underline-offset:8px;overflow-wrap:anywhere}
.mail:hover{color:var(--white)}

/* Back to top: fades in once the page has scrolled a little way. Needs the
   small script in _includes/partials/back-to-top.njk to add .show. */
.totop{position:fixed;right:24px;bottom:24px;z-index:9;width:52px;height:52px;border-radius:50%;background:rgba(10,10,10,.82);box-shadow:inset 0 0 0 1px rgba(255,255,255,.22);display:flex;align-items:center;justify-content:center;opacity:0;visibility:hidden;transform:translateY(8px);transition:opacity .4s,transform .4s,visibility .4s}
.totop.show{opacity:1;visibility:visible;transform:none}
.totop svg{width:26px;height:29px;fill:var(--accent);opacity:.85}
.totop:hover{background:var(--ink)}
.totop:hover svg{opacity:1}
.totop:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
@media (prefers-reduced-motion:reduce){.totop{transform:none;transition:opacity .4s,visibility .4s}}

@media (max-width:760px){
  .bar-mail{font-size:15px}
  .hero{padding:48px 0 64px}
  .totop{right:16px;bottom:16px}
}


/* ==========================================================================
   PART 11: SMALL SCREENS
   ========================================================================== */

@media (max-width:760px){
  body{font-size:17px}
  section{padding:var(--space-2xl) 0}
  .bar nav{margin-left:0;width:100%}
  .cols{grid-template-columns:1fr;gap:40px}
}
@media (max-width:380px){.bar .brand span{display:none}}
