/* Yardage tools kit — interactive tools. Consumes the theme's --yd-* tokens with fallbacks. */

.yd-visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.yd-tool { margin: var(--yd-s-6, 32px) 0; }
.yd-tool__section { margin: 0 0 var(--yd-s-7, 48px); }
.yd-tool__h { font-family: var(--yd-font-display, inherit); font-size: var(--yd-text-xl, 1.5rem); margin: 0 0 var(--yd-s-3, 12px); }
.yd-tool__lede { color: var(--yd-ink-2, #4b534d); margin: 0 0 var(--yd-s-4, 16px); }
.yd-tool__form { margin: 0; }
.yd-tool__grid { display: grid; grid-template-columns: 1fr; gap: var(--yd-s-4, 16px); margin: var(--yd-s-4, 16px) 0; }
.yd-tool__grid--clubs { grid-template-columns: repeat(2, 1fr); }
.yd-tool__field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.yd-tool__field label { font-weight: 600; font-size: var(--yd-text-sm, .875rem); color: var(--yd-ink, #141a16); }
.yd-tool__hint { font-size: var(--yd-text-xs, .75rem); color: var(--yd-ink-3, #5f6862); }
.yd-tool__input { font: inherit; font-size: 1.0625rem; font-variant-numeric: tabular-nums; padding: 10px 12px; border: 1px solid var(--yd-rule-strong, #b9b8ae); border-radius: var(--yd-radius-sm, 8px); background: var(--yd-surface, #fff); color: var(--yd-ink, #141a16); width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; }
select.yd-tool__input { background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 32px; }
.yd-tool__input:focus { outline: 2px solid var(--yd-focus, #267946); outline-offset: 2px; border-color: var(--yd-green, #267946); }
.yd-tool__input--sm { padding: 6px 8px; font-size: .9375rem; min-width: 5.5rem; }
.yd-tool__input:disabled { background: var(--yd-surface-2, #f1f0e9); color: var(--yd-ink-3, #5f6862); cursor: not-allowed; }
.yd-tool__input[aria-invalid="true"] { border-color: var(--yd-partial, #8a5a0b); border-width: 2px; }
/* Handicap fields: text input + a "Plus" switch (plus indexes; iPhone number pads have no + key). */
.yd-tool__hcp { display: flex; align-items: stretch; gap: var(--yd-s-2, 8px); }
.yd-tool__hcp .yd-tool__input { flex: 1 1 auto; }
.yd-tool__plus { display: inline-flex; flex: none; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid var(--yd-rule-strong, #b9b8ae); border-radius: var(--yd-radius-sm, 8px); font-size: var(--yd-text-sm, .875rem); font-weight: 600; color: var(--yd-ink, #141a16); cursor: pointer; white-space: nowrap; }
.yd-tool__plus:has(input:checked) { border-color: var(--yd-green, #267946); background: var(--yd-green-soft, #e3efe6); }
.yd-tool__plus input { width: 18px; height: 18px; margin: 0; accent-color: var(--yd-green, #267946); }
.yd-tool__actions { display: flex; flex-wrap: wrap; gap: var(--yd-s-2, 8px); margin: var(--yd-s-3, 12px) 0; }
.yd-tool__choices { border: 0; padding: 0; margin: 0 0 var(--yd-s-3, 12px); display: flex; flex-wrap: wrap; gap: var(--yd-s-3, 12px); align-items: center; }
.yd-tool__choices legend { font-weight: 600; font-size: var(--yd-text-sm, .875rem); padding: 0; margin-bottom: 6px; }
.yd-tool__choices label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--yd-rule-strong, #b9b8ae); border-radius: var(--yd-radius-pill, 999px); cursor: pointer; }
.yd-tool__choices label:has(input:checked) { border-color: var(--yd-green, #267946); background: var(--yd-green-soft, #e3efe6); }

.yd-tool__result { margin: var(--yd-s-5, 24px) 0 0; padding: var(--yd-s-5, 24px); border: 1px solid var(--yd-rule, #dfded6); border-radius: var(--yd-radius, 12px); background: var(--yd-surface, #fff); }
.yd-tool__result--row { display: grid; grid-template-columns: 1fr; gap: var(--yd-s-4, 16px); }
.yd-tool__number .yd-number__value { font-size: clamp(3rem, 2rem + 6vw, 5.5rem); }
.yd-tool__number--text .yd-number__value { font-size: clamp(2rem, 1.2rem + 4vw, 3.5rem); white-space: nowrap; }
.yd-tool__number .yd-number__value--empty { opacity: .28; }
.yd-tool__rounds thead th { white-space: nowrap; font-size: .7rem; }
.yd-tool__status { min-height: 1.4em; margin: var(--yd-s-3, 12px) 0 0; color: var(--yd-ink-2, #4b534d); font-size: var(--yd-text-sm, .875rem); }
.yd-tool__facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 0; margin: var(--yd-s-3, 12px) 0 0; font-size: var(--yd-text-sm, .875rem); overflow-wrap: break-word; }
.yd-tool__facts:empty { display: none; }
.yd-tool__facts dt { color: var(--yd-ink-3, #5f6862); }
.yd-tool__facts dd { margin: 0 0 8px; font-variant-numeric: tabular-nums; }
@media (min-width: 640px) {
  .yd-tool__facts { grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: 6px var(--yd-s-4, 16px); }
  .yd-tool__facts dd { margin: 0; }
}
.yd-tool__verdict { font-weight: 600; margin: var(--yd-s-4, 16px) 0 0; }
.yd-tool__verdict:empty { display: none; }
.yd-tool__ref { margin: var(--yd-s-4, 16px) 0; }
.yd-tool__ref summary { cursor: pointer; font-weight: 600; color: var(--yd-green-text, #23703f); }
.yd-tool__ref table { margin-top: var(--yd-s-3, 12px); }
.yd-tool__rounds th, .yd-tool__rounds td { padding: 4px 6px; vertical-align: middle; }
.yd-tool__round[hidden] { display: none; }
.yd-tool__diff { font-weight: 600; }
.yd-tool [data-yd-est] { color: var(--yd-ink-2, #4b534d); font-style: italic; }
.yd-tool .yd-table caption { caption-side: top; }

@media (min-width: 640px) {
  .yd-tool__grid { grid-template-columns: repeat(2, 1fr); }
  .yd-tool__grid--clubs { grid-template-columns: repeat(4, 1fr); }
  .yd-tool__result--row { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .yd-tool__grid { grid-template-columns: repeat(3, 1fr); }
  .yd-tool__grid--clubs { grid-template-columns: repeat(6, 1fr); }
}

/* Distance card */
.yd-dist-card__title { margin: 0 0 var(--yd-s-2, 8px); }
.yd-dist-table[hidden], .yd-dist-mine [hidden] { display: none; }

/* Demo */
.yd-demo { display: grid; grid-template-columns: 1fr; gap: var(--yd-s-5, 24px); align-items: start; }
.yd-demo__stage { touch-action: none; user-select: none; -webkit-user-select: none; }
.yd-demo__svg { display: block; width: 100%; max-width: 22rem; margin: 0 auto; height: auto; border-radius: var(--yd-radius, 12px); box-shadow: var(--yd-shadow-1, 0 1px 2px rgba(20,26,22,.06)); }
.yd-demo__rough { fill: var(--yd-green-deep, #123b24); }
.yd-demo__fairway { fill: var(--yd-green, #267946); fill-opacity: .9; }
.yd-demo__tee rect { fill: var(--yd-green-soft, #e3efe6); fill-opacity: .9; }
.yd-demo__green-shape { fill: #9ad0ac; }
.yd-demo__ring { fill: none; stroke: var(--yd-bg, #fbfaf6); stroke-width: 1.5; stroke-dasharray: 3 2; }
.yd-demo__center { fill: var(--yd-bg, #fbfaf6); }
.yd-demo__line { stroke: var(--yd-bg, #fbfaf6); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .8; }
.yd-demo__marker { cursor: grab; }
.yd-demo__marker:active { cursor: grabbing; }
.yd-demo__marker:focus { outline: none; }
.yd-demo__marker:focus-visible .yd-demo__marker-halo { stroke: #fff; stroke-width: 2; }
.yd-demo__marker-halo { fill: #fff; fill-opacity: .18; }
.yd-demo__marker-dot { fill: #fff; }
.yd-demo__marker-core { fill: var(--yd-green-deep, #123b24); }
.yd-demo__number .yd-number__value { font-size: clamp(5rem, 3rem + 10vw, 8rem); }
.yd-demo__hint { color: var(--yd-ink-2, #4b534d); font-size: var(--yd-text-sm, .875rem); }
.yd-demo__nav { display: flex; gap: var(--yd-s-2, 8px); flex-wrap: wrap; }
.yd-demo__cta { margin-top: var(--yd-s-6, 32px); padding-top: var(--yd-s-5, 24px); border-top: 1px solid var(--yd-rule, #dfded6); }
.yd-demo__claim { font-size: var(--yd-text-lg, 1.2rem); }
@media (min-width: 720px) {
  .yd-demo { grid-template-columns: minmax(0, 20rem) 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .yd-demo__marker { transition: transform .08s linear; }
  .yd-demo__marker.is-dragging { transition: none; }
}

/* Print: the club card prints clean; everything else stays readable */
@media print {
  .yd-tool__actions, .yd-tool__status, .yd-tool__hint, .yd-demo__nav { display: none !important; }
  .yd-tool__result { border: 1px solid #000; }
  body.yd-print-card { visibility: hidden; }
  body.yd-print-card .yd-dist-card, body.yd-print-card .yd-dist-card * { visibility: visible; }
  body.yd-print-card .yd-dist-card { position: absolute; left: 0; top: 0; width: 100%; margin: 0; border: 0; }
}
