/* C&W Seals: gasket builder page (gasket-builder.php). The tool, what happens next, file formats. */

/* ================= the tool ================= */
.bld { --bld-top: 88px; --bld-chrome: 196px; padding-block: clamp(64px, 7vw, 112px); scroll-margin-top: 40px; }
.bld .head { margin-bottom: clamp(28px, 3vw, 44px); }
.bld-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(24px, 3vw, 52px); align-items: start; }

/* no JavaScript: a note and the contact route instead of the tool */
.bld-nojs { display: none; }
.no-js .bld-nojs { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(28px, 4vw, 72px); align-items: center; padding: clamp(20px, 3vw, 40px); background: var(--paper); border: 1px solid var(--line); }
.no-js .bld-grid { display: none; }
.bld-nojs__copy { display: grid; gap: 16px; }
.bld-nojs__media .frame__img { aspect-ratio: 16 / 10; max-height: var(--media-cap); }
@media (max-width: 900px) { .no-js .bld-nojs { grid-template-columns: 1fr; } }

/* ---------- controls ---------- */
.bld-form { display: grid; gap: 22px; padding: clamp(18px, 2vw, 30px); background: var(--paper); border: 1px solid var(--line); border-radius: 2px; box-shadow: 0 30px 60px -48px rgba(6, 35, 41, .45); }
.bld-set { min-width: 0; margin: 0; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); display: grid; gap: 16px; }
.bld-set--first { padding-top: 0; border-top: 0; }
.bld-set[hidden], .bld-set [hidden] { display: none !important; }
.bld-legend { float: left; width: 100%; padding: 0; margin: 0 0 2px; font-size: .9rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--petrol); }
.bld-legend + * { clear: both; }
.bld-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; align-items: start; }
.bld-sub { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; align-items: start; }
.bld-f--wide { grid-column: 1 / -1; }

.bld-f { gap: 6px; }
.bld-f .bld-rng { margin: -6px 0 -8px; }
.bld-f .field__label { font-size: .92rem; line-height: 1.3; }
.bld-f .field__hint { margin: 0; font-size: .9rem; line-height: 1.4; }
.bld-f.is-off { opacity: .45; }
.bld-in { position: relative; }
.bld-in .input { min-height: 48px; padding: 10px 50px 10px 14px; font-family: var(--f-mono); font-weight: 500; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.bld-in .input::-webkit-outer-spin-button, .bld-in .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bld-unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: .9rem; color: var(--steel); pointer-events: none; }
.bld-f .select { min-height: 48px; }

/* sliders: a petrol track that fills, a thumb drawn like the crosshair ring */
.bld-rng { --p: 50%; -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
.bld-rng:focus { outline: none; }
.bld-rng::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--petrol), var(--petrol)) 0 0 / var(--p) 100% no-repeat, rgba(8, 99, 118, .16); }
.bld-rng::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; border: 2px solid var(--petrol); background: radial-gradient(circle, var(--petrol) 0 2.5px, #fff 3px); box-shadow: 0 2px 6px rgba(6, 35, 41, .2); transition: transform .25s var(--ease-out); }
.bld-rng:active::-webkit-slider-thumb { transform: scale(1.15); }
.bld-rng::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(8, 99, 118, .16); }
.bld-rng::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--petrol); }
.bld-rng::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--petrol); background: radial-gradient(circle, var(--petrol) 0 2.5px, #fff 3px); }
.bld-f.has-error .bld-rng::-webkit-slider-thumb { border-color: #b3261e; }

/* segmented control: an ink block slides under the chosen option */
.bld-seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; background: #fff; border: 1.5px solid rgba(6, 35, 41, .22); border-radius: 2px; }
.bld-seg__opt { position: relative; z-index: 1; display: block; cursor: pointer; }
.bld-seg__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.bld-seg__opt > span { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 8px 10px; text-align: center; font-weight: 600; font-size: .96rem; line-height: 1.2; color: var(--ink); background-color: #fff;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%); transition: color .35s var(--ease-out), background-color .35s var(--ease-out); }
.bld-seg__opt svg { width: 22px; height: 22px; flex: none; }
.bld-seg__opt input:checked + span { color: #fff; background-color: var(--ink); }
.bld-seg__opt:hover input:not(:checked) + span { color: var(--petrol); }
.bld-seg__opt input:focus-visible + span { outline: 2px solid var(--petrol); outline-offset: -4px; }
.bld-seg__opt input:checked:focus-visible + span { outline-color: var(--mint); }
.bld-cols--gap { margin-top: 2px; }

/* examples */
.bld-ex { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bld-ex__lab { margin-right: 4px; font-size: .95rem; color: var(--steel); }
.bld-chip { min-height: 44px; padding: 8px 14px; background: transparent; border: 1.5px solid rgba(8, 99, 118, .32); border-radius: 2px; cursor: pointer; font-weight: 500; font-size: .92rem; line-height: 1.2; color: var(--ink); transition: background-color .25s, border-color .25s, color .25s; }
.bld-chip:hover { background: var(--film); border-color: var(--petrol); color: var(--petrol); }
.bld-chip:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }

/* switch */
.bld-switch { position: relative; display: inline-flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-weight: 500; }
.bld-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.bld-switch__track { position: relative; flex: none; width: 46px; height: 26px; border-radius: 13px; background: rgba(8, 99, 118, .22); transition: background-color .3s var(--ease-out); }
.bld-switch__track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(6, 35, 41, .3); transition: transform .4s var(--ease-out); }
.bld-switch input:checked + .bld-switch__track { background: var(--petrol); }
.bld-switch input:checked + .bld-switch__track::after { transform: translateX(20px); }
.bld-switch input:focus-visible + .bld-switch__track { outline: 2px solid var(--petrol); outline-offset: 3px; }

.bld-foot { margin: 0; font-size: .95rem; color: var(--steel); }
.bld-foot .tlink { display: flex; width: max-content; max-width: 100%; margin-top: 2px; min-height: 44px; }

/* ---------- the drawing ---------- */
.bld-view { position: sticky; top: var(--bld-top); display: grid; gap: 14px; }
.bld-fig { position: relative; display: grid; gap: 12px; }
.bld-paper { position: relative; width: min(100%, calc((100vh - var(--bld-top) - 20px - var(--bld-chrome)) * 4 / 3)); margin-inline: auto; filter: drop-shadow(0 26px 30px rgba(6, 35, 41, .16)); }
@supports (height: 100svh) { .bld-paper { width: min(100%, calc((100svh - var(--bld-top) - 20px - var(--bld-chrome)) * 4 / 3)); } }
.bld-svg { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; background: var(--paper); outline: 1px solid rgba(8, 99, 118, .25);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%); }
.bld-svg text { user-select: none; -webkit-user-select: none; }
@media (hover: hover) and (pointer: fine) { .bld-svg { cursor: crosshair; } }

.js:not(.rm):not(.no-motion) .bld-paper[data-bcut] { clip-path: inset(0% 100% 0% 0%); }
.no-motion .bld-paper[data-bcut] { clip-path: none !important; }

.bld-msg { position: absolute; left: 12px; top: 12px; right: 12px; display: grid; gap: 6px; justify-items: start; pointer-events: none; }
.bld-msg:empty { display: none; }
.bld-msg__i { max-width: min(62ch, 78%); padding: 9px 12px 9px 13px; background: #fff; border-left: 3px solid #b3261e; box-shadow: 0 10px 24px -12px rgba(6, 35, 41, .4); font-size: .9rem; line-height: 1.4; font-weight: 500; color: var(--ink); }
.bld-msg__i--warn { border-left-color: var(--petrol); font-weight: 400; }

.bld-coord { position: absolute; right: 12px; top: 12px; padding: 5px 10px; background: var(--ink); color: #fff; font-size: .9rem; line-height: 1.3; white-space: pre; opacity: 0; transform: translateY(-4px); transition: opacity .25s, transform .35s var(--ease-out); pointer-events: none; }
.bld-coord.is-on { opacity: 1; transform: none; }

.bld-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border-block: 1px solid var(--line); background: rgba(247, 250, 249, .7); }
.bld-figs > div { padding: 10px 14px 12px; min-width: 0; }
.bld-figs > div + div { border-left: 1px solid var(--line); }
.bld-figs dt { font-size: .9rem; line-height: 1.3; color: var(--steel); }
.bld-figs dd { margin: 2px 0 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; }
.bld-figs .mono { font-size: clamp(1.1rem, 1.45vw, 1.45rem); line-height: 1.2; color: var(--ink); transition: color .5s var(--ease-out); }
.bld-figs__u { font-size: .9rem; color: var(--steel); }
.bld-figs .is-hot .mono { color: var(--petrol-2); }

.bld-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bld-acts .btn[disabled] { opacity: .42; cursor: not-allowed; }
.bld-send { margin-left: auto; }
.bld-note { flex-basis: 100%; min-height: 1.5em; margin: 0; font-size: .92rem; line-height: 1.4; color: var(--steel); }

/* ---------- tablet and phone: drawing on top and kept in view, controls below ---------- */
@media (max-width: 960px) {
  .bld { --bld-top: 78px; }
  .bld-grid { display: flex; flex-direction: column; gap: 18px; }
  .bld-view { display: contents; }
  .bld-fig { order: 0; position: sticky; top: var(--bld-top); z-index: 5; gap: 8px; margin-inline: calc(-1 * var(--gutter)); padding: 10px var(--gutter); background: var(--film); box-shadow: 0 16px 22px -20px rgba(6, 35, 41, .5); }
  .bld-paper { width: min(100%, calc(33vh * 4 / 3)); filter: none; }
  .bld-form { order: 1; }
  .bld-acts { order: 2; }
  .bld-figs > div { padding: 6px 8px 8px; }
  .bld-figs dt { font-size: .9rem; line-height: 1.2; }
  .bld-figs .mono { font-size: 1rem; }
  .bld-figs__u { font-size: .9rem; }
  .bld-msg { left: 8px; top: 8px; right: 8px; }
  .bld-msg__i { max-width: 100%; padding: 6px 9px; font-size: .9rem; line-height: 1.3; }
  .bld-coord { display: none; }
  .bld-form input, .bld-form select { scroll-margin-top: calc(var(--bld-top) + 33vh + 110px); }
  .bld-send { margin-left: 0; }
}
@supports (height: 100svh) {
  @media (max-width: 960px) {
    .bld-paper { width: min(100%, calc(33svh * 4 / 3)); }
    .bld-form input, .bld-form select { scroll-margin-top: calc(var(--bld-top) + 33svh + 110px); }
  }
}
@media (max-width: 460px) {
  .bld-cols, .bld-sub { grid-template-columns: 1fr; }
  .bld-seg__opt > span { gap: 7px; font-size: .9rem; padding: 8px 6px; }
  .bld-seg__opt svg { width: 18px; height: 18px; }
  .bld-acts .btn { flex: 1 1 auto; justify-content: center; }
}

/* ================= what happens next ================= */
.bsteps { padding-block: clamp(64px, 6.5vw, 104px); color: #fff; }
.bsteps .lede { color: rgba(255, 255, 255, .86); }
.bsteps .crop::before, .bsteps .crop::after { background: var(--mint); }
.bsteps__rail { position: relative; display: block; height: 36px; margin-bottom: 16px; }
.bsteps__ticks { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(18px, 2vw, 32px); align-items: center; }
.bsteps__track { position: absolute; left: 0; right: 0; top: 50%; border-top: 1.5px dashed rgba(169, 195, 197, .38); }
.bsteps__line { position: absolute; left: 0; right: 0; top: calc(50% - 1px); height: 2px; background: var(--laser); transform-origin: 0 50%; box-shadow: 0 0 10px rgba(255, 74, 50, .7); }
.bsteps__tick { position: relative; display: block; width: 14px; height: 14px; }
.bsteps__tick::before, .bsteps__tick::after { content: ""; position: absolute; background: var(--mint); }
.bsteps__tick::before { left: 0; right: 0; top: 6px; height: 2px; }
.bsteps__tick::after { top: 0; bottom: 0; left: 6px; width: 2px; }
.bsteps__x { position: absolute; left: 0; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; color: var(--laser); filter: drop-shadow(0 0 6px rgba(255, 74, 50, .8)); }
.rm .bsteps__x, .no-js .bsteps__x, .no-motion .bsteps__x { left: 100%; }
.bsteps__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(18px, 2vw, 32px); }
.bstep { min-width: 0; }
.bstep__media .frame__img { aspect-ratio: 3 / 2; }
.bstep__top { display: flex; align-items: baseline; gap: 12px; margin: 22px 0 10px; }
.bstep__n { flex: none; font-size: 1.1rem; color: var(--mint); }
.bstep p { margin: 0; font-size: 1rem; line-height: 1.6; color: var(--fog); }
@media (max-width: 1100px) {
  .bsteps__rail { display: none; }
  .bsteps__list { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
}
@media (max-width: 600px) { .bsteps__list { grid-template-columns: 1fr; } }

/* ================= other files we take ================= */
.bfiles { padding-block: clamp(64px, 6.5vw, 104px); }
.bfiles__grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(32px, 5vw, 88px); align-items: center; }
.bfiles__copy { display: grid; gap: 24px; min-width: 0; }
.bfiles__fmts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; perspective: 900px; }
.bfiles__fmt { position: relative; padding: 16px 16px 18px; background: #fff; box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%); }
.bfiles__fmt::after { content: ""; position: absolute; top: 0; right: 0; width: 18px; height: 18px; background: linear-gradient(45deg, rgba(8, 99, 118, .22) 50%, transparent 50%); }
.bfiles__ext { display: block; font-family: var(--f-display); font-weight: 720; font-size: clamp(1.8rem, 2.5vw, 2.5rem); line-height: 1; font-variation-settings: "wdth" 93; color: var(--petrol); transition: font-variation-settings .6s var(--ease-out); }
.bfiles__fmt:hover .bfiles__ext { font-variation-settings: "wdth" 104; }
.bfiles__what { display: block; margin-top: 10px; font-size: .92rem; line-height: 1.4; color: var(--steel); }
.bfiles__more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 32px; padding-top: 22px; border-top: 1px solid var(--line); }
.bfiles__more .h3 { margin-bottom: 8px; }
.bfiles__more p { margin: 0; font-size: 1rem; }
.bfiles__media { width: min(100%, var(--media-cap)); justify-self: end; }
.bfiles__media .frame__img { aspect-ratio: 1 / 1; }
@media (max-width: 1000px) {
  .bfiles__grid { grid-template-columns: 1fr; }
  .bfiles__media { justify-self: start; }
  .bfiles__media .frame__img { aspect-ratio: 4 / 3; }
}
@media (max-width: 700px) {
  .bfiles__fmts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bfiles__more { grid-template-columns: 1fr; }
}
