/* ==========================================================================
   site.css - the ONE stylesheet for the whole site.

   How CSS works in one sentence: each rule picks elements ("selector") and
   sets how they look ("property: value;"). Example:  h1 { color: navy; }

   To re-brand the site, change only the DESIGN TOKENS in section 1
   (the colours in each theme block).
   Everything below reads its colours, fonts and spacing from them.
   ========================================================================== */


/* 1. DESIGN TOKENS ---------------------------------------------------------
   Named values ("custom properties") used everywhere as var(--name).
   Sizes and fonts are shared by every theme; colours come from a theme block. */
:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;  /* no web-font download needed */
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;

  --space-1: 0.5rem;         /* 1rem = the browser's base text size, usually 16 px */
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --radius: 8px;             /* rounded corners */
  --max-width: 1120px;       /* widest the content column gets on big screens */
  --glow: color-mix(in srgb, var(--light-warm) var(--glow-strength), transparent);   /* the golden glow around a card under the pointer (R75's glow, golden since R78): the theme's warm light at the theme's --glow-strength. Derived, so it follows the theme and needs no change in a re-brand */
  --glow-brand: color-mix(in srgb, var(--brand) 45%, transparent);   /* R75's glow: the brand colour at 45 %, all round a card under the pointer (R78 keeps it as the base and lays the golden glow over three edges) */
  --edge-gold: color-mix(in srgb, var(--light-warm) 80%, var(--brand));   /* the golden end of a card's border under the pointer: the warm light toned a fifth toward the brand colour (R78) */
}

/* THEMES. A theme is one block of colour tokens, picked by the attribute
   data-theme on the <html> tag. The default theme is named by "theme" in
   site.yaml; the sun/moon button in the header switches for the session.
   Every theme sets every colour token; no other rule changes. */
:root[data-theme="dark"] {
  color-scheme: dark;        /* lets the browser draw scrollbars and form controls to match */
  --brand: #7ab8ee;          /* main brand colour: links, buttons, headings accent */
  --brand-dark: #a5d0f5;     /* hover: lighter here, because the background is dark */
  --accent: #16324d;         /* tint for highlighted areas */
  --text: #e6eaf0;           /* body text */
  --muted: #a3adba;          /* secondary text: dates, captions */
  --line: #36404d;           /* borders and table lines */
  --surface: #12171e;        /* page background */
  --surface-alt: #1a212b;    /* alternating table rows, footer */
  --good: #6fd08c;           /* "Active" status */
  --warn: #e5b45a;           /* "Preview" / "NRND" status */
  --logo-ink: #e0dbcc;       /* the colour the logo's letters are left in (R78): the card titles, so that they match the logo. Measured, not derived: read it off the top of a letter in the still picture of the entry on the site (static/landing/<name>-still.webp) after a redraw, and retype it here if it has moved (R79) */
  --light-warm: color-mix(in srgb, var(--warn) 80%, white);   /* the page picture's warm light (and, while it runs, the animation's glow): the city picture's lamps and the glow over the name are both drawn from --warn by the generators in explore/, and this is that light a fifth lighter, as the animation draws its glow. The card's golden glow and the gold end of its ring take it, so the card stands on the same source as the picture without depending on the logo (R78; named for the page in R79) */
  --glow-strength: 40.5%;    /* the golden glow's strength: R75's 45 % less a tenth, soft over the blue (R78) */
  --on-brand: #0b1a2a;       /* text on a brand-coloured button */
  --send: #142a52;           /* the contact form's Send message button (owner, R87): its own dark blue, the same in both themes */
  --on-send: #ffffff;        /* text on it */
  --good-tint: #163524;      /* background of the "Active" badge */
  --warn-tint: #3a2c0c;      /* background of the "Preview" and "NRND" badges */
  --paper: #ffffff;          /* stays white in every theme: backing for drawings made for paper */
  --shadow: 0 1px 3px rgb(0 0 0 / 0.5);    /* soft edge under framed photos */
  --page-image: url("/backgrounds/city.webp");   /* the picture behind every page (section 2); a page may have its own, below */
  --page-image-opacity: 0.25;  /* how strongly it shows: the most at which --muted text keeps 4.5:1 on it */
}

:root[data-theme="light"] {
  color-scheme: light;
  --brand: #0b4f8a;
  --brand-dark: #083a66;     /* hover: darker here, because the background is light */
  --accent: #e8f1fa;
  --text: #1c2430;
  --muted: #5b6675;
  --line: #d9dee5;
  --surface: #ffffff;
  --surface-alt: #f5f7fa;
  --good: #1f7a3d;
  --warn: #855b00;           /* #9a6a00 was 4.21:1 on its badge, text needs 4.5:1 */
  --logo-ink: #0b4f8a;       /* the light theme's logo is drawn in the brand colour (ink_theme: light in the register), so the brand colour's value (R78) */
  --light-warm: var(--brand);   /* no page picture in the light theme, so no warm light: the brand colour stands in, and the glow around a card is the brand colour as it has been since R75 (R78, R79) */
  --glow-strength: 45%;      /* R75's strength */
  --on-brand: #ffffff;
  --send: #142a52;           /* the Send message button, as in the dark theme (owner, R87) */
  --on-send: #ffffff;
  --good-tint: #e3f4e8;
  --warn-tint: #fbf1d9;
  --paper: #ffffff;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.15);
  --page-image: none;          /* no picture in the light theme: the page colour alone */
  --page-image-opacity: 0;
}

/* A page with a picture of its own. base.html puts the page's file name on <body>
   (contact.md: data-page="contact"); a rule here names that page's picture. Only in
   the dark theme: the light theme shows no picture. The opacity stays the theme's,
   unless the rule sets its own; test_style.py measures every picture named here. */
:root[data-theme="dark"] body[data-page="contact"] {
  --page-image: url("/backgrounds/flow.webp");   /* sending a message: light flowing out */
}


/* 2. BASE ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }   /* widths include padding: easier layouts */

/* Keep the scrollbar's space on every page, long or short. Otherwise the scrollbar
   appears on long pages only, the window gets narrower there, and the centred
   header and text move sideways as the visitor goes from page to page. */
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  overflow-wrap: anywhere;   /* a word wider than its box wraps instead of sticking out */
  min-height: 100dvh;        /* body fills the window at least ... */
  display: flex;             /* ... as a column of header, main, footer */
  flex-direction: column;
}
table { overflow-wrap: normal; }   /* table columns keep words whole; a wide table scrolls in its wrapper */
main { flex: 1; width: 100%; }     /* main takes the spare height, so the footer sits at the bottom; width: 100% stops it shrinking to its text */

/* The page picture: one layer behind every page, in place of the plain page colour.
   It is faded over that colour (--page-image-opacity), so no colour of its own is
   needed, and the text keeps its contrast. Each theme names its picture in
   section 1 (--page-image); none means the page colour alone. The picture is
   already blurred in its file, so the browser does no blurring. Header and
   footer keep their own colour and stay solid strips. */
body::before {
  content: "";
  position: fixed;          /* stays in the window while the page scrolls; works on phones too */
  inset: 0;                 /* covers the whole window */
  z-index: -1;              /* behind the page, in front of the page colour */
  background: var(--page-image) center / cover no-repeat;   /* cover: fills the window, cropping the picture's edges */
  opacity: var(--page-image-opacity);
  pointer-events: none;     /* clicks go to the page, never to the picture */
}

[hidden] { display: none !important; }   /* the product filter hides rows with the hidden attribute; no later rule may undo it */

/* Keyboard: a visible ring on the focused element, and a "Skip to content" link */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }  /* read by screen readers, not shown */
.skip-link { position: absolute; left: -9999px; }   /* off-screen until a keyboard user tabs to it */
.skip-link:focus { left: var(--space-2); top: var(--space-1); z-index: 1; padding: var(--space-1) var(--space-2); background: var(--surface); }

h1, h2, h3 { line-height: 1.25; margin: var(--space-3) 0 var(--space-1); }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-2); }
.muted { color: var(--muted); }
.lead { font-size: 1.15rem; color: var(--muted); }


/* 3. IMAGES ----------------------------------------------------------------
   Every image shrinks to fit its column and keeps its proportions.
   build.py adds width/height attributes, so the browser reserves the right
   space before the picture arrives and the text does not jump.

   Authors choose a style in Markdown by adding a class after the image:
     ![What it shows](/img/name.jpg){: .img-wide }    full column width
     ![What it shows](/img/name.jpg){: .img-right }   beside the text
     ![What it shows](/img/name.jpg){: .img-left }
   An image without a class appears at its natural size (up to the column). */
img { max-width: 100%; height: auto; }

.img-wide  { display: block; width: 100%; margin: var(--space-3) 0; border-radius: var(--radius); }
.img-right { float: right; width: 42%; margin: 0 0 var(--space-2) var(--space-3); border-radius: var(--radius); }
.img-left  { float: left;  width: 42%; margin: 0 var(--space-3) var(--space-2) 0; border-radius: var(--radius); }
.img-product { width: 220px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); padding: var(--space-1); }
.img-logo  { height: 40px; width: auto; filter: grayscale(1); opacity: 0.8; }  /* customer/partner logos */
.img-frame { padding: var(--space-1); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }  /* photo frame: write after a position class, {: .img-right .img-frame } */

.prose::after { content: ""; display: block; clear: both; }  /* keep floated images inside their article */


/* 4. HEADER, NAVIGATION, FOOTER ------------------------------------------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding-block: var(--space-1); flex-wrap: wrap; }
.logo svg { display: block; max-width: 100%; height: auto; }   /* a narrow phone header shrinks the logo instead of scrolling sideways */
.logo { min-width: 0; }
/* The animated name beside the mark, on the landing page (R39). The picture of the theme in use
   is shown and blended into the header: in the dark theme it is light on black, and "screen"
   adds the light to what is behind (black adds nothing); in the light theme it is ink on white,
   and "multiply" keeps the ink (white changes nothing). */
.logo-animated { display: flex; align-items: center; gap: 2px; }
.logo-animated img { display: block; max-width: 100%; height: auto; }
.logo-animated picture { min-width: 0; }           /* the name shrinks on a narrow phone */
:root[data-theme="dark"] .logo-name-light, :root[data-theme="light"] .logo-name-dark { display: none; }
:root[data-theme="dark"] .logo-name-dark img { mix-blend-mode: screen; }
:root[data-theme="light"] .logo-name-light img { mix-blend-mode: multiply; }
.logo-lettering { fill: var(--text); }    /* the name as lettering, where site.yaml names no animation (base.html) */
/* Theme button: pinned to the top-right corner of the header, so it stays beside the logo when the menu wraps on a phone */
.header-row { position: relative; padding-right: calc(var(--space-2) + 2.75rem); }   /* room for the button */
.theme-toggle { position: absolute; top: calc(var(--space-1) + 2px); right: var(--space-2); padding: var(--space-1); border: 0; border-radius: var(--radius); background: none; color: var(--text); cursor: pointer; line-height: 0; }
.theme-toggle:hover { color: var(--brand); }
:root[data-theme="dark"] .icon-moon, :root[data-theme="light"] .icon-sun { display: none; }   /* the icon shows the theme a click switches to */
.main-nav { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.main-nav a { text-decoration: none; font-weight: 600; color: var(--text); }
.main-nav a:hover { color: var(--brand); }

.site-footer { margin-top: var(--space-4); background: var(--surface-alt); border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--muted); }
.footer-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); padding-block: var(--space-2); }
.footer-row a + a { margin-left: var(--space-2); }   /* space between neighbouring links */


/* 5. BUTTONS AND BADGES ---------------------------------------------------- */
.actions { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.button {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--on-brand); }
.button-secondary { background: transparent; color: var(--brand); }
.button-secondary:hover { background: var(--accent); color: var(--brand-dark); }
/* The contact form's Send message button (R87, the owner's design): its own dark blue (--send, white text) in
   place of the brand blue; snug around its text instead of the column's width, about two fifths of the "I'm not
   a robot" box above it (at least 120 px: the text and half a rem each side; the box is 300 px), and at the left
   edge of the form. Under the pointer it keeps its blue and takes the brand colour as its edge, as a card takes
   its ring, so the hover adds no colour. */
.button-send { background: var(--send); border-color: var(--send); color: var(--on-send); padding: 0.6rem 0.5rem; min-width: 120px; justify-self: start; }
.button-send:hover { background: var(--send); border-color: var(--brand); color: var(--on-send); }

.badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--accent); color: var(--brand-dark); font-size: 0.85rem; font-weight: 600; vertical-align: middle; text-decoration: none; }  /* no underline: some badges are links */
.badge-active  { background: var(--good-tint); color: var(--good); }
.badge-preview, .badge-nrnd { background: var(--warn-tint); color: var(--warn); }
.badge-obsolete { background: var(--surface-alt); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }  /* thin edge */


/* 6. HOME PAGE ------------------------------------------------------------- */
.hero { padding: var(--space-4) 0 var(--space-3); }
.hero h1 { font-size: 2.4rem; max-width: 20ch; }
.hero-text { max-width: 60ch; font-size: 1.1rem; }
.proof-strip { display: flex; flex-wrap: wrap; gap: var(--space-1); padding: var(--space-2) 0; border-block: 1px solid var(--line); }
/* Company facts: a row of large numbers, each above a small label. */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2); margin: var(--space-3) 0; }
.facts div { display: flex; flex-direction: column-reverse; }   /* shows the number (dd) above its label (dt) */
.facts dt { color: var(--muted); font-size: 0.9rem; }
.facts dd { margin: 0; font-size: 1.6rem; font-weight: 700; color: var(--brand); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-2); }
.card { display: block; padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.card:hover { border-color: var(--brand); }
.card h3 { margin-top: 0; color: var(--logo-ink); }   /* the colour of the logo's letters, bold as before (R78; the brand colour until then) */

/* Landing page (R37 to R39, R75): the introduction, the target applications and the packages. */
.landing-hero { padding: var(--space-3) 0 var(--space-2); }
.landing-hero .hero-text { max-width: none; }   /* the introduction runs the width of the page, as wide as the four cards under it (R75); home.html keeps the 60ch column above */
body[data-page="index"] h2 { font-weight: 400; color: var(--brand); }   /* the landing page's two headings (R78): h2's size but not bold, and in the brand colour, so that they weigh less beside the logo's soft letters and tie to the blue glow at a card's left edge; the card titles under them take the logo's own colour (.card h3); the Contact page's headings take the same look (its own rule below, R84) */
/* A card that is not a link, under the pointer (R75, R78): its border becomes a ring that runs from the brand blue
   at the left edge to a gold toned toward the blue at the right edge, so the top and bottom edges fade from blue to
   gold (the ring is the ::after below, a gradient cut to a 1 px frame by a mask, because a border colour has no
   gradient and border-image would lose the rounded corners); R75's blue glow stands all round, and over the top,
   bottom and right edges lies a soft golden glow in the page's warm light (--light-warm); at the left and right
   edges the glow reaches a fifth further out than at the top and bottom. A
   box shadow has no sides, so five make it: R75's own, unchanged; a second blue one for the left edge, its box shrunk
   0.5rem on every side and pushed 0.7rem left with a fifth more blur, so that it adds reach there and leaves only a
   tail elsewhere; and three golden ones with the same shrunk box, pushed 0.5rem up and down with R75's blur, and
   0.7rem right with the fifth more blur. Measured in R78 (where the glow falls to a quarter of its strength at the
   border): R75's glow 8.0 px on every side; now 8.3 px at the top and bottom, 10.2 px at the left and 9.9 px at
   the right. Section 10 fades all of it in and out */
.card-static:hover {
  border-color: transparent;   /* the ring below shows in its place */
  box-shadow: 0 0 0.75rem var(--glow-brand), -0.7rem 0 0.9rem -0.5rem var(--glow-brand),
              0 -0.5rem 0.75rem -0.5rem var(--glow), 0 0.5rem 0.75rem -0.5rem var(--glow), 0.7rem 0 0.9rem -0.5rem var(--glow);
}
.card-static { position: relative; }   /* holds the ring */
.card-static::after {   /* the ring: a 1 px frame on the border, blue at the left running to gold at the right; hidden until the pointer comes (section 10 fades it) */
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none; opacity: 0;
  background: linear-gradient(to right, var(--brand), var(--edge-gold));
  -webkit-mask: linear-gradient(black 0 0) content-box, linear-gradient(black 0 0); -webkit-mask-composite: xor;   /* keep the frame, cut the middle */
  mask: linear-gradient(black 0 0) content-box, linear-gradient(black 0 0); mask-composite: exclude;
}
.card-static:hover::after { opacity: 1; }

/* Contact page (R84): the offices, each a heading over one of the landing page's cards (card-static, so the ring and
   the glow come under the pointer) with the address on two lines; a photo named in site.yaml stands at the top
   of its office, above the heading (R85).
   Side by side, the photos are equally high and each office is as wide as its photo's shape asks (the owner's
   layout, R89; R85 had cut every photo to one 2:1 frame, and in R88 each kept its shape and a tall photo rose
   above a wide one). The offices stand in one row, and the row's columns come from the page: contact.html writes
   every photo's shape, its width divided by its height as the build measured it, into --columns on the row
   (1.5fr 0.54fr for a 3:2 photo beside a tall one). A photo fills its column, so the height of every photo is the
   row's width, less the gaps, divided by the sum of the shapes: the same for all. Because a photo's room is
   exactly its shape, the corners are rounded like the cards' again.
   An office is two parts, its top (the photo and the heading, .office-top in contact.html) and its card, and the
   offices share the rows of the row's grid ("subgrid", R88): a row of tops, each standing on the row's bottom
   edge, and a row of cards. So the headings are level, the cards start on one line and are equally high, and an
   office without a photo has its heading level with the others. In a narrow window the offices stand one under
   the other, each with rows of its own (section 9). */
body[data-page="contact"] h1, body[data-page="contact"] h2 { font-weight: 400; color: var(--brand); }   /* the page's heading and the office headings as the landing page's headings above: in the brand colour, not bold, at their own size */
.offices { display: grid; grid-template-columns: var(--columns); gap: var(--space-2) var(--space-4); }   /* --columns: the photos' shapes as shares of the row, written by contact.html; the wider gap is between offices side by side, the other between offices one under the other */
.office {
  display: grid;
  grid-row: span 2;               /* an office takes two rows of the offices' grid: one for its top, one for its card */
  grid-template-rows: auto 1fr;   /* for an older browser (Chrome and Edge before 117, of September 2023), which does not know the next line and keeps this one: rows of the office's own, the card's taking the spare height; with photos equally high, the tops and the cards are level there too */
  grid-template-rows: subgrid;    /* the two rows are the offices' grid's own, shared with the office beside it */
  row-gap: 0;                     /* no gap between an office's top and its card: the grid's row gap is for offices one under the other */
}
.office-top { align-self: end; }  /* the top stands on the bottom edge of its row */
.office .img-wide { margin: var(--space-3) 0 var(--space-1); }   /* the photo starts its office as high as a heading would (the heading's own top margin) and has the heading close under it. It fills its column (img-wide), and its height follows from its own shape: the build writes each photo's size into its tag, so the room is kept before the photo arrives */
.office .img-wide + h2 { margin-top: 0; }           /* the heading sits as close under its photo as the card sits under the heading */
.office address { font-style: normal; }             /* browsers slant an address by default; the page's text is upright */

.news-list { list-style: none; padding: 0; }
.news-list li { padding: var(--space-1) 0; border-bottom: 1px solid var(--line); }
.news-list time, .news-item time { color: var(--muted); font-size: 0.9rem; margin-right: var(--space-2); }
.news-item { border-bottom: 1px solid var(--line); padding-bottom: var(--space-2); }


/* 7. PRODUCT PAGES AND TABLES ---------------------------------------------- */
.breadcrumbs { margin-top: var(--space-2); font-size: 0.9rem; color: var(--muted); }
.product-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); flex-wrap: wrap; }

.table-scroll { overflow-x: auto; }       /* wide tables scroll sideways on phones */
.spec-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.spec-table th, .spec-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.spec-table thead th { background: var(--surface-alt); border-bottom: 2px solid var(--line); }
.spec-table tbody tr:nth-child(even) { background: var(--surface-alt); }
.spec-table th[scope="row"] { width: 40%; font-weight: 600; }
/* Sortable headings: the button looks like plain heading text */
.spec-table th button { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
/* \00A0 is a space that keeps the arrow beside the last word. The / "" gives the arrow an empty text
   alternative: screen readers skip it, because aria-sort already tells them the order. */
.spec-table th button::after { content: "\00A0\21C5" / ""; color: var(--muted); }                      /* faint double arrow: this column sorts */
.spec-table th[aria-sort="ascending"] button::after  { content: "\00A0\25B2" / ""; color: inherit; }   /* sorted upwards */
.spec-table th[aria-sort="descending"] button::after { content: "\00A0\25BC" / ""; color: inherit; }   /* sorted downwards */
.prose table { display: block; width: fit-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; }  /* a Markdown table has no wrapper, so it scrolls inside itself on phones */
.prose th, .prose td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; }


/* 8. FORMS ------------------------------------------------------------------ */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-2); margin: var(--space-2) 0; }
.filters label, .contact-form label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 600; font-size: 0.9rem; justify-content: space-between; }  /* a label on two lines does not push its field out of line */
.filters input, .filters select { height: 2.75rem; }   /* text fields as tall as drop-downs */
input, select, textarea { font: inherit; padding: 0.5rem; border: 1px solid var(--muted); border-radius: 6px; background: var(--surface); color: var(--text); }  /* --muted edge: a field's edge needs 3:1 to be seen */
::placeholder { color: var(--muted); opacity: 1; }   /* hint text in an empty field, readable in both themes */
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.contact-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); max-width: 520px; margin: var(--space-3) 0; }   /* one column that never grows past the page: without the minmax(0, ...) the "I'm not a robot" box, 304 px that Google fixes, would widen the column and every field with it on a 320 px phone (R84) */
.honeypot { position: absolute; left: -9999px; }
/* What the contact form answers (R90; static/js/contact.js decides, templates/contact.html holds the words): the
   Send button and, beside it, one line of text, which wraps under the button on a narrow phone. Once the message
   is sent the form has the class "sent": its fields can be read but not changed, and show it with the cards' calm
   edge and the secondary text colour; the button, now reading "Submitted", no longer answers the pointer. */
.form-send { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.form-note { margin: 0; }
.contact-form.sent input, .contact-form.sent textarea { border-color: var(--line); color: var(--muted); }
.button-send:disabled, .button-send:disabled:hover { border-color: var(--send); cursor: default; }
/* The "I'm not a robot" box in the dark theme (R87): Google draws its dark box, 300 x 74 px inside a 1 px grey
   border with rounded corners, at the top left of a 304 x 78 px frame whose own background is white, so from R84
   to R86 a 2 px white strip showed along the box's right and bottom edges and white showed at its corners. A cut
   at the border's outer edge was not enough: on a scaled display (Windows at 125 or 150 %) that edge falls
   between device pixels, and a sliver of the white frame still showed at the right and bottom while the top and
   left kept Google's grey. So the container shows only the box's inside, and draws the edge itself, 1 px in the
   cards' line colour, the same on all four sides at any scale: it is cut to 298 x 72 px, 1 px inside Google's
   box on every side, and Google's frame is moved 2 px up and left, so that the box's dark inside reaches 1 px
   past the cut all round. That slack is needed: with the cut exactly at the inside's edge, the browser snapped
   the frame and the cut to different device pixels at 125 and 150 %, and Google's border or the white frame
   showed in a one-pixel line at the right and bottom (measured in R87 at scales 1, 1.25, 1.5 and 2). The cut
   follows the theme the page's script gave the box when Google drew it (data-theme on this element), not a theme
   switched later, and without the script nothing here applies. The light box needs none of it: its frame is white
   on a white page. */
.g-recaptcha[data-theme="dark"] { width: 300px; height: 74px; overflow: hidden; border: 1px solid var(--line); border-radius: 3px; }   /* 300 x 74 outside the edge: 298 x 72 inside, 1 px inside the box's own inside */
.g-recaptcha[data-theme="dark"] > div { margin: -2px 0 0 -2px; }   /* Google's frame moved 2 px up and left: its border and white margin lie beyond the cut on every side */


/* 9. SMALL SCREENS -----------------------------------------------------------
   Rules inside this block apply only when the window is 640 px wide or less
   (most phones): floated images stack, headings shrink. */
@media (max-width: 640px) {
  h1, .hero h1 { font-size: 1.7rem; }
  .img-right, .img-left { float: none; width: 100%; margin: var(--space-2) 0; }
  .main-nav { gap: var(--space-2); }
  .header-row { padding-right: var(--space-2); }   /* the menu wraps below the logo, so only the logo line needs room for the theme button */
  .logo { max-width: calc(100% - 2.75rem); }      /* the logo line leaves room for the theme button (R40: the 24 px name is wider) */
}
/* The offices on the Contact page (R89). Side by side, the office with the tall photo has a narrow column, about a
   quarter of the row, and its card needs 263 px to keep the street line of its address on one line (measured:
   229 px of text and the card's padding and border), which the column has from a window of about 1080 px up. So
   in a window of 1100 px or less the offices stand one under the other, each as wide as the page, and every
   address stays on its two lines. A photo then fills that width, but is never higher than 70 % of the window, so
   that a tall photo does not run the page (the owner's rule): its width is the smaller of the column's width and
   the width that height gives it, 70vh times its shape (--shape, written on the office's top by contact.html).
   The width is worked out here and not left to the browser, so the photo's room is kept before the photo
   arrives. */
@media (max-width: 1100px) {
  .offices { grid-template-columns: 1fr; }
  .office .img-wide { width: min(100%, calc(70vh * var(--shape, 1))); }
}
/* The "I'm not a robot" box on the Contact page is 304 px wide, a size Google fixes. Below 352 px the form's
   column is narrower than that (16 px of gutter each side, and up to 15 px kept for a scrollbar), so there the
   box is drawn at 0.88 of its size from its top-left corner: 268 px, which fits the 273 px left at 320 px. A
   scaled box reaches only as far as its scaled width, so the page does not scroll sideways (R84). */
@media (max-width: 352px) {
  .g-recaptcha { transform: scale(0.88); transform-origin: 0 0; }
}


/* 10. MOTION -----------------------------------------------------------------
   The site's only transitions. They run only for visitors who have not asked
   their device for less motion. Every future transition or animation goes here.
   The one exception is the landing page's animation, a picture: its <picture>
   element offers it only to the same visitors (templates/base.html, since R39). */
@media (prefers-reduced-motion: no-preference) {
  a, .button, .card { transition: color 0.15s, background-color 0.15s, border-color 0.15s; }
  .card-static { transition: border-color 0.3s, box-shadow 0.3s; }   /* the landing cards' glow fades in under the pointer and out when it leaves (R75) */
  .card-static::after { transition: opacity 0.3s; }                  /* and the blue-to-gold ring with it (R78) */
  /* The landing page's reveal (R76): the introduction, the two headings and the cards fade in and rise a little,
     one after the other from the top down and from left to right, starting as the light turns on at the name's left edge
     and ending about when the name has formed (the header's picture runs 2.8 s since logo-*-v9). Each element's
     turn is its --step, numbered in templates/landing.html: the introduction at 0.1 s, then 0.15 s more for each
     step, each fade taking 0.6 s; the last card is in place by about 1.9 s. The Contact page takes the same rule
     (R86, templates/contact.html): its heading at step 0, each office at its own step, and the form at the fifth
     step after the last office, so it starts 0.15 s after the offices are in place (with two offices at 1.15 s,
     in place by 1.75 s). Visitors who ask for less motion see
     the page complete at once: this block does not apply to them, and nothing outside it hides anything. */
  .reveal { animation: reveal 0.6s ease-out both; animation-delay: calc(0.1s + var(--step, 0) * 0.15s); }
  @keyframes reveal { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }
}
