/* Hallmark · component: calculator (two-panel tool) · genre: editorial · theme: Focus Quarters (design.md, locked)
 * states: default · hover · focus · active · disabled · error · success (copy) · loading: n/a (synchronous)
 * contrast: Ink on White and Sea Mist on Teal Dark pass AA; Oak is used for shapes only on the dark panel.
 * Colours and fonts come from the theme's presets; the fallbacks repeat design.md.
 */
.fq-dh {
	--fq-paper: var(--wp--preset--color--base, #F8F6F1);
	--fq-ink: var(--wp--preset--color--contrast, #1C2321);
	--fq-teal: var(--wp--preset--color--accent-1, #134E4A);
	--fq-teal-deep: var(--wp--preset--color--accent-2, #0B3532);
	--fq-oak: var(--wp--preset--color--accent-3, #C08552);
	--fq-stone: var(--wp--preset--color--accent-4, #5E6866);
	--fq-white: var(--wp--preset--color--accent-5, #FFFFFF);
	--fq-line: var(--wp--preset--color--accent-6, #E3DED4);
	--fq-oak-light: var(--wp--preset--color--oak-light, #F3E5D6);
	--fq-mist: var(--wp--preset--color--mist, #E6EFED);
	--fq-sea: var(--wp--preset--color--sea-mist, #CFE3DF);
	--fq-on-dark-line: rgba(207, 227, 223, .22); /* Sea Mist at 22%: hairlines on the dark panel */
	--fq-on-dark-tile: rgba(207, 227, 223, .07);
	--fq-display: var(--wp--preset--font-family--fraunces, "Fraunces", "Fraunces Fallback", Georgia, serif);
	--fq-ease: cubic-bezier(.2, .7, .2, 1);
	--fq-r: 12px;
	margin-block: 2rem 2.5rem;
}
.fq-dh *, .fq-dh *::before, .fq-dh *::after { box-sizing: border-box; }
.fq-dh .screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---- The app: inputs | results ---- */
.fq-dh__app {
	display: grid; grid-template-columns: minmax(0, 1fr);
	border: 1px solid var(--fq-line); border-radius: var(--fq-r); overflow: hidden; background: var(--fq-white);
}
@media (min-width: 900px) {
	.fq-dh__app { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}
.fq-dh__in { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 22px; padding: clamp(18px, 3.5vw, 32px); }
.fq-dh__out { background: var(--fq-teal-deep); color: var(--fq-sea); padding: clamp(18px, 3.5vw, 32px); min-width: 0; }

.fq-dh fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.fq-dh__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fq-dh__eyebrow { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fq-teal); }
.fq-dh__label { display: block; padding: 0; margin: 0 0 10px; font-weight: 600; color: var(--fq-ink); }
.fq-dh__hint { font-weight: 400; color: var(--fq-stone); font-size: var(--wp--preset--font-size--small, 15px); }
p.fq-dh__hint { margin: 0 0 12px; }

/* ---- Height: big readout + slider + steppers ---- */
.fq-dh__readout { display: flex; align-items: baseline; gap: 12px; margin: 0 0 6px; }
.fq-dh__big { font-family: var(--fq-display); font-weight: 600; font-size: clamp(44px, 6vw, 60px); line-height: 1; color: var(--fq-ink); font-variant-numeric: tabular-nums; }
.fq-dh__readout .fq-dh__alt { color: var(--fq-stone); font-size: 17px; }
.fq-dh__slider { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 12px; }
.fq-dh__step {
	width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--fq-teal); background: var(--fq-white); color: var(--fq-teal);
	font-family: inherit; font-size: 24px; font-weight: 500; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0;
	transition: background-color .15s var(--fq-ease), color .15s var(--fq-ease);
}
.fq-dh__step:hover { background: var(--fq-mist); }
.fq-dh__step:active { background: var(--fq-teal); color: var(--fq-white); }
.fq-dh__step:disabled { border-color: var(--fq-line); color: var(--fq-line); background: var(--fq-white); cursor: default; }
.fq-dh__scale { display: flex; justify-content: space-between; padding: 4px 56px 0; font-size: 13px; color: var(--fq-stone); }

.fq-dh input[type="range"] {
	-webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer;
}
.fq-dh input[type="range"]::-webkit-slider-runnable-track {
	height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--fq-teal) 0 var(--p, 50%), var(--fq-mist) var(--p, 50%) 100%);
}
.fq-dh input[type="range"]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--fq-mist); }
.fq-dh input[type="range"]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--fq-teal); }
.fq-dh input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%;
	background: var(--fq-white); border: 3px solid var(--fq-teal); box-shadow: 0 1px 3px rgba(28, 35, 33, .25);
}
.fq-dh input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--fq-white); border: 3px solid var(--fq-teal); }
.fq-dh input[type="range"]:active::-webkit-slider-thumb { background: var(--fq-mist); }

/* ---- Segmented controls (radio groups) ---- */
.fq-seg__row { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--fq-mist); border-radius: 10px; }
.fq-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.fq-seg label {
	flex: 1 1 0; min-width: max-content; min-height: 44px; display: flex; align-items: center; justify-content: center; text-align: center;
	padding: 8px 14px; border-radius: 7px; font-weight: 500; color: var(--fq-ink); cursor: pointer; white-space: nowrap;
	transition: background-color .15s var(--fq-ease), color .15s var(--fq-ease);
}
.fq-seg label:hover { background: rgba(255, 255, 255, .7); }
.fq-seg input:checked + label { background: var(--fq-teal); color: var(--fq-white); font-weight: 600; }
.fq-seg input:focus-visible + label { outline: 2px solid var(--fq-teal); outline-offset: 2px; }
.fq-seg--sm .fq-seg__row { padding: 3px; }
.fq-seg--sm label { padding: 6px 12px; font-size: 15px; }
@media (max-width: 420px) { .fq-seg--3 label { flex-basis: 100%; } }

.fq-dh__sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: -10px; }
.fq-dh__sub[hidden] { display: none; }
.fq-dh__sub label { font-weight: 500; }
.fq-dh__num-in { display: inline-flex; align-items: center; gap: 8px; }
.fq-dh input[type="number"] {
	width: 6.5em; min-height: 44px; padding: 8px 12px; font: inherit; color: var(--fq-ink); background: var(--fq-white);
	border: 1.5px solid var(--fq-stone); border-radius: 6px; font-variant-numeric: tabular-nums;
}
.fq-dh input[type="number"]:hover { border-color: var(--fq-ink); }
.fq-dh input[type="number"]:focus-visible { outline: 2px solid var(--fq-teal); outline-offset: 2px; border-color: var(--fq-teal); }
.fq-dh input[type="number"]:invalid { border-color: var(--fq-oak); background: var(--fq-oak-light); }
.fq-dh input[type="range"]:focus-visible, .fq-dh__step:focus-visible, .fq-dh summary:focus-visible, .fq-dh button:focus-visible {
	outline: 2px solid var(--fq-teal); outline-offset: 2px;
}

/* ---- Switch ---- */
.fq-dh__switch { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; color: var(--fq-ink); }
.fq-dh__switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fq-dh__track { flex: none; width: 44px; height: 26px; border-radius: 13px; background: var(--fq-line); position: relative; transition: background-color .15s var(--fq-ease); }
.fq-dh__track::after {
	content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--fq-white);
	box-shadow: 0 1px 2px rgba(28, 35, 33, .25); transition: transform .15s var(--fq-ease);
}
.fq-dh__switch:hover .fq-dh__track { background: var(--fq-stone); }
.fq-dh__switch input:checked + .fq-dh__track { background: var(--fq-teal); }
.fq-dh__switch input:checked + .fq-dh__track::after { transform: translateX(18px); }
.fq-dh__switch input:focus-visible + .fq-dh__track { outline: 2px solid var(--fq-teal); outline-offset: 2px; }

.fq-dh__src { margin: 4px 0 0; font-size: 14px; line-height: 1.5; color: var(--fq-stone); }
.fq-dh__src a { color: var(--fq-teal); text-decoration-color: var(--fq-oak); text-underline-offset: 3px; }

/* ---- More options ---- */
.fq-dh__more { border-top: 1px solid var(--fq-line); padding-top: 6px; }
.fq-dh__more summary {
	min-height: 44px; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--fq-teal); cursor: pointer; list-style: none;
}
.fq-dh__more summary::-webkit-details-marker { display: none; }
.fq-dh__more summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s var(--fq-ease); }
.fq-dh__more[open] summary::before { transform: rotate(45deg); }
.fq-dh__more summary:hover { text-decoration: underline; text-decoration-color: var(--fq-oak); text-underline-offset: 4px; }
.fq-dh__grid { display: grid; gap: 6px 16px; align-items: center; font-size: var(--wp--preset--font-size--small, 15px); }
.fq-dh__grid label { padding-top: 8px; color: var(--fq-ink); }
@media (min-width: 600px) { .fq-dh__grid { grid-template-columns: minmax(0, 1fr) auto; } .fq-dh__grid label { padding-top: 0; } }

/* ---- Result panel (dark) ---- */
.fq-dh__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.fq-dh__title { margin: 0; font-family: var(--fq-display); font-size: clamp(22px, 2.4vw, 28px); line-height: 1.2; color: var(--fq-white); }
.fq-dh__title:focus { outline: none; }
.fq-dh__posture { margin: 0; font-weight: 600; color: var(--fq-sea); }
.fq-dh__tabs { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--fq-on-dark-tile); border: 1px solid var(--fq-on-dark-line); }
.fq-dh .fq-dh__tab {
	min-height: 44px; min-width: 104px; padding: 8px 16px; border: 0; border-radius: 7px; background: transparent; color: var(--fq-sea);
	font-family: inherit; font-size: 15px; font-weight: 500; line-height: 1; cursor: pointer; transition: background-color .15s var(--fq-ease), color .15s var(--fq-ease);
}
.fq-dh .fq-dh__tab:hover { background: var(--fq-on-dark-tile); color: var(--fq-white); }
.fq-dh .fq-dh__tab[aria-pressed="true"] { background: var(--fq-sea); color: var(--fq-teal-deep); font-weight: 600; }
.fq-dh .fq-dh__tab:focus-visible, .fq-dh__out button:focus-visible { outline: 2px solid var(--fq-sea); outline-offset: 2px; }
@media (max-width: 599px) { .fq-dh__tabs { width: 100%; } .fq-dh .fq-dh__tab { flex: 1; min-height: 44px; } }

.fq-dh__stage { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .fq-dh__stage { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; } }
.fq-dh__fig { display: block; width: 100%; height: auto; max-width: 560px; }
.fq-dh__f-floor { stroke: var(--fq-sea); stroke-width: 2; }
.fq-dh__f-line { fill: none; stroke: var(--fq-on-dark-line); stroke-width: 1.5; stroke-dasharray: 5 5; }
.fq-dh__f-line--eye { stroke: var(--fq-oak); }
.fq-dh__f-wood { fill: var(--fq-oak); }
.fq-dh__f-metal { fill: var(--fq-sea); opacity: .55; }
.fq-dh__f-key { fill: var(--fq-sea); }
.fq-dh__f-screen { fill: var(--fq-white); }
.fq-dh__f-foot { fill: var(--fq-oak-light); }
.fq-dh__f-num { fill: var(--fq-white); font: 600 21px/1 var(--wp--preset--font-family--inter, Inter, system-ui, sans-serif); font-variant-numeric: tabular-nums; }
.fq-dh__f-lbl { fill: var(--fq-sea); font: 400 18px/1 var(--wp--preset--font-family--inter, Inter, system-ui, sans-serif); }

.fq-dh__tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
@media (min-width: 1100px) { .fq-dh__tiles { grid-template-columns: minmax(0, 1fr); } }
.fq-dh__tile { padding: 12px 14px; border-radius: 10px; background: var(--fq-on-dark-tile); border: 1px solid var(--fq-on-dark-line); }
.fq-dh__tile dt { font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--fq-sea); }
.fq-dh__tile dd { margin: 4px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; }
.fq-dh__num { font-family: var(--fq-display); font-weight: 600; font-size: clamp(30px, 3.4vw, 38px); line-height: 1.05; color: var(--fq-white); font-variant-numeric: tabular-nums; }
.fq-dh__unit { font-size: 16px; color: var(--fq-white); }
.fq-dh__tile .fq-dh__alt { font-size: 14px; color: var(--fq-sea); margin-left: auto; }
.fq-dh__range { flex-basis: 100%; margin-top: 4px; font-size: 13px; color: var(--fq-sea); opacity: .9; }

.fq-dh__from { margin: 18px 0 0; font-size: 14px; color: var(--fq-sea); }
.fq-dh__h3 { margin: 22px 0 10px; font-family: var(--fq-display); font-size: 20px; color: var(--fq-white); }
.fq-dh__tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.fq-dh__tips li { position: relative; padding-left: 26px; color: var(--fq-sea); font-size: 16px; line-height: 1.55; }
.fq-dh__tips li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--fq-sea); }
.fq-dh__tips .fq-dh__tip--warn::before { border-color: var(--fq-oak); background: var(--fq-oak); }
.fq-dh__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--fq-on-dark-line); }
.fq-dh__out .fq-dh__actions button {
	min-height: 44px; padding: 10px 18px; border-radius: 6px; font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer;
	color: var(--fq-sea); background: transparent; border: 1.5px solid var(--fq-sea); transition: background-color .15s var(--fq-ease), color .15s var(--fq-ease);
}
.fq-dh__out .fq-dh__actions button:hover { background: var(--fq-sea); color: var(--fq-teal-deep); }
.fq-dh__out .fq-dh__actions button:active { background: var(--fq-white); }
.fq-dh__copied { color: var(--fq-sea); overflow-wrap: anywhere; font-size: 14px; }
@media (max-width: 599px) { .fq-dh__out .fq-dh__actions button { width: 100%; } }
.fq-dh__warn { margin: 0; padding: 16px 20px; border-radius: 10px; background: var(--fq-oak-light); color: var(--fq-ink); border-left: 3px solid var(--fq-oak); }

/* ---- Chart below the app: back to the reading column ---- */
.fq-dh__chart { max-width: var(--wp--style--global--content-size, 760px); margin: 40px auto 0; overflow-x: auto; }
.fq-dh__chart table { width: 100%; min-width: 560px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.fq-dh__chart caption { text-align: left; font-weight: 600; padding-bottom: 8px; }
.fq-dh__chart th, .fq-dh__chart td { padding: 8px 10px; border: 1px solid var(--fq-line); text-align: left; }
.fq-dh__chart thead th { background: var(--fq-mist); font-size: var(--wp--preset--font-size--small, 15px); }
.fq-dh__cm { display: block; font-weight: 400; color: var(--fq-stone); font-size: 13px; }
.fq-dh figcaption { color: var(--fq-stone); font-size: var(--wp--preset--font-size--small, 15px); }

@media print {
	.fq-dh__in, .fq-dh__actions, .fq-dh__tabs { display: none; }
	.fq-dh__app { display: block; border: 0; }
	.fq-dh__out { background: none; color: #000; }
	.fq-dh__title, .fq-dh__num, .fq-dh__unit, .fq-dh__tile dt, .fq-dh__tips li, .fq-dh__from, .fq-dh__h3 { color: #000; }
}
@media (prefers-reduced-motion: reduce) { .fq-dh * { transition: none !important; } }
