/* =====================================================================
   DesignClass CFD — cfd.css  (v2.4: matches the 2026 site redesign)
   The colours, fonts and shapes below mirror the site's Elementor global
   classes (dc-hero, dc-titleblock, dc-btn, dc-tag, dc-card…), so the tool
   looks like part of detscotland.co.uk.
   ===================================================================== */
:root {
  /* --- Blueprint (dark) --- */
  --dc-navy: #0a1020;          /* hero, footer, 3D stage            */
  --dc-navy-2: #121b36;        /* dark cards                         */
  --dc-navy-3: #162142;
  --dc-line: rgba(160, 195, 255, .2);   /* hairlines on navy           */
  --dc-ink-soft: #c9d3ee;      /* body text on navy                  */
  --dc-ink-mute: #7186bb;      /* mono labels on navy                */
  --dc-cyan: #4fe3ff;          /* highlights / eyebrows              */
  /* --- Paper (light) --- */
  --dc-paper: #f4f2ec;         /* page background                   */
  --dc-card: #ffffff;
  --dc-text: #121726;          /* main text                          */
  --dc-muted: #4d566a;         /* secondary text                     */
  --dc-hair: rgba(18, 23, 38, .1);
  /* --- Accent --- */
  --dc-blue: #2448ff;
  --dc-blue-dark: #1630d6;
  --dc-red: #e0352b;
  --dc-warm: #ff8a2a;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 24px;
  --shadow: 0 0 0 1px var(--dc-hair) inset, 0 18px 40px -28px rgba(18, 23, 38, .35);
}

/* ---------- Fonts: local copies first, then the copies the site already hosts ---------- */
@font-face { font-family: 'Poppins'; font-weight: 400; font-display: swap; src: url('../vendor/fonts/poppins-latin-400-normal.woff2') format('woff2'), url('/wp-content/uploads/home-v2/fonts/poppins-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('../vendor/fonts/poppins-latin-500-normal.woff2') format('woff2'), url('/wp-content/uploads/home-v2/fonts/poppins-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url('../vendor/fonts/poppins-latin-600-normal.woff2') format('woff2'), url('/wp-content/uploads/home-v2/fonts/poppins-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-display: swap; src: url('../vendor/fonts/poppins-latin-700-normal.woff2') format('woff2'), url('/wp-content/uploads/home-v2/fonts/poppins-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 800; font-display: swap; src: url('../vendor/fonts/poppins-latin-800-normal.woff2') format('woff2'), url('/wp-content/uploads/home-v2/fonts/poppins-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap; src: url('../vendor/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2'), url('/wp-content/uploads/home-v2/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-display: swap; src: url('../vendor/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2'), url('/wp-content/uploads/home-v2/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2'); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  font-size: 15px; line-height: 1.55;
  color: var(--dc-text); background: var(--dc-paper);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--dc-blue); }
.small, small { font-size: 12.5px; }
.red { color: var(--dc-red); font-weight: 600; }
.blue { color: var(--dc-blue); font-weight: 600; }
.dc-wrap { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }

/* =====================================================================
   HERO — navy blueprint with drawing grid and blue glow (= .dc-hero)
   ===================================================================== */
.dc-hero {
  position: relative; color: #fff; background-color: var(--dc-navy);
  background-image:
    radial-gradient(50% 120% at 78% 30%, rgba(36, 72, 255, .38) 0%, rgba(36, 72, 255, 0) 70%),
    linear-gradient(rgba(120, 170, 255, .13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 170, 255, .13) 1px, transparent 1px),
    linear-gradient(rgba(120, 170, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 170, 255, .05) 1px, transparent 1px);
  background-size: 100% 100%, 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-top: 22px; padding-bottom: 22px; }
.hero-text { display: flex; flex-direction: column; align-items: flex-start; }
.brand-logo { display: block; line-height: 0; margin-bottom: 18px; }
.brand-logo img { height: 44px; width: auto; display: block; }
.dc-eyebrow {
  font-family: var(--mono); font-weight: 500; font-size: .78rem; color: var(--dc-cyan);
  letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px;
}
.hero-title {
  margin: 0; font-weight: 800; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1;
  letter-spacing: -0.035em; color: #fff;
}
.hero-title b { color: var(--dc-cyan); font-weight: 800; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .06); color: var(--dc-ink-soft);
  box-shadow: 0 0 0 1px rgba(160, 195, 255, .28) inset; display: grid; place-items: center;
  transition: background-color .2s, color .2s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover, .icon-btn:focus-visible { background: var(--dc-blue); color: #fff; }

/* ---------- Title block (= .dc-titleblock / .dc-tb-cell) ---------- */
.dc-titleblock { background: rgba(10, 16, 32, .6); border-top: 1px solid rgba(160, 195, 255, .28); }
.tb-row { display: flex; flex-wrap: wrap; }
.tb-cell {
  flex: 1 1 auto; min-width: 0; padding: 11px 16px;
  font-family: var(--mono); font-size: .78rem; color: var(--dc-ink-soft);
  border-left: 1px solid var(--dc-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-cell:last-child { flex: 0 0 auto; border-right: 1px solid var(--dc-line); }
.tb-cell b {
  display: block; font-weight: 500; font-size: .66rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--dc-ink-mute); margin-bottom: 2px;
}
.badge { color: var(--dc-ink-soft); }
.badge::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--dc-ink-mute); vertical-align: 1px; }
.badge.ok::before { background: #11b981; box-shadow: 0 0 0 3px rgba(17, 185, 129, .2); }
.badge.warn::before { background: var(--dc-warm); box-shadow: 0 0 0 3px rgba(255, 138, 42, .2); }
@media (max-width: 760px) { .tb-cell:nth-child(3), .tb-cell:nth-child(5) { display: none; } }

/* ---------- Banner ---------- */
.banner { padding: 12px clamp(16px, 3vw, 32px); background: #fff3e4; color: #6b3a07; border-bottom: 1px solid #f6d3a8; }
.banner.error { background: #fde8e6; border-color: #f2b8b1; color: #7d1d14; }
.banner.show { display: block; }

/* =====================================================================
   MAIN LAYOUT
   ===================================================================== */
.layout {
  display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px;
  padding: 18px clamp(16px, 3vw, 32px); max-width: 1600px; margin: 0 auto;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

/* ---------- Settings panel (= light .dc-level-card) ---------- */
.panel {
  position: relative; overflow: hidden; align-self: start;
  background: var(--dc-card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 20px 20px;
}
.panel::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--dc-blue); }
.step { padding: 16px 0; border-bottom: 1px solid var(--dc-hair); }
.step h2 {
  display: flex; align-items: center; gap: 12px; margin: 0 0 10px;
  font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; color: var(--dc-text);
}
.num {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--dc-blue); color: #fff; font-family: var(--mono); font-weight: 700; font-size: .75rem;
}
.hint { margin: 0 0 8px; color: var(--dc-muted); font-size: .9rem; }
.hint.small { font-size: .8rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.row label { font-weight: 500; }
.row label small { color: var(--dc-muted); font-weight: 400; }

.drop-zone {
  display: flex; align-items: center; gap: 14px; padding: 16px; cursor: pointer;
  border-radius: 16px; background: var(--dc-paper);
  box-shadow: 0 0 0 1.5px rgba(18, 23, 38, .18) inset;
  background-image: linear-gradient(rgba(36, 72, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(36, 72, 255, .06) 1px, transparent 1px);
  background-size: 16px 16px; transition: box-shadow .2s, background-color .2s;
}
.drop-zone svg { width: 34px; height: 34px; flex: none; color: #fff; background: var(--dc-blue); border-radius: 999px; padding: 7px; }
.drop-zone:hover, .drop-zone.drag, .drop-zone:focus-visible { box-shadow: 0 0 0 2px var(--dc-blue) inset; background-color: #eef1ff; outline: none; }
.drop-zone small { color: var(--dc-muted); }
.file-info { margin-top: 10px; font-size: .82rem; color: var(--dc-muted); background: var(--dc-paper); border-radius: 12px; padding: 10px 12px; }
.file-info b { color: var(--dc-text); font-weight: 600; }

.seg { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 4px; border-radius: 999px; background: var(--dc-paper); box-shadow: 0 0 0 1px var(--dc-hair) inset; }
.seg button {
  border: 0; border-radius: 999px; background: transparent; padding: 7px 0; cursor: pointer;
  font-family: var(--mono); font-weight: 700; font-size: .8rem; color: var(--dc-muted);
  transition: background-color .15s, color .15s;
}
.seg button.on { background: var(--dc-blue); color: #fff; box-shadow: 0 6px 14px -8px rgba(36, 72, 255, .9); }
.seg button:hover:not(.on) { background: #fff; color: var(--dc-text); }

select, input[type=number] {
  border: 0; border-radius: 12px; padding: 8px 10px; background: var(--dc-paper);
  box-shadow: 0 0 0 1px rgba(18, 23, 38, .14) inset; font-family: var(--mono); font-size: .88rem;
}
select:focus-visible, input[type=number]:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--dc-blue) inset; }
input[type=number] { width: 104px; }
.unit-input { display: inline-flex; align-items: center; gap: 8px; }
.unit-input input { width: 80px; }
.unit-input span { font-family: var(--mono); font-size: .8rem; color: var(--dc-muted); }

input[type=range] { width: 100%; accent-color: var(--dc-blue); }
.ticks { display: flex; justify-content: space-between; margin-top: -2px; font-family: var(--mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--dc-muted); }

.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #c9cfdb; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 2px 6px rgba(18, 23, 38, .25); }
.switch input:checked + span { background: var(--dc-blue); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(36, 72, 255, .3); }
.switch input:disabled + span { opacity: .4; cursor: not-allowed; }

/* ---------- Buttons (= .dc-btn) ---------- */
.btn {
  min-height: 52px; border: 0; border-radius: 999px; padding: .8em 1.45em; cursor: pointer;
  font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 1rem; line-height: 1.1;
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  transition: background-color .18s, color .18s, transform .18s, box-shadow .18s;
}
.btn.primary, .btn.export { background: var(--dc-blue); color: #fff; box-shadow: 0 10px 24px -10px rgba(36, 72, 255, .7); }
.btn.primary:hover:not(:disabled), .btn.export:hover:not(:disabled) { background: var(--dc-blue-dark); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn.primary { width: 100%; }
.btn.ghost { width: 100%; margin-top: 10px; background: transparent; color: var(--dc-text); box-shadow: 0 0 0 1.5px rgba(18, 23, 38, .25) inset; }
.btn.ghost:hover { background: var(--dc-paper); }

.run-box { padding-top: 18px; }
.progress { height: 6px; border-radius: 99px; background: var(--dc-paper); margin-top: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--dc-hair) inset; }
.progress div { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--dc-blue), var(--dc-cyan)); transition: width .2s; }
.status { margin: 10px 0 0; font-size: .82rem; color: var(--dc-muted); min-height: 38px; }

.history h2 { margin-top: 4px; }
.history table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.history th { font-family: var(--mono); font-weight: 500; font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dc-muted); }
.history th, .history td { text-align: left; padding: 6px 2px; border-bottom: 1px solid var(--dc-hair); }
.history td:last-child, .history th:last-child { text-align: right; }
.history td:last-child { font-family: var(--mono); font-weight: 700; }
.link-btn { margin-left: auto; border: 0; background: none; color: var(--dc-blue); cursor: pointer; font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }

/* =====================================================================
   3D STAGE — dark blueprint panel (= .dc-card on navy)
   ===================================================================== */
.stage {
  position: sticky; top: 18px; align-self: start;
  height: calc(100vh - 36px); min-height: 560px; max-height: 920px;
  border-radius: var(--radius); overflow: hidden; background: var(--dc-navy);
  box-shadow: 0 0 0 1px rgba(160, 195, 255, .16) inset, 0 30px 60px -30px rgba(18, 23, 38, .55);
}
@media (max-width: 900px) { .stage { position: relative; top: 0; height: 70vh; } }
.viewport { position: absolute; inset: 0; }
.viewport canvas { display: block; width: 100%; height: 100%; }

/* glassy dark overlays (= .dc-lens-callout) */
.chip, .slice-tools, .legend, .results {
  background: rgba(10, 16, 32, .82); color: var(--dc-ink-soft);
  box-shadow: 0 0 0 1px rgba(160, 195, 255, .3) inset; backdrop-filter: blur(8px);
}
.view-tools { position: absolute; left: 14px; top: 14px; right: 280px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  font-size: .8rem; cursor: pointer; user-select: none; transition: box-shadow .15s;
}
.chip:hover { box-shadow: 0 0 0 1px var(--dc-cyan) inset; }
.chip input { accent-color: var(--dc-blue); margin: 0; }
.slice-tools { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 8px; border-radius: 999px; }
.slice-tools select {
  padding: 4px 8px; font-size: .74rem; border-radius: 999px; color: #fff;
  background: rgba(255, 255, 255, .06); box-shadow: 0 0 0 1px rgba(160, 195, 255, .25) inset;
}
.slice-tools select option { color: var(--dc-text); }
.slice-tools input[type=range] { width: 110px; accent-color: var(--dc-cyan); }

.legend { position: absolute; left: 14px; bottom: 14px; width: 290px; border-radius: 16px; padding: 12px 14px; }
.legend-title { font-family: var(--mono); font-weight: 500; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dc-ink-mute); margin-bottom: 8px; }
.legend-bar { height: 12px; border-radius: 99px; }
.legend-labels { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .72rem; color: #fff; margin-top: 6px; }
.legend-sub { font-size: .72rem; color: var(--dc-ink-soft); margin-top: 4px; line-height: 1.4; }

.results { position: absolute; right: 14px; top: 14px; width: 256px; border-radius: 20px; padding: 14px 16px; overflow: hidden; }
.results::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--dc-cyan); }
.results-label { font-family: var(--mono); font-weight: 500; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dc-ink-mute); }
.cd { display: flex; align-items: baseline; gap: 10px; }
.cd span { font-family: var(--mono); font-size: 1rem; color: var(--dc-cyan); }
.cd strong { font-size: 2.6rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; color: #fff; }
.split { font-size: .8rem; margin: 4px 0 10px; }
.split div { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.split b { margin-left: auto; font-family: var(--mono); font-weight: 700; color: #fff; font-size: .76rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.p { background: var(--dc-cyan); }
.dot.f { background: var(--dc-warm); }
.caveat { font-size: .72rem; line-height: 1.45; color: var(--dc-ink-soft); margin: 0; padding: 9px 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); box-shadow: 0 0 0 1px rgba(160, 195, 255, .16) inset; }
.caveat strong { color: #fff; }
.caveat a { color: var(--dc-cyan); }
.more { margin-top: 10px; font-size: .76rem; }
.more summary { cursor: pointer; color: var(--dc-cyan); font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
.more dl { display: grid; grid-template-columns: auto auto; gap: 3px 10px; margin: 8px 0 0; }
.more dt { color: var(--dc-ink-mute); }
.more dd { margin: 0; text-align: right; font-family: var(--mono); color: #fff; font-size: .72rem; }

.empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--dc-ink-soft); pointer-events: none; padding: 20px; }
.empty svg { width: 76px; height: 76px; margin: 0 auto 10px; color: var(--dc-cyan); opacity: .8; }
.empty strong { color: #fff; font-size: 1.15rem; font-weight: 700; }

.btn.export { position: absolute; right: 14px; bottom: 14px; min-height: 46px; padding: .7em 1.2em; font-size: .92rem; }
.btn.export svg { width: 18px; height: 18px; }

@media (max-width: 1150px) {
  .view-tools { right: 14px; top: auto; bottom: 70px; }
  .legend { bottom: 126px; }
}

/* =====================================================================
   LEARN — "How does it work?" (= .dc-tag, .dc-h2, .dc-learn-item)
   ===================================================================== */
.learn { max-width: 1600px; margin: 0 auto; padding: clamp(40px, 6vw, 80px) clamp(16px, 3vw, 32px); }
.learn-head { margin-bottom: 28px; }
.dc-tag {
  display: inline-flex; align-items: center; overflow: hidden; margin-bottom: 16px;
  font-family: var(--mono); font-weight: 700; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dc-blue); border: 1.5px solid currentColor; border-radius: 6px; padding-right: 11px; line-height: 1.9;
}
.dc-tag span { background: var(--dc-blue); color: #fff; padding: 0 9px; margin-right: 11px; }
.dc-h2 { margin: 0; font-weight: 800; font-size: clamp(2rem, 4.4vw, 3.2rem); letter-spacing: -0.025em; line-height: 1.06; }
.dc-h2 span { color: var(--dc-blue); }
.learn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.learn details { background: var(--dc-card); border-radius: 18px; padding: 16px 20px; box-shadow: var(--shadow); }
.learn details[open] { box-shadow: 0 0 0 1.5px var(--dc-blue) inset, 0 18px 40px -28px rgba(18, 23, 38, .35); }
.learn summary { display: flex; align-items: center; gap: 14px; font-weight: 700; font-size: 1.02rem; cursor: pointer; list-style: none; }
.learn summary::-webkit-details-marker { display: none; }
.learn summary i {
  font-style: normal; flex: 0 0 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--mono); font-size: .76rem; font-weight: 700; color: #fff; background: var(--dc-blue);
}
.learn details:nth-child(2) summary i { background: #11b981; }
.learn details:nth-child(3) summary i { background: #ff3d81; }
.learn details:nth-child(4) summary i { background: var(--dc-warm); }
.learn details:nth-child(5) summary i { background: #121726; }
.learn details:nth-child(6) summary i { background: #3d6bff; }
.learn p, .learn ul { color: var(--dc-muted); margin: 12px 0 2px; font-size: .94rem; }
.learn li { margin-bottom: 6px; }

/* =====================================================================
   FOOTER (= .dc-ftr)
   ===================================================================== */
.dc-ftr {
  color: #fff; background-color: var(--dc-navy);
  background-image: linear-gradient(rgba(120, 170, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(120, 170, 255, .06) 1px, transparent 1px);
  background-size: 40px 40px;
}
.ftr-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; padding-top: 36px; padding-bottom: 32px; }
.ftr-row p { margin: 0; color: #b9c4e2; max-width: 52ch; font-size: .95rem; }
.ftr-logo { height: 44px; width: auto; }
.ftr-base { background: rgba(0, 0, 0, .18); border-top: 1px solid rgba(160, 195, 255, .22); }
.ftr-base .tb-cell { white-space: normal; }
