/* Keep longer instructions and user-entered text in sentence case. */
:is(h1, h2, h3, h4, .nav-button, .button, .button-secondary, .filter,
    .mode-switch button, .market-type, .card-kicker, .demo-badge,
    .earn-tracks strong, .profile-available) {
  text-transform: uppercase;
}

:is(h1, h2, h3, h4) {
  overflow-wrap: anywhere;
  text-wrap: balance;
}

:is(.nav-button, .button, .button-secondary, .filter, .mode-switch button) {
  min-block-size: 44px;
  letter-spacing: .025em;
  line-height: 1.25;
}

.market-card-title h3, .dialog-header h2 {
  letter-spacing: -.025em;
  line-height: 1.15;
}

.market-card-foot { width: 100%; }
.market-search input, .market-search select { font-size: 1rem; }

@media (max-width: 1024px) {
  .header-inner {
    min-height: 0;
    padding-block: .75rem;
    grid-template-columns: 1fr auto;
    gap: .5rem .85rem;
  }

  .navigation {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .25rem;
  }

  .nav-button { padding-inline: .3rem; }
  .mode-switch { grid-column: 2; grid-row: 1; justify-self: end; }
}

.paro-tab-icon { display: none; }

@media (max-width: 600px) {
  .navigation {
    position: fixed;
    z-index: 5;
    inset: auto 0 0;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    background: #fffdf8;
    border-top: 1px solid #ddd8cc;
    box-shadow: 0 -4px 18px #21150a14;
    padding: .28rem .2rem max(.28rem, env(safe-area-inset-bottom));
  }
  .navigation .nav-button {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: .15rem;
    min-height: 3.15rem;
    padding: .2rem 0;
    font-size: clamp(.56rem, 2.5vw, .7rem);
    line-height: 1.05;
    letter-spacing: 0;
  }
  .navigation .nav-button[aria-pressed="true"] { color: #853421; background: #ffe9e0; }
  .paro-tab-icon { display: block; font-size: 1.25rem; line-height: 1; }
  .main { margin-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(4.5rem + env(safe-area-inset-bottom)); }

  #action-dialog {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: calc(100% - max(.75rem, env(safe-area-inset-top)));
    max-height: calc(100dvh - max(.75rem, env(safe-area-inset-top)));
    margin: 0;
    padding: 0;
    border-radius: 1.25rem 1.25rem 0 0;
    overscroll-behavior: contain;
  }

  #action-dialog .dialog-header {
    position: sticky;
    z-index: 2;
    top: 0;
    padding: .75rem 1rem;
    margin: 0;
    background: var(--card);
    border-bottom: 1px solid var(--line);
  }

  #action-dialog .dialog-header h2 { font-size: clamp(1.1rem, 4.9vw, 1.45rem); }
  #action-dialog .close { width: 44px; height: 44px; }

  #dialog-body {
    min-inline-size: 0;
    padding: .9rem 1rem max(1.25rem, env(safe-area-inset-bottom));
    overflow-wrap: anywhere;
  }

  #action-dialog form :is(input, select, textarea) {
    min-inline-size: 0;
    max-inline-size: 100%;
    font-size: 16px;
  }

  #action-dialog form :is(input:not([type="checkbox"]):not([type="radio"]), select) { min-block-size: 44px; }

  #action-dialog .op-actions > .button,
  #action-dialog form > button[type="submit"] {
    width: 100%;
    white-space: normal;
    text-align: center;
  }
}

/* ── Campos de formulario: claros, grandes y consistentes (v forms-2) ── */
form label { gap: .4rem; font-weight: 640; font-size: .95rem; color: var(--ink); }
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), textarea, select,
.op-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .op-form select, .op-form textarea {
  min-block-size: 48px;
  padding: .75rem .9rem;
  font-size: 16px; /* evita el zoom automático en iPhone */
  line-height: 1.35;
  border: 1.5px solid #cfd3c8;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
textarea, .op-form textarea { min-block-size: 6.5rem; }
select, .op-form select {
  appearance: none;
  padding-inline-end: 2.4rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23505952' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right .95rem center;
}
input::placeholder, textarea::placeholder { color: #8a9188; }
:is(input, textarea, select):hover { border-color: #aeb4a7; }
:is(input, textarea, select):focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px #254d4022;
}
form:has(button[type=submit]:active) :is(input, textarea, select):invalid,
:is(input, textarea, select):user-invalid { border-color: #c2412d; box-shadow: 0 0 0 4px #c2412d1f; }
input[type="checkbox"], input[type="radio"] { inline-size: 20px; block-size: 20px; accent-color: var(--green); flex: 0 0 auto; }
form label:has(> input[type="checkbox"]), .op-form label:has(input[type=checkbox]) {
  display: flex; align-items: flex-start; gap: .65rem; font-weight: 500; line-height: 1.4; cursor: pointer;
}
form label:has(> input[type="checkbox"]) input { order: -1; margin-top: .1rem; }
.field-hint { display: block; font-size: .82rem; font-weight: 450; color: var(--quiet); }
.field-optional { margin-inline-start: .3rem; padding: .05rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 600; color: var(--quiet); background: var(--mist); vertical-align: .1em; }
.op-form-feedback { margin: 0; padding: .7rem .9rem; border-radius: 12px; background: #fdecea; color: #8e2519; font-weight: 600; }

/* Pasos del formulario de publicar */
.form-step { display: grid; gap: .9rem; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; min-inline-size: 0; }
.form-step legend { padding: 0 .35rem; font-weight: 800; font-size: 1rem; letter-spacing: -.01em; }
.form-step-hint { margin: -.4rem 0 0; color: var(--quiet); font-size: .88rem; }
.form-more { border: 1px dashed #cfd3c8; border-radius: 16px; background: var(--canvas); }
.form-more > summary { padding: .95rem 1rem; font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; min-block-size: 48px; }
.form-more > summary::-webkit-details-marker { display: none; }
.form-more > summary::after { content: "+"; font-size: 1.3rem; color: var(--quiet); }
.form-more[open] > summary::after { content: "–"; }
.form-more[open] { display: grid; gap: .9rem; padding: 0 1rem 1rem; }
.form-more[open] > summary { margin-inline: -1rem; }
.op-form > button[type="submit"], #action-dialog form > button[type="submit"] { min-block-size: 52px; font-size: 1rem; }
