/*
 * HJS Catchall Tray Designer - storefront styling.
 *
 * v0.2.4 - THE DARK WORKSHOP THEME. Up to v0.2.3 this file was deliberately theme-agnostic and
 * light: white panels, hairline grey borders, and the merchant's own theme showing through. It is
 * now a self-contained dark theme - near-black panels, warm brown/wood-tone borders and one amber
 * accent - because the designer is a workbench, not a form, and a tray rendered on a white card
 * reads as an admin screen rather than a product being made. The palette is the one already in
 * use on hjsolutions.com's own tray designer, so the two look like the same tool.
 *
 * TWO THINGS ABOUT THAT CHANGE, SAID PLAINLY BECAUSE BOTH ARE DELIBERATE:
 *
 *   1. Everything is still scoped under .hjs-ctd. Nothing outside the designer's own wrapper is
 *      touched - the page heading, the breadcrumb, the theme's header and footer all stay exactly
 *      as the merchant's theme draws them, so this drops into any theme as a dark panel on that
 *      theme's page rather than fighting it.
 *   2. It now DOES restyle core Bootstrap classes (.btn, .alert) - but only INSIDE .hjs-ctd. That
 *      is a change of stance from v0.2.3's "nothing here restyles a core element", made on purpose:
 *      a default white Bootstrap button sitting on a near-black panel is the one thing that would
 *      give the theme away as bolted on. A merchant who prefers their own buttons can delete the
 *      "theme's own buttons" block near the bottom of this file and lose nothing else.
 *
 * The colours live in the custom properties on .hjs-ctd below. A merchant who wants a different
 * timber only has to change those - every rule in this file reads them rather than repeating a
 * hex code, with the single documented exception of the artwork thumbnails (see there).
 *
 * The engraving fonts are Google Fonts. A shop that must not make third-party requests can
 * delete this @import - the three system fonts at the top of the font list still work, and the
 * rest fall back to the browser's default rather than breaking.
 */
@import url('https://fonts.googleapis.com/css2?family=Berkshire+Swash&family=Cinzel+Decorative:wght@400;700&family=Cormorant+Garamond:wght@500&family=Dancing+Script:wght@500;700&family=Great+Vibes&family=IM+Fell+English+SC&family=Lobster&family=MedievalSharp&family=Pacifico&family=Pirata+One&family=Playfair+Display:wght@600&family=Rye&family=Tangerine:wght@400;700&family=UnifrakturCook:wght@700&family=Yeseva+One&display=swap');

/* --------------------------------------------------------------------------------------------
   THE PALETTE. Read from hjsolutions.com's own tray designer so the two are the same tool, not
   two tools that happen to both be dark.

     --hjs-ctd-accent      the amber. Unchanged from v0.2.3 - it already was the site's amber.
     --hjs-ctd-bg          panel face. The near-black everything sits on.
     --hjs-ctd-bg-sunk     a shade below the panel, for things set INTO it: the canvas, the
                           artwork gallery well, the pocket editor. Depth, not decoration.
     --hjs-ctd-bg-raised   a shade above the panel, for things that sit ON it: layout buttons,
                           shape buttons, fields. What you can press or type in.
     --hjs-ctd-line        the wood tone. Warm brown, and it is the borders alone that make this
                           read as timber - there is no texture image anywhere in this product,
                           and the site's own designer does not use one either.
     --hjs-ctd-line-soft   the same idea, quieter, for internal rules that should not compete.
     --hjs-ctd-text        white. --hjs-ctd-muted, the grey for everything secondary.

   color-scheme: dark is doing real work, not tidying: it tells the browser to draw the parts of
   a <select> popup, a scrollbar and a focus ring that CSS cannot reach in their dark forms. Set
   it and a native dropdown opens dark; omit it and it opens as a white sheet over a black panel.
-------------------------------------------------------------------------------------------- */
.hjs-ctd {
  --hjs-ctd-accent: #e2a144;
  --hjs-ctd-bg: #0c0c0c;
  --hjs-ctd-bg-sunk: #090909;
  --hjs-ctd-bg-raised: #141414;
  --hjs-ctd-line: #5b4127;
  --hjs-ctd-line-soft: #3f3428;
  --hjs-ctd-text: #fff;
  --hjs-ctd-muted: #c6c6c6;
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--hjs-ctd-line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(14, 14, 14, .97), rgba(8, 8, 8, .97));
  color: var(--hjs-ctd-text);
  color-scheme: dark;
  accent-color: var(--hjs-ctd-accent);
}
.hjs-ctd h1, .hjs-ctd h2, .hjs-ctd h3, .hjs-ctd strong, .hjs-ctd dt { color: var(--hjs-ctd-text); }

/* The page heading and intro are the THEME's, outside .hjs-ctd, and are left alone on purpose. */
.hjs-ctd-intro { max-width: 70ch; }

.hjs-ctd-layouts { margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--hjs-ctd-line-soft); border-radius: 6px; background: var(--hjs-ctd-bg); }
.hjs-ctd-layouts-head h2 { font-size: 1.36rem; margin: 0 0 2px; }
.hjs-ctd-layouts-head p { margin: 0 0 12px; font-size: 1.0rem; color: var(--hjs-ctd-muted); }
.hjs-ctd-layout-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.hjs-ctd-layout { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border: 1px solid var(--hjs-ctd-line-soft); border-radius: 5px; background: var(--hjs-ctd-bg-raised); color: var(--hjs-ctd-text); text-align: left; cursor: pointer; }
.hjs-ctd-layout:hover { border-color: var(--hjs-ctd-accent); }
.hjs-ctd-layout strong { font-size: 1.0rem; }
.hjs-ctd-layout small { font-size: 0.83rem; color: var(--hjs-ctd-muted); }

/* v0.2.2. A merchant's own picture for a layout, when they have set one. object-fit keeps their
   photograph its own shape inside a fixed box, so five images of five different proportions still
   make a tidy row - and a merchant who sets none gets exactly the button they had before. */
.hjs-ctd-layout-image { display: block; width: 100%; height: 76px; object-fit: cover; border-radius: 4px; margin-bottom: 6px; }

/* v0.2.15. The drawn starter-layout plan, used when the merchant set no picture: same box as a picture. */
.hjs-ctd-layout-thumb { display: block; width: 100%; height: 76px; margin-bottom: 6px; }

.hjs-ctd-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.hjs-ctd-controls { grid-column: 1; grid-row: 1; }
.hjs-ctd-summary { grid-column: 1; grid-row: 2; position: static; }
.hjs-ctd-canvas-panel { grid-column: 2; grid-row: 1 / 3; position: sticky; top: 16px; }
.hjs-ctd-panel { padding: 14px; border: 1px solid var(--hjs-ctd-line); border-radius: 6px; background: var(--hjs-ctd-bg); }
.hjs-ctd-panel-title, .hjs-ctd-section { display: flex; align-items: center; gap: 8px; font-size: 1.18rem; margin: 0 0 10px; }
.hjs-ctd-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--hjs-ctd-line-soft); }
/* Near-black on the amber, not white: a 700-weight digit in white on #e2a144 is the one piece of
   text in the module that would sit below a readable contrast ratio. */
.hjs-ctd-step { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--hjs-ctd-accent); color: #14100a; font-size: 0.89rem; font-weight: 700; }

.hjs-ctd-field { display: block; font-size: 0.92rem; font-weight: 600; margin-bottom: 10px; color: var(--hjs-ctd-text); }
.hjs-ctd-field select, .hjs-ctd-field input[type=number], .hjs-ctd-field textarea, .hjs-ctd-field input[type=file] { display: block; width: 100%; margin-top: 4px; padding: 6px 8px; font-weight: 400; border: 1px solid var(--hjs-ctd-line-soft); border-radius: 4px; box-sizing: border-box; background: var(--hjs-ctd-bg-raised); color: var(--hjs-ctd-text); }
.hjs-ctd-field select:focus, .hjs-ctd-field input:focus, .hjs-ctd-field textarea:focus { outline: none; border-color: var(--hjs-ctd-accent); }
/* The font dropdown's own options are drawn by the OS, and the inline font-family on each one
   makes this the one place a merchant sees a light list on some platforms. Stated, not hidden. */
.hjs-ctd-field select option { background: var(--hjs-ctd-bg-raised); color: var(--hjs-ctd-text); }
.hjs-ctd-field input[type=range] { display: block; width: 100%; margin-top: 4px; }
.hjs-ctd-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hjs-ctd-range-value { float: right; color: var(--hjs-ctd-accent); font-weight: 700; }
.hjs-ctd-hint { display: block; font-size: 0.85rem; font-weight: 400; color: var(--hjs-ctd-muted); line-height: 1.4; margin-top: 4px; }

.hjs-ctd-shape-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hjs-ctd-shape-buttons button, .hjs-ctd-pocket-editor button, .hjs-ctd-remove { padding: 7px 6px; font-size: 0.89rem; border: 1px solid var(--hjs-ctd-line); border-radius: 4px; background: var(--hjs-ctd-bg-raised); color: var(--hjs-ctd-text); cursor: pointer; }
.hjs-ctd-shape-buttons button:hover, .hjs-ctd-pocket-editor button:hover, .hjs-ctd-remove:hover { border-color: var(--hjs-ctd-accent); color: var(--hjs-ctd-accent); }
.hjs-ctd-pocket-editor { margin-top: 10px; padding: 10px; border: 1px solid var(--hjs-ctd-line-soft); border-radius: 5px; background: var(--hjs-ctd-bg-sunk); }
.hjs-ctd-pocket-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 0.92rem; }
.hjs-ctd-remove { display: block; width: 100%; margin-top: 8px; }

/* v0.2.1 - the real-world pocket minimum. The hint is permanent wording; the notice only appears
   when shrinking the item has forced pockets to grow, so it is styled to be noticed. */
.hjs-ctd-pocket-min { margin-top: 6px; }
.hjs-ctd-pocket-grown { margin-top: 6px; padding: 7px 9px; border: 1px solid var(--hjs-ctd-accent); border-radius: 4px; background: rgba(226, 161, 68, .12); color: #f2dcb4; font-size: 0.89rem; line-height: 1.45; }
.hjs-ctd-pocket-grown[hidden] { display: none; }

.hjs-ctd-canvas-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.hjs-ctd-canvas-head h2 { font-size: 1.18rem; margin: 0; }
/* The canvas. The tray itself is drawn by designer.js in its own timber colours, so the job of
   this background is to get out of its way - the sunk near-black does that and the light
   #f3f1ed it replaces did not, because a pale board on a pale card has no edge. */
.hjs-ctd-canvas-wrap { position: relative; min-height: 420px; border: 1px solid var(--hjs-ctd-line); border-radius: 5px; background: var(--hjs-ctd-bg-sunk); overflow: hidden; }
#hjs-ctd-preview { display: block; width: 100%; height: auto; min-height: 420px; touch-action: none; user-select: none; -webkit-user-select: none; }
#hjs-ctd-upload-preview { position: absolute; max-width: none; cursor: grab; touch-action: none; user-select: none; }
.hjs-ctd-draggable { cursor: grab; }
.hjs-ctd-draggable:active { cursor: grabbing; }
.hjs-ctd-pocket-shape { cursor: move; }
.hjs-ctd-pocket-shape.is-selected { stroke-dasharray: 7 4; }

/* v0.2.1. touch-action is stated on the draggable CHILDREN as well as on the <svg>. A browser
   works out the effective touch-action by walking up from the element the finger landed on, so
   the parent's rule does reach them - but an SVG child inheriting a parent's touch-action is a
   corner of the spec browsers have disagreed about, and a wrong answer here is a pocket that
   scrolls the page instead of moving. Two lines to take the question off the table entirely. */
.hjs-ctd-pocket-shape, .hjs-ctd-draggable { touch-action: none; }

.hjs-ctd-summary h2 { display: flex; align-items: center; gap: 8px; font-size: 1.18rem; margin: 0 0 10px; }
.hjs-ctd-price-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: .04em; color: #999; }
.hjs-ctd-price { font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: var(--hjs-ctd-text); }
.hjs-ctd-breakdown { margin: 8px 0 12px; padding: 8px 0; border-top: 1px solid var(--hjs-ctd-line-soft); border-bottom: 1px solid var(--hjs-ctd-line-soft); }
.hjs-ctd-breakdown div { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; font-size: 0.89rem; color: #ddd; }
.hjs-ctd-breakdown strong { white-space: nowrap; }
.hjs-ctd-summary dl { display: grid; grid-template-columns: 80px 1fr; gap: 2px 8px; font-size: 0.92rem; margin-bottom: 12px; }
.hjs-ctd-summary dt { font-weight: 600; color: #999; }
.hjs-ctd-summary dd { margin: 0; color: var(--hjs-ctd-muted); }
.hjs-ctd-message { margin-top: 10px; font-size: 0.94rem; }

/* THE ONE DELIBERATE LIGHT AREA, and it is copied from hjsolutions.com's own designer rather
   than being an oversight here. Artwork is line vector - black strokes with no fill - so a dark
   tile shows a customer an empty square. The thumbnails are parchment cards with a dark brown
   edge, reading as a sample sheet laid on the bench. The two hex codes below are written out
   rather than taken from the variables ON PURPOSE: they are not part of the dark palette and
   must not follow it if a merchant re-times the rest. */
.hjs-ctd-art-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-height: 240px; overflow: auto; margin: 6px 0 10px; padding: 5px; border: 1px solid var(--hjs-ctd-line-soft); border-radius: 5px; background: var(--hjs-ctd-bg-sunk); }
.hjs-ctd-art-empty { grid-column: 1 / -1; padding: 12px; font-size: 0.85rem; text-align: center; color: #888; }
.hjs-ctd-art-thumb { display: block; padding: 4px; border: 1px solid #33271c; border-radius: 4px; background: #f4f1ea; cursor: pointer; }
.hjs-ctd-art-thumb svg, .hjs-ctd-art-thumb img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; }
.hjs-ctd-art-thumb.is-selected { border-color: var(--hjs-ctd-accent); box-shadow: inset 0 0 0 1px var(--hjs-ctd-accent), 0 0 0 1px var(--hjs-ctd-accent); }

/* ------------------------------------------------------------------------------------------------
   v0.2.0 - the AI finished-product preview panel, and the standalone paid-file page.

   Both are written against this module's own class names only. Nothing here restyles a theme's
   elements, so a shop running any OpenCart 4 theme gets its own buttons and its own alerts and this
   only lays them out.
------------------------------------------------------------------------------------------------ */
.hjs-ctd-ai { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hjs-ctd-line-soft); }
.hjs-ctd-ai-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hjs-ctd-ai-head h3 { margin: 0; font-size: 1.12rem; }
.hjs-ctd-ai-head p { margin: 2px 0 0; font-size: 0.89rem; color: var(--hjs-ctd-muted); }
.hjs-ctd-ai-status { margin-top: 10px; font-size: 0.94rem; }
.hjs-ctd-ai-status:empty { margin-top: 0; }
.hjs-ctd-ai-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.hjs-ctd-ai-image { display: block; width: 100%; height: auto; border: 1px solid var(--hjs-ctd-line); border-radius: 6px; background: var(--hjs-ctd-bg-sunk); }

.hjs-ctd-file-grid { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 14px; }
.hjs-ctd-file-summary dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 8px 0 14px; font-size: 0.94rem; }
.hjs-ctd-file-summary dt { font-weight: 600; color: #999; }
.hjs-ctd-file-summary dd { margin: 0; color: var(--hjs-ctd-muted); }

/* --------------------------------------------------------------------------------------------
   THE THEME'S OWN BUTTONS AND ALERTS, INSIDE THIS MODULE ONLY.

   Add to Basket, Download SVG, Buy the file and Generate preview are Bootstrap buttons from the
   merchant's theme, and on a near-black panel a stock white .btn-default is the join showing. The
   selectors below are all descendants of .hjs-ctd, so a theme's buttons everywhere else on the
   site - including everywhere else on this same page - are untouched.

   .btn-primary is the amber, because Add to Basket is the one thing on the screen the customer is
   being asked to press. Everything else is a dark button with a timber edge that turns amber on
   hover, so the hierarchy is visible at a glance rather than three buttons shouting equally.

   A merchant who would rather keep their own button styling can delete this block; nothing else
   in the file depends on it.
-------------------------------------------------------------------------------------------- */
.hjs-ctd .btn { border-radius: 4px; }
.hjs-ctd .btn-default { background: var(--hjs-ctd-bg-raised); border-color: var(--hjs-ctd-line); color: var(--hjs-ctd-text); }
.hjs-ctd .btn-default:hover, .hjs-ctd .btn-default:focus { background: #1b1b1b; border-color: var(--hjs-ctd-accent); color: var(--hjs-ctd-accent); }
.hjs-ctd .btn-primary { background: var(--hjs-ctd-accent); border-color: var(--hjs-ctd-accent); color: #14100a; font-weight: 600; }
.hjs-ctd .btn-primary:hover, .hjs-ctd .btn-primary:focus { background: #efb257; border-color: #efb257; color: #14100a; }
.hjs-ctd .btn-success { background: transparent; border-color: var(--hjs-ctd-accent); color: var(--hjs-ctd-accent); }
.hjs-ctd .btn-success:hover, .hjs-ctd .btn-success:focus { background: rgba(226, 161, 68, .14); border-color: var(--hjs-ctd-accent); color: var(--hjs-ctd-accent); }
.hjs-ctd .btn + .btn { margin-top: 8px; }

/* The status and message areas print the theme's alert markup. Left as the theme's colours for
   the coloured ones - a red failure should look like the shop's red - but the plain .alert-info
   default is a pale blue box that would glare here, so it is given the panel's own dark form. */
.hjs-ctd .alert { border-radius: 4px; }
.hjs-ctd .alert-info { background: var(--hjs-ctd-bg-raised); border-color: var(--hjs-ctd-line); color: var(--hjs-ctd-muted); }

@media (max-width: 1200px) {
  .hjs-ctd-grid { grid-template-columns: 250px minmax(0, 1fr); }
  .hjs-ctd-summary { grid-column: 1 / -1; position: static; }
}

@media (max-width: 820px) {
  .hjs-ctd-layout-grid { grid-template-columns: repeat(2, 1fr); }
  .hjs-ctd-file-grid { grid-template-columns: 1fr; }

  /* v0.2.13 - the phone/tablet layout, and the sticky canvas that never stuck.
     Two faults in one. (1) The desktop rule pins the canvas panel to grid column 2, and setting
     the template to one column here did not un-pin it: the grid grew an implicit second column and
     the canvas was squeezed to ~110px beside the controls. (2) Sticky only holds inside its own
     containing block, and a grid item's is its grid AREA - so a canvas in its own row stuck for
     that row and let go, "about halfway down".
     So below 820px the grid becomes a plain column. The panel is display:contents, which makes the
     canvas itself a direct child of the column, and a sticky child's containing block is then the
     whole column - it holds for the entire form. Order puts the canvas first, then the AI preview,
     then the controls. The canvas is capped by WIDTH, never height: designer.js turns a pointer
     position into a tray position from the svg's bounding box against the 760x620 viewBox, so the
     box must keep the viewBox's proportions or dragging lands in the wrong place. */
  .hjs-ctd-grid { display: flex; flex-direction: column; gap: 14px; }
  .hjs-ctd-canvas-panel { display: contents; }
  .hjs-ctd-canvas-head { order: -3; margin: 0; }
  .hjs-ctd-canvas-wrap {
    order: -2;
    position: sticky; top: 0; z-index: 20;
    width: min(100%, 36vh * 1.2258);
    margin: 0 auto;
    min-height: 0;
    box-shadow: 0 8px 10px -6px rgba(0, 0, 0, .75);
  }
  #hjs-ctd-preview { min-height: 0; }
  .hjs-ctd-canvas-panel > .hjs-ctd-ai { order: -1; padding: 14px; border: 1px solid var(--hjs-ctd-line); border-radius: 6px; background: var(--hjs-ctd-bg); }
  .hjs-ctd-controls { order: 0; }
  .hjs-ctd-summary { order: 1; }
}
/* 100vh on a phone is the height with the browser toolbar HIDDEN, so a canvas sized to it is
   taller than the visible screen while the toolbar shows. dvh is the height actually on screen. */
@supports (height: 1dvh) {
  @media (max-width: 820px) {
    .hjs-ctd-canvas-wrap { width: min(100%, 36dvh * 1.2258); }
  }
}
/* A phone on its side is ~400px tall: a sticky canvas there would leave nothing to scroll. */
@media (max-width: 820px) and (max-height: 520px) {
  .hjs-ctd-canvas-wrap { position: static; width: 100%; box-shadow: none; }
}

/* ------------------------------------------------------------------------------------------------
   v0.2.1 - PHONES.

   Up to v0.2.0 the narrowest breakpoint was 820px, which reflows the three columns into one and
   then stops. On a real phone (375-430px CSS pixels) that left type as small as .7rem, panel and
   field padding sized for a mouse, and a 420px-tall preview box letterboxing a preview that only
   needs ~290px of it - so the controls a customer needs were pushed further down the page than
   they had to be.

   TWO SEPARATE QUESTIONS, ANSWERED SEPARATELY, because they are not the same question:
     - HOW WIDE is the screen  -> max-width, below. Layout and type.
     - HOW BLUNT is the pointer -> pointer: coarse, further down. Hit targets.
   A 1024px tablet is touch and not narrow; a narrow desktop window is narrow and not touch. Using
   width to decide hit-target size gets both of those wrong.
------------------------------------------------------------------------------------------------ */
@media (max-width: 560px) {
  /* v0.2.4: the phone used to get a DARKER hairline than the desktop, because on a light panel a
     stronger line is what survives a small bright screen. On the dark theme the same intent goes
     the other way - the timber edge is lifted, not deepened, so the panels still separate in
     sunlight. Same purpose, opposite direction, and it is the palette that flipped, not the rule. */
  .hjs-ctd { --hjs-ctd-line: #6d4f2f; --hjs-ctd-line-soft: #4a3d2e; padding: 12px; }

  /* Type. Nothing below .8rem survives contact with a phone held at arm's length, and several of
     these were .7rem - readable on a 27in monitor, not on a bus. */
  .hjs-ctd-field { font-size: 1.0rem; margin-bottom: 14px; }
  .hjs-ctd-hint { font-size: 0.94rem; }
  .hjs-ctd-layout small { font-size: 0.92rem; }
  .hjs-ctd-layout strong { font-size: 1.09rem; }
  .hjs-ctd-layouts-head p { font-size: 0.97rem; }
  .hjs-ctd-breakdown div { font-size: 1.0rem; }
  .hjs-ctd-summary dl { grid-template-columns: 84px 1fr; font-size: 1.0rem; }
  .hjs-ctd-pocket-head { font-size: 1.04rem; }
  .hjs-ctd-price-label { font-size: 0.92rem; }
  .hjs-ctd-art-empty { font-size: 0.94rem; }
  .hjs-ctd-pocket-grown { font-size: 0.97rem; }
  .hjs-ctd-ai-head p { font-size: 0.97rem; }
  .hjs-ctd-file-summary dl { font-size: 1.04rem; }

  /* A 16px font on a focusable field is what stops iOS Safari zooming the whole page in the
     moment the customer taps it - and it never zooms back out on its own. */
  .hjs-ctd-field select,
  .hjs-ctd-field input[type=number],
  .hjs-ctd-field textarea,
  .hjs-ctd-field input[type=file] { font-size: 16px; padding: 9px 10px; }

  /* Space. Less of it round the edges, more of it between things that get tapped. */
  .hjs-ctd-panel { padding: 12px 11px; }
  .hjs-ctd-layouts { padding: 12px 11px; }
  .hjs-ctd-grid { gap: 12px; }
  .hjs-ctd-layout-grid { gap: 7px; }
  .hjs-ctd-two { gap: 10px; }

  /* The preview. width:100% x the 760:620 viewBox is about 290px tall at this width. v0.2.13: no
     min-height here at all any more - the 820px rule sizes the canvas by width, and a min-height
     taller than that would stretch the svg's box off the viewBox's proportions and skew dragging. */

  /* The artwork gallery scrolls inside the page; at this width a shorter box is easier to get
     past with a thumb, and four columns of tiny thumbnails is worse than three. */
  .hjs-ctd-art-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-height: 200px; }

  /* The running total is the number they came for. */
  .hjs-ctd-price { font-size: 2.1rem; }
}

/* Very narrow - small phones, and split-screen. One column of presets rather than two cramped. */
@media (max-width: 380px) {
  .hjs-ctd-layout-grid { grid-template-columns: 1fr; }
  .hjs-ctd-shape-buttons { grid-template-columns: 1fr; }
  .hjs-ctd-summary dl { grid-template-columns: 1fr; }
  .hjs-ctd-summary dt { margin-top: 4px; }
}

/* ------------------------------------------------------------------------------------------------
   v0.2.1 - TOUCH.

   Every interactive control in this module is sized for a fingertip when the primary pointer is a
   coarse one, whatever the screen width. ~44px is the figure both Apple's and Google's guidance
   settle on and it is what the buttons here fell well short of: .hjs-ctd-shape-buttons button and
   friends padded to roughly 30px tall.

   A range input is the one that actually decides whether this product is usable on a phone: its
   thumb is about 14px by default, which is under a third of a fingertip, so resizing a pocket was
   a game of chance. The track is given real height and the thumb is grown to 26px - vendor-
   prefixed separately because a browser drops a whole selector list it does not understand, and
   -webkit- and -moz- cannot share one rule.
------------------------------------------------------------------------------------------------ */
@media (pointer: coarse) {
  .hjs-ctd-shape-buttons button,
  .hjs-ctd-pocket-editor button,
  .hjs-ctd-remove,
  .hjs-ctd-art-thumb { min-height: 44px; padding: 10px 8px; font-size: 1.0rem; }

  .hjs-ctd-layout { min-height: 56px; padding: 12px 10px; }

  .hjs-ctd-shape-buttons { gap: 8px; }
  .hjs-ctd-pocket-editor { padding: 12px; }

  /* No grey flash box round a tapped button. */
  .hjs-ctd button, .hjs-ctd-layout, .hjs-ctd-art-thumb { -webkit-tap-highlight-color: transparent; }

  /* v0.2.4: the track was a translucent BLACK, which was a visible grey groove on the old white
     panel and is invisible on this one - a 26px amber thumb floating on nothing, with no way to
     see how far along the travel it is. It is now the timber tone, which is what the site's own
     designer uses for the same control. The thumb's outline goes the same way. */
  .hjs-ctd-field input[type=range] { height: 34px; margin-top: 6px; background: transparent; }
  .hjs-ctd-field input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: var(--hjs-ctd-line-soft); }
  .hjs-ctd-field input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--hjs-ctd-line-soft); }
  .hjs-ctd-field input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -9px; border: 1px solid #33271c; border-radius: 50%; background: var(--hjs-ctd-accent); }
  .hjs-ctd-field input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border: 1px solid #33271c; border-radius: 50%; background: var(--hjs-ctd-accent); }

  /* A drag across the preview must never start selecting text instead. touch-action stays where
     it already is, on the <svg> and its draggable children, and is deliberately NOT widened here:
     it is what guarantees a finger on a pocket moves the pocket rather than scrolling the page,
     and the price of that guarantee is that a swipe on the empty part of the preview does not
     scroll either. That dead zone is why the preview's minimum height is cut on a phone above -
     there is simply less of it to get stuck on. */
  .hjs-ctd-canvas-wrap { user-select: none; -webkit-user-select: none; }
}
