/* Address book (spec 2026-09-30-address-book-design.md): the "Mis direcciones"
   cards and the checkout's saved-address picker. Loaded after store.css, whose
   `.store-page` rules already style plain labels, inputs and buttons -- these
   only add what a card list and a radio picker need. */

/* store.css turns every direct-child <ul> of .store-page into a padded card and
   every <li> in it into a ruled row. The list here is a stack of cards, so the
   wrapper goes bare and each <li> carries the card -- these selectors are
   written to outrank those two rules, not to repeat them. */
.store-page > .addr-list {
  display: grid; gap: 14px; margin: 16px 0; padding: 0;
  background: none; border: 0; border-radius: 0; list-style: none;
}

.store-page > .addr-list > .addr-card {
  position: relative;
  padding: 18px 20px;
  background: linear-gradient(175deg, var(--surface) 0%, var(--card-gradient-end) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color 0.15s ease;
}
.store-page > .addr-list > .addr-card:hover { border-color: var(--accent-line); }
/* The default address gets the outlined glow the site uses for its headline
   blocks (.store-balance-figure), plus an accent rail so it reads at a glance
   in a list of five. */
.store-page > .addr-list > .addr-card.is-default {
  border-color: var(--accent-line);
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%), linear-gradient(175deg, var(--surface) 0%, var(--card-gradient-end) 100%);
  box-shadow: 0 0 24px -12px var(--accent);
}
.store-page > .addr-list > .addr-card.is-default::before {
  content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}

.addr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.addr-head b { font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }
.addr-body { margin-top: 8px; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.addr-badge {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  padding: 3px 10px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.addr-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.addr-actions form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

/* Every action is the same quiet pill; "Eliminar" is the only one with a colour
   of its own. store.css paints submit buttons solid accent green, which on a
   card with three actions made "Hacer predeterminada" shout over the address. */
.store-page .addr-actions a,
.store-page .addr-actions button[type="submit"],
.store-page .addr-confirm summary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent;
  color: var(--text-primary); font-size: 13px; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.store-page .addr-actions a:hover,
.store-page .addr-actions button[type="submit"]:hover {
  border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent);
}

.addr-confirm { margin-left: auto; }
.addr-confirm summary { list-style: none; color: var(--text-secondary); }
.addr-confirm summary::-webkit-details-marker { display: none; }
.addr-confirm summary:hover { border-color: rgba(255, 84, 112, 0.35); background: rgba(255, 84, 112, 0.12); color: var(--critical); }
.addr-confirm[open] { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.addr-confirm[open] summary { border-color: rgba(255, 84, 112, 0.35); color: var(--critical); }
.addr-confirm form span { font-size: 13px; color: var(--text-secondary); }
.store-page .addr-confirm button[type="submit"] {
  border-color: rgba(255, 84, 112, 0.35); background: rgba(255, 84, 112, 0.12); color: var(--critical);
}
.store-page .addr-confirm button[type="submit"]:hover {
  border-color: var(--critical); background: rgba(255, 84, 112, 0.2); color: var(--critical);
}

/* "Usar como dirección predeterminada": a whole-row toggle instead of a bare
   checkbox. store.css gives every .store-page input width:100% and padding, so
   the native box rendered as a full-width bar; the input is hidden here (still
   focusable and clickable through its label) and a drawn box stands in. */
.store-page .addr-check {
  position: relative; flex-direction: row; align-items: center; gap: 14px;
  margin: 18px 0; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text-primary); cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.store-page .addr-check:hover { border-color: var(--accent-line); }
.store-page .addr-check input {
  position: absolute; opacity: 0; width: 1px; height: 1px; padding: 0; border: 0; pointer-events: none;
}
.addr-check-box {
  display: grid; place-items: center; flex-shrink: 0;
  width: 24px; height: 24px;
  border: 1.5px solid var(--text-secondary); border-radius: 7px;
  background: var(--ink); color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.addr-check-box svg { width: 15px; height: 15px; opacity: 0; transform: scale(0.6); transition: opacity 0.15s ease, transform 0.15s ease; }
.addr-check-text { display: grid; gap: 2px; }
.addr-check-text b { font-size: 14.5px; font-weight: 600; }
.addr-check-text small { font-size: 12.5px; color: var(--text-secondary); }

.store-page .addr-check:has(input:checked) {
  border-color: var(--accent-line); box-shadow: 0 0 24px -12px var(--accent);
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%), var(--surface);
}
.addr-check input:checked + .addr-check-box { background: var(--accent); border-color: var(--accent); }
.addr-check input:checked + .addr-check-box svg { opacity: 1; transform: scale(1); }
.addr-check input:focus-visible + .addr-check-box { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 520px) {
  .store-page > .addr-list > .addr-card { padding: 16px; }
  .addr-confirm { margin-left: 0; }
}

/* Checkout picker: the radios and their cards are siblings of the new-address
   fieldset so `:checked ~` can reveal it without JavaScript. */
.addr-picker > input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.addr-picker > label {
  display: block;
  margin: 8px 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.addr-picker > input[type="radio"]:checked + label { border-color: var(--accent-line); background: var(--accent-soft); }
.addr-picker > input[type="radio"]:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.addr-new-form { display: none; }
#addr-new:checked ~ .addr-new-form { display: block; }
/* The rule above has an id in it, so it outranks store.css's
   `.store-address { display: grid }` at desktop width and would stack the
   revealed fields in one column. Restate the grid at the same breakpoint. */
@media (min-width: 620px) {
  #addr-new:checked ~ .addr-new-form { display: grid; }
}
