/* Oberdoerfer & Krebs — shop pages (shop/<name>.html), the Shop overview (shop.html) and
   the Terms page (terms.html), 17 Oct 2026. Loaded AFTER style.css, which gives the font,
   ground, ink, links, the invisible 12-column grid (--margin, --width, --cols), the header
   (logo, studio name and the hairline under them, as on the landing page; the content
   starts --rule-header-below under the line) and the bottom navigation bar with its
   Contact box. Shared with workshop/tune-product.html, so the page and its tuning copy
   cannot drift apart. Every adjustable value is in :root below. */

:root {
  --p-photo-span: 6;          /* the main photo's width in columns of 12; the text starts one
                                 empty column after it (phones: photo full width, text below) */

  /* Product pages (shop/<name>.html; Bruno's rules, 18 Oct 2026; STARTING VALUES for Bruno to
     tune): at most three text sizes (large: the name; base: everything else; small: the VAT
     line only); hierarchy otherwise through grey and weight; spaces from one ruler (8/16/32);
     spaces inside a group always smaller than between groups */
  --p-large: 24px;            /* the name: one step up from base on a 1.333 scale */
  --p-base: 18px;             /* everything else */
  --p-small: 14px;            /* the legal VAT line only */
  --p-name-leading: 1.25;     /* the name's line height (its first line's top is trimmed to the
                                 capitals, so it lines up with the photo's top) */
  --p-grey: var(--site-grey); /* secondary lines: the site grey (style.css), #6B6B6B */
  --p-space-in: 8px;          /* between the lines of a group */
  --p-space-between: 32px;    /* between groups (and, on phones, from the photo to the text) */
  --p-measure: 65;            /* the WHOLE text column's width, in characters of the short text at base size
                                 (comfortable: 45–90); everything in the column shares its edges */
  --p-gutter: 32px;           /* the least space between the photo and the text column (option B: exactly this) */
  --p-char: 0.4537em;         /* Inter's average character width in this running text (measured 18 Oct 2026 on the Bend Stool text); turns --p-measure into a width */

  /* Terms page and the Shop overview's captions (unchanged; product pages use the values above) */
  --p-name-size: 40px;        /* the Terms page's title (32px on phones) */
  --p-body-size: 16px;        /* the Terms text */
  --p-details-size: 13px;     /* the Shop overview's captions */
  --p-block-space: 24px;      /* between the Terms page's blocks */
  --p-photo-fit: 150;         /* (Bruno, 18 Oct 2026: large photos, even taller than the window; was 100)
                                 the main photo's greatest height, in % of the room between the
                                 header and the bottom bar (100: it just fits in the window;
                                 not on phones) */
  --p-photo-below: 83px;      /* kept free under the photo: the bar (35px), its 16px from the
                                 window edge and 32px (the margin) above it */

  /* About page (about.html, 18 Oct 2026; Claude's proposal, to be judged): the product pages'
     typographic system (sizes, grey, spaces, line length) */
  --a-col: 7;                 /* the column (of 12) where the text column starts: the right half,
                                 where the product pages' text sits (computers only) */
  --a-photo-span: 6;          /* the photo of Bruno and Jasper: columns of 12 it takes from the left
                                 (computers), less one gutter (--p-gutter) before the text */
  --a-photo-fit: var(--p-photo-fit);   /* its greatest height, in % of the room between the header
                                 and the bar, as the product photos (150; computers) */
  --a-measure: var(--p-measure);   /* the text column's width in characters (65, as the product pages) */
  --a-paragraph-space: 16px;  /* between the studio text's paragraphs (from the 8/16/32 ruler) */

  /* Work pages (works/<name>.html, 18 Oct 2026; since 4 Nov 2026, Bruno's brief): computers: the text in
     the left third, sticky; the images in the right two-thirds by THE IMAGE RULE (see below);
     phones and tablets: one column */
  --w-measure: var(--p-measure);   /* phones and tablets: the text at most this many characters wide (65) */
  --w-paragraph-space: 16px;  /* between the text's paragraphs */
  --w-section-space: 32px;    /* between the text and the facts */
  --w-img-gap: 16px;          /* between images side by side */
  --w-row-gap: 16px;          /* between rows of images (phones and tablets: between the images) */
}

/* ---- The product: photo left, text in tight blocks right ------------------------------ */
.p-main {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  align-items: start;
  padding-bottom: var(--page-bottom);
}
.p-photo { grid-column: 1 / span var(--p-photo-span); margin: 0; }
/* Whole, never cropped, proportions kept: as wide as its columns, but never taller than
   the window's room below the header (the top margin, the name's cap height, the header
   line and the spaces around it, as in style.css) and above the bar; at least 160px */
.p-photo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: max(160px, (100svh - var(--head-h) - var(--p-photo-below)) * var(--p-photo-fit) / 100);
}
.p-info {
  grid-column: calc(var(--p-photo-span) + 2) / -1;
  min-width: 0;
  font-size: var(--p-body-size);
  line-height: 1.3;
}
.p-info > :not(:first-child) { margin-top: var(--p-block-space); }
.p-info p, .p-info dl, .p-info dd { margin: 0; }
.p-small { font-size: var(--p-details-size); line-height: 1.35; }
.p-name {
  font-size: var(--p-name-size);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  text-box: trim-both cap alphabetic;   /* the block's top is the capitals' top: lines up with the photo's top */
}
.p-info a.u { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

/* ---- Product pages: four groups (Piece, Offer, Text, More), 18 Oct 2026 ---------------
   Spaces are between line boxes: --p-space-in inside a group, --p-space-between between
   groups. Three sizes only: --p-large, --p-base, --p-small. */
[data-product] .p-info { font-size: var(--p-base); line-height: 1.4; }
[data-product] .p-info > :not(:first-child) { margin-top: var(--p-space-between); }
.p-info .p-group > * + * { margin-top: var(--p-space-in); }   /* (".p-info" so it outranks ".p-info p { margin: 0 }") */
[data-product] .p-name {
  font-size: var(--p-large);
  line-height: var(--p-name-leading);
  text-box: trim-start cap alphabetic;   /* top on the capitals' top (lines up with the photo); the bottom keeps its line spacing */
}
.p-grey { color: rgb(var(--p-grey) var(--p-grey) var(--p-grey)); }
.p-small { font-size: var(--p-small); line-height: 1.4; }
.p-price { font-weight: 400; }   /* regular (Bruno, 18 Oct 2026): only the name is bold */

/* Size choice (18 Oct 2026; shop/upside-down.html; Claude's design, to be judged): quiet,
   not a webshop control. Three plain letters "S M L" in a row at base size, the chosen one
   ink, the others the site grey; no boxes or pills; 16 px between the letters (from the
   ruler). A real radio group: the buttons themselves are invisible but focusable (arrow
   keys move the choice; screen readers hear "Size, Small, radio button, 1 of 3"); each
   letter's click area is 8 px wider on both sides than the letter. Directly above the price. */
.p-sizes { margin: 0; padding: 0; border: 0; min-inline-size: 0; }
.p-sizes:not([hidden]) { display: flex; }
.p-sizes label { position: relative; padding: 0 8px; cursor: pointer; color: rgb(var(--p-grey) var(--p-grey) var(--p-grey)); }
.p-sizes label:first-of-type { margin-left: -8px; }   /* the S on the column's left edge */
.p-sizes input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.p-sizes input:checked + span { color: var(--ink); }
.p-sizes label:hover span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.p-sizes input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.p-size-list { margin: 0; padding: 0; list-style: none; }
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* One width for the whole text column (Bruno, 18 Oct 2026): --p-measure characters of the
   short text at base size. Computers (880 px and wider): photo left, as wide as it fits
   (see .p-photo img above, at most --p-photo-span columns); the text column in the rest:
   option B (the site's, Bruno 18 Oct 2026) one gutter (--p-gutter) after the photo; option A
   (workshop/tune-product.html, html data-text-position="a") right-aligned, its right edge
   on the header's right edge (the end of the hairline), at least --p-gutter from the photo. */
[data-product].p-main { grid-template-columns: max-content minmax(0, 1fr); }
[data-product] .p-photo { grid-column: 1; }
[data-product] .p-photo img { max-width: calc(var(--width) * var(--p-photo-span) / 12); }
[data-product] .p-info {
  grid-column: 2;
  justify-self: start;
  margin-left: var(--p-gutter);
  width: min(calc(var(--p-measure) * var(--p-char)), 100% - var(--p-gutter));
}
html[data-text-position="a"] [data-product] .p-info { justify-self: end; margin-left: 0; }

/* Tablets (701–879 px): beside the photo the column would fall under about 45 characters,
   so the text goes under the photo; photo and text column share the column's width and
   left edge (the photo still fits the window's height) */
@media (min-width: 701px) and (max-width: 879px) {
  [data-product].p-main { grid-template-columns: minmax(0, 1fr); }
  [data-product] .p-photo { font-size: var(--p-base); }   /* so --p-char (in em) means the same here as in the text */
  [data-product] .p-photo img { max-width: min(100%, var(--p-measure) * var(--p-char)); }
  html [data-product] .p-info,
  html[data-text-position="a"] [data-product] .p-info {
    grid-column: 1;
    justify-self: start;
    width: min(calc(var(--p-measure) * var(--p-char)), 100%);
    margin: var(--p-space-between) 0 0;
  }
}
[data-product] .fold-body > * + * { margin-top: var(--p-space-in); }
.p-info .p-group > .folds + * { margin-top: var(--fold-space); }   /* a line after fold-outs: as far from the last hairline as the fold-out headings are from theirs (fold-outs not used on Bend Stool since 18 Oct 2026; kept for later) */

/* Enquire (Bruno, 18 Oct 2026, tuned at 1920 px): SOLID, an ink bar with ground-coloured
   text, 14 px 500, the text column's width. Two other styles for comparison on
   workshop/tune-product.html (html data-enquire): "outline" (a 1 px outline in the text
   colour, base size, padding 8 / 16 px including the line) and "link" (plain text with an
   arrow, like "Shipping & terms →"). */
.p-enquire {
  display: block;
  padding: 13px 16px 14px;
  background: var(--ink);
  color: var(--ground);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
}
.p-enquire:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
html[data-enquire="outline"] .p-enquire,
html[data-enquire="link"] .p-enquire {
  padding: 7px 15px;
  border: 1px solid var(--ink);
  background: none;
  color: var(--ink);
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}
html[data-enquire="link"] .p-enquire { display: inline-block; padding: 0; border: 0; text-align: left; }
html[data-enquire="link"] .p-enquire::after { content: " →"; }

/* ---- Terms page: the same text column, blocks of a heading and its text --------------- */
.t-block h2 { margin: 0; font: inherit; font-weight: 600; }
.t-block p { margin: 0; }

/* ---- About page (about.html, 18 Oct 2026) ----------------------------------------------
   The 12-column grid; the text column from column --a-col (7) to the right, --a-measure
   characters wide (but never wider than the room), left-aligned in its columns. In it: the
   studio text (base size, ink; paragraphs --a-paragraph-space apart, the first capitals'
   top trimmed so it lines up like the product pages' name), then, --p-space-between below,
   the fold-outs (the shared component: hairlines, plus/minus, grey content, ink links;
   lines --p-space-in apart). The photo of Bruno and Jasper (.a-photo, 18 Oct 2026) takes
   columns 1 to --a-photo-span (6) less one gutter (--p-gutter, 32px, the pause before the
   text, as on the product pages), whole, never cropped, never taller than --a-photo-fit of
   the room below the header; its top on the text's first capitals. Tablets (701–879 px)
   and phones: the photo above the text, the full width; the text the full width, capped
   at --a-measure. */
.a-main {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  align-items: start;
  padding-bottom: var(--page-bottom);
}
.a-photo { grid-column: 1 / span var(--a-photo-span); grid-row: 1; margin: 0; padding-right: var(--p-gutter); }
.a-photo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: max(160px, (100svh - var(--head-h) - var(--p-photo-below)) * var(--a-photo-fit) / 100);
}
.a-text {
  grid-column: var(--a-col) / -1;
  grid-row: 1;
  width: min(calc(var(--a-measure) * var(--p-char)), 100%);
  font-size: var(--p-base);
  line-height: 1.4;
}
.a-text p { margin: 0; }
.a-text > * + * { margin-top: var(--p-space-between); }
.a-story { text-box: trim-start cap alphabetic; }   /* the first capitals' top on the content's top */
.a-story > p + p { margin-top: var(--a-paragraph-space); }
.a-text .fold-body > * + * { margin-top: var(--p-space-in); }
@media (max-width: 879px) {
  .a-photo, .a-text { grid-column: 1 / -1; grid-row: auto; }
  .a-photo { padding-right: 0; }
  .a-photo + .a-text { margin-top: var(--p-space-between); }
  .a-photo img { width: 100%; max-width: 100%; max-height: none; }   /* above the text, the full width (Bruno, 18 Oct 2026) */
}
@media (max-width: 700px) {
  .a-text { width: auto; }
}

/* ---- Work pages (works/<name>.html, 18 Oct 2026; sticky text and image rows since 4 Nov 2026)
   COMPUTERS (880 px and wider; MIRRORED by Bruno, 4 Nov 2026: images left, text right, so the
   fixed logo at the top left passes over the images and never over the text): THE TEXT (.w-text)
   in the RIGHT THIRD (4 of 12 columns, less one gutter, --p-gutter, after the images, to the right
   page margin), STICKY until the images end: if it fits the window it
   holds where it starts (top: the header's height); if it is taller, work.js lowers that top so
   it first scrolls up until its last line ends --p-photo-below above the window's bottom (the
   bar and 32 px of air), then holds. In it: the name (large, its capitals' top on the images' top),
   the grey lines 8px apart, 32px down the text (paragraphs --w-paragraph-space apart),
   --w-section-space down the facts (grey), 32px down "Available in the shop →".
   THE IMAGES (.w-images) in the LEFT TWO-THIRDS (8 columns, from the left page margin), scrolling
   with the page, by THE IMAGE RULE (the template for every work page): the first row is the
   finished piece (.w-first) and a detail of it, side by side; after that portrait images in
   pairs side by side (each half the width, --w-img-gap apart), landscape images the full width
   (.w-full); an image left alone in a row takes the left half; an image may run taller than the
   window; never cropped; no captions, no click action; rows --w-row-gap apart.
   PHONES AND TABLETS (879 px and below): one column: the finished piece, the text, then the
   other images, each the full width, --w-row-gap apart (the text 32 px from the images above
   and below it, at most --w-measure characters wide). */
.w-main {
  --w-head: var(--head-h);   /* the header's height: where the content starts (style.css) */
  display: grid;
  grid-template-columns: minmax(0, 1fr) calc(var(--width) * 4 / 12 - var(--p-gutter));   /* images (8 columns), text (4 less the gutter) */
  column-gap: var(--p-gutter);
  align-items: start;
  padding-bottom: var(--page-bottom);
}
.w-text {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: var(--w-head);
  min-width: 0;
  font-size: var(--p-base);
  line-height: 1.4;
}
.w-text p, .w-head h1 { margin: 0; }
.w-head { text-box: trim-start cap alphabetic; }   /* the name's capitals on the images' top */
.w-name { font-size: var(--p-large); font-weight: 600; letter-spacing: -0.035em; line-height: var(--p-name-leading); }
.w-head > * + * { margin-top: var(--p-space-in); }
.w-grey, .w-facts { color: rgb(var(--p-grey) var(--p-grey) var(--p-grey)); }
.w-story { margin-top: var(--p-space-between); }
.w-story > p + p { margin-top: var(--w-paragraph-space); }
.w-facts { margin-top: var(--w-section-space); }
.w-facts > * + * { margin-top: var(--p-space-in); }
.w-facts > .w-link { margin-top: var(--p-space-between); color: var(--ink); }
.w-images {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--w-img-gap);
  row-gap: var(--w-row-gap);
  align-items: start;
}
.w-img { margin: 0; }
.w-img.w-full { grid-column: 1 / -1; }
.w-img.w-cols-4 { grid-column: 1 / -1; width: calc(var(--width) * 4 / 12); }   /* 4 of the 12 page columns, left (Bruno, 5 Nov 2026: Human Layers' tall tests photo) */
.w-img img { display: block; width: 100%; height: auto; }
/* A tall drawing in a full-width row, at HALF its own height (Bruno, 19 Nov 2026: Stroke's toolpath
   drawing, 650 x 1040): the row keeps the full width, it is half as high, and the drawing (on a
   transparent ground) is scaled down to fit and centred in it. The ratio is the row's width / height:
   650 / 1040 * 2 = 1.25. Computers only: one column on phones and tablets, as before. */
.w-img.w-half-height img { aspect-ratio: 1.25; object-fit: contain; }

@media (max-width: 879px) {
  .w-main { display: flex; flex-direction: column; align-items: stretch; gap: var(--w-row-gap); }   /* stretch: every image the full width (an SVG has no width of its own) */
  .w-images { display: contents; }           /* its images join the one column, so the text can stand after the first */
  .w-first { order: 1; }
  .w-text { order: 2; position: static; margin: calc(32px - var(--w-row-gap)) 0; width: min(calc(var(--w-measure) * var(--p-char)), 100%); }
  .w-img:not(.w-first) { order: 3; }
  .w-img.w-cols-4 { width: auto; }           /* full width like the others */
  .w-img.w-half-height img { aspect-ratio: auto; }   /* its own height again, in the one column */
}
@media (max-width: 700px) {
  .w-text { width: auto; }
}

/* ---- Shop overview (shop.html): the landing page's grid, photos instead of drawings ----
   Tile width and spacing are the landing page's own values (style.css: --tile-span,
   --tile-gap; rows 3 times apart). Each tile: the photo whole in a frame with its
   proportions; a second photo, if the piece has one, crossfades in under the mouse or
   keyboard focus (--fade, as on the landing page); under it the name and the price. */
.s-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--tile-gap);
  row-gap: calc(var(--tile-gap) * 3);
  align-items: start;
  padding-bottom: var(--page-bottom);
}
.s-tile { display: block; grid-column: span var(--tile-span); }
.s-tile:hover { text-decoration: none; }
.s-frame { position: relative; }
.s-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }   /* whole, never cropped */
.s-frame .s-photo2 { position: absolute; inset: 0; opacity: 0; transition: opacity var(--fade) linear; }
@media (hover: hover) {
  .s-tile:hover .s-photo2, .s-tile:focus-visible .s-photo2 { opacity: 1; }
}
.s-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1em;
  margin-top: 12px;
  font-size: var(--p-details-size);
  line-height: 1.35;
}
.s-tile:hover .s-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
@media (prefers-reduced-motion: reduce) {
  .s-frame .s-photo2 { transition: none; }
}

/* ---- Phones -------------------------------------------------------------------------- */
@media (max-width: 700px) {
  :root {
    --p-name-size: 32px;
  }
  .p-photo, .p-info { grid-column: 1 / -1; }
  .p-photo img { width: 100%; max-height: none; }   /* phones: full width, as before */
  .p-photo + .p-info { margin-top: var(--p-space-between); }   /* under the photo (product pages); the Terms page has none */
  /* Product pages on phones: unchanged, photo then text, both the full width (options A/B do not apply) */
  [data-product].p-main { grid-template-columns: minmax(0, 1fr); }
  [data-product] .p-photo img { max-width: 100%; }
  html [data-product] .p-info,
  html[data-text-position="a"] [data-product] .p-info { grid-column: 1; justify-self: stretch; width: auto; margin-left: 0; }
  .s-tile { grid-column: 1 / -1; }
}
