/* Men's Array — interactive tools. Loaded only on pages with [ma_tool].
 *
 * The look borrows from the tailor's shop, not from software: a photo-led magazine header,
 * a measurement card for inputs (underlined fields, serif numbers), fabric swatches with pinked
 * edges for colors, and the result on a stitched garment label in the brand plum.
 */

.tool-page { padding-top: 40px; padding-bottom: 80px; }
.tool-page .article-head__title { max-width: 18ch; }
.tool-page .prose { margin-top: 0; }
.tool-page .prose > :not(.tool) { max-width: 820px; }
.tool-page__updated { margin-top: 14px; font-size: 15px; color: var(--muted); }

/* Header with photo, like a magazine opener */
.tool-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: 56px; align-items: center; }
.tool-hero__media { margin: 0; }
.tool-hero__media img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-card); }

.tool {
	display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start;
	margin: 48px 0 64px; padding-top: 40px; max-width: none !important;
	border-top: 2px solid var(--ink);
	font-size: 17px; line-height: 1.5;
}
.prose > .tool + * { margin-top: 0; }

/* Form side: a measurement card */
.tool__form { display: flex; flex-direction: column; gap: 30px; }
.tool__units { display: inline-flex; align-self: flex-start; gap: 26px; border-bottom: 1px solid var(--line); }
.tool__units + .tool__units { margin-top: -8px; }
.tool__unit {
	min-height: 40px; margin-bottom: -1px; padding: 0 0 6px; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
	background: none; color: var(--muted); font: 600 12.5px/1 var(--label); letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
}
.tool__unit:hover { color: var(--text); }
.tool__unit.is-active { color: var(--text); border-bottom-color: var(--accent); }

.tool__field { display: flex; flex-direction: column; gap: 6px; }
.tool__field > label, .tool__label { font: 700 16px/1.3 var(--sans); }
.tool__optional { margin-left: 8px; font-weight: 400; font-style: italic; font-size: 14px; color: var(--muted); }
.tool__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.tool__input { position: relative; }
.tool__input input {
	width: 100%; height: 54px; padding: 0 44px 0 0;
	border: 0; border-bottom: 1.5px solid #cbc2cf; border-radius: 0; background: transparent;
	font: 600 28px/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--text);
	-moz-appearance: textfield; appearance: textfield;
}
.tool__input input::placeholder { color: #cdc6d0; }
.tool__input input::-webkit-outer-spin-button,
.tool__input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tool__input input:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 0 var(--accent); }
.tool__suffix { position: absolute; right: 0; bottom: 12px; color: var(--muted); font-size: 15px; pointer-events: none; }
.tool__hint { font-size: 14px; color: var(--muted); }
.tool__error { padding: 12px 14px; border-radius: var(--radius-btn); background: #fbeceb; color: #8a2a22; font-size: 15px; }
.tool__submit { align-self: flex-start; margin-top: 4px; }

/* Result side: a stitched garment label */
.tool__result {
	position: sticky; top: calc(var(--header-h) + 24px);
	display: flex; flex-direction: column; justify-content: flex-start; padding: 4px 0 8px 56px;
	border-left: 1px solid var(--line); color: var(--text);
}
.tool__eyebrow { font: 700 12.5px/1 var(--label); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.tool__big { margin-top: 14px; font: 700 clamp(64px, 7vw, 104px)/1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: lining-nums; }
.tool__empty .tool__big, .tool__big.is-placeholder { font-size: clamp(48px, 5vw, 72px); color: #8b8391; }
.tool__lead { margin-top: 14px; font-size: 18px; color: var(--muted); max-width: 40ch; }
.tool__rows { display: grid; grid-template-columns: 1fr 1fr; margin: 28px 0 0; border-top: 1px solid var(--line); }
.tool__rows--3 { grid-template-columns: repeat(3, 1fr); }
.tool__rows > div { padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line); }
.tool__rows dt { font-size: 13px; color: var(--muted); }
.tool__rows dd { margin: 4px 0 0; font: 600 22px/1.2 var(--serif); font-variant-numeric: lining-nums; }
.tool__notes { margin: 24px 0 0 !important; padding: 0 !important; list-style: none; font-size: 15px; color: var(--muted); }
.tool__notes li { position: relative; padding-left: 18px; }
.tool__notes li + li { margin-top: 8px; }
.tool__notes li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Hub: a lookbook of tools */
.tool-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 40px 28px; margin-top: 32px !important; padding: 0 !important; list-style: none; }
.tool-list li { margin: 0 !important; }
.tool-list a { display: block; text-decoration: none !important; color: var(--text) !important; }
.tool-list img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-btn); margin: 0 0 16px !important; }
.tool-list strong { display: block; font: 700 22px/1.2 var(--serif); }
.tool-list a:hover strong { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.tool-list span { display: block; margin-top: 8px; font-size: 16px; color: var(--muted); }
.tool-page .prose > .tool-list { max-width: none; }

/* Phone: jump from the picks to the result */
.tool-jump {
	position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40; transform: translate(-50%, 0);
	min-height: 48px; padding: 0 22px; border: 0; border-radius: var(--radius-btn);
	background: var(--ink); color: #fff; font: 600 13px/1 var(--label); letter-spacing: .08em; text-transform: uppercase;
	box-shadow: 0 10px 30px rgba(17, 0, 28, .28); cursor: pointer; transition: opacity .2s ease, transform .2s ease;
}
.tool-jump[hidden] { display: block !important; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
.tool-jump:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (min-width: 1000px) { .tool-jump { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .tool-jump { transition: none; } }

@media (max-width: 999px) {
	.tool-hero { grid-template-columns: minmax(0, 1fr); gap: 28px; }
	.tool-hero__media { order: -1; }
	.tool-hero__media img { aspect-ratio: 16 / 9; }
	.tool { grid-template-columns: minmax(0, 1fr); gap: 40px; }
	.tool__result { position: relative; top: auto; padding: 32px 0 0; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 639px) {
	.tool-page { padding-top: 16px; padding-bottom: 56px; }
	.tool-hero { gap: 20px; }
	.tool-hero__media img { aspect-ratio: 2 / 1; border-radius: var(--radius-btn); }
	.tool { margin: 32px 0 40px; padding-top: 28px; gap: 32px; }
	.tool__form { gap: 26px; }
	.tool__result { padding: 28px 0 0; }
		.tool__submit { align-self: stretch; }
	.tool-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
	.tool-list strong { font-size: 18px; }
	.tool-list span { font-size: 14.5px; }
}
.tool__units--wrap { flex-wrap: wrap; gap: 8px; border-bottom: 0; }
.tool__units--wrap .tool__unit {
	min-height: 40px; margin: 0; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px;
	font: 600 15px/1 var(--sans); letter-spacing: 0; text-transform: none; color: var(--text);
}
.tool__units--wrap .tool__unit:hover { border-color: var(--accent); }
.tool__units--wrap .tool__unit.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Face shape tool */
.tool--face { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.tool--face .tool__result { justify-content: flex-start; }
.face__stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 420px; border: 2px dashed #d9d2dc; border-radius: var(--radius-card); background: var(--tint); overflow: hidden; }
.face__stage.has-photo { border-style: solid; border-color: var(--line); background: #0d0a10; }
.face__drop { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 24px; text-align: center; }
.face__drop-icon { color: var(--accent); }
.face__drop-title { font: 700 22px/1.25 var(--serif); }
.face__buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }
.face__buttons .btn { cursor: pointer; }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn--ghost:hover { background: var(--ink); color: #fff; }
.face__canvas { display: block; width: 100%; height: auto; max-height: 640px; object-fit: contain; }
.face__status { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 8px 14px; border-radius: var(--radius-btn); background: rgba(17, 0, 28, .82); color: #fff; font-size: 15px; white-space: nowrap; }
.face__reset { position: absolute; right: 12px; top: 12px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .92); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; }
.face__privacy { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.face__privacy svg { flex: none; margin-top: 3px; color: var(--accent); }
.face__tryon { display: flex; flex-direction: column; gap: 10px; }

.face__shapes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.face__chip { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; }
.face__chip:hover { border-color: var(--accent); }
.face__chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.face__recs { margin-top: 26px; }
.face__tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius-btn); background: var(--tint); }
.face__tab { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 15px; cursor: pointer; }
.face__tab.is-active { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(17, 0, 28, .12); }
.face__panel { margin-top: 18px; font-size: 16px; }
.face__note { color: var(--text); }
.face__avoid { margin-top: 14px; font-size: 14px; color: var(--muted); }
.face__list { margin: 14px 0 0 !important; padding: 0 !important; list-style: none; }
.face__list li { padding: 10px 0; border-top: 1px solid var(--line); font-weight: 600; }
.face__frames { margin: 14px 0 0 !important; padding: 0 !important; list-style: none; }
.face__frames li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.face__frames strong { flex: 1 1 140px; font-size: 16px; }
.face__link { padding: 0; border: 0; background: none; color: var(--accent) !important; font-size: 14px; font-weight: 600; text-decoration: underline !important; text-underline-offset: 3px; cursor: pointer; }

@media (max-width: 999px) {
	.tool--face { grid-template-columns: minmax(0, 1fr); }
	.face__stage { min-height: 320px; }
}
.tool [hidden] { display: none !important; }
.face__frames strong { color: var(--text) !important; }
.face__list li { color: var(--text); }
.face__chip.is-near { border-color: var(--accent); color: var(--accent); }
.tool__big.is-placeholder { color: #8b8391; }

/* Dress code decoder */
.tool--dc { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.tool--dc .tool__result { justify-content: flex-start; }
.dc__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dc__chip { min-height: 40px; padding: 0 14px; border: 1px solid #d9d2dc; border-radius: 10px; background: transparent; color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; transition: border-color .15s ease; }
.dc__chip:hover { border-color: var(--accent); }
.dc__chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.dc__mods { display: flex; flex-wrap: wrap; gap: 22px 28px; }
.dc__name { margin-top: 14px; font: 700 clamp(40px, 4.4vw, 60px)/1.05 var(--serif); letter-spacing: -0.015em; }
.dc__name.is-placeholder { color: #8b8391; }
.dc__meter { display: flex; align-items: center; gap: 12px; margin-top: 24px; font-size: 14px; color: var(--muted); }
.dc__meter-bar { flex: 1; max-width: 260px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.dc__meter-bar span { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.dc__meter-num { font-weight: 600; color: var(--text); }
.dc__rows { margin: 22px 0 0; border-top: 1px solid var(--line); }
.dc__rows > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dc__rows dt { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.dc__rows dd { margin: 0; font-size: 16px; color: var(--text); }
.dc__shop { margin-left: 4px; color: var(--accent) !important; font-size: 14px; font-weight: 600; text-decoration: underline !important; text-underline-offset: 3px; white-space: nowrap; }
.dc__avoid { margin-top: 18px; font-size: 15px; color: var(--muted); }
.dc__tip { margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-btn); background: var(--tint); font-size: 15px; color: var(--text); }
.dc__links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 22px; }
.dc__links-label { font: 700 12px/1 var(--label); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.dc__links a { color: var(--text) !important; font-size: 15px; font-weight: 600; text-decoration: underline !important; text-decoration-color: rgba(147, 87, 43, .45) !important; text-underline-offset: 3px; }
@media (max-width: 999px) {
	.tool--dc { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 639px) {
	.dc__rows > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
	.dc__chip { font-size: 14px; padding: 0 12px; }
}

/* Tie color matcher */
.tool--tm { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.tool--tm .tool__result { justify-content: flex-start; }
/* Color choices as fabric swatches: a cut of cloth with a pinked (zigzag) lower edge, name below. */
.tm__swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 16px 10px; }
.tm__swatch {
	position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 0 0 8px;
	border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.2; text-align: left; cursor: pointer;
}
.tm__swatch .tm__dot {
	width: 100%; height: 50px; border-radius: 4px 4px 0 0;
	box-shadow: inset 0 0 0 1px rgba(17, 0, 28, .12), inset 0 -10px 18px -12px rgba(0, 0, 0, .25);
	-webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 8px 100%;
	mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 8px 100%;
}
.tm__swatch::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; }
.tm__swatch:hover { color: var(--text); }
.tm__swatch.is-active { color: var(--text); }
.tm__swatch.is-active::after { background: var(--accent); }
.tm__swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.tm__dot { flex: none; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(17, 0, 28, .18); }
.tm__preview { display: block; width: 100%; max-width: 300px; height: auto; margin-top: 4px; align-self: center; border-radius: var(--radius-card); background: var(--tint); }
.tm__preview polygon, .tm__preview circle { transition: fill .2s ease; }
.tm__name { font-size: clamp(32px, 3.4vw, 46px); }
.tm__group { margin-top: 24px; font: 700 12px/1 var(--label); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.tm__ties { margin: 10px 0 0 !important; padding: 0 !important; list-style: none; }
.tm__ties li { display: flex; align-items: flex-start; gap: 12px; margin: 0 !important; border-top: 1px solid var(--line); }
.tm__tie { display: flex; flex: 1; align-items: flex-start; gap: 12px; padding: 12px 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.tm__tie-dot { flex: none; width: 26px; height: 26px; margin-top: 1px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(17, 0, 28, .14); }
.tm__tie.is-active .tm__tie-dot { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
.tm__tie-text { display: flex; flex-direction: column; gap: 2px; }
.tm__tie-text strong { color: var(--text); font-size: 16px; }
.tm__tie-text span { font-size: 15px; color: var(--muted); }
.tm__tie:hover .tm__tie-text strong { text-decoration: underline; text-underline-offset: 3px; }
.tm__ties .dc__shop { margin: 14px 0 0; }
.tm__skip { margin: 10px 0 0 !important; padding: 0 !important; list-style: none; font-size: 15px; color: var(--muted); }
.tm__skip li { margin: 0 !important; padding: 8px 0; border-top: 1px solid var(--line); }
.tm__skip strong { color: var(--text); }
@media (max-width: 999px) {
	.tool--tm { grid-template-columns: minmax(0, 1fr); }
	.tm__preview { max-width: 240px; }
}
@media (max-width: 639px) {
	.tm__swatches { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 14px 8px; }
	.tm__swatch { font-size: 13px; }
	.tm__swatch .tm__dot { height: 40px; }
}

/* Skin tone color finder (shares tie matcher and face tool pieces) */
.tool--st { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.tool--st .tool__result { justify-content: flex-start; }
.st__tests { margin: 6px 0 0 !important; padding: 0 !important; list-style: none; font-size: 14px; color: var(--muted); }
.st__tests li + li { margin-top: 4px; }
.st__tests strong { color: var(--text); }
.st__stage { min-height: 200px; }
.st__canvas { cursor: crosshair; max-height: 460px; }
.st__hint { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--muted); }
.st__sampled { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.st__swatches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; margin: 10px 0 0 !important; padding: 0 !important; list-style: none; }
.st__swatches li { display: flex; align-items: center; gap: 10px; margin: 0 !important; padding: 10px 0; border-top: 1px solid var(--line); }
.st__dot { flex: none; width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(17, 0, 28, .14); }
.st__name { flex: 1; color: var(--text); font-weight: 600; font-size: 15px; }
.st__swatches .dc__shop { margin: 0; }
.st__swatches--small .st__dot { width: 18px; height: 18px; }
.st__swatches--small .st__name { font-weight: 400; color: var(--muted); }
@media (max-width: 999px) {
	.tool--st { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 380px) {
	.st__swatches { grid-template-columns: minmax(0, 1fr); }
}

/* Outfit color matcher (shares tie matcher pieces) */
.tool--oc { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.tool--oc .tool__result { justify-content: flex-start; }
.oc__preview { max-width: 240px; }
.oc__preview path, .oc__preview rect { transition: fill .2s ease; }
@media (max-width: 999px) {
	.tool--oc { grid-template-columns: minmax(0, 1fr); }
	.oc__preview { max-width: 200px; }
}
