/*
 * KT Stone calculator component. Every rule is scoped to .ktc so nothing leaks
 * into the theme. Colours and type use the theme's tokens where present, with
 * the approved KT Stone palette as fallback.
 */
.ktc {
  --ktc-ink: var(--ink, #181818);
  --ktc-muted: var(--muted, #666662);
  --ktc-border: var(--border, #dadad5);
  --ktc-surface: var(--surface, #ffffff);
  --ktc-alt: var(--alt, #efefeb);
  --ktc-dark: var(--dark, #20201e);
  --ktc-gold: var(--gold, #daa14c);
  --ktc-danger: #9b2b20;
  --ktc-sans: var(--sans, "Helvetica Neue", Helvetica, Arial, sans-serif);
  --ktc-serif: var(--serif, Charter, "Bitstream Charter", "Sitka Text", Georgia, serif);
  color: var(--ktc-ink);
  font-family: var(--ktc-sans);
  font-size: 1rem;
  line-height: 1.55;
}
.ktc *, .ktc *::before, .ktc *::after { box-sizing: border-box; }
.ktc [hidden] { display: none !important; }

.ktc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.ktc-form { min-width: 0; }

.ktc-progress { height: 3px; background: var(--ktc-border); margin-bottom: 1rem; }
.ktc-progress span { display: block; height: 100%; width: 20%; background: var(--ktc-ink); transition: width 240ms ease; }
.ktc-step-label { margin: 0 0 1.5rem; color: var(--ktc-muted); font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.ktc-step-title:focus { outline: none; }
.ktc-step-title:focus-visible { outline: 2px solid var(--ktc-ink); outline-offset: 4px; }
.ktc-step-title { margin: 0 0 1.5rem; font-family: var(--ktc-serif); font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 400; line-height: 1.1; }

.ktc-field { margin: 0 0 1.5rem; padding: 0; border: 0; min-width: 0; }
.ktc-field legend, .ktc-field > label, .ktc-grid-2 label, .ktc-grid-3 label, .ktc-grid-4 label, .ktc-piece label {
  display: block; margin-bottom: .55rem; font-size: .76rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.ktc-optional { color: var(--ktc-muted); font-weight: 400; letter-spacing: 0; text-transform: none; }
.ktc input[type="text"], .ktc input[type="email"], .ktc input[type="tel"], .ktc input[type="number"], .ktc select, .ktc textarea {
  width: 100%; min-height: 3rem; padding: .7rem .85rem; border: 1px solid var(--ktc-border); border-radius: 0;
  background: var(--ktc-surface); color: var(--ktc-ink); font: inherit;
}
.ktc textarea { min-height: 6rem; resize: vertical; }
/* The native file control is only as tall as its button (~25px). The whole
   control is the click/tap target, so it gets the same 48px height as the
   other fields. Accepted types, size limit and validation are unchanged. */
.ktc input[type="file"] {
  display: block; width: 100%; min-height: 3rem; padding: .4rem .5rem; border: 1px solid var(--ktc-border); border-radius: 0;
  background: var(--ktc-surface); color: var(--ktc-ink); font: inherit; font-size: .9rem; line-height: 2.1rem; cursor: pointer;
}
.ktc input[type="file"]::file-selector-button {
  min-height: 2.25rem; margin-right: .85rem; padding: .35rem 1rem; border: 1px solid var(--ktc-ink); border-radius: 0;
  background: var(--ktc-surface); color: var(--ktc-ink); font: inherit; font-size: .76rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
}
.ktc input[type="file"]:hover::file-selector-button { background: var(--ktc-ink); color: #fff; }
.ktc input:focus-visible, .ktc select:focus-visible, .ktc textarea:focus-visible, .ktc-btn:focus-visible {
  outline: 2px solid var(--ktc-ink); outline-offset: 2px;
}
/* Option boxes and colour tiles: the ring appears for keyboard focus only (a
   click shows the selected state instead) and is drawn inside the box, so it
   never overlaps a neighbour's hairline or gets clipped by the scrolling grid. */
.ktc-option:has(input:focus-visible), .ktc-colour:has(input:focus-visible) { outline: 2px solid var(--ktc-ink); outline-offset: -2px; }
.ktc-option:has(input:checked):has(input:focus-visible) { outline-color: #fff; outline-offset: -5px; }
.ktc [aria-invalid="true"] { border-color: var(--ktc-danger); }
.ktc-error { min-height: 0; margin: .4rem 0 0; color: var(--ktc-danger); font-size: .85rem; }
.ktc-error:empty { display: none; }
.ktc-hint, .ktc-note { margin: .4rem 0 0; color: var(--ktc-muted); font-size: .9rem; }
.ktc-note-disabled { padding: .9rem 1rem; border: 1px solid var(--ktc-border); background: var(--ktc-alt); }
.ktc-sr, .ktc-hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ktc-options { display: grid; gap: 1px; border: 1px solid var(--ktc-border); background: var(--ktc-border); }
/* Option counts vary (2-3 thicknesses, 4 materials, 6 layouts), so grids fill
   the row instead of leaving empty cells showing the hairline background. */
.ktc-options-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ktc-options-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.ktc-options-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ktc-option { position: relative; display: flex; min-height: 4.25rem; padding: 1rem; background: var(--ktc-surface); cursor: pointer; }
.ktc-option input { position: absolute; opacity: 0; pointer-events: none; }
.ktc-option span { display: grid; gap: .2rem; }
.ktc-option strong { font-size: .95rem; font-weight: 600; }
.ktc-option small { color: var(--ktc-muted); font-size: .82rem; }
.ktc-option:has(input:checked) { background: var(--ktc-dark); color: #fff; }
.ktc-option:has(input:checked) small { color: rgba(255, 255, 255, .72); }

/* Colours are text cards: no third-party imagery is loaded. A card shows an
   image only when an authorised same-site one is configured. */
.ktc-colour-tools { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: end; justify-content: space-between; margin-bottom: .75rem; }
.ktc-colour-tools .ktc-hint { margin: 0 0 .8rem; }
.ktc-colour-search { flex: 1 1 240px; max-width: 360px; }
.ktc-colour-search label { display: block; margin-bottom: .55rem; font-size: .76rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.ktc input[type="search"] { width: 100%; min-height: 3rem; padding: .7rem .85rem; border: 1px solid var(--ktc-border); border-radius: 0; background: var(--ktc-surface); color: var(--ktc-ink); font: inherit; }
.ktc input[type="search"]:focus-visible { outline: 2px solid var(--ktc-ink); outline-offset: 2px; }
/* Each card draws its own right and bottom hairline, so a part-filled last row
   ends cleanly instead of showing empty grey cells. */
.ktc-colours { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: 520px; overflow-y: auto; border-top: 1px solid var(--ktc-border); border-left: 1px solid var(--ktc-border); background: var(--ktc-surface); }
.ktc-colour { position: relative; display: grid; align-content: start; gap: 0; padding: .55rem .55rem .7rem; border-right: 1px solid var(--ktc-border); border-bottom: 1px solid var(--ktc-border); background: var(--ktc-surface); cursor: pointer; }
.ktc-colour[hidden] { display: none; }
.ktc-colour input { position: absolute; opacity: 0; pointer-events: none; }
/* Swatch tile: the Stone record photo, or a flat tile where none exists yet. A
   2px ink ring marks the chosen colour; the card itself never fills or rounds. */
.ktc-swatch { display: block; width: 100%; aspect-ratio: 1; overflow: hidden; background: var(--ktc-alt); outline: 0 solid var(--ktc-ink); outline-offset: -2px; transition: outline-width .12s ease; }
.ktc-swatch img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ktc-swatch.is-blank { display: grid; place-items: center; background: var(--ktc-alt); }
.ktc-swatch.is-blank::after { content: attr(data-initial); color: var(--ktc-muted); font-family: var(--ktc-serif); font-size: 2.4rem; line-height: 1; opacity: .55; }
.ktc-chosen .ktc-swatch.is-blank::after { font-size: 1.6rem; }
.ktc-colour-text { display: grid; gap: .15rem; padding-top: .6rem; }
.ktc-colour-name { font-size: .88rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.ktc-colour-meta { color: var(--ktc-muted); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
.ktc-colour:hover .ktc-swatch { outline-width: 1px; }
/* Selected colour: the card itself is ringed (always visible on the white card,
   whatever the stone), and the photo gets a two-tone edge — ink outside, white
   inside — so dark stones read as clearly as light ones. */
.ktc-colour:has(input:checked) { outline: 2px solid var(--ktc-ink); outline-offset: -2px; }
.ktc-colour:has(input:checked) .ktc-swatch { outline-width: 2px; }
.ktc-swatch { position: relative; }
.ktc-swatch::after { content: ""; position: absolute; inset: 2px; pointer-events: none; box-shadow: inset 0 0 0 0 #fff; transition: box-shadow .12s ease; }
.ktc-colour:has(input:checked) .ktc-swatch::after { box-shadow: inset 0 0 0 2px #fff; }
.ktc-colour:has(input:checked):has(input:focus-visible) { outline-width: 3px; }
/* The chosen colour repeated beside the estimate. */
.ktc-chosen { display: grid; grid-template-columns: 4.5rem 1fr; gap: .9rem; align-items: center; margin: 0 0 1rem; padding: .9rem 0; border-top: 1px solid var(--ktc-border); border-bottom: 1px solid var(--ktc-border); }
.ktc-chosen .ktc-colour-text { padding-top: 0; }

.ktc-pieces { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
.ktc-piece { padding: 1rem; border: 1px solid var(--ktc-border); background: var(--ktc-surface); }
.ktc-piece h3 { margin: 0 0 .8rem; font-size: .95rem; font-weight: 600; }
.ktc-grid-2, .ktc-grid-3, .ktc-grid-4 { display: grid; gap: 0 1rem; }
.ktc-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ktc-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ktc-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ktc-extra { margin-bottom: 1rem; padding: 1rem 1rem 0; border-left: 2px solid var(--ktc-ink); background: var(--ktc-alt); }

.ktc-message { margin-bottom: 1.25rem; padding: .9rem 1rem; border: 1px solid var(--ktc-danger); color: var(--ktc-danger); background: #fff; }
.ktc-nav { display: flex; gap: .75rem; justify-content: flex-end; padding-top: 1rem; border-top: 1px solid var(--ktc-border); }
.ktc-btn {
  display: inline-flex; min-height: 3.2rem; align-items: center; justify-content: center; padding: .75rem 1.5rem;
  border: 1px solid var(--ktc-ink); border-radius: 0; background: var(--ktc-ink); color: #fff; font: inherit;
  font-size: .8rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
}
.ktc-btn:hover { background: transparent; color: var(--ktc-ink); }
.ktc-btn-ghost { background: transparent; color: var(--ktc-ink); }
.ktc-btn[disabled], .ktc-btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; }

.ktc-summary { position: sticky; top: 1.5rem; padding: 1.5rem; border: 1px solid var(--ktc-border); background: var(--ktc-surface); }
.ktc-layout-form-only { grid-template-columns: minmax(0, 1fr); }
.ktc-layout-form-only .ktc-form { max-width: 920px; width: 100%; margin-inline: auto; }
.ktc-summary-label { margin: 0; color: var(--ktc-muted); font-size: .76rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.ktc-summary-amount { margin: .3rem 0; font-family: var(--ktc-serif); font-size: clamp(2.2rem, 4vw, 3rem); line-height: 1; }
.ktc-summary-note { margin: 0 0 1rem; color: var(--ktc-muted); font-size: .85rem; }
.ktc-breakdown { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ktc-border); }
.ktc-breakdown li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--ktc-border); font-size: .9rem; }

.ktc-success { max-width: 640px; padding: clamp(1.5rem, 4vw, 3rem); border: 1px solid var(--ktc-border); background: var(--ktc-surface); }
.ktc-success-ref { color: var(--ktc-muted); }
.ktc-contact { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.ktc-contact a { color: var(--ktc-ink); font-weight: 600; }

@media (max-width: 1080px) {
  .ktc-layout { grid-template-columns: 1fr; }
  .ktc-summary { position: static; order: -1; }
}
@media (max-width: 820px) {
  .ktc-options-4, .ktc-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ktc-options-3, .ktc-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .ktc-options-2, .ktc-options-3, .ktc-options-4, .ktc-grid-2, .ktc-grid-3 { grid-template-columns: 1fr; }
  .ktc-colours { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 380px; }
  .ktc-colour { padding: .75rem; }
  .ktc-colour-search { max-width: none; }
  .ktc-nav { position: static; background: var(--ktc-surface); padding-bottom: .75rem; }
  .ktc-nav .ktc-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ktc-progress span { transition: none; }
}

/* Consent (UK GDPR) */
.ktc-consent{display:grid;grid-template-columns:auto 1fr;gap:.35rem .65rem;align-items:start}
.ktc-consent input{margin-top:.3rem;width:1.1rem;height:1.1rem}
.ktc-consent label{font-size:.92rem;line-height:1.5}
.ktc-consent .ktc-error{grid-column:1 / -1}
.ktc-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Success panel: WhatsApp in its brand green with the logo. */
.ktc-contact .ktc-whatsapp{display:inline-flex;align-items:center;gap:.45rem;color:#1a8f4e}
.ktc-contact .ktc-whatsapp svg{flex:0 0 auto;color:#25d366}
.ktc-contact .ktc-whatsapp:hover{color:#147a41}

/* Original KT Stone visual option illustrations. */
.ktc-visual-field{margin-top:clamp(28px,4vw,48px)}
.ktc-options.ktc-visual-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:14px;border:0;background:transparent}
.ktc-options.ktc-visual-grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.ktc-visual-option{padding:0;min-height:178px;border:1px solid var(--ktc-border);overflow:hidden}
.ktc-visual-option{transition:border-color .2s,box-shadow .2s}
.ktc-visual-option:hover{border-color:var(--ktc-gold);box-shadow:0 0 0 1px var(--ktc-gold),0 8px 20px rgba(48,55,62,.08)}
.ktc-visual-option>span{width:100%;padding:0 12px 16px;text-align:center;align-content:start;background:#fff}
.ktc-visual-art{display:grid!important;place-items:center;width:calc(100% + 24px);height:auto;aspect-ratio:1;margin:0 -12px 14px;background:#f6f5f2;border-bottom:1px solid #e8e0d3;overflow:hidden}
.ktc-visual-art img{display:block;width:100%;height:100%;object-fit:contain}
.ktc .ktc-visual-option:has(input:checked){background:#fff;color:var(--ktc-ink);border-color:var(--ktc-gold);outline:2px solid var(--ktc-gold);outline-offset:-2px;box-shadow:0 0 0 1px var(--ktc-gold)}
.ktc .ktc-visual-option:has(input:checked):hover{border-color:var(--ktc-gold);outline-color:var(--ktc-gold);box-shadow:0 0 0 1px var(--ktc-gold),0 8px 20px rgba(48,55,62,.1)}
.ktc-visual-option:has(input:checked)::after{content:'\2713';position:absolute;top:9px;right:9px;display:grid;place-items:center;width:27px;height:27px;border-radius:50%;background:var(--ktc-gold);color:#fff;font-size:15px;font-weight:800;box-shadow:0 2px 8px rgba(0,0,0,.18)}
.ktc-visual-option:has(input:checked) .ktc-visual-art{background:linear-gradient(145deg,#f2e6d2,#fff8ea)}
.ktc-visual-option:has(input:checked) .ktc-visual-art{box-shadow:inset 0 0 0 3px var(--ktc-gold)}
.ktc-thickness-picker{display:grid;grid-template-columns:minmax(420px,540px) minmax(0,1fr);align-items:center;gap:26px;margin-top:10px}
.ktc-thickness-visual{margin:0;border:1px solid var(--ktc-border);border-radius:8px;overflow:hidden;background:#f6f5f2}
.ktc-thickness-visual img{display:block;width:100%;height:auto;aspect-ratio:543/234;object-fit:cover}
.ktc-thickness-visual figcaption{padding:8px 10px;background:#fff;color:var(--ktc-muted);font-size:12px;font-weight:700;text-align:center}
.ktc-thickness-picker-custom{margin:14px 0 18px}.ktc-thickness-picker-custom>.ktc-field{margin:0}
@media(max-width:700px){.ktc-thickness-picker{grid-template-columns:1fr;gap:12px}.ktc-thickness-visual figcaption{padding:7px;font-size:11px}.ktc-thickness-picker .ktc-options{grid-template-columns:repeat(2,minmax(0,1fr))}.ktc-thickness-picker-custom>.ktc-field label{font-size:13px}}
.ktc-existing-details{margin-top:32px;border:1px solid #e3d8c6;border-radius:12px;background:#fbfaf7;padding:0 20px}
.ktc-existing-details summary{cursor:pointer;padding:20px 34px 20px 0;font-weight:700;position:relative}
.ktc-existing-details summary::after{content:'+';position:absolute;right:0;top:13px;font:300 30px/1 serif;color:#b67b25}
.ktc-existing-details[open] summary::after{content:'\2212'}
.ktc-existing-details>.ktc-field{margin-top:4px}
@media(max-width:900px){.ktc-options.ktc-visual-grid,.ktc-options.ktc-visual-grid-4{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:600px){.ktc-options.ktc-visual-grid,.ktc-options.ktc-visual-grid-4{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.ktc-visual-option{min-height:0}.ktc-visual-option>span{padding:0 8px 12px}.ktc-visual-art{width:calc(100% + 16px);height:auto;margin:0 -8px 10px}.ktc-visual-art img{height:100%}.ktc-visual-option strong{font-size:13px}}

.ktc[data-flow="single-page"] .ktc-form{display:flex;flex-direction:column;max-width:1180px}
.ktc[data-flow="single-page"] .ktc-progress,.ktc[data-flow="single-page"] .ktc-step-label{display:none}
.ktc[data-flow="single-page"] .ktc-step{padding:clamp(26px,5vw,54px) 0;border-top:1px solid var(--ktc-border)}
.ktc[data-flow="single-page"] .ktc-step[data-step="2"]{order:1;border-top:0;padding-top:0}
.ktc[data-flow="single-page"] .ktc-step[data-step="1"]{order:2}
.ktc[data-flow="single-page"] .ktc-step[data-step="3"]{order:3}
.ktc[data-flow="single-page"] .ktc-step[data-step="4"]{order:4}
.ktc[data-flow="single-page"] .ktc-step[data-step="5"]{order:5}
.ktc[data-flow="single-page"] .ktc-message{order:0}
.ktc[data-flow="single-page"] .ktc-nav{order:6;justify-content:center}
.ktc[data-flow="single-page"] .ktc-nav .ktc-btn{min-width:240px;border-radius:999px}
.ktc[data-flow="single-page"] .ktc-layout-visual-grid{grid-template-columns:repeat(6,minmax(0,1fr))}
.ktc[data-flow="single-page"] .ktc-step{scroll-margin-top:110px}
.ktc[data-flow="single-page"] .ktc-consent label{font-size:14px!important;line-height:1.65!important;font-weight:500!important;letter-spacing:0!important;text-transform:none!important}
@media(max-width:900px){.ktc[data-flow="single-page"] .ktc-layout-visual-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:600px){.ktc[data-flow="single-page"] .ktc-layout-visual-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ktc[data-flow="single-page"] .ktc-consent label{font-size:13px!important;line-height:1.55!important}}
