/* ==========================================================================
   K07 — Elements (kit/elements.html)

   Static specimens of the kit's small parts. Frozen states are shown with
   state classes on the element itself:
     .is-hover  .is-focus  .is-active  .is-selected
     .is-disabled  .is-error  .is-success
   e.g. <span class="btn btn--secondary btn--sm is-error">✕ Try again</span>

   Contents
     1. Utilities            .text-error .text-success .is-focus
     2. Specimens            .text-link .field .chip .tag (+ state rules
                             for the shared .btn)
     3. 01 States            .state-matrix
     4. 02 Anatomy           .anatomy .field-anatomy
     5. 03 Themes × presets  .preset-grid .preset-card
     6. 04 Element catalog   .catalog .catalog-card + demo elements
   ========================================================================== */

/* 1. Utilities ----------------------------------------------------------- */
.text-error   { color: var(--error); }
.text-success { color: var(--success); }

/* Frozen focus-visible ring (same as the global :focus-visible rule) */
.is-focus {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* 2. Specimens ----------------------------------------------------------- */

/* Buttons: state rules for the shared .btn */
.btn--primary.is-hover {
  background: var(--accent-text);
}

.btn.is-active {
  transform: scale(.97);
}

.btn--primary.is-disabled {
  background: var(--line);
  color: var(--muted);
}

.btn--primary.is-success {
  background: var(--success);
  color: #fff;
}

.btn--secondary.is-hover {
  background: var(--ink);
  color: var(--canvas);
}

.btn--secondary.is-disabled {
  border-style: dashed;
  border-color: var(--muted);
  color: var(--muted);
}

.btn--secondary.is-error {
  border-color: var(--error);
  color: var(--error);
}

.btn--secondary.is-success {
  border-color: var(--success);
  color: var(--success);
}

/* Text link with a drawn underline */
.text-link {
  padding-bottom: 2px;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0% 1.5px no-repeat;
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
  transition: background-size 240ms cubic-bezier(.16, 1, .3, 1);
}

a.text-link:hover,
.text-link.is-hover,
.text-link.is-active {
  background-size: 100% 1.5px;
  color: var(--accent-text);
}

.text-link.is-disabled {
  color: var(--muted);
}

/* Text field (static; the real <input> styles live in the patterns pages) */
.field-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.field {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.field.is-hover {
  border-width: 1.5px;
}

.field.is-disabled {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
}

.field.is-error {
  border: 1.5px dashed var(--error);
  background: var(--error-bg);
}

.field.is-success {
  border-color: var(--success);
}

.field__msg {
  font-size: 13px;
}

/* Selectable chip (budget ranges, filters) */
.chip {
  padding: 6px 10px;
  border: 1px solid var(--ink);
  font-size: 14px;
}

.chip--lg {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 15px;
}

.chip--sm {
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 13px;
}

.chip.is-hover {
  border-width: 1.5px;
  background: var(--canvas);
}

.chip.is-active,
.chip.is-selected {
  background: var(--ink);
  color: var(--canvas);
}

.chip.is-disabled {
  border-style: dashed;
  border-color: var(--muted);
  color: var(--muted);
}

.chip.is-error {
  border-color: var(--error);
  color: var(--error);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Non-interactive tag */
.tag {
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-size: 13px;
}

/* 3. 01 States ----------------------------------------------------------- */
.state-matrix-scroll {
  overflow-x: auto;
}

.state-matrix {
  display: grid;
  grid-template-columns: 150px repeat(8, minmax(0, 1fr));
  gap: 14px 12px;
  align-items: start;
  min-width: 1100px;
}

.state-matrix__label {
  padding-top: 10px;
  font-size: 15px;
  font-weight: 600;
}

.state-matrix__cell {
  display: flex;
  min-width: 0;
}

/* 4. 02 Anatomy ---------------------------------------------------------- */
.anatomy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 40px;
}

.anatomy {
  position: relative;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.anatomy--button {
  padding-top: 48px;
}

.anatomy__specimen {
  position: relative;
  display: inline-flex;
}

/* Dashed outline marking the measured box */
.anatomy__target {
  outline: 1px dashed var(--accent);
  outline-offset: 0;
}

/* Measurement labels around the specimen */
.anatomy__dim {
  position: absolute;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--accent-text);
  white-space: nowrap;
}

.anatomy__dim--height  { left: -44px; top: 14px; }
.anatomy__dim--padding { left: 4px; top: -18px; }
.anatomy__dim--gap     { right: 22px; top: -18px; }
.anatomy__dim--label   { left: 30px; bottom: -20px; }

.anatomy__notes {
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.anatomy--button .anatomy__notes {
  margin-top: 36px;
}

.field-anatomy {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-anatomy__top {
  display: flex;
  justify-content: space-between;
}

.field-anatomy__label {
  font-size: 15px;
  font-weight: 600;
}

.field-anatomy__hint {
  font-size: 14px;
  color: var(--muted);
}

/* 5. 03 Themes × presets ------------------------------------------------- */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 10px;
}

/* Each card carries its own data-preset / data-theme, so the tokens
   inside resolve to that combination. */
.preset-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--f-body);
}

.preset-card__btn {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 14px;
}

.preset-card__field {
  border-radius: var(--radius);
  font-size: 14px;
}

/* 6. 04 Element catalog -------------------------------------------------- */
.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 14px;
}

.catalog-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.catalog-card__title {
  font-weight: 600;
}

.catalog-card__demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 72px;
}

/* Do / don't */
.catalog-card__rules {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
}

/* Icon button */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--ink);
}

/* Mini availability calendar */
.mini-cal {
  display: grid;
  grid-template-columns: repeat(7, 26px);
  gap: 3px;
  font-family: var(--f-mono);
  font-size: 11px;
  text-align: center;
}

.mini-cal__dow {
  color: var(--muted);
}

.mini-cal__day {
  height: 24px;
  line-height: 24px;
}

.mini-cal__day--free {
  border: 1px solid var(--line);
}

.mini-cal__day--booked {
  background: var(--ink);
  color: var(--canvas);
}

.mini-cal__day--open {
  border: 1.5px solid var(--accent);
}

.mini-cal__day--off {
  color: var(--muted);
}

/* File upload drop zone */
.dropzone {
  width: 100%;
  padding: 14px;
  border: 1.5px dashed var(--muted);
  font-size: 14px;
  text-align: center;
}

/* Link field with protocol prefix */
.link-field {
  display: flex;
  width: 100%;
  border: 1px solid var(--ink);
}

.link-field__prefix {
  padding: 10px;
  border-right: 1px solid var(--line);
  background: var(--canvas);
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 13px;
}

.link-field__value {
  padding: 10px;
  font-size: 15px;
}

/* Card checkbox / radio */
.choice-card {
  flex: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 110px;
  padding: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
}

.choice-card.is-selected {
  border-color: var(--ink);
}

.choice-card__box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--ink);
  font-size: 11px;
}

/* Switch (on) */
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle__track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--ink);
}

.toggle__thumb {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--canvas);
}

/* Segmented view toggle */
.segmented {
  display: flex;
  border: 1px solid var(--ink);
}

.segmented__item {
  padding: 8px 12px;
  font-family: var(--f-mono);
  font-size: 12px;
}

.segmented__item.is-selected {
  background: var(--ink);
  color: var(--canvas);
}

/* Availability: fully booked variant of the shared .availability */
.availability--off {
  color: var(--muted);
}

.availability--off .dot {
  background: var(--muted);
}

/* Price anchor */
.price-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--ink);
}

.price-chip__from {
  font-size: 13px;
  color: var(--muted);
}

.price-chip__value {
  font-size: 24px;
}

/* Metadata & camera lines */
.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.camera-meta {
  font-family: var(--f-mono);
  font-size: 13px;
}

.frame-no {
  padding: 4px 8px;
  background: var(--sheet);
  color: var(--edge);
  font-family: var(--f-mono);
  font-size: 15px;
}

/* Stamp with a per-instance angle:  style="--tilt:4deg" */
.stamp--tilt {
  transform: rotate(var(--tilt, -5deg));
}

/* Annotation marks (circle drawn by proof.js via data-mark) */
.annotated-price {
  padding: 4px 10px;
  font-size: 30px;
}

/* The mark box is wider than its host (120 %); lift base.css's
   svg { max-width: 100% } cap. */
.annotated-price > .mark {
  max-width: none;
}

.annotation-note {
  font-size: 22px;
  color: var(--accent-text);
}

/* Cursor label specimen (static version of .cursor-label__text) */
.cursor-chip {
  padding: 4px 8px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--canvas);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Loupe */
.loupe-demo {
  width: 80px;
  height: 80px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: repeating-linear-gradient(135deg, var(--ph) 0 20px, var(--ph-stripe) 20px 22px);
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .4);
}

/* Crop marks around a placeholder */
.crop-demo {
  position: relative;
  width: 100px;
  height: 60px;
  margin: 14px;
  background: repeating-linear-gradient(135deg, var(--ph) 0 10px, var(--ph-stripe) 10px 11px);
  filter: var(--img-filter);
}

.crop-demo__mark {
  position: absolute;
  background: var(--ink);
}

.crop-demo__mark--top-h    { top: -1px;    left: -20px;   width: 12px; height: 1px; }
.crop-demo__mark--top-v    { top: -20px;   left: -1px;    width: 1px;  height: 12px; }
.crop-demo__mark--bottom-h { bottom: -1px; right: -20px;  width: 12px; height: 1px; }
.crop-demo__mark--bottom-v { bottom: -20px; right: -1px;  width: 1px;  height: 12px; }

/* Color bar (static version of the scroll progress bands) */
.color-bar {
  display: flex;
  width: 100%;
  height: 8px;
}

.color-bar > span {
  flex: 1;
}

.color-bar > span:nth-child(1) { background: #00A0DC; }
.color-bar > span:nth-child(2) { background: #E4007C; }
.color-bar > span:nth-child(3) { background: #FFE500; }
.color-bar > span:nth-child(4) { background: var(--ink); }
.color-bar > span:nth-child(5) { background: var(--accent); }

/* Caption & credits */
.caption {
  font-size: 14px;
  line-height: 1.5;
}

/* Pull-quote mark */
.quote-mark {
  font-size: 80px;
  line-height: .7;
  color: var(--accent);
}

/* Avatars */
.avatar {
  width: var(--size, 36px);
  height: var(--size, 36px);
  border-radius: 50%;
  background: repeating-linear-gradient(135deg, var(--ph) 0 10px, var(--ph-stripe) 10px 11px);
  filter: var(--img-filter);
}

.avatar--lg { --size: 48px; }
.avatar--md { --size: 36px; }
.avatar--sm { --size: 28px; }

.avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--canvas);
  font-size: 13px;
  filter: none;
}

/* Tooltip */
.tooltip-demo {
  position: relative;
  padding-top: 40px;
}

.tooltip-demo__tip {
  position: absolute;
  top: 0;
  left: 0;
  padding: 5px 9px;
  background: var(--ink);
  color: var(--canvas);
  font-size: 13px;
  white-space: nowrap;
}

.tooltip-demo__trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: var(--f-mono);
  font-size: 12px;
}

/* Step progress */
.steps {
  width: 100%;
}

.steps__label {
  margin-bottom: 6px;
  font-family: var(--f-mono);
  font-size: 12px;
}

.steps__bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}

.steps__seg {
  height: 4px;
  background: var(--line);
}

.steps__seg--done {
  background: var(--ink);
}

/* Blur-up placeholder */
.blur-up {
  width: 100%;
  aspect-ratio: 3 / 2;
  background: linear-gradient(135deg, var(--ph), var(--ph-stripe));
  filter: blur(6px);
  transform: scale(.96);
}

/* Skeleton */
.skeleton {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.skeleton__block {
  height: 60px;
  background: var(--line);
}

.skeleton__line {
  width: var(--w, 100%);
  height: 10px;
  background: var(--line);
}

/* Toast */
.toast-demo {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--canvas);
  font-size: 14px;
}

.toast-demo__action {
  text-decoration: underline;
}
