/* defectos.css — Estilos para la Enciclopedia de Defectos (Mobile-First, Sin JS) */
@import url('tokens.css');

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--carbon);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p {
  letter-spacing: normal;
}

.print-header,
.print-footer {
  display: none !important;
}

a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--melt);
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--melt);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 999;
}
.skip-link:focus {
  top: 1rem;
}

/* Header */
.header { border-bottom: 1px solid var(--line); background: rgba(14,17,22,.95); position: static; z-index: 100; }
.header__inner { max-width: var(--maxw); margin: 0 auto; padding: .7rem var(--gutter); display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.header__brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  flex-shrink: 0;
}
.brand__logo { height: 26px; width: auto; display: block; }
.brand__section { display: none; color: var(--teal); font-family: var(--font-mono); font-size: .85rem; font-weight: 700; text-decoration: none; letter-spacing: .02em; }
.header__cta { order: 2; margin-left: auto; white-space: nowrap; }
.header__nav { order: 3; flex: 1 0 100%; display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.header__nav a { color: var(--bone); text-decoration: none; font-size: .9rem; font-family: var(--font-sans); white-space: nowrap; padding: .45rem 0; transition: color .15s ease; }
.header__nav a:hover { color: var(--teal); }
@media (min-width: 420px) { .brand__section { display: inline; } }
@media (min-width: 760px) {
  .header { position: sticky; top: 0; backdrop-filter: blur(8px); }
  .header__inner { flex-wrap: nowrap; padding: .8rem var(--gutter); }
  .brand__logo { height: 30px; }
  .brand__section { font-size: .95rem; }
  .header__nav { order: 2; flex: 0 1 auto; margin-left: auto; gap: 1.25rem; }
  .header__cta { order: 3; margin-left: 1.25rem; }
}

/* Layout */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem var(--gutter) 4rem var(--gutter);
}
.container--wide {
  max-width: var(--maxw-wide);
}

/* Breadcrumbs */
.breadcrumbs {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #A0A8B4;
  margin-bottom: 1.5rem;
  word-break: break-word;
}
.breadcrumbs__list {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.breadcrumbs__item {
  display: inline-flex;
  align-items: center;
  word-break: break-word;
  min-width: 0;
}
.breadcrumbs__item + .breadcrumbs__item::before {
  content: "›";
  color: #A0A8B4;
  margin-right: 0.35rem;
  speak: never;
}
.breadcrumbs a {
  color: #A0A8B4;
  text-decoration: none;
}
.breadcrumbs a:hover {
  color: var(--teal);
}
.breadcrumbs span[aria-current="page"] {
  color: var(--bone);
  font-weight: 500;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: #FFFFFF;
  line-height: 1.25;
}
h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin: 0.5rem 0 1rem 0;
  letter-spacing: -0.02em;
}
h2 {
  font-size: clamp(1.4rem, 3.5vw, 1.85rem);
  margin: 2.5rem 0 1rem 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}
h3 {
  font-size: 1.25rem;
  margin: 1.8rem 0 0.8rem 0;
}

.author-line {
  font-size: 0.95rem;
  color: #A0A8B4;
  margin-bottom: 2rem;
  font-family: var(--font-body);
}

/* Highlight / Quick Answer Box */
.box-highlight {
  background: var(--carbon-2);
  border: 1px solid var(--teal);
  border-left: 5px solid var(--teal);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}
.box-highlight__title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--teal);
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.box-highlight p {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--bone);
}

/* Action Steps (Orden de actuacion) */
.action-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.action-card {
  background: var(--carbon-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s ease;
}
.action-card:hover {
  border-color: rgba(44, 177, 188, 0.4);
}
.action-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.action-card__step {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--melt);
}
.badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.06);
  color: var(--steel);
  display: inline-block;
  white-space: nowrap;
}
.badge--comprobacion { background: rgba(44, 177, 188, 0.15); color: var(--teal); }
.badge--proceso      { background: rgba(255, 106, 43, 0.15); color: var(--melt); }
.badge--material     { background: rgba(230, 180, 50, 0.15); color: #E6B432; }
.badge--maquina      { background: rgba(138, 146, 156, 0.2); color: var(--bone); }
.badge--molde        { background: rgba(180, 100, 240, 0.15); color: #C482F5; }
.badge--pieza        { background: rgba(56, 189, 248, 0.15); color: #38BDF8; }
.badge--dir          { background: rgba(255, 255, 255, 0.08); color: var(--bone); }
.badge--pending      { background: rgba(230, 180, 50, 0.15); color: #E6B432; border: 1px solid rgba(230, 180, 50, 0.4); }

.action-card__body {
  font-size: 1rem;
}
.action-card__meta {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: var(--steel);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.6rem;
}
@media (min-width: 600px) {
  .action-card__meta {
    grid-template-columns: 1fr 1fr;
  }
}
.action-card__meta strong {
  color: var(--bone);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0 2rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}
th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}
th {
  background: var(--carbon-2);
  color: var(--bone);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tr:last-child td {
  border-bottom: none;
}
td {
  color: #DDE2E8;
}
td.mono {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* CTAs */
.cta-box {
  background: linear-gradient(135deg, rgba(44, 177, 188, 0.08), rgba(255, 106, 43, 0.08));
  border: 1px solid rgba(44, 177, 188, 0.3);
  border-radius: var(--radius);
  padding: 2rem;
  margin: 3rem 0;
  text-align: center;
}
.cta-box--inline {
  background: var(--carbon-2);
  border: 1px solid var(--line);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.btn--primary {
  background: var(--melt);
  color: #0E1116;
  box-shadow: var(--melt-glow);
}
.btn--primary:hover {
  transform: translateY(-2px);
  background: #FF7E45;
  color: #0E1116;
}
.btn--secondary {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--teal);
}
.btn--secondary:hover {
  background: rgba(44, 177, 188, 0.1);
  color: var(--teal);
}
.btn--sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}
.btn--melt {
  background: var(--melt);
  color: #0E1116;
}
.btn--melt:hover {
  background: #FF7E45;
  color: #0E1116;
  opacity: 0.95;
}

/* FAQ Details */
details {
  background: var(--carbon-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
  padding: 0.8rem 1.2rem;
}
summary {
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
  outline: none;
  color: var(--bone);
}
summary:hover {
  color: var(--teal);
}
details[open] summary {
  margin-bottom: 0.8rem;
  color: var(--teal);
}
details p {
  margin: 0;
  color: #CAD1DA;
}

/* Legal Notice */
.legal-notice {
  font-size: 0.85rem;
  color: var(--steel);
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
  margin-top: 3rem;
  font-style: italic;
}

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  padding: 3rem var(--gutter);
  background: #090B0E;
  color: var(--steel);
  font-size: 0.9rem;
  text-align: center;
}
.footer a {
  color: var(--steel);
}
.footer a:hover {
  color: var(--bone);
}
