/* =========================================================================
   DimensionNest Pro - converter pages
   -------------------------------------------------------------------------
   Loaded only on the converter pages, after pages.css. One card: inputs on
   the left, the answer on a dark panel on the right, so the result always
   reads as the thing to look at. Stacks on phones.
   ========================================================================= */

.dnc-section {
	padding-block: clamp(36px, 5vw, 64px) clamp(28px, 4vw, 48px);
}

.dnc {
	display: grid;
	grid-template-columns: 1fr;
	max-width: 1180px;
	margin: 0 auto;
	overflow: hidden;
	border: 1px solid var(--dnp-line);
	border-radius: 24px;
	background: var(--dnp-white);
	box-shadow: 0 2px 4px rgba(33, 42, 49, 0.04), 0 30px 60px -32px rgba(33, 42, 49, 0.35);
}

@media (min-width: 900px) {
	.dnc {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	}
}

/* --- Inputs ----------------------------------------------------------- */

.dnc-form {
	padding: clamp(24px, 3.6vw, 48px);
}

.dnp-page .dnc-form__title {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 28px;
	color: var(--dnp-ink);
	font-size: 1.2rem;
	font-weight: 700;
}

.dnc-badge {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 14px;
	background: rgba(18, 78, 102, 0.1);
	color: var(--dnp-teal);
}

.dnc-fields {
	display: grid;
	grid-template-columns: 1fr;
	gap: 22px 18px;
}

@media (min-width: 560px) {
	.dnc-fields {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.dnc-fields > * {
		grid-column: 1 / -1;
	}

	.dnc-fields > .dnc-field--half {
		grid-column: auto;
	}
}

.dnc-field {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.dnp-page .dnc-label {
	display: block;
	margin: 0 0 9px;
	padding: 0;
	color: var(--dnp-ink);
	font-size: 0.98rem;
	font-weight: 700;
}

.dnc-input {
	position: relative;
}

.dnp-page .dnc-input input {
	width: 100%;
	height: 62px;
	margin: 0;
	padding: 0 76px 0 18px;
	border: 1.5px solid rgba(33, 42, 49, 0.18);
	border-radius: 14px;
	background: #fafbfa;
	color: var(--dnp-ink);
	font: inherit;
	font-size: 1.35rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	box-shadow: none;
	transition: border-color 0.2s var(--dnp-ease), box-shadow 0.2s var(--dnp-ease), background-color 0.2s var(--dnp-ease);
	-moz-appearance: textfield;
}

.dnp-page .dnc-input input::-webkit-outer-spin-button,
.dnp-page .dnc-input input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.dnp-page .dnc-input input::placeholder {
	color: #9aa8ab;
	font-weight: 400;
}

.dnp-page .dnc-input input:focus {
	outline: none;
	border-color: var(--dnp-teal);
	background: #fff;
	box-shadow: 0 0 0 4px rgba(18, 78, 102, 0.14);
}

.dnc-unit {
	position: absolute;
	top: 50%;
	right: 14px;
	transform: translateY(-50%);
	padding: 4px 9px;
	border-radius: 8px;
	background: var(--dnp-surface);
	color: var(--dnp-muted);
	font-size: 0.86rem;
	font-weight: 700;
	pointer-events: none;
}

.dnc-pair {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.dnc-select {
	position: relative;
}

.dnc-select::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 20px;
	width: 8px;
	height: 8px;
	margin-top: -6px;
	border-right: 2px solid var(--dnp-muted);
	border-bottom: 2px solid var(--dnp-muted);
	transform: rotate(45deg);
	pointer-events: none;
}

.dnp-page .dnc-select select {
	width: 100%;
	height: 62px;
	margin: 0;
	padding: 0 46px 0 18px;
	border: 1.5px solid rgba(33, 42, 49, 0.18);
	border-radius: 14px;
	background: #fafbfa;
	color: var(--dnp-ink);
	font: inherit;
	font-size: 1.05rem;
	font-weight: 600;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.dnp-page .dnc-select select:focus {
	outline: none;
	border-color: var(--dnp-teal);
	background: #fff;
	box-shadow: 0 0 0 4px rgba(18, 78, 102, 0.14);
}

.dnp-page .dnc-hint {
	margin: 8px 0 0;
	color: var(--dnp-muted);
	font-size: 0.86rem;
	line-height: 1.5;
}

.dnc-more {
	margin-top: 22px;
	padding: 4px 18px;
	border: 1px dashed rgba(18, 78, 102, 0.35);
	border-radius: 14px;
	background: #fbfcfb;
}

.dnc-more > summary {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	color: var(--dnp-teal);
	font-weight: 700;
	cursor: pointer;
	list-style: none;
}

.dnc-more > summary::-webkit-details-marker {
	display: none;
}

.dnc-more > summary::before {
	content: "+";
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba(18, 78, 102, 0.12);
	font-size: 1rem;
	line-height: 1;
}

.dnc-more[open] > summary::before {
	content: "\2212";
}

.dnc-more > .dnc-fields {
	padding: 4px 0 18px;
}

.dnc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 28px;
}

.dnp-page .dnc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 54px;
	padding: 0 30px;
	border: 1.5px solid transparent;
	border-radius: 999px;
	font: inherit;
	font-size: 1.02rem;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s var(--dnp-ease), border-color 0.2s var(--dnp-ease), color 0.2s var(--dnp-ease), transform 0.2s var(--dnp-ease);
}

.dnp-page .dnc-btn--go {
	background: var(--dnp-teal);
	color: #fff;
}

.dnp-page .dnc-btn--go:hover {
	background: var(--dnp-teal-hi);
	transform: translateY(-1px);
}

.dnp-page a.dnc-btn--ghost,
.dnp-page a.dnc-btn--ghost:visited {
	border-color: rgba(33, 42, 49, 0.2);
	background: transparent;
	color: var(--dnp-ink);
}

.dnp-page a.dnc-btn--ghost:hover {
	border-color: var(--dnp-ink);
	color: var(--dnp-ink);
}

/* --- Result panel ----------------------------------------------------- */

.dnc-result {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: clamp(26px, 3.6vw, 48px);
	background:
		radial-gradient(90% 80% at 100% 0%, rgba(18, 78, 102, 0.85) 0%, transparent 65%),
		var(--dnp-ink);
	color: var(--dnp-mist);
	scroll-margin-top: var(--dnp-sticky-top);
}

.dnp-page .dnc-result__label {
	margin: 0 0 10px;
	color: var(--dnp-steel);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.dnp-page .dnc-result__main {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 12px;
	margin: 0;
	color: #fff;
	line-height: 1;
}

.dnc-result__value {
	font-size: clamp(2.6rem, 6vw, 4.2rem);
	font-weight: 800;
	letter-spacing: -0.03em;
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
}

.dnc-result__unit {
	color: var(--dnp-mist);
	font-size: clamp(1.1rem, 2vw, 1.4rem);
	font-weight: 700;
}

.dnp-page .dnc-result__formula {
	margin: 18px 0 0;
	padding: 12px 14px;
	border: 1px solid rgba(211, 217, 212, 0.14);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.04);
	color: rgba(211, 217, 212, 0.92);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.86rem;
	line-height: 1.55;
	overflow-wrap: anywhere;
}

.dnc-tiles {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	margin: 20px 0 0;
	padding: 0;
	list-style: none;
}

.dnc-tile {
	margin: 0;
	padding: 14px 16px;
	border: 1px solid rgba(211, 217, 212, 0.12);
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.05);
}

/* Three tiles: the third spans the row instead of leaving a hole. */
.dnc-tiles .dnc-tile:nth-child(3):last-child {
	grid-column: 1 / -1;
}

.dnc-tile__label {
	display: block;
	margin-bottom: 6px;
	color: var(--dnp-steel);
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.dnc-tile__value {
	display: block;
	color: #fff;
	font-size: 1.08rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.dnp-page .dnc-copy {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	align-self: flex-start;
	margin-top: 20px;
	padding: 10px 16px;
	border: 1px solid rgba(211, 217, 212, 0.3);
	border-radius: 999px;
	background: transparent;
	color: var(--dnp-mist);
	font: inherit;
	font-size: 0.9rem;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.2s var(--dnp-ease), border-color 0.2s var(--dnp-ease);
}

.dnp-page .dnc-copy[hidden],
.dnc-result__body[hidden],
.dnc-result__msg[hidden] {
	display: none;
}

.dnp-page .dnc-copy:hover {
	border-color: var(--dnp-mist);
	background: rgba(255, 255, 255, 0.08);
}

.dnp-page .dnc-result__msg {
	margin: 0;
	padding: 18px;
	border: 1px dashed rgba(211, 217, 212, 0.3);
	border-radius: 14px;
	color: var(--dnp-mist);
	font-size: 1.02rem;
}

/* --- How to use ------------------------------------------------------- */

.dnc-how {
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
	max-width: 1180px;
	margin: clamp(26px, 4vw, 40px) auto 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 760px) {
	.dnc-how {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.dnc-how__step {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	margin: 0;
	padding: 18px 20px;
	border: 1px solid var(--dnp-line);
	border-radius: 16px;
	background: var(--dnp-surface);
	color: var(--dnp-ink);
	font-size: 0.97rem;
	line-height: 1.5;
}

.dnc-how__num {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--dnp-teal);
	color: #fff;
	font-weight: 800;
}

/* --- Reference table -------------------------------------------------- */

.dnc-table-section {
	padding-block: clamp(28px, 4vw, 48px);
}

.dnc-table-wrap {
	max-width: 960px;
	margin: 0 auto;
	overflow-x: auto;
	border: 1px solid var(--dnp-line);
	border-radius: 18px;
	box-shadow: var(--dnp-card-shadow);
}

.dnc-table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.dnc-table th,
.dnc-table td {
	padding: 13px 18px;
	border-bottom: 1px solid var(--dnp-line);
	text-align: center;
	white-space: nowrap;
}

.dnp-page .dnc-table thead th {
	background: var(--dnp-ink);
	color: #fff;
	font-size: 0.86rem;
	font-weight: 700;
	letter-spacing: 0.04em;
}

.dnp-page .dnc-table tbody th {
	color: var(--dnp-teal);
	font-weight: 700;
}

.dnc-table td {
	color: var(--dnp-body);
}

.dnc-table tbody tr:nth-child(even) {
	background: #f7f9f8;
}

.dnc-table tbody tr:last-child th,
.dnc-table tbody tr:last-child td {
	border-bottom: 0;
}

/* --- Guide and byline ------------------------------------------------- */

.dnc-guide {
	padding-top: clamp(24px, 3vw, 40px);
}

.dnc-byline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px 22px;
	max-width: 860px;
	margin: 0 auto 36px;
	padding-bottom: 24px;
	border-bottom: 1px solid var(--dnp-line);
	color: var(--dnp-muted);
	font-size: 0.92rem;
}

.dnp-page a.dnc-byline__who {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	color: var(--dnp-muted);
	text-decoration: none;
}

.dnc-byline__who b {
	display: block;
	color: var(--dnp-ink);
}

.dnp-page a.dnc-byline__who:hover b {
	color: var(--dnp-teal);
}

.dnc-byline__photo {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
}

/* --- Related converters ----------------------------------------------- */

.dnc-related-section {
	background: var(--dnp-surface);
	border-top: 1px solid var(--dnp-line);
}

.dnc-related {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 640px) {
	.dnc-related {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.dnc-related {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.dnc-related li {
	margin: 0;
}

.dnp-page a.dnc-related__card {
	display: flex;
	align-items: center;
	gap: 16px;
	height: 100%;
	padding: 18px 20px;
	border: 1px solid var(--dnp-line);
	border-radius: 18px;
	background: var(--dnp-white);
	color: var(--dnp-ink);
	text-decoration: none;
	transition: border-color 0.25s var(--dnp-ease), transform 0.25s var(--dnp-ease), box-shadow 0.25s var(--dnp-ease);
}

.dnp-page a.dnc-related__card:hover {
	border-color: rgba(18, 78, 102, 0.45);
	box-shadow: var(--dnp-card-shadow-hover);
	transform: translateY(-3px);
}

.dnc-related__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.dnc-related__text strong {
	font-size: 1.02rem;
}

.dnc-related__text span {
	color: var(--dnp-muted);
	font-size: 0.86rem;
}

.dnc-related__arrow {
	color: var(--dnp-teal);
	font-weight: 700;
	transition: transform 0.25s var(--dnp-ease);
}

.dnc-related__card:hover .dnc-related__arrow {
	transform: translateX(4px);
}

/* --- Phones ----------------------------------------------------------- */

@media (max-width: 599px) {
	.dnc-actions .dnc-btn {
		flex: 1 1 auto;
	}

	.dnc-tiles {
		grid-template-columns: 1fr;
	}

	.dnc-tiles .dnc-tile:nth-child(3):last-child {
		grid-column: auto;
	}

	.dnc-table th,
	.dnc-table td {
		padding: 11px 12px;
		font-size: 0.92rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dnc *,
	.dnc-related * {
		transition-duration: 0.001ms !important;
	}
}
