/*
 * Feet/Inches Calculator — ftcalc-style.css
 * All selectors are prefixed with .ftcalc- to avoid theme conflicts.
 * Enqueue via functions.php scoped to the calculator article template.
 */

.ftcalc-widget {
	max-width: 100%;
	margin: 2em auto;
	padding: 0 18px;
}

.ftcalc-calc {
	border: 1px solid rgba(127,127,127,.35);
	border-radius: 18px;
	padding: 14px;
	box-shadow: 0 12px 30px rgba(0,0,0,.08);
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.ftcalc-topbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
	flex-wrap: wrap;
}

.ftcalc-brand {
	flex-shrink: 0;
}

.ftcalc-opts {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.ftcalc-widget select,
.ftcalc-chipbtn {
	border: 1px solid rgba(127,127,127,.35);
	background: transparent;
	color: inherit;
	border-radius: 999px;
	padding: 10px 14px;
	font-size: 14px;
	cursor: pointer;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
}

.ftcalc-chipbtn:active {
	transform: translateY(1px);
}

/* Stack logo above controls on narrow phones */
@media (max-width: 420px) {
	.ftcalc-topbar {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}
	.ftcalc-opts {
		width: 100%;
		justify-content: flex-start;
	}
}

/* ── Display ────────────────────────────────────────────────────────────── */
.ftcalc-display {
	border: 1px solid rgba(127,127,127,.35);
	border-radius: 16px;
	padding: 12px 12px 10px;
	margin-bottom: 12px;
	background: rgba(127,127,127,.06);
}

/* Fixed 5-line history area */
.ftcalc-history {
	font-size: 12px;
	line-height: 1.35;
	height: calc(5 * 1.35em);
	overflow-y: auto;
	padding: 6px 6px 8px;
	margin: -2px -2px 8px;
	border-radius: 12px;
	border: 1px dashed rgba(127,127,127,.35);
	background: rgba(127,127,127,.04);
}

.ftcalc-histline {
	opacity: .85;
	text-align: right;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ftcalc-expr {
	min-height: 18px;
	font-size: 12px;
	opacity: .8;
	text-align: right;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ftcalc-main {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 10px;
}

.ftcalc-value {
	font-size: 34px;
	font-weight: 700;
	text-align: right;
	margin-top: 6px;
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ftcalc-unit {
	font-size: 12px;
	opacity: .85;
	padding: 4px 8px;
	border-radius: 999px;
	border: 1px solid rgba(127,127,127,.35);
}

/* Fixed-height row prevents layout jump when sub-values appear */
.ftcalc-subout {
	margin-top: 8px;
	font-size: 12px;
	opacity: .85;
	display: flex;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	min-height: 16px;
	align-items: center;
}

.ftcalc-subout > div {
	min-height: 16px;
}

/* ── Utility ────────────────────────────────────────────────────────────── */
.ftcalc-mono {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ── Keypad ─────────────────────────────────────────────────────────────── */
.ftcalc-keys {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
}

.ftcalc-key {
	border: 1px solid rgba(127,127,127,.35);
	background: transparent;
	color: inherit;
	border-radius: 14px;
	padding: 14px 10px;
	font-size: 16px;
	cursor: pointer;
	user-select: none;
	touch-action: manipulation;
}

.ftcalc-key:active {
	transform: translateY(1px);
}

.ftcalc-op   { font-weight: 700; }
.ftcalc-wide { grid-column: span 2; }
.ftcalc-small { font-size: 13px; }

.ftcalc-primary { border-color: rgba(80,140,255,.7); }
.ftcalc-danger  { border-color: rgba(220,80,80,.7); }

/* ── Hint ───────────────────────────────────────────────────────────────── */
.ftcalc-hint {
	margin-top: 10px;
	font-size: 12px;
	opacity: .8;
	line-height: 1.35;
}

/* Hide keyboard-only hint on touch devices */
@media (hover: none) and (pointer: coarse) {
	.ftcalc-hint { display: none; }
}

/* ── Light mode ─────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
	.ftcalc-calc { background: white; }
	.ftcalc-key  { background: rgba(127,127,127,.06); }
	.ftcalc-key.ftcalc-primary { background: rgba(80,140,255,.10); }
	.ftcalc-key.ftcalc-danger  { background: rgba(220,80,80,.10); }
}

/* ── Dark mode ──────────────────────────────────────────────────────────── */
// @media (prefers-color-scheme: dark) {
// This disables dark mode. To turn it back on, uncomment the line above and then delete the next line
@media not all {
	.ftcalc-calc { background: rgba(30,30,32,1); }
	.ftcalc-key  { background: rgba(255,255,255,.07); }
	.ftcalc-key.ftcalc-primary { background: rgba(80,140,255,.18); }
	.ftcalc-key.ftcalc-danger  { background: rgba(220,80,80,.18); }
}
