/* Size guide */
.sg { padding-top: clamp(2.5rem, 1.5rem + 4vw, 6rem); }

.sg__controls { margin-top: var(--s-5); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); }
.sg__garments { gap: var(--s-2); }

/* in | cm — quiet text switch */
.sg__units { border: 0; margin: 0; padding: 0; display: inline-flex; gap: 2px; min-inline-size: 0; }
.sg__units label { position: relative; display: inline-flex; }
.sg__units input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.sg__units span {
  display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0 var(--s-2);
  font-size: var(--fs-sm); font-weight: 500; color: var(--faint); transition: color 0.2s;
  background: linear-gradient(currentColor, currentColor) 50% calc(100% - 9px) / 0 1px no-repeat;
}
.sg__units input:checked + span { color: var(--fg); background-size: 16px 1px; }
.sg__units label:hover span { color: var(--fg); }
.sg__units input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }

.sg__grid { margin-top: var(--s-6); display: grid; gap: var(--s-6); }

/* the flat */
.sg__figure { margin: 0; background: var(--bone); display: grid; place-items: center; padding: var(--s-5) var(--s-4); }
.sg-svg { width: 100%; max-width: 420px; height: auto; overflow: visible; }
.sg-lines path { fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-linejoin: round; stroke-linecap: round; }
.sg-lines path:first-child { fill: var(--ivory); }
.sg-panel { fill: var(--oat); stroke: var(--ink); stroke-width: 0.8; stroke-dasharray: 2 2.4; }
.sg-m path { fill: none; stroke: var(--focus); stroke-width: 1.4; }
.sg-m circle { fill: var(--focus); }
.sg-m text { font-family: var(--font-display); font-style: italic; font-size: 17px; fill: var(--focus); text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: var(--ivory); stroke-width: 5px; stroke-linejoin: round; }

/* draw-in when a garment is chosen (one calm motion; the unit switch doesn't replay it) */
.sg-lines path { stroke-dasharray: 1; animation: sg-draw 1.1s var(--ease) both; }
.sg-lines path:first-child { animation: sg-draw 1.1s var(--ease) both, sg-fill 0.6s 0.5s var(--ease) both; }
.sg-lines path:nth-child(n+2) { animation-delay: 0.25s; animation-duration: 0.8s; }
.sg-panel { animation: sg-fade 0.6s 0.7s var(--ease) both; }
.sg-m path { stroke-dasharray: 1; animation: sg-draw 0.7s calc(0.75s + var(--i) * 0.14s) var(--ease) both; }
.sg-m circle, .sg-m text { animation: sg-fade 0.4s calc(1.05s + var(--i) * 0.14s) var(--ease) both; }
.is-still .sg-lines path, .is-still .sg-panel, .is-still .sg-m path, .is-still .sg-m circle, .is-still .sg-m text { animation: none; }
@keyframes sg-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes sg-fill { from { fill-opacity: 0; } to { fill-opacity: 1; } }
@keyframes sg-fade { from { opacity: 0; } to { opacity: 1; } }

/* numbers */
.sg__data { min-width: 0; animation: sg-fade 0.5s var(--ease) both; }
.sg__name { font-family: var(--font-display); font-size: var(--fs-xl); line-height: 1.15; }
.sg__fit { margin-top: var(--s-1); color: var(--muted); }
.sg__table-wrap { margin-top: var(--s-5); }
.sg__table { font-size: var(--fs-base); }
.sg__table th, .sg__table td { padding: var(--s-3) var(--s-3) var(--s-3) 0; }
.sg__table thead th { font-size: var(--fs-sm); vertical-align: bottom; }
.sg__table tbody th { font-weight: 600; color: var(--fg); }
.sg__table tbody tr { transition: background-color 0.2s; }
.sg__table tbody tr:hover { background: color-mix(in srgb, var(--oat) 30%, transparent); }
.sg__letter { font-family: var(--font-display); font-style: italic; color: var(--focus); font-size: 1.05em; }
.sg__note { margin-top: var(--s-4); max-width: 34rem; }
.sg__big { margin-top: var(--s-5); font-family: var(--font-display); font-size: var(--fs-2xl); line-height: 1.1; max-width: 14ch; }
.sg__sizes { margin-top: var(--s-5); font-size: var(--fs-md); }
.sg__data .sp-small { margin-top: var(--s-2); }

/* how to measure */
.sg__how { margin-top: var(--section); padding-top: var(--s-6); border-top: 1px solid var(--line); }
.sg__how h2 { font-size: var(--fs-xl); }
.sg__steps { margin-top: var(--s-5); padding: 0; display: grid; gap: var(--s-5); }
.sg__steps li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: var(--s-3); }
.sg__steps .sg__letter { font-size: var(--fs-lg); line-height: 1.2; }
.sg__step-title { font-weight: 600; }
.sg__steps p + p { margin-top: 2px; color: var(--ink-2); }

@media (min-width: 640px) {
  .sg__steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6) var(--s-7); }
}
@media (min-width: 1000px) {
  .sg__grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s-8); align-items: start; }
  .sg__figure { position: sticky; top: calc(var(--header-h) + var(--s-5)); min-height: min(70svh, 640px); padding: var(--s-7); }
  .sg-svg { max-width: 520px; }
  .sg__data { padding-top: var(--s-2); }
  .sg__steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
