/* Digital Organics — house style.
 * Brand from the logo: navy #33475B, olive #6E7A3C, bark #8A5A2B. Paper was #FBFDFF -
 * which is to say white - and is now #F5F7FA, the dark page's own hue (215) at 97% lightness.
 * Ink #23252B and signal yellow #F6C018 come from the cartoon set.
 *
 * Rule: refined frame, warm voice, one oddity. Serif headings, human body copy, the yellow used only
 * as a marker (never as decoration), and NO web fonts and NO third-party requests of any kind — the
 * page has to load on a microwaved link in a glen, and "we do not track anybody" should be something a
 * visitor can verify rather than something we claim.
 *
 * THEMING. Every colour that changes between light and dark is a custom property, and the dark values
 * appear exactly twice: once for "system says dark and you haven't chosen" and once for "you chose
 * dark". Both blocks are identical; if you edit one, edit both. Rules themselves never mention a
 * literal colour. With JavaScript switched off the toggle simply does nothing and the system setting
 * wins, which is the correct degradation.
 */

:root {
  --paper: #F5F7FA;      /* page. Not white, and the dark page's own colour: hue 215, saturation 40%
                            exactly as #0E1621, only the lightness differs, so light and dark are one
                            family rather than two arguments. Cards stay #FFF and sit proud of it. */
  --field: #FFFFFF;      /* inputs */
  --text:  #22303D;      /* body copy */
  --head:  #33475B;      /* headings, brand, strong */
  --muted: #5E6978;      /* small print, italic notes. Was #6D7B89: 4.25:1, under AA for body-size
                            text. 5.19:1 now, same hue and only a shade darker. */
  --faint: #657081;      /* footer. Was #7A8797 at 3.59:1; this is the faintest ink that still clears
                            4.5:1 on the page (4.67). Below it, quieter means unreadable. */
  --rule:  #D9E2EC;      /* hairlines */
  --edge:  #C3CFDA;      /* input borders */
  --olive: #6E7A3C;
  --olive-btn: #6E7A3C;
  --bark:  #8A5A2B;
  --sig:   #F6C018;      /* signal yellow: one marker per page, no more */

  /* The hues of a rainbow, for the 404 only, where the subject IS a rainbow and keeping to two
     colours would have been politeness rather than judgement. Ordered as a spectrum arrives: warm
     outside, deep inside. On the dark page, the same hues and quieter: a moonlit bow, which happens
     up here and is rarer than the ordinary kind. */
  --bow-warm: #B0693B; --bow-gold: #EFB01C; --bow-leaf: #6E7A3C;
  --bow-sea:  #4C7CA4; --bow-deep: #33475B;
  --btn-bg: #33475B;
  --btn-bg-hover: #263646;
  --link-edge: #B9C6D2;
  --surf: #FFFFFF;        /* the cards sit on a surface, so a shadow has somewhere to fall */
  --branch-made: #33475B; /* the branch's made half: navy on paper */
  --lift: 0 1px 2px rgba(34,48,61,.07);
  --lift-hi: 0 10px 22px -12px rgba(34,48,61,.30);
  --card-line-hi: rgba(110,122,60,.5);

  --col: 68ch;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

/* System setting, unless the visitor has chosen otherwise. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1621; --field: #0B1219; --text: #C9D6E2; --head: #DCE8F2;
    --muted: #93A4B4; --faint: #8FA0B2; --rule: #212F3F; --edge: #2E4156;
    --olive: #A9BE74; --olive-btn: #6E7A3C; --bark: #C08B57;
    --bow-warm: #C08B57; --bow-gold: #E8C25B; --bow-leaf: #A9BE74;
    --bow-sea:  #7FA8CC; --bow-deep: #A9C2DC;
    --btn-bg: #263A50; --btn-bg-hover: #38506B; --link-edge: #4A6076;
    --surf: #131F2C;
    --branch-made: #8FB0CE; /* on the dark page navy is invisible, and --head (near white) turns the
                               made half into highlights. This is steel: paler, still navy. */
    --lift: 0 1px 2px rgba(0,0,0,.45);
    --lift-hi: 0 12px 26px -12px rgba(0,0,0,.85);
    --card-line-hi: rgba(169,190,116,.42);
  }
}

/* Visitor's own choice, remembered on this device by theme.js. */
:root[data-theme="dark"] {
  --paper: #0E1621; --field: #0B1219; --text: #C9D6E2; --head: #DCE8F2;
  --muted: #93A4B4; --faint: #8FA0B2; --rule: #212F3F; --edge: #2E4156;
  --olive: #A9BE74; --olive-btn: #6E7A3C; --bark: #C08B57;
  --bow-warm: #C08B57; --bow-gold: #E8C25B; --bow-leaf: #A9BE74;
  --bow-sea:  #7FA8CC; --bow-deep: #A9C2DC;
  --btn-bg: #263A50; --btn-bg-hover: #38506B; --link-edge: #4A6076;
  --surf: #131F2C;
  --branch-made: #8FB0CE;
  --lift: 0 1px 2px rgba(0,0,0,.45);
  --lift-hi: 0 12px 26px -12px rgba(0,0,0,.85);
  --card-line-hi: rgba(169,190,116,.42);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 clamp(16px, 0.45vw + 12px, 19px)/1.65 var(--sans);
  text-rendering: optimizeLegibility;
}

/* Header, main and footer share one box model so their content edges line up exactly. (They did not:
   the header was 8vw wider than the column, which is why the footer looked "almost, but not quite"
   left-aligned against the text above it.) */
header.bar, main, footer {
  max-width: var(--col); width: 100%; margin: 0 auto; padding-inline: 4vw;
}
/* The lockup was 2.05rem tall, which made the wordmark unreadable and the whole masthead apologetic.
   It now scales up with the viewport and the nav sits on the bottom line of it rather than its
   middle, which is what makes a big logo look deliberate instead of oversized: the two are aligned,
   not merely in the same box. */
header.bar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  padding-top: 1.3rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
main { padding-top: 2.2rem; padding-bottom: 3.5rem; }
footer { padding-top: 1.1rem; padding-bottom: 2.4rem; border-top: 1px solid var(--rule); font-size: .82rem; }

.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--head); }
/* Two artwork files, chosen in CSS: logo.svg on paper, logo-dark.svg on the dark page. Measured:
   the coloured navy on the dark page is 1.73:1 (invisible), 1.90:1 after deepening the page; the
   lifted navy of logo-dark.svg is 10.0:1, its olive 8.9:1 and its bark 6.7:1. Same hues, same
   drawing - and unlike a filter, the trunk gradient and the two-colour wordmark survive.

   The full lockup sits in the header now, as geo asked; it prints the name itself, so the separate
   text wordmark went with it - one name, twice-readable, is better than one name three times. */
.brand img { height: clamp(3rem, 1.55rem + 3.5vw, 4.65rem); width: auto; display: block; }
.brand span { font-family: var(--serif); font-size: 1.16rem; font-weight: 600; letter-spacing: .012em; }

nav { display: flex; align-items: center; gap: 1.1rem; font-size: .95rem; white-space: nowrap;
      padding-bottom: .3rem; }   /* the lockup carries internal space below its lettering; without
                                     this the nav floats above the baseline it is meant to sit on */
nav .tbtn { margin-left: .25rem; }
/* Nav links: the olive underline grows out from the left instead of toggling on, so nothing appears
   or vanishes under the reader's eye. The focus ring is the plain outline further down, untouched. */
nav a { color: var(--head); text-decoration: none; position: relative; padding-bottom: 3px; }
nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
               background: var(--olive); transform: scaleX(0); transform-origin: 0 50%; }
nav a:hover::after, nav a:focus-visible::after { transform: scaleX(1); }
nav a.here { color: var(--olive); font-weight: 600; }

/* ---- theme toggle ---- */
.tbtn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: none; border: 1px solid var(--edge); border-radius: 999px;
  color: var(--muted); font: inherit; font-size: .84rem; line-height: 1;
  padding: .34rem .7rem .34rem .55rem; cursor: pointer;
}
.tbtn:hover { color: var(--head); border-color: var(--olive); background: transparent; }
.tbtn svg { width: 1.05rem; height: 1.05rem; display: block; fill: none; stroke: currentColor;
            stroke-width: 1.7; stroke-linecap: round; }
/* The icon shows the theme you would GET, Wikipedia's convention: a moon while you are in the light,
   a sun while you are in the dark. Without JavaScript the button simply isn't wired up and the
   correct icon still shows, because these rules are pure CSS.

   Both icons now occupy the same grid cell and trade places with opacity and a slight turn, rather
   than one being display:none - a crossfade instead of a jump. */
.tbtn .ic { display: grid; place-items: center; width: 1.05rem; height: 1.05rem; }
.tbtn .ic > svg { grid-area: 1 / 1; opacity: 1; }
.tbtn .ic > svg.sun { opacity: 0; transform: rotate(-40deg) scale(.72); }
:root[data-theme="dark"] .tbtn .ic > svg.moon { opacity: 0; transform: rotate(40deg) scale(.72); }
:root[data-theme="dark"] .tbtn .ic > svg.sun { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tbtn .ic > svg.moon { opacity: 0; transform: rotate(40deg) scale(.72); }
  :root:not([data-theme="light"]) .tbtn .ic > svg.sun { opacity: 1; transform: none; }
}
/* Artwork swap: light file by default, dark file whenever the page is dark.
   The element name is part of every selector on purpose: `.brand img { display: block }` is more
   specific than a bare `.l-d`, and with bare class selectors BOTH logos showed in the light theme -
   caught by rendering it, not by reading it. */
img.l-d { display: none; }
:root[data-theme="dark"] img.l-l { display: none; }
:root[data-theme="dark"] img.l-d { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.l-l { display: none; }
  :root:not([data-theme="light"]) img.l-d { display: block; }
}

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
      clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

p { margin: 0 0 1.05em; }
strong { color: var(--head); }
a { color: var(--head); text-decoration: underline; text-decoration-color: var(--link-edge); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--olive); }
a:focus-visible, button:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--olive); outline-offset: 3px;
}

h1, h2, h3 { font-family: var(--serif); color: var(--head); font-weight: 600; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.35rem); line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.32rem; margin: 2.4rem 0 1.1rem; padding-bottom: .45rem; border-bottom: 2px solid var(--olive); }
h3 { font-size: 1.06rem; margin: 0 0 .45rem; letter-spacing: .005em; }

.lede {
  font-family: var(--serif); font-size: clamp(1.16rem, 1.1vw + .95rem, 1.45rem);
  line-height: 1.5; color: var(--head); margin-bottom: 1.3em;
}
.lede strong { color: inherit; }

.hero { margin: 0 0 2rem; }
.hero img { width: 100%; max-width: 46rem; display: block; }
.hero.small img { max-width: 24rem; }   /* the robots, on the 404, at the size of a joke rather than
                                           an announcement - the scene is a good drawing and it is
                                           better half a size down at the end of a short page */
.hero figcaption { font-size: .8rem; color: var(--faint); margin-top: .35rem; }

.cards { display: grid; gap: 1.6rem; margin: 0 0 1.4rem;
         width: min(92vw, 1040px); position: relative; left: 50%; transform: translateX(-50%); }
@media (min-width: 40rem) { .cards { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } }
.cards article { border: 1px solid var(--rule); border-top: 3px solid var(--olive); border-radius: 10px;
                 background: var(--surf); padding: 1rem 1.05rem 1.1rem; box-shadow: var(--lift); }
.cards article p { font-size: .95em; }
/* The plates. Inlined like the branch so they take the theme: navy line on paper in the light, and in
   the dark the line lifts with the text while the fills stay the colour of the card. --plate-paper is
   deliberately the card surface rather than the page, so a plate never looks like a pasted slip. */
.plate { display: block; width: 100%; height: auto; margin: .2rem 0 .1rem;
         --plate-ink: var(--head); --plate-leaf: var(--olive); --plate-paper: var(--surf); }
/* The coverage drawing gets a little more air than a plate in a card, and the caption is allowed to
   be read as a caption rather than as body copy. */
.map { margin: 1.7rem 0 1.4rem; }
.map .plate { margin: 0 auto; max-width: 31rem; }   /* a portrait drawing: capped, and centred, rather than stretched across the measure */
.figcap { font-family: var(--serif); font-size: .78rem !important; color: var(--muted);
          letter-spacing: .03em; margin: 0 0 .75rem !important; }
.cards article p:last-child { margin-bottom: 0; }
.fine { font-size: .85em !important; color: var(--muted); font-style: italic; }

.umbrella {
  font-family: var(--serif); font-size: 1.06rem; color: var(--bark);
  border-left: 3px solid var(--sig); padding-left: 1rem; margin: 1.9rem 0 0;
}

ul.plain { margin: 0 0 1.2rem; padding-left: 1.15rem; }
ul.plain li { margin-bottom: .55em; }
ul.plain li::marker { color: var(--olive); }

/* Placeholders must look deliberate, never sloppy: dashed rule plus a tooltip saying why. */
.tbc { border-bottom: 1px dashed var(--bark); color: var(--bark); text-decoration: none; cursor: help; }
.note { font-size: .84em; color: var(--muted); margin-top: 2.4rem; }

.mailbtn {
  display: inline-block; margin: .3rem 0 1.6rem; padding: .62rem 1.15rem;
  background: var(--btn-bg); color: var(--paper); border-radius: 6px;
  text-decoration: none; font-weight: 600; font-size: 1.02rem;
}
.mailbtn:hover { background: var(--btn-bg-hover); }
form { display: grid; gap: .85rem; max-width: 34rem; margin: 0 0 1.4rem; }
label { font-size: .88rem; font-weight: 600; color: var(--head); display: block; margin-bottom: .25rem; }
label .opt { font-weight: 400; color: var(--muted); }  /* was an inline style with a hard-coded grey, which stayed grey on the dark page */
input, textarea {
  width: 100%; padding: .6rem .7rem; font: inherit; color: var(--text);
  background: var(--field); border: 1px solid var(--edge); border-radius: 5px;
}
textarea { min-height: 9.5rem; resize: vertical; }
button {
  justify-self: start; padding: .6rem 1.3rem; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--olive-btn); color: #fff; border: 0; border-radius: 6px;
}
button:hover { background: #5C6730; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sent { border-left: 3px solid var(--olive); padding-left: 1rem; margin: 0 0 1.4rem;
        font-family: var(--serif); color: var(--head); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.2rem; font-size: .95rem; }
dl.facts dt { color: var(--olive); font-weight: 600; }
dl.facts dd { margin: 0; }

footer { color: var(--faint); }
footer a { color: var(--faint); }
.lockup { display: block; height: 3.4rem; width: auto; margin: 0 0 .8rem; opacity: .95; }

/* ---------------------------------------------------------------- art: the branch
   Inlined into the page rather than <img src>, so it takes the theme's colours and the page's CSS can
   animate it. --ink and --leaf are the only things it needs from here; the artwork carries brand
   fallbacks so branch.svg still opens on its own.

   Grown, not faded: the stem is a stroked centreline with pathLength="1", so it draws itself from the
   collar to the tip and the leaves unfurl behind the wave, each with its own --d delay.

   Without JavaScript - or with reduced motion - none of this exists and the branch is simply drawn.
   The hiding rules only apply inside (prefers-reduced-motion: no-preference) AND to a .js element.
*/
.branch { display: block; width: 100%; height: auto; margin: 2.6rem 0 2.1rem; overflow: visible;
          --ink: var(--branch-made); --leaf: var(--olive); }
/* The colours, out of the file's own <style> block and in here, where they sit beside the rest of the
   page rules and the inlined copies stay small. The brand fallbacks stay in the artwork so it can be
   opened on its own. */
.branch .stem, .branch .root, .branch .petiole, .branch .thread {
  fill: none; stroke-linecap: round; stroke-linejoin: round; }
.branch .stem  { stroke: var(--ink,#33475B); stroke-width: 2.6; }
.branch .root  { stroke: var(--ink,#33475B); stroke-width: 4.4; }
.branch .collar { fill: var(--ink,#33475B); }
.branch .bore   { fill: var(--paper,#F5F7FA); }
.branch .thread  { stroke: var(--ink,#33475B); stroke-width: 2; }
.branch .petiole { stroke: var(--ink,#33475B); stroke-width: 2.2; }
.branch .vein  { stroke: var(--paper,#F5F7FA); stroke-width: 1.3; opacity: .6; stroke-linecap: round; fill: none; }
.branch .tip   { fill: var(--leaf,#6E7A3C); }
.branch .leaf { transform-box: fill-box; transform-origin: 0 50%; }
.branch .tip { transform-box: fill-box; transform-origin: 0 50%; }

/* ---------------------------------------------------------------- art: the onlooker
   Small, low-contrast, unexplained, in the bottom corner on wide screens. Fixed, so it stays with
   you; pointer-events none, aria-hidden, and it has no caption anywhere. It is decor and a screen
   reader should never hear about it. Not on a phone: that corner belongs to cookie banners and
   thumbs. Not in print.
*/
.onlooker { display: none; }
@media (min-width: 60rem) {
  .onlooker { display: block; position: fixed; right: max(1.1vw, 14px); bottom: 12px; width: 34px;
              height: auto; opacity: .5; pointer-events: none; }
}

/* ---------------------------------------------------------------- motion
   Spend it like money: the link out is 0.6 Mbit of microwave, so there are no libraries, no
   third-party requests, and about a kilobyte of our own JavaScript for all of it. One scroll reveal,
   which is the cards, once. Everything here is suppressed by prefers-reduced-motion.

   The `translate` property is used rather than `transform` so a card can move without disturbing any
   transform a layout rule owns. */
@media (prefers-reduced-motion: no-preference) {
  .tbtn, .mailbtn, button { transition: color .15s ease, border-color .15s ease, background-color .15s ease; }
  .tbtn .ic > svg { transition: opacity .18s ease, transform .3s cubic-bezier(.3,.02,.2,1); }
  nav a::after { transition: transform .18s ease-out; }

  /* ~2px, and the shadow deepens rather than the box growing - a growing box shifts the words about
     under somebody's eyes. */
  .cards article { transition: translate .18s ease-out, box-shadow .18s ease-out, border-color .18s ease-out; }
  .cards article:hover { translate: 0 -2px; box-shadow: var(--lift-hi); border-color: var(--card-line-hi); }

  /* The one scroll reveal. Hide what has not arrived rather than everything - `animation: ... backwards`
     fills the delay only, so the first version of this left the cards at opacity:0 again the moment the
     animation finished. No fill mode is needed now: the end of the animation is the element's own
     state, and it leaves nothing behind for the hover rule above to fight with. */
  .js .cards:not(.in) article { opacity: 0; }
  .js .cards.in article { animation: rise .55s cubic-bezier(.2,.7,.3,1) both; }
  .js .cards.in article:nth-child(2) { animation-delay: .09s; }
  .js .cards.in article:nth-child(3) { animation-delay: .18s; }
  @keyframes rise { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }

  /* The branch, drawn rather than faded. The dash has to stay on the stem the whole time - `pathLength=1`
     makes the arithmetic trivial - and the keyframes say both ends explicitly, with fill mode `both`, so
     the pre-start frame (during a leaf's delay) and the frame after the last are both the ones I wrote
     down rather than whatever the base rule happens to compute to. */
  .js .branch .stem, .js .branch .root { stroke-dasharray: 1; }
  .js .branch:not(.in) .stem, .js .branch:not(.in) .root { stroke-dashoffset: 1; }
  .js .branch:not(.in) .leaf, .js .branch:not(.in) .tip { opacity: 0; }
  .js .branch.in .root { animation: draw .34s ease-out both; }
  .js .branch.in .stem { animation: draw 1.5s cubic-bezier(.3,.02,.2,1) both; }
  .js .branch.in .leaf { animation: unfurl .55s ease-out both; animation-delay: var(--d, 0s); }
  .js .branch.in .tip { animation: unfurl .6s ease-out 1.35s both; }
  @keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
  @keyframes unfurl { from { opacity: 0; scale: .3; } to { opacity: 1; scale: 1; } }

  /* Blink, once every eight seconds, and otherwise nothing at all. */
  .onlooker .eyes { transform-box: fill-box; transform-origin: 50% 50%; animation: blink 8s linear infinite; }
  @keyframes blink {
    0%, 90.5% { transform: scaleY(1); }
    93% { transform: scaleY(.12); }
    95.5%, 100% { transform: scaleY(1); }
  }
}

/* Depth once the page has moved: the header's hairline gains a shadow. Pure CSS where the browser
   supports scroll-driven animation, and simply a hairline where it does not. */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    header.bar {
      animation: hdr linear both;
      animation-timeline: scroll(root block);
      animation-range: 0 16px;
    }
    @keyframes hdr {
      from { box-shadow: 0 0 0 0 rgba(0,0,0,0); border-bottom-color: var(--rule); }
      to   { box-shadow: 0 6px 14px -12px rgba(20,30,40,.55); border-bottom-color: var(--edge); }
    }
  }
}

@media print {
  header.bar nav, form, .hero, .onlooker { display: none; }
  body { color: #000; background: #fff; }
}

/* A disclosure rather than a privacy-policy page (comment in contact.html explains why). Native
   <details>/<summary>, so it needs no script and the paragraph is genuinely on the page either way.
   Colour is all by token, so both themes get it for free; the marker is drawn because the browser
   default is a small grey triangle that looks like an afterthought. */
details.more { margin: 2.4rem 0 0; }
details.more > summary { list-style: none; cursor: pointer; font-family: var(--serif); color: var(--head);
  font-weight: 600; font-size: 1.32rem; line-height: 1.25; padding-bottom: .45rem;
  border-bottom: 2px solid var(--olive); text-wrap: balance; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; float: right; color: var(--olive); font-weight: 600; }
details.more[open] > summary::after { content: "\2212"; }
details.more > summary:hover { color: var(--olive); }
details.more > summary:focus-visible { outline: 2px solid var(--olive); outline-offset: 4px; border-radius: 4px; }
details.more > p { margin: .95rem 0 0; }
