/* =====================================================================
   Webyfox Tools — brand colours, light/dark mode, and tool styles
   ===================================================================== */

/* ---------- Brand tokens: light (default) ---------- */
:root {
	--wf-bg: #F3F5F9;
	--wf-surface: #FFFFFF;
	--wf-surface-2: #EBEFF5;
	--wf-line: #DCE2EB;
	--wf-field-line: #C9D1DD;
	--wf-text: #14213D;
	--wf-muted: #556178;
	--wf-accent: #F26B2B;
	--wf-accent-text: #BF4A17;
	--wf-accent-soft: #FDEEE5;
	--wf-btn-bg: #BF4A17;
	--wf-btn-text: #FFFFFF;
	--wf-success: #1F6B4A;
	--wf-success-soft: #E4F2EA;
	--wf-error: #B42318;
	--wf-bar-a: #14213D;
	--wf-radius: 14px;
	--wf-font-head: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
	--wf-font-body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Brand tokens: dark ---------- */
html[data-theme="dark"] {
	color-scheme: dark;
	--wf-bg: #0D1526;
	--wf-surface: #15203A;
	--wf-surface-2: #1B2846;
	--wf-line: #26345A;
	--wf-field-line: #33446D;
	--wf-text: #EEF2F8;
	--wf-muted: #A5B0C4;
	--wf-accent: #F26B2B;
	--wf-accent-text: #FF8A50;
	--wf-accent-soft: #3A2216;
	--wf-btn-bg: #F26B2B;
	--wf-btn-text: #0D1526;
	--wf-success: #5CC293;
	--wf-success-soft: #16302A;
	--wf-error: #FF8A80;
	--wf-bar-a: #C9D3E3;

	/* Kadence theme palette in dark mode (overrides Customizer colours). */
	--global-palette1: #FF8A50;
	--global-palette2: #F26B2B;
	--global-palette3: #EEF2F8;
	--global-palette4: #E1E7F0;
	--global-palette5: #C3CCDA;
	--global-palette6: #A5B0C4;
	--global-palette7: #26345A;
	--global-palette8: #0D1526;
	--global-palette9: #15203A;
	--global-palette9rgb: 21, 32, 58;
	--global-palette-btn-bg: #F26B2B;
	--global-palette-btn-bg-hover: #FF8A50;
	--global-palette-btn: #0D1526;
	--global-palette-btn-hover: #0D1526;
}
html[data-theme="light"] { color-scheme: light; }

/* Logo swap in dark mode: hides the navy logo and shows the white one.
   (The white logo URL is added by the plugin.) */
html[data-theme="dark"] .custom-logo-link,
html[data-theme="dark"] .site-branding a.brand {
	background-repeat: no-repeat;
	background-position: left center;
	background-size: contain;
}
html[data-theme="dark"] .custom-logo-link img,
html[data-theme="dark"] .site-branding a.brand img {
	visibility: hidden;
}

/* ---------- Theme toggle ---------- */
.wft-theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border-radius: 10px;
	border: 1px solid var(--wf-line);
	background: var(--wf-surface);
	color: var(--wf-text);
	cursor: pointer;
	box-shadow: none;
}
.wft-theme-toggle:hover { border-color: var(--wf-accent-text); color: var(--wf-accent-text); background: var(--wf-surface); }
.wft-theme-toggle:focus-visible { outline: 3px solid var(--wf-accent); outline-offset: 2px; }
.wft-theme-toggle .wft-icon-sun { display: none; }
html[data-theme="dark"] .wft-theme-toggle .wft-icon-sun { display: block; }
html[data-theme="dark"] .wft-theme-toggle .wft-icon-moon { display: none; }

/* ---------- Tool shell ---------- */
.wft-tool {
	font-family: var(--wf-font-body);
	color: var(--wf-text);
	background: var(--wf-surface);
	border: 1px solid var(--wf-line);
	border-radius: 18px;
	padding: clamp(18px, 3vw, 28px);
	margin: 0 0 2em;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 20px;
}
.wft-tool *, .wft-tool *::before, .wft-tool *::after { box-sizing: border-box; }
.wft-tool p { margin: 0; }

.wft-grid { display: flex; flex-wrap: wrap; gap: 28px; }
.wft-inputs { flex: 1 1 300px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.wft-result {
	flex: 1 1 280px;
	min-width: 0;
	background: var(--wf-surface-2);
	border-radius: var(--wf-radius);
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* ---------- Fields ---------- */
.wft-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wft-field-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wft-tool label, .wft-tool legend { font-size: 15px; font-weight: 600; color: var(--wf-text); margin: 0; }
.wft-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.wft-fieldset legend { padding: 0; margin-bottom: 8px; }

.wft-tool .wft-input {
	font: 500 16px/1.4 var(--wf-font-body);
	color: var(--wf-text);
	background: var(--wf-surface);
	border: 1.5px solid var(--wf-field-line);
	border-radius: 10px;
	padding: 10px 12px;
	min-height: 46px;
	width: 100%;
	max-width: 100%;
	box-shadow: none;
}
.wft-tool .wft-input:focus { outline: none; border-color: var(--wf-accent-text); box-shadow: 0 0 0 3px var(--wf-accent-soft); }
.wft-tool .wft-num { width: 160px; text-align: right; font-weight: 600; flex-shrink: 0; }
.wft-tool select.wft-input { appearance: auto; }
.wft-tool .wft-textarea { min-height: 220px; resize: vertical; line-height: 1.6; }

/* Sliders: fully custom so theme form styles can't hide the track */
.wft-tool input[type="range"].wft-range {
	-webkit-appearance: none !important;
	appearance: none !important;
	display: block;
	width: 100% !important;
	height: 24px !important;
	min-height: 24px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	outline: none;
	cursor: pointer;
	--wf-fill: 50%;
}
.wft-tool input[type="range"].wft-range::-webkit-slider-runnable-track {
	height: 6px;
	border-radius: 999px;
	border: 0;
	background: linear-gradient(to right, var(--wf-btn-bg) 0, var(--wf-btn-bg) var(--wf-fill), var(--wf-line) var(--wf-fill), var(--wf-line) 100%);
}
.wft-tool input[type="range"].wft-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	margin-top: -7px;
	border-radius: 50%;
	background: var(--wf-btn-bg);
	border: 3px solid var(--wf-surface);
	box-shadow: 0 0 0 1px var(--wf-btn-bg), 0 1px 3px rgba(13, 21, 38, 0.25);
}
.wft-tool input[type="range"].wft-range::-moz-range-track {
	height: 6px;
	border-radius: 999px;
	border: 0;
	background: var(--wf-line);
}
.wft-tool input[type="range"].wft-range::-moz-range-progress {
	height: 6px;
	border-radius: 999px;
	background: var(--wf-btn-bg);
}
.wft-tool input[type="range"].wft-range::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--wf-btn-bg);
	border: 3px solid var(--wf-surface);
	box-shadow: 0 0 0 1px var(--wf-btn-bg), 0 1px 3px rgba(13, 21, 38, 0.25);
}
.wft-tool input[type="range"].wft-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--wf-accent); }
.wft-tool input[type="range"].wft-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--wf-accent); }
.wft-tool input[type="range"].wft-range:disabled { cursor: not-allowed; opacity: 0.5; }

/* Rate chips and segmented choices */
.wft-chips, .wft-segment { display: flex; flex-wrap: wrap; gap: 8px; }
.wft-chip input, .wft-segment input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wft-tool .wft-chip, .wft-tool .wft-segment label { font-weight: 600; font-size: 15px; cursor: pointer; position: relative; }
.wft-chip span, .wft-segment span {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 8px 16px;
	border-radius: 10px;
	border: 1.5px solid var(--wf-field-line);
	background: var(--wf-surface);
	color: var(--wf-text);
}
.wft-chip input:checked + span, .wft-segment input:checked + span {
	background: var(--wf-accent-soft);
	border-color: var(--wf-accent-text);
	color: var(--wf-accent-text);
}
.wft-chip input:focus-visible + span, .wft-segment input:focus-visible + span { outline: 3px solid var(--wf-accent); outline-offset: 2px; }
.wft-custom-rate { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; max-width: 240px; }
.wft-tool [hidden] { display: none !important; }

/* ---------- Results ---------- */
.wft-result-label { font-size: 14px; font-weight: 600; color: var(--wf-muted); }
.wft-result-big {
	font-family: var(--wf-font-head);
	font-weight: 800;
	font-size: clamp(30px, 5vw, 42px);
	line-height: 1.1;
	letter-spacing: -0.02em;
	color: var(--wf-text);
	word-break: break-word;
}
.wft-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--wf-line); }
.wft-bar-a { background: var(--wf-bar-a); width: 50%; transition: width .2s ease; }
.wft-bar-b { background: var(--wf-accent); flex-grow: 1; }
.wft-rows { margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.wft-rows > div { display: flex; justify-content: space-between; gap: 12px; }
.wft-rows > div[hidden] { display: none; }
.wft-rows dt { display: flex; align-items: center; gap: 8px; color: var(--wf-text); font-weight: 400; margin: 0; }
.wft-rows dd { margin: 0; font-weight: 600; text-align: right; }
.wft-rows .wft-total { border-top: 1px solid var(--wf-line); padding-top: 10px; }
.wft-rows .wft-total dd { font-weight: 700; }
.wft-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.wft-key-a { background: var(--wf-bar-a); }
.wft-key-b { background: var(--wf-accent); }
.wft-note { font-size: 13px; line-height: 1.5; color: var(--wf-muted); }
.wft-error { font-size: 14px; font-weight: 600; color: var(--wf-error); }

/* ---------- Table ---------- */
.wft-details { border-top: 1px solid var(--wf-line); padding-top: 14px; }
.wft-details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; color: var(--wf-accent-text); }
.wft-table-wrap { overflow-x: auto; margin-top: 8px; }
.wft-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; margin: 0; }
.wft-table th, .wft-table td { padding: 10px 12px; border-bottom: 1px solid var(--wf-line); text-align: right; white-space: nowrap; color: var(--wf-text); background: transparent; }
.wft-table th:first-child, .wft-table td:first-child { text-align: left; }
.wft-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--wf-muted); font-weight: 600; }

/* ---------- Buttons ---------- */
.wft-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.wft-actions[hidden] { display: none; }
.wft-tool .wft-btn {
	font: 600 15px/1 var(--wf-font-body);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 12px 20px;
	border-radius: 10px;
	cursor: pointer;
	text-decoration: none;
	box-shadow: none;
}
.wft-tool .wft-btn-primary { background: var(--wf-btn-bg); color: var(--wf-btn-text); border: 0; }
.wft-tool .wft-btn-primary:hover { filter: brightness(1.08); color: var(--wf-btn-text); }
.wft-tool .wft-btn-secondary { background: var(--wf-surface); color: var(--wf-text); border: 1.5px solid var(--wf-text); }
.wft-tool .wft-btn-secondary:hover { background: var(--wf-surface-2); color: var(--wf-text); }
.wft-tool .wft-btn:focus-visible { outline: 3px solid var(--wf-accent); outline-offset: 2px; }
.wft-status { font-size: 14px; color: var(--wf-success); font-weight: 600; }

/* ---------- Word counter ---------- */
.wft-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.wft-stat { background: var(--wf-surface-2); border-radius: 12px; padding: 14px 16px; }
.wft-stat-num { font-family: var(--wf-font-head); font-weight: 800; font-size: 26px; line-height: 1.1; color: var(--wf-text); }
.wft-stat-label { font-size: 13px; color: var(--wf-muted); margin-top: 4px; }

/* ---------- Image compressor ---------- */
.wft-drop {
	border: 2px dashed var(--wf-field-line);
	border-radius: 16px;
	background: var(--wf-surface-2);
	padding: 32px 20px;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 8px;
	color: var(--wf-accent-text);
	transition: border-color .15s;
}
.wft-drop.is-over { border-color: var(--wf-accent-text); background: var(--wf-accent-soft); }
.wft-drop-title { font-family: var(--wf-font-head); font-weight: 700; font-size: 20px; color: var(--wf-text); }
.wft-drop-sub { font-size: 14px; color: var(--wf-muted); margin-bottom: 8px !important; }
.wft-file-btn { position: relative; overflow: hidden; }
.wft-file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.wft-tool .wft-file-btn:focus-within { outline: 3px solid var(--wf-accent); outline-offset: 2px; }

.wft-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.wft-options output { font-weight: 700; color: var(--wf-text); }
.wft-field.is-disabled { opacity: .5; }

.wft-img-results { display: flex; flex-direction: column; gap: 10px; }
.wft-img-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
	border: 1px solid var(--wf-line);
	border-radius: 12px;
	padding: 12px;
	background: var(--wf-surface);
}
.wft-img-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--wf-surface-2); flex-shrink: 0; }
.wft-img-info { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wft-img-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wft-img-meta { font-size: 13px; color: var(--wf-muted); }
.wft-badge { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--wf-success-soft); color: var(--wf-success); white-space: nowrap; }
.wft-badge.is-warn { background: var(--wf-accent-soft); color: var(--wf-accent-text); }

@media (max-width: 520px) {
	.wft-field-row { flex-wrap: wrap; }
	.wft-tool .wft-num { width: 100%; text-align: left; }
	.wft-result { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
	.wft-bar-a, .wft-drop { transition: none; }
}
