/* ============================================================
   Átomos — docs/02-inventario-componentes.md §1
   Radio 0, chaflanes por clip-path, sin sombras ni blur (DESIGN.md).
   ============================================================ */

@layer atoms {
  /* --- Contenedores (no son átomos visuales, pero todo los usa) --- */
  .container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--page-margin);
  }
  .container--text {
    max-width: calc(var(--container-text) + 2 * var(--page-margin));
  }

  /* --- Botón ---------------------------------------------------- */
  .btn {
    --btn-bg: transparent;
    --btn-fg: var(--c-ink);
    --btn-border: var(--c-line-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-sm);
    min-height: 48px;
    padding: 0.8rem 1.4rem;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-family: var(--f-sans);
    font-size: var(--fs-small);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  }
  .btn svg {
    width: 1.1em;
    height: 1.1em;
    flex: none;
    transition: transform var(--dur-fast) var(--ease-out);
  }
  .btn:hover svg {
    transform: translateX(3px);
  }
  .btn--primary {
    --btn-bg: var(--c-red);
    --btn-border: var(--c-red);
    /* Chaflán inferior derecho (DESIGN.md: botones 8 px) */
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut-sm)), calc(100% - var(--cut-sm)) 100%, 0 100%);
  }
  .btn--primary:hover {
    --btn-bg: var(--c-red-hover);
    --btn-border: var(--c-red-hover);
  }
  .btn--primary:focus-visible {
    clip-path: none;
  }
  .btn--secondary:hover {
    --btn-border: var(--c-ink);
  }
  .btn--ghost {
    --btn-border: transparent;
    padding-inline: 0;
  }
  .btn--ghost:hover {
    --btn-fg: var(--c-ink);
    text-decoration: underline;
    text-decoration-color: var(--c-red-line);
  }
  .btn--sm {
    min-height: 40px;
    padding: 0.55rem 1rem;
    font-size: var(--fs-meta);
  }
  .btn--block {
    width: 100%;
  }

  /* --- Eyebrow / kicker: cuadrado rojo + etiqueta mono --------- */
  .eyebrow {
    display: block;
    margin: 0;
    color: var(--c-ink-2);
    font-family: var(--f-mono);
    font-size: var(--fs-meta);
    font-weight: 700;
    letter-spacing: var(--tracking-meta);
    text-transform: uppercase;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }
  .eyebrow::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 0.6rem;
    vertical-align: 0.15em;
    background: var(--c-red);
  }

  /* --- Enlace con subrayado rojo que crece ----------------------- */
  .link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--c-ink);
    font-weight: 600;
    text-decoration: none;
    padding-bottom: 2px;
  }
  .link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--c-red-line);
    transform: scaleX(0.35);
    transform-origin: left;
    transition: transform var(--dur-fast) var(--ease-out);
  }
  .link:hover::after,
  .link:focus-visible::after {
    transform: scaleX(1);
  }

  /* --- Chip / tag ------------------------------------------------ */
  .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--c-line-strong);
    color: var(--c-ink-2);
    font-family: var(--f-mono);
    font-size: var(--fs-meta);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.3;
  }
  .chip--accent {
    border-color: var(--c-red-line);
    color: var(--c-ink);
  }

  /* --- Palabra destacada en titulares (≥ 24px: puede ir en rojo de línea) --- */
  .hl {
    color: var(--c-red-line);
  }

  /* --- Número con contorno y marca de agua (decorativos) --------- */
  .outline-number {
    font-family: var(--f-display);
    font-stretch: var(--display-stretch);
    font-weight: 900;
    font-size: clamp(5rem, 3rem + 8vw, 10rem);
    line-height: 0.8;
    color: transparent;
    -webkit-text-stroke: 1px rgba(244, 241, 236, 0.18);
    user-select: none;
  }
  .watermark {
    position: absolute;
    pointer-events: none;
    user-select: none;
    font-family: var(--f-display);
    font-stretch: var(--display-stretch);
    font-weight: 900;
    line-height: 0.8;
    letter-spacing: -0.04em;
    color: transparent;
    -webkit-text-stroke: 1px rgba(244, 241, 236, 0.05);
    white-space: nowrap;
  }

  /* --- Logo (SVG oficial; nunca filter:invert) ------------------- */
  .logo {
    display: inline-flex;
    align-items: center;
    color: var(--c-white);
    text-decoration: none;
  }
  .logo svg,
  .logo img {
    height: 34px;
    width: auto;
  }

  /* --- Ícono ----------------------------------------------------- */
  .icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: square;
  }

  /* --- Campos de formulario -------------------------------------- */
  .input,
  .select,
  .textarea {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--c-line-strong);
    border-radius: 0;
    background: var(--c-surface-1);
    color: var(--c-ink);
    line-height: 1.4;
    transition: border-color var(--dur-fast) var(--ease-out);
  }
  .textarea {
    min-height: 140px;
    resize: vertical;
  }
  .select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--c-ink-2) 50%), linear-gradient(135deg, var(--c-ink-2) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.4rem;
  }
  .input:hover,
  .select:hover,
  .textarea:hover {
    border-color: var(--c-gray);
  }
  .input:focus,
  .select:focus,
  .textarea:focus {
    border-color: var(--c-ink);
    outline: none;
  }
  .input:focus-visible,
  .select:focus-visible,
  .textarea:focus-visible {
    outline: 2px solid var(--c-focus);
    outline-offset: 2px;
  }
  [aria-invalid="true"] {
    border-color: var(--c-red-line);
  }
  .checkbox {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    font-size: var(--fs-small);
    color: var(--c-ink-2);
    line-height: 1.5;
  }
  .checkbox input {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--c-red);
  }

  /* --- Alertas --------------------------------------------------- */
  .alert {
    padding: var(--s-md) var(--s-lg);
    border: 1px solid var(--c-line-strong);
    border-left: 3px solid var(--c-ink-2);
    background: var(--c-surface-1);
    font-size: var(--fs-small);
  }
  .alert--error {
    border-left-color: var(--c-red-line);
  }
  .alert--ok {
    border-left-color: var(--c-ink);
  }

  /* --- Línea divisoria ------------------------------------------- */
  .rule {
    height: 1px;
    border: 0;
    background: var(--c-line);
    margin: 0;
  }
}

@layer atoms {
  /* Mismo ajuste de contraste en los desplegables del sitio público */
  select option,
  select optgroup {
    background-color: var(--c-surface-2, #1c1c20);
    color: var(--c-ink);
  }
}
