/* Calculator24x7 – Ohm's Law Calculator
   Same design system as the Time Elapsed calculator: navy canvas, teal accent, mono digits.
   Quantity color code used everywhere: V teal, I amber, R violet, P rose. */

.c24x7-ohm {
	--c24x7-navy-900: #081426;
	--c24x7-navy-800: #0b1f3a;
	--c24x7-navy-700: #12294a;
	--c24x7-navy-600: #1b3a63;
	--c24x7-teal-500: #14b8a6;
	--c24x7-teal-400: #2dd4bf;
	--c24x7-teal-300: #5eead4;
	--c24x7-mist:     #dbe7f4;
	--c24x7-mist-dim: #8fa6c2;
	--c24x7-danger:   #f87171;
	--c24x7-q-v:      #2dd4bf; /* Voltage  */
	--c24x7-q-i:      #f59e0b; /* Current  */
	--c24x7-q-r:      #8b5cf6; /* Resistance */
	--c24x7-q-p:      #f43f5e; /* Power    */
	--c24x7-radius:   14px;

	box-sizing: border-box;
	max-width: 860px;
	margin: 2rem auto;
	padding: clamp(1.1rem, 3vw, 2rem);
	background: linear-gradient(160deg, var(--c24x7-navy-800), var(--c24x7-navy-900) 70%);
	border: 1px solid var(--c24x7-navy-600);
	border-radius: calc(var(--c24x7-radius) + 6px);
	color: var(--c24x7-mist);
	font-family: "Space Grotesk", system-ui, sans-serif;
	line-height: 1.5;
}
.c24x7-ohm *, .c24x7-ohm *::before, .c24x7-ohm *::after { box-sizing: inherit; }

/* ---------- Header ---------- */
.c24x7-ohm__header { margin-bottom: 1.4rem; }
.c24x7-ohm__brand { display: flex; align-items: center; gap: .55rem; }
.c24x7-ohm__brand-dot {
	width: 12px; height: 12px; border-radius: 50%;
	background: var(--c24x7-teal-400);
	box-shadow: 0 0 0 4px rgba(45, 212, 191, .18);
	animation: c24x7-ohm-pulse 2.4s ease-in-out infinite;
}
@keyframes c24x7-ohm-pulse {
	0%, 100% { box-shadow: 0 0 0 4px rgba(45, 212, 191, .18); }
	50%      { box-shadow: 0 0 0 8px rgba(45, 212, 191, .06); }
}
.c24x7-ohm__brand-name { font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 700; letter-spacing: -.01em; }
.c24x7-ohm__tagline { margin: .35rem 0 0; color: var(--c24x7-mist-dim); font-size: .95rem; }
.c24x7-ohm__tagline strong { color: var(--c24x7-teal-300); }

/* ---------- Presets ---------- */
.c24x7-ohm__presets { margin-bottom: 1.2rem; }
.c24x7-ohm__presets-label {
	display: block; margin-bottom: .45rem;
	font-size: .72rem; text-transform: uppercase; letter-spacing: .12em;
	color: var(--c24x7-teal-300);
}
.c24x7-ohm__preset-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.c24x7-ohm__preset {
	border: 1px solid var(--c24x7-navy-600);
	background: var(--c24x7-navy-700);
	color: var(--c24x7-mist);
	font: 500 .82rem/1 "Space Grotesk", sans-serif;
	padding: .5rem .8rem;
	border-radius: 999px;
	cursor: pointer;
	transition: border-color .15s, background .15s, transform .15s;
}
.c24x7-ohm__preset:hover { border-color: var(--c24x7-teal-500); background: var(--c24x7-navy-600); transform: translateY(-1px); }
.c24x7-ohm__preset:focus-visible { outline: 2px solid var(--c24x7-teal-400); outline-offset: 2px; }

/* ---------- Inputs ---------- */
.c24x7-ohm__inputs {
	background: var(--c24x7-navy-700);
	border: 1px solid var(--c24x7-navy-600);
	border-radius: var(--c24x7-radius);
	padding: 1rem;
}
.c24x7-ohm__input-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: .8rem;
}
.c24x7-ohm__field { position: relative; }
.c24x7-ohm__field label {
	display: flex; align-items: center; gap: .4rem;
	margin-bottom: .35rem;
	font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
	color: var(--c24x7-mist-dim);
}
.c24x7-ohm__q-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.c24x7-ohm__field-row { display: flex; gap: .35rem; }
.c24x7-ohm__field input[type="number"] {
	flex: 1; min-width: 0;
	background: var(--c24x7-navy-900);
	border: 1px solid var(--c24x7-navy-600);
	border-radius: 8px;
	color: var(--c24x7-mist);
	font: 500 .95rem "IBM Plex Mono", monospace;
	padding: .6rem .7rem;
	appearance: textfield;
}
.c24x7-ohm__field input::-webkit-outer-spin-button,
.c24x7-ohm__field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.c24x7-ohm__field select {
	background: var(--c24x7-navy-900);
	border: 1px solid var(--c24x7-navy-600);
	border-radius: 8px;
	color: var(--c24x7-mist-dim);
	font: 500 .82rem "IBM Plex Mono", monospace;
	padding: 0 .4rem;
	cursor: pointer;
}
.c24x7-ohm__field input:focus-visible,
.c24x7-ohm__field select:focus-visible { outline: 2px solid var(--c24x7-teal-400); outline-offset: 1px; }
.c24x7-ohm__field.is-solved input {
	border-color: var(--c24x7-teal-500);
	color: var(--c24x7-teal-300);
	background: rgba(20, 184, 166, .08);
}
.c24x7-ohm__hint { margin: .7rem 0 0; font-size: .8rem; color: var(--c24x7-mist-dim); }

.c24x7-ohm__actions { display: flex; gap: .6rem; margin-top: .8rem; }
.c24x7-ohm__calc-btn {
	flex: 1;
	border: 0; border-radius: 10px;
	background: linear-gradient(90deg, var(--c24x7-teal-500), var(--c24x7-teal-400));
	color: var(--c24x7-navy-900);
	font: 700 1rem "Space Grotesk", sans-serif;
	padding: .8rem 1rem;
	cursor: pointer;
	transition: filter .15s, transform .1s;
}
.c24x7-ohm__calc-btn:hover { filter: brightness(1.08); }
.c24x7-ohm__calc-btn:active { transform: scale(.99); }
.c24x7-ohm__calc-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.c24x7-ohm__reset-btn {
	border: 1px solid var(--c24x7-navy-600);
	background: transparent;
	color: var(--c24x7-mist-dim);
	font: 600 .9rem "Space Grotesk", sans-serif;
	padding: .8rem 1.1rem;
	border-radius: 10px;
	cursor: pointer;
	transition: color .15s, border-color .15s;
}
.c24x7-ohm__reset-btn:hover { color: var(--c24x7-mist); border-color: var(--c24x7-mist-dim); }

.c24x7-ohm__error { margin: .8rem 0 0; color: var(--c24x7-danger); font-size: .9rem; }

/* ---------- Result values ---------- */
.c24x7-ohm__result { margin-top: 1.6rem; }
.c24x7-ohm__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: .6rem;
}
.c24x7-ohm__cell {
	background: var(--c24x7-navy-700);
	border: 1px solid var(--c24x7-navy-600);
	border-top: 3px solid var(--cell-color, var(--c24x7-teal-500));
	border-radius: 10px;
	padding: .8rem .6rem;
	text-align: center;
}
.c24x7-ohm__cell b { display: block; font: 600 1.3rem "IBM Plex Mono", monospace; color: var(--c24x7-mist); word-break: break-all; }
.c24x7-ohm__cell span { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--c24x7-mist-dim); }
.c24x7-ohm__cell .c24x7-ohm__badge {
	display: inline-block; margin-top: .3rem;
	font-size: .62rem; letter-spacing: .08em; text-transform: uppercase;
	padding: .12rem .45rem; border-radius: 999px;
}
.c24x7-ohm__badge--given  { background: rgba(143,166,194,.18); color: var(--c24x7-mist-dim); }
.c24x7-ohm__badge--solved { background: rgba(45,212,191,.16); color: var(--c24x7-teal-300); }

/* ---------- Solution steps ---------- */
.c24x7-ohm__solution {
	margin-top: 1.1rem;
	background: var(--c24x7-navy-700);
	border: 1px solid var(--c24x7-navy-600);
	border-left: 4px solid var(--c24x7-teal-500);
	border-radius: var(--c24x7-radius);
	padding: 1rem 1.1rem;
}
.c24x7-ohm__solution h3 { margin: 0 0 .6rem; font-size: 1rem; color: var(--c24x7-teal-300); }
.c24x7-ohm__steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .55rem; }
.c24x7-ohm__steps li { font-size: .92rem; color: var(--c24x7-mist); }
.c24x7-ohm__steps .c24x7-ohm__math {
	display: inline-block;
	font-family: "IBM Plex Mono", monospace;
	font-size: .88rem;
	background: var(--c24x7-navy-900);
	border: 1px solid var(--c24x7-navy-600);
	border-radius: 6px;
	padding: .15rem .5rem;
	margin: .15rem 0;
	color: var(--c24x7-teal-300);
}
.c24x7-ohm__steps .c24x7-ohm__why { color: var(--c24x7-mist-dim); font-size: .84rem; }

/* ---------- Charts + wheel ---------- */
.c24x7-ohm__charts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: .9rem;
	margin-top: 1.1rem;
}
.c24x7-ohm__chart-card {
	margin: 0;
	background: var(--c24x7-navy-700);
	border: 1px solid var(--c24x7-navy-600);
	border-radius: var(--c24x7-radius);
	padding: .9rem;
}
.c24x7-ohm__chart-card figcaption {
	font-size: .78rem; color: var(--c24x7-mist-dim); margin-bottom: .5rem;
	text-transform: uppercase; letter-spacing: .1em;
}
.c24x7-ohm__chart-wrap { position: relative; height: 260px; }
.c24x7-ohm__wheel-wrap { display: flex; justify-content: center; }
.c24x7-ohm__wheel-wrap svg { max-width: 300px; width: 100%; height: auto; }
.c24x7-ohm__wheel-seg { cursor: pointer; transition: opacity .15s; }
.c24x7-ohm__wheel-seg.is-dim { opacity: .25; }
.c24x7-ohm__wheel-text { pointer-events: none; font-family: "IBM Plex Mono", monospace; }

/* ---------- History ---------- */
.c24x7-ohm__history { margin-top: 1.8rem; }
.c24x7-ohm__history-head {
	display: flex; flex-wrap: wrap; gap: .6rem;
	align-items: center; justify-content: space-between;
	margin-bottom: .6rem;
}
.c24x7-ohm__history-head h3 { margin: 0; font-size: 1.05rem; color: var(--c24x7-mist); }
.c24x7-ohm__export { display: flex; gap: .4rem; flex-wrap: wrap; }
.c24x7-ohm__export-btn {
	border: 1px solid var(--c24x7-teal-500);
	background: transparent;
	color: var(--c24x7-teal-300);
	font: 600 .78rem "Space Grotesk", sans-serif;
	padding: .45rem .8rem;
	border-radius: 8px;
	cursor: pointer;
	transition: background .15s, color .15s;
}
.c24x7-ohm__export-btn:hover { background: var(--c24x7-teal-500); color: var(--c24x7-navy-900); }
.c24x7-ohm__export-btn--danger { border-color: var(--c24x7-danger); color: var(--c24x7-danger); }
.c24x7-ohm__export-btn--danger:hover { background: var(--c24x7-danger); color: var(--c24x7-navy-900); }

.c24x7-ohm__history-scroll { overflow-x: auto; border: 1px solid var(--c24x7-navy-600); border-radius: var(--c24x7-radius); }
.c24x7-ohm__table { width: 100%; border-collapse: collapse; font-size: .84rem; min-width: 620px; }
.c24x7-ohm__table th, .c24x7-ohm__table td {
	padding: .55rem .7rem; text-align: left;
	border-bottom: 1px solid var(--c24x7-navy-600);
	white-space: nowrap;
}
.c24x7-ohm__table th {
	background: var(--c24x7-navy-700);
	font-size: .7rem; text-transform: uppercase; letter-spacing: .1em;
	color: var(--c24x7-mist-dim);
}
.c24x7-ohm__table td { font-family: "IBM Plex Mono", monospace; color: var(--c24x7-mist); }
.c24x7-ohm__table tr:last-child td { border-bottom: 0; }
.c24x7-ohm__row-del { border: 0; background: transparent; color: var(--c24x7-danger); cursor: pointer; font-size: .95rem; line-height: 1; }
.c24x7-ohm__empty { margin: 0; padding: .9rem; color: var(--c24x7-mist-dim); font-size: .85rem; }

/* ---------- Learn / explanation ---------- */
.c24x7-ohm__learn { margin-top: 1.8rem; }
.c24x7-ohm__learn > h3 { margin: 0 0 .7rem; font-size: 1.05rem; }
.c24x7-ohm__panel {
	background: var(--c24x7-navy-700);
	border: 1px solid var(--c24x7-navy-600);
	border-radius: 10px;
	margin-bottom: .55rem;
	overflow: hidden;
}
.c24x7-ohm__panel summary {
	cursor: pointer;
	padding: .75rem 1rem;
	font-weight: 600;
	color: var(--c24x7-teal-300);
	list-style: none;
	position: relative;
}
.c24x7-ohm__panel summary::-webkit-details-marker { display: none; }
.c24x7-ohm__panel summary::after {
	content: "+"; position: absolute; right: 1rem; top: 50%;
	transform: translateY(-50%);
	color: var(--c24x7-mist-dim); font-weight: 400;
}
.c24x7-ohm__panel[open] summary::after { content: "−"; }
.c24x7-ohm__panel summary:focus-visible { outline: 2px solid var(--c24x7-teal-400); outline-offset: -2px; }
.c24x7-ohm__panel-body { padding: 0 1rem .9rem; font-size: .92rem; }
.c24x7-ohm__panel-body p { margin: .5rem 0; }
.c24x7-ohm__panel-body code {
	font-family: "IBM Plex Mono", monospace; font-size: .85em;
	background: var(--c24x7-navy-900); border: 1px solid var(--c24x7-navy-600);
	border-radius: 5px; padding: .1rem .35rem; color: var(--c24x7-teal-300);
}
.c24x7-ohm__panel-body ul, .c24x7-ohm__panel-body ol { margin: .5rem 0; padding-left: 1.3rem; }
.c24x7-ohm__panel-body li { margin: .3rem 0; }
.c24x7-ohm__big-formula {
	font: 700 1.6rem "IBM Plex Mono", monospace;
	color: var(--c24x7-teal-300);
	text-align: center;
	margin: .6rem 0 .8rem !important;
}
.c24x7-ohm__formula-table-wrap { overflow-x: auto; margin-top: .6rem; }
.c24x7-ohm__formula-table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 520px; }
.c24x7-ohm__formula-table th, .c24x7-ohm__formula-table td {
	border: 1px solid var(--c24x7-navy-600);
	padding: .45rem .6rem; text-align: left;
	font-family: "IBM Plex Mono", monospace;
}
.c24x7-ohm__formula-table th { background: var(--c24x7-navy-800); color: var(--c24x7-mist-dim); font-family: "Space Grotesk", sans-serif; }
.c24x7-ohm__formula-table td[data-q="V"] { color: var(--c24x7-q-v); font-weight: 600; }
.c24x7-ohm__formula-table td[data-q="I"] { color: var(--c24x7-q-i); font-weight: 600; }
.c24x7-ohm__formula-table td[data-q="R"] { color: var(--c24x7-q-r); font-weight: 600; }
.c24x7-ohm__formula-table td[data-q="P"] { color: var(--c24x7-q-p); font-weight: 600; }

/* ---------- Footer ---------- */
.c24x7-ohm__footer { margin-top: 1.4rem; text-align: center; font-size: .78rem; color: var(--c24x7-mist-dim); }
.c24x7-ohm__footer a { color: var(--c24x7-teal-300); text-decoration: none; }
.c24x7-ohm__footer a:hover { text-decoration: underline; }

/* ---------- Responsive / motion ---------- */
@media (max-width: 620px) {
	.c24x7-ohm__input-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
	.c24x7-ohm__input-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
	.c24x7-ohm__brand-dot { animation: none; }
	.c24x7-ohm * { transition: none !important; }
}
