/* ══════════════════════════════════════════════════════════════════════════
   Catalog Flipbook — styles
   Colours are injected as CSS variables from config.js -> theme.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  /* NDI palette — lives on the root because the contact dialog is outside .quote. */
  --ndi-blue: #77A954;
  --ndi-navy: #08284C;
  --ndi-body: #334155;
  --ndi-muted: #6b747c;
  --ndi-section: #f3f4f5;
  --ndi-card-tint: #eff5f5;
  --ndi-border: #e2e6e0;
  --r-sm: 4px;
  --r-lg: 8px;

  --bg: #0e1116;
  --bg-2: #161b22;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #2f81f7;
  --accent-text: #fff;
  --border: rgba(255, 255, 255, .10);

  /* The top bar was removed; the catalog uses the full height. The variable is
     kept at 0 because the vertical calculations still use it. */
  --topbar-h: 0px;
  /* The bottom bar was removed; page navigation moved to the left vertical strip. */
  --bottombar-h: 0px;
  /* The toolbar sits horizontally at the bottom: on the left only a margin
     remains, and vertical space is reserved for the height of the bar. */
  --tool-area: 66px;
  --tool-height: 78px;
  /* Free space to the right of the book: the quote card sits here. */
  --right-area: 372px;
  --ease-soft: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body::before {
  /* A very slight depth on the light background, so the book does not sit on a flat surface. */
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 42%, rgba(32,36,52,.045), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hidden { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .16s, color .16s, transform .16s;
}
.icon-btn:hover:not(:disabled) { background: rgba(32,36,52,.07); color: var(--text); }
.icon-btn:active:not(:disabled) { transform: scale(.93); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.enabled { background: var(--accent); color: var(--accent-text); }
.icon-btn.small { width: 30px; height: 30px; }

.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button {
  display: inline-block;
  padding: 11px 22px;
  border: 0;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button-accent { background: var(--accent); color: var(--accent-text); }

/* ── Toolbar (left vertical strip) ───────────────────────────────────────
   The top bar was removed: logo + title stated the brand twice and the bar
   took 56 px of the catalog's height. The tools sit in a strip on the left,
   centred vertically; the right side is reserved for the quote column. */

/* The bottom bar has three separate groups: tools, counter, quote call.
   Gathered in one long white box they looked cluttered; separate boxes
   explain by themselves what each group is for.
   The bar itself is an invisible carrier. */
.toolbar {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap; /* three groups on one row; stacked only on phones (the 820px rule below) */
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: opacity .25s, transform .25s;
  max-width: calc(100vw - 28px);
}

.tool-group {
  display: flex;
  align-items: center;
  /* All three groups should be the same height; otherwise their different
     contents (38 px icon, 34 px button, 28 px counter) made the boxes differ. */
  min-height: 52px;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(32, 36, 51, .08);
}
.tool-group-cta { gap: 8px; padding: 6px 10px 6px 14px; }
.toolbar::-webkit-scrollbar { width: 0; }

/* Quote call in the bottom bar. With the right column gone it is one row instead of a card. */
.tool-label {
  padding: 0 8px 0 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ndi-navy);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s, border-color .16s, box-shadow .16s;
}
.tool-btn { text-decoration: none; }
.tool-btn:hover { background: var(--ndi-card-tint); border-color: #c4c4c4; }
.tool-btn-icon {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: .8;
}
.tool-btn img { display: block; opacity: .85; }
.tool-btn-primary {
  background: var(--ndi-navy);
  border-color: var(--ndi-navy);
  color: #fff;
}
.tool-btn-primary:hover { background: #2b3043; border-color: #2b3043; box-shadow: 0 6px 16px rgba(32, 36, 52, .22); }
.tool-btn-primary img { filter: brightness(0) invert(1); opacity: 1; }

/* ── Stage + book ────────────────────────────────────────────────────────── */

.stage {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Room is left on the right for the quote card and future panels;
     that is why the catalog sits slightly left of centre. */
  /* Left/right padding is updated by publishLayout() in app.js: the inner
     box stays exactly as wide as the book, so the book sits right beside the
     right column. Without the variables (narrow screen) the old behaviour applies. */
  padding: calc(var(--topbar-h) + 16px) var(--right-area) calc(var(--bottombar-h) + var(--tool-height)) var(--stage-left, var(--tool-area));
}

.book-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

/* Note: a floor shadow (::after) used to be here, but it came after the
   pages in DOM order, overlapped the page's bottom edge and blurred the
   paper. The two-layer shadow on .page already gives the depth. */

.book { opacity: 0; transition: opacity .5s var(--ease-soft); }
.book.ready { opacity: 1; }

/* Page holder generated by StPageFlip */
.page {
  background: #fff;
  /* overflow: hidden clips both the canvas and the shadow/texture layers to
     the corners, so the rounding applies to every layer. */
  overflow: hidden;
  border-radius: var(--page-radius, 6px);
  /* Close contact shadow + wide soft shadow: the page looks lifted off the surface. */
  box-shadow:
    0 1px 2px rgba(0,0,0,.28),
    0 10px 34px rgba(0,0,0,.42);
}
.page canvas,
.page img.page-image { display: block; width: 100%; height: 100%; }
.page img.page-image { object-fit: fill; user-select: none; -webkit-user-drag: none; }

/* Matte coated-paper feel.
   The on-screen page is pure white and smooth, so it looked like glossy,
   polished paper. Two touches bring it closer to matte coated stock:
   • a very fine grain (the texture of printing paper),
   • a slight warm tone leaning to off-white — matte paper absorbs light
     rather than reflecting it.
   Both are kept extremely light; the aim is not to make the texture
   noticeable but to take off the shine. */
.page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  /* soft-light is used: grain produces both light and dark pixels, so the
     page's overall brightness is kept. multiply gives the texture but
     darkened the paper visibly. */
  mix-blend-mode: soft-light;
  opacity: calc(var(--paper-texture, 1) * .95);
  /* Two layers: the fine grain gives the roughness of printing paper, the
     coarse soft layer the uneven fibre spread of coated stock. A single
     layer looked too regular, like digital noise. */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='.62'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='k'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.16' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23k)' opacity='.34'/%3E%3C/svg%3E");
  background-size: 120px 120px, 300px 300px;
}

/* skeleton while the page has not been rendered yet */
.page-skeleton {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #f3f4f6;
  color: #9aa2ad;
  font-size: 12px;
  letter-spacing: .04em;
  overflow: hidden;
}
.page-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 25%, rgba(255,255,255,.75) 50%, transparent 75%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 220% 0; } to { background-position: -120% 0; } }

/* ── Binding (spine) shadow ──────────────────────────────────────────────
   In a printed catalog the page curves towards the binding, so it darkens
   there; this is what really gives the 3D feel.

   Two points are critical for the paper feel:
   • The shadow is not a narrow strip; it spreads over the WHOLE page — a
     very slight darkness remains even in the middle. A narrow band looks
     like a belt and feels artificial.
   • The colour is grey, not pure black; black makes the paper look dirty.
   No white "light" layer is added to the page — paper is already light,
   and laying white over it makes the page look pale and artificial. */

.paper-shadow {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

/* The shadow fades out at about a third of the page: the area near the
   binding stays dark, the rest of the page stays paper white. Spreading
   the shadow over the whole page darkened the page as a whole. */

/* Left page: binding on the right edge */
.paper-shadow.left {
  background:
    linear-gradient(to left,
      rgba(20, 20, 20, .34) 0%,
      rgba(20, 20, 20, 0) 1.8%),
    linear-gradient(to left,
      rgba(58, 58, 58, .30) 0%,
      rgba(54, 54, 54, .08) 14%,
      rgba(54, 54, 54, .02) 26%,
      rgba(200, 200, 200, 0) 38%);
}

/* Right page: binding on the left edge */
.paper-shadow.right {
  background:
    linear-gradient(to right,
      rgba(20, 20, 20, .34) 0%,
      rgba(20, 20, 20, 0) 1.8%),
    linear-gradient(to right,
      rgba(53, 53, 53, .32) 0%,
      rgba(53, 53, 53, .09) 14%,
      rgba(53, 53, 53, .02) 26%,
      rgba(200, 200, 200, 0) 38%);
}

/* ── Clickable link layer ────────────────────────────────────────────────── */

.link-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;   /* only the hotspots are clickable, page turning is not disturbed */
}

.hotspot {
  position: absolute;
  pointer-events: auto;
  display: block;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
  transition: background .18s, box-shadow .18s;
}
.hotspot:hover,
.hotspot:focus-visible {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  box-shadow: 0 0 0 2px var(--accent);
  outline: none;
}
/* show the links for a moment (L key / first-open hint) */
.link-layer.show .hotspot {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent);
}

/* ── Side arrows ─────────────────────────────────────────────────────────── */

.arrow {
  position: fixed;
  top: 50%;
  z-index: 20;
  transform: translateY(-50%);
  width: 46px;
  height: 82px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .18s, opacity .18s, transform .18s;
}
.arrow:disabled { opacity: 0; pointer-events: none; }
/* The side arrows were removed: navigation is already done with the buttons
   in the bottom bar, the keyboard arrow keys, clicking the page edge and
   swiping on mobile. */
/* Page navigation uses the arrows on both sides of the catalog. They used
   to be off (display:none) with next/previous in the left strip; the strip
   got crowded, and the arrows are right beside the catalog, which is where
   the hand goes. Colours suit the light background: the old
   rgba(255,255,255,.06) was a leftover from the dark theme and was
   invisible on #f3f4f5. */
.arrow {
  display: grid;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  box-shadow: 0 4px 14px rgba(32, 36, 51, .10);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 8px;
  width: 40px;
  height: 76px;
}
.arrow:hover:not(:disabled) { background: var(--bg); color: var(--text); border-color: #c4c4c4; }
.arrow:active:not(:disabled) { transform: translateY(-50%) scale(.95); }
/* The arrows sit at the very edges of the screen, not on top of the catalog.
   The margins (STAGE_MARGIN / RIGHT_MARGIN in the JS) are calculated to
   leave room for the arrows, so they never overlap the page at any
   screen width. */
.arrow-left { left: 14px; }
.arrow-right { right: 14px; }
.arrow svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Bottom bar ──────────────────────────────────────────────────────────── */

/* Page counter: in the form "12 / 64", aligned with the bar. */
.counter {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.counter-input {
  width: 38px;
  padding: 4px 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.counter-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.counter .counter-sep { width: 8px; height: 1px; background: var(--border); margin: 0; }
.counter-total { color: var(--text-muted); font-size: 11.5px; }

/* ── Thumbnail strip ─────────────────────────────────────────────────────── */

.strip {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 208px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: stripIn .26s var(--ease-soft);
}
@keyframes stripIn { from { transform: translateX(-100%); } to { transform: none; } }

.strip-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 9px 11px 15px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.strip-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}
.strip-list::-webkit-scrollbar { width: 8px; }
.strip-list::-webkit-scrollbar-thumb { background: rgba(32,36,52,.18); border-radius: 4px; }

.thumbnail {
  position: relative;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  transition: border-color .16s, transform .16s;
}
.thumbnail:hover { transform: translateY(-2px); }
.thumbnail.active { border-color: var(--accent); }
.thumbnail canvas,
.thumbnail img.thumbnail-image { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbnail span {
  position: absolute;
  right: 3px;
  bottom: 3px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0,0,0,.72);
  font-size: 10px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* ── Zoom ────────────────────────────────────────────────────────────────── */

.zoom {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 10, 13, .96);
  display: flex;
  flex-direction: column;
}
.zoom-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.zoom-canvas {
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 18px;
}
.zoom-canvas canvas,
.zoom-canvas img {
  display: block;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0,0,0,.55);
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */

.loading {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity .45s var(--ease-soft);
}
.loading.done { opacity: 0; pointer-events: none; }
.loading-box { text-align: center; width: 230px; }

/* Brand ring: the arc fills to the real loading percentage, and at 100% the
   bar in the middle turns navy and does a soft snap. The same drawing also
   spins in the tab favicon (vendor/vdn-loader-anim.js). */
.loading-ring {
  display: block;
  width: 116px;
  height: 116px;
  margin: 0 auto 24px;
}

.loading-title { margin: 0 0 14px; font-size: 13.5px; color: var(--text-muted); }
.loading-bar { height: 3px; border-radius: 2px; background: rgba(32,36,52,.10); overflow: hidden; }
.loading-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.loading-percent { margin: 9px 0 0; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Error ───────────────────────────────────────────────────────────────── */

.error {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.error-box { max-width: 420px; text-align: center; }
.error-box h2 { margin: 0 0 10px; font-size: 19px; }
.error-box p { margin: 0 0 22px; font-size: 14px; line-height: 1.6; color: var(--text-muted); }

/* ── Quote panel ─────────────────────────────────────────────────────────
   A separate layer from the catalog: it does not cover the pages, opens
   from the right, and the user does not lose the page they are on. */

/* Closed state: a small card in the empty space to the right of the book.
   A gap is left on the right so it does not collide with the side arrow. */
/* ── NDI brand layer ─────────────────────────────────────────────────────
   The panel uses the same design system as the NDI Website: one palette,
   one type scale (Roboto), radii of only 4 (small) and 8 (large). The
   catalog interface stays dark; this panel is a light theme to match the site. */
.quote {
  --ndi-blue: #77A954;
  --ndi-navy: #08284C;
  --ndi-body: #334155;
  --ndi-muted: #6b747c;
  --ndi-section: #f3f4f5;
  --ndi-card-tint: #eff5f5;
  --ndi-border: #e2e6e0;
  --r-sm: 4px;
  --r-lg: 8px;

  position: fixed;
  /* Position and height come from app.js; it sits against the book's right
     edge and covers the same height. Without the variables, the old
     (narrow screen) layout applies. */
  right: var(--panel-right, 68px);
  top: var(--panel-top, 50%);
  transform: var(--panel-shift, translateY(-50%));
  z-index: 50;
  width: 296px;
  color: var(--ndi-body);
  font-family: 'Roboto', system-ui, Arial, sans-serif;
  height: var(--catalog-height, auto);
  /* In the wide layout the book sets the limit (the book is already sized to
     fit the screen); without the variable the old viewport limit stays. */
  max-height: var(--catalog-height, calc(100vh - var(--topbar-h) - var(--bottombar-h) - 36px));
  overflow-y: auto;
  scrollbar-width: thin;
}
.quote::-webkit-scrollbar { width: 6px; }
.quote::-webkit-scrollbar-thumb { background: rgba(32,36,52,.18); border-radius: 3px; }

/* ── Right column cards (NDI-catalog / right col) ─────────────────────── */

/* The column fills the catalog's height exactly. The difference is taken
   from the photo areas: text blocks keep their natural height, and images
   use object-fit: cover so they stretch or shrink without distortion. */
.right-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  min-height: 0;
}

.ndi-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-height: 0;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: 0 4px 14px rgba(32, 36, 51, .08);
  overflow: hidden;
}

/* Cards with photos are flexible: they share any extra or missing height. */
.right-column .ndi-card:has(.ndi-card-photo) { flex: 1 1 auto; }
.ndi-card-body { flex: 0 0 auto; }

.ndi-card-quote { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.ndi-card-text { display: flex; flex-direction: column; gap: 4px; }
.ndi-card-text strong { font-size: 16px; font-weight: 500; color: var(--ndi-navy); }
.ndi-card-text span { font-size: 14px; color: var(--ndi-muted); }

.quote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 44px;
  padding: 6px 18px 6px 12px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--ndi-navy);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.quote-btn:hover { box-shadow: 0 8px 20px rgba(107, 117, 130, .28); transform: translateY(-1px); }
.quote-btn img { display: block; filter: brightness(0) invert(1); }

/* Secondary action — same size as Quote, but in the system's outline style:
   two dark buttons side by side made it unclear which was the main call. */
.quote-btn-secondary {
  background: #fff;
  color: var(--ndi-navy);
  border: 1px solid var(--ndi-border);
}
.quote-btn-secondary:hover { background: var(--ndi-card-tint); box-shadow: 0 6px 16px rgba(107, 117, 130, .16); }
.quote-btn-secondary img { filter: none; opacity: .8; }

/* ── Contact dialog ──────────────────────────────────────────────────────
   The expert and address cards moved here; the right column shrank to one card. */

.contact-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(32, 36, 52, .42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.contact-dialog {
  position: fixed;
  z-index: 71;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--ndi-section);
  box-shadow: 0 24px 60px rgba(32, 36, 52, .34);
  font-family: 'Roboto', system-ui, Arial, sans-serif;
  color: var(--ndi-body);
}
.contact-title {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--ndi-border);
}
.contact-title strong { font-size: 16px; font-weight: 500; color: var(--ndi-navy); }
.contact-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  scrollbar-width: thin;
}
/* Cards keep their natural height in the dialog; the stretching rules from
   the right column do not apply here. */
.contact-body .ndi-card { flex: 0 0 auto; }
.contact-body .ndi-card-photo { flex: 0 0 auto; }
.contact-body .ndi-card-photo-expert { height: 170px; }
.contact-body .ndi-card-photo-office { height: 160px; }

.ndi-card-photo { width: 100%; overflow: hidden; flex: 1 1 auto; min-height: 0; }
.ndi-card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Fixed heights are now only a starting/narrow-screen value: flex-basis. */
.ndi-card-photo-expert { flex-basis: 170px; min-height: 96px; }
.ndi-card-photo-expert img { object-position: center 22%; }
.ndi-card-photo-office { flex-basis: 200px; min-height: 110px; }

.ndi-card-body { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.ndi-card-body-address { gap: 12px; padding: 18px; }

.ndi-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .66px;
  color: var(--ndi-muted);
}
.ndi-name { font-size: 16px; font-weight: 500; color: var(--ndi-navy); }
.ndi-title { font-size: 14px; color: var(--ndi-muted); }

.ndi-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ndi-navy);
  text-decoration: none;
}
.ndi-contact img { display: block; flex: 0 0 auto; }
.ndi-contact:hover span { color: var(--ndi-blue); }

.ndi-address { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ndi-navy); }
.ndi-address img { display: block; flex: 0 0 auto; }
.ndi-directions-label { font-size: 12px; color: var(--ndi-muted); }

.ndi-directions { display: flex; gap: 8px; }
.ndi-directions-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--ndi-border);
  border-radius: var(--r-lg);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: var(--ndi-navy);
  text-decoration: none;
  transition: background .15s;
}
.ndi-directions-btn:hover { background: var(--ndi-card-tint); }
.ndi-directions-btn img { display: block; flex: 0 0 auto; }

/* The right column is hidden when the form panel opens */
.quote.open .right-column { display: none; }

.quote-body { display: none; }

/* Open state: sticks to the right edge and becomes a full-height panel */
/* ── Quote form ──────────────────────────────────────────────────────────
   This block was deleted by mistake during an edit; the form was left
   unstyled and the inputs shrank to 21 px. Restored from version history. */
.quote-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 14px 20px;
  border-bottom: 1px solid var(--ndi-border);
}
.quote-title strong { display: block; font-size: 16px; color: var(--ndi-navy); }
.quote-title span { display: block; margin-top: 3px; font-size: 12px; color: #6b7280; }
.quote-title .icon-btn { color: #6b7280; }
.quote-title .icon-btn:hover { background: var(--ndi-card-tint); color: var(--ndi-navy); }

.quote-form { padding: 18px 20px 24px; display: flex; flex-direction: column; gap: 13px; }

.quote-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: #6b7280;
}
.quote-form label span { color: var(--ndi-blue); }

.quote-form input,
.quote-form textarea {
  padding: 10px 12px;
  border: 1px solid var(--ndi-border);
  border-radius: 8px;
  background: #fff;
  color: var(--ndi-body);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}
.quote-form input:focus,
.quote-form textarea:focus {
  outline: none;
  border-color: var(--ndi-blue);
  box-shadow: 0 0 0 3px rgba(0, 142, 214, .14);
}

/* Two actions side by side: send is primary, PDF secondary */
.quote-actions { display: flex; gap: 8px; margin-top: 4px; }
.quote-actions .button { flex: 1; padding: 11px 12px; font-size: 13px; }

.quote-form .button-accent { background: var(--ndi-blue); color: #fff; }
.button-secondary {
  background: #fff;
  color: var(--ndi-navy);
  border: 1px solid var(--ndi-border);
}
.button-secondary:hover { background: var(--ndi-card-tint); }

/* ── Product picker ──────────────────────────────────────────────────────
   Search by part number or product name; selections are listed as tags.
   The product list loads the first time the panel opens; it does not slow
   down catalog start-up. */

.product-picker { display: flex; flex-direction: column; gap: 6px; }
.product-picker > label { font-size: 12.5px; color: #6b7280; }

.product-search-wrap { position: relative; }

.product-search-wrap input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ndi-border);
  border-radius: 8px;
  background: #fff;
  color: var(--ndi-body);
  font: inherit;
  font-size: 14px;
}
.product-search-wrap input:focus {
  outline: none;
  border-color: var(--ndi-blue);
  box-shadow: 0 0 0 3px rgba(0, 142, 214, .14);
}

.product-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 232px;
  overflow-y: auto;
  border: 1px solid var(--ndi-border);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(16, 24, 40, .18);
}

.product-suggest li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  line-height: 1.35;
}
.product-suggest li:hover,
.product-suggest li[aria-selected="true"] { background: rgba(0, 142, 214, .10); }
.product-suggest li strong { display: block; color: var(--ndi-navy); font-weight: 600; }
.product-suggest li span { color: #6b7280; font-size: 11.5px; }
.product-suggest li mark { background: transparent; color: var(--ndi-blue); font-weight: 600; }
.product-suggest .product-empty { color: #6b7280; cursor: default; }
.product-suggest .product-empty:hover { background: transparent; }

/* Selected products: a row list instead of pills. A quantity can be entered
   on each row, which did not fit in a pill; long part numbers are also
   easier to read on one line. */
.product-selected { display: flex; flex-direction: column; gap: 6px; }
.product-selected:empty { display: none; }

.product-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 11px;
  border: 1px solid var(--ndi-border);
  border-radius: var(--r-sm);
  background: var(--ndi-card-tint);
}
.product-row-code {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ndi-navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-qty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-size: 11px;
  color: #6b7280;
}
.product-qty input {
  width: 54px;
  padding: 5px 6px;
  border: 1px solid var(--ndi-border);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--ndi-navy);
  font: inherit;
  font-size: 12.5px;
  text-align: center;
}
.product-qty input:focus {
  outline: none;
  border-color: var(--ndi-blue);
  box-shadow: 0 0 0 3px rgba(0, 142, 214, .14);
}
.product-remove {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: #6b7280;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.product-remove:hover { background: rgba(0, 142, 214, .14); color: var(--ndi-navy); }

/* Optional-field label. */
.field-note {
  font-style: normal;
  font-size: 11px;
  font-weight: 400;
  color: var(--ndi-muted);
}

/* Attachment picker. The browser's own "Choose file" button did not match
   the form style; the real input is hidden and the label is used as a button. */
.attachment-field { display: flex; flex-direction: column; gap: 6px; }
.attachment-field > label:first-child { font-size: 12.5px; color: #6b7280; }
.attachment-field input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.attachment-pick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  padding: 9px 14px;
  border: 1px dashed var(--ndi-border);
  border-radius: var(--r-lg);
  background: #fff;
  color: var(--ndi-navy);
  font-size: 13px;
  cursor: pointer;
}
.attachment-pick:hover { background: var(--ndi-card-tint); border-color: var(--ndi-blue); }
.attachment-field input[type="file"]:focus-visible + .attachment-pick {
  border-color: var(--ndi-blue);
  box-shadow: 0 0 0 3px rgba(0, 142, 214, .14);
}
.attachment-pick svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round;
}
.attachment-name { font-size: 12px; color: var(--ndi-body); word-break: break-all; }
.attachment-name.error { color: #c0392b; }

.quote-form button[type="submit"] { margin-top: 4px; width: 100%; }
.quote-form button[disabled] { opacity: .55; cursor: default; }

.quote-note { margin: 0; font-size: 11.5px; line-height: 1.6; color: #6b7280; }

.quote-thanks { padding: 36px 24px 24px; text-align: center; }
.quote-thanks strong { display: block; font-size: 17px; margin-bottom: 8px; color: var(--ndi-navy); }
.quote-thanks p { margin: 0 0 20px; font-size: 13.5px; color: #6b7280; }
.quote-thanks .button { width: 100%; margin-bottom: 8px; }
.quote-thanks .button-accent { background: var(--ndi-blue); color: #fff; }

/* ── Ask the NDI Expert ──────────────────────────────────────────────────
   An exact match of the component in the NDI Website design: light card
   background, 4 px corners, 32 px avatar, phone and underlined email. */

/* Quote dialog — same style as the contact dialog: centred on screen, above
   the dark overlay. It used to be a drawer opening from the right; now that
   the catalog is centred, a panel coming from the right edge looked unbalanced. */
.quote.open {
  left: 50%;
  right: auto;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  height: auto;
  /* Widened for the two-column form: with the short fields (email/phone,
     PO/attachment) side by side on one row the form becomes noticeably shorter. */
  width: 580px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px rgba(32, 36, 52, .34);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  animation: quoteIn .22s var(--ease-soft);
  z-index: 71;
}

/* Drawer layout: title fixed at the top, fields scroll in the middle,
   actions fixed at the bottom. Scrolling the whole panel left a wide empty
   white area at the bottom of a short form and "Send request" hung in the
   middle of the screen. */
.quote.open .quote-body {
  /* Grow with the content, shrink if needed — but do not shrink by itself
     first and make the form scroll for nothing. */
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.quote.open .quote-title { flex: 0 0 auto; }
.quote.open .quote-form {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;

  /* Two columns: short fields pair up, long fields span the row. */
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px 16px;
  align-content: start;
}
/* Spanning the row: product picker, notes, attachment and the bottom bar. */
.quote.open .quote-form > .product-picker,
.quote.open .quote-form > .attachment-field,
.quote.open .quote-form > .quote-footer,
.quote.open .quote-form > label:has(textarea),
/* With PO alone, the cell to its right was empty and the row looked ragged;
   spanning the row looks neater. */
.quote.open .quote-form > label:has([name="poNo"]) { grid-column: 1 / -1; }

/* The INPUTS of fields on the same row should line up. Label texts differ
   in length (like "PO number optional"), so aligning to the top was not
   enough; cells are aligned to the bottom so the inputs sit on one line. */
.quote.open .quote-form > label { justify-content: flex-end; }

/* On a narrow screen two columns are cramped; it switches to one column. */
@media (max-width: 620px) {
  .quote.open { width: 420px; }
  .quote.open .quote-form { grid-template-columns: 1fr; }
}
/* Bottom bar. The negative margins and sticky positioning left over from
   the drawer period did not work in the dialog: the bar grew to 450 px,
   overflowed the 420 px box and hung below it. The dialog is sized by its
   content, so a normal block in the flow is enough for the bar. */
.quote.open .quote-footer {
  margin: 0;
  padding: 14px 0 0;
  position: static;
  border-top: 1px solid var(--ndi-border);
}
.quote.open .quote-footer .quote-note { margin-bottom: 0; }
.quote.open .quote-trigger { display: none; }
.quote.open .quote-thanks { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* Only opacity is animated. When transform was touched, the dialog stayed
   at an intermediate position and drifted off centre whenever the
   transition did not progress. */
@keyframes quoteIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* The right column was removed: .quote is now only the quote drawer that
   opens. When closed it takes no space and the catalog sits in the middle
   of the page. */
.quote:not(.open) { display: none; }

/* ── Product card preview ────────────────────────────────────────────────
   After hovering over a card for half a second, that card is cropped from
   the page's own 2600 px image and enlarged; no separate image is downloaded.

   The frame has two layers: the outer box carries padding/shadow/corners,
   the inner layer only the picture. With a single layer the crop touched
   the box edge and looked like a piece of a screenshot. It starts at 68
   because the right arrow is at 14 px. */

.card-preview {
  position: fixed;
  right: 68px;
  z-index: 60;
  padding: 9px;
  border-radius: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  box-shadow:
    0 1px 2px rgba(32, 36, 52, .10),
    0 24px 56px rgba(32, 36, 52, .22);
  pointer-events: none;
  animation: previewIn .16s ease-out;
}
.card-preview.hidden { display: none !important; }

/* Small tip pointing at the card: shows where the preview comes from. */
.card-preview::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 2px 0 0 0;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: translateY(-50%) rotate(-45deg);
}

.card-preview-inner {
  display: block;
  border-radius: 8px;
  background-repeat: no-repeat;
  background-color: #fff;
  /* Makes the edge of the cropped area clearer; the card background is white,
     so without a frame it was not clear where it ended. */
  box-shadow: inset 0 0 0 1px rgba(32, 36, 52, .10);
}

/* Opacity only: transform is not used because position animations in this
   project froze at an intermediate value several times and left the
   element in the wrong place. */
@keyframes previewIn { from { opacity: 0; } to { opacity: 1; } }

/* No room on a narrow screen; touch devices have no hover anyway. */
@media (max-width: 1180px) {
  .card-preview { display: none !important; }
}

/* ── Toast ───────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottombar-h) + 22px);
  z-index: 70;
  transform: translate(-50%, 12px);
  padding: 9px 17px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }


/* If one row does not fit, first the label and then the button texts are dropped; on phones the groups stack. */
@media (max-width: 1100px) { .tool-label { display: none; } }
@media (max-width: 960px) { .tool-btn span { display: none; } }
@media (max-width: 820px) { .toolbar { flex-wrap: wrap; } }

/* Hide-interface mode */
body.ui-hidden .toolbar { opacity: 0; pointer-events: none; transform: translate(-12px, -50%); }
@media (max-width: 820px) {
  body.ui-hidden .toolbar { transform: translateY(12px); }
}


/* MOBILE-PATCH */
/* ── Phone + tablet ───────────────────────────────────────────────────────
   The 372 px reserved for the old right column was removed: below 1180 px
   only 66 px remains on each side for the arrows. On phones (<=820) the
   arrows are hidden (pages turn by swiping), the margins drop to 8 px and
   the toolbar becomes a single-row bottom bar. */
@media (max-width: 1180px) { :root { --right-area: 66px; } }

#btnLinks { position: relative; }
.link-badge {
  position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 600;
  line-height: 17px; text-align: center; pointer-events: none;
}
@media (hover: hover) and (min-width: 1181px) { #btnLinks { display: none; } }

.link-panel {
  position: fixed; z-index: 95; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(560px, 100vw); max-height: 78vh; display: flex; flex-direction: column;
  background: var(--bg-2); border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.18);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: transform .28s var(--ease-soft), opacity .2s;
}
.link-panel.hidden { transform: translate(-50%, 104%); opacity: 0; pointer-events: none; }
#linkPanelOverlay { z-index: 94; }
.lp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 18px; }
.lp-head strong { font-size: 16px; font-weight: 600; color: var(--text); }
.lp-list { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 14px 18px; }
.lp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.lp-card { display: block; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--border); }
.lp-card:active { transform: scale(.98); }
.lp-image { display: block; width: 100%; background-repeat: no-repeat; }
.lp-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 48px; padding: 0 14px; margin-bottom: 8px; border-radius: 12px;
  background: #fff; border: 1px solid var(--border); color: var(--text);
  font-size: 14px; font-weight: 500; text-decoration: none;
}
.lp-row svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lp-sep { margin: 6px 2px 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.lp-empty { color: var(--text-muted); font-size: 14px; padding: 8px 4px 20px; }

@media (max-width: 820px) {
  :root { --tool-area: 8px; --right-area: 8px; --tool-height: 76px; }
  .arrow { display: none; }
  .toolbar {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    flex-wrap: nowrap; gap: 4px; max-width: calc(100vw - 12px);
  }
  .tool-group, .tool-group-cta { min-height: 48px; padding: 3px; gap: 1px; }
  #btnPrint, #btnFullscreen, #btnBackToStart, #btnSite { display: none; }
  .toolbar .icon-btn { width: 40px; height: 40px; }
  .tool-btn { padding: 0 10px; height: 40px; }
  .counter-input { width: 38px; }
}
