/*
 * Sistema visual de Juan el Mecánico. Los contrastes se mantienen altos y las
 * medidas fluidas evitan que aumentar el texto rompa la pantalla.
 */
:root {
  --ink: #102a3a;
  --muted: #526775;
  --navy: #073954;
  --navy-deep: #03283d;
  --teal: #0b918e;
  --teal-soft: #dff7f3;
  --orange: #ed6b21;
  --orange-soft: #fff0e5;
  --cream: #fffaf2;
  --white: #fff;
  --line: #d8e2e7;
  --shadow: 0 18px 45px rgb(7 57 84 / 10%);
  --radius: 22px;
  --shell: min(1160px, calc(100% - 32px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: #f7fafb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
}
img { max-width: 100%; height: auto; }
a { color: #086f75; text-underline-offset: .18em; }
a:hover { color: var(--orange); }
:focus-visible { outline: 3px solid #f4a261; outline-offset: 3px; }
.site-shell { width: var(--shell); margin-inline: auto; }
.skip-link { position: absolute; left: 16px; top: -80px; z-index: 100; padding: 12px 16px; background: var(--white); }
.skip-link:focus { top: 12px; }

.site-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgb(255 255 255 / 14%); background: rgb(3 40 61 / 96%); backdrop-filter: blur(10px); }
.header-row { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--white); font-size: 1.08rem; font-weight: 800; text-decoration: none; }
.brand img { border-radius: 15px; box-shadow: 0 5px 18px rgb(0 0 0 / 20%); }
.site-header nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: #e9ffff;
  font-weight: 700;
  text-decoration: none;
}
.site-header nav { display: flex; align-items: center; gap: 22px; }
.site-header ul { display: flex; gap: 22px; padding: 0; margin: 0; list-style: none; }

.hero { color: var(--white); background: radial-gradient(circle at 80% 20%, #107b86 0, transparent 32%), linear-gradient(135deg, var(--navy-deep), var(--navy)); padding: clamp(64px, 9vw, 118px) 0; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .75fr); align-items: center; gap: clamp(42px, 7vw, 90px); }
.eyebrow { margin: 0 0 10px; color: var(--orange); font-size: .82rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.hero h1, .page-heading h1 { margin: 0; max-width: 820px; font-size: clamp(2.25rem, 5vw, 4.7rem); line-height: 1.04; letter-spacing: -.04em; }
.hero-copy { max-width: 720px; color: #d5edf1; font-size: clamp(1.05rem, 2vw, 1.25rem); }
.hero-card { display: grid; grid-template-columns: 44px 1fr; gap: 8px 16px; padding: 30px; border: 1px solid rgb(255 255 255 / 18%); border-radius: var(--radius); background: rgb(255 255 255 / 8%); box-shadow: var(--shadow); }
.hero-card p { margin: 7px 0 20px; color: #eefcfd; }
.step-number { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: var(--navy-deep); background: #f8c74d; font-weight: 900; }

.code-search { max-width: 660px; margin: 30px 0 18px; }
.code-search label { display: block; margin-bottom: 8px; font-weight: 800; }
.search-row { display: flex; gap: 10px; }
.search-row input { min-width: 0; flex: 1; min-height: 54px; padding: 0 17px; border: 2px solid transparent; border-radius: 14px; font: inherit; font-size: 1.1rem; text-transform: uppercase; }
.search-row button, .button-link { min-height: 54px; padding: 0 24px; border: 0; border-radius: 14px; color: #281205; background: #ffb35c; font: inherit; font-weight: 900; cursor: pointer; }
.button-link { display: inline-flex; align-items: center; text-decoration: none; }
.form-error { min-height: 1.5em; margin: 5px 0 0; color: #ffd3bd; font-weight: 700; }
.text-link {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  color: #d7ffff;
  font-weight: 800;
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }

.catalog-page, .diagnostic-page, .content-page { padding-block: clamp(42px, 7vw, 86px); }
.page-heading { padding: clamp(32px, 5vw, 62px); border-radius: var(--radius); color: var(--white); background: linear-gradient(135deg, var(--navy-deep), #0b6270); }
.page-heading h1 { font-size: clamp(2.2rem, 4.5vw, 4rem); }
.page-heading p:last-child { max-width: 760px; color: #d9f2f3; }
.language-switcher { display: flex; flex-wrap: wrap; gap: 9px; margin: 28px 0; }
.language-switcher a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--navy); background: var(--white); font-weight: 800; text-decoration: none; }
.language-switcher a[aria-current="page"] { color: var(--white); border-color: var(--teal); background: var(--teal); }
.compact-search { color: var(--ink); }
.compact-search input { border-color: var(--line); }
.compact-search .form-error { color: #a23b13; }

.code-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 38px; }
.code-card, .content-card, .hypothesis-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: 0 8px 24px rgb(7 57 84 / 6%); }
.code-card { padding: 25px; }
.code-card h2 { margin: 12px 0 10px; font-size: 1.15rem; line-height: 1.35; }
.code-card h2 a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}
.code-card p:last-child { color: var(--muted); }
.code-pill { display: inline-flex; margin: 0; padding: 5px 11px; border-radius: 9px; color: #7c2e09; background: var(--orange-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 900; letter-spacing: .05em; }

.diagnostic-hero { padding: clamp(30px, 5vw, 62px); border-radius: var(--radius); color: var(--white); background: linear-gradient(140deg, var(--navy-deep), #085b6b); box-shadow: var(--shadow); }
.large-code { font-size: 1.2rem; }
.diagnostic-hero h1 { margin: 18px 0 12px; max-width: 930px; font-size: clamp(2rem, 4.5vw, 3.8rem); line-height: 1.08; letter-spacing: -.035em; }
.plain-lead { max-width: 900px; color: #def4f4; font-size: clamp(1.08rem, 2vw, 1.28rem); }
.safety-notice { margin: 22px 0; padding: 18px 20px; border-left: 5px solid var(--orange); border-radius: 12px; background: var(--orange-soft); }
.section-block { margin-top: clamp(42px, 6vw, 76px); }
.section-block > h2 { font-size: clamp(1.55rem, 3vw, 2.35rem); }
.hypothesis-list { display: grid; gap: 24px; }
.hypothesis-card { position: relative; padding: clamp(24px, 4vw, 42px); overflow: hidden; }
.hypothesis-card h3 { margin: 0 0 14px; padding-right: 48px; font-size: clamp(1.3rem, 2vw, 1.75rem); }
.cause-number { position: absolute; right: 22px; top: 15px; margin: 0; color: #d6e8eb; font-size: 2.2rem; font-weight: 900; }
.plain-box { padding: 16px 18px; border-radius: 13px; background: var(--teal-soft); }
.check-list { display: grid; grid-template-columns: minmax(150px, .32fr) 1fr; gap: 12px 24px; margin-top: 25px; }
.check-list dt { color: var(--navy); font-weight: 900; }
.check-list dd { margin: 0; color: var(--muted); }
.visual-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.visual-grid figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.visual-grid figcaption { padding: 16px 20px 20px; color: var(--muted); }
.info-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.content-card { padding: clamp(24px, 4vw, 40px); }
.content-card h2 { margin-top: 0; }
.content-card h3 a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
}
.sources li { margin-bottom: 16px; }
.sources span, small { color: var(--muted); }
.not-found { max-width: 720px; margin: 30px auto; }

.site-footer { margin-top: 70px; padding: 34px 0; color: #d7e7eb; background: var(--navy-deep); }
.footer-row { display: grid; grid-template-columns: .45fr 1fr; gap: 30px; }
.footer-row p { margin: 0; }

@media (max-width: 880px) {
  .hero-grid, .info-columns { grid-template-columns: 1fr; }
  .code-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  :root { --shell: min(100% - 22px, 1160px); }
  .header-row { min-height: 68px; }
  .brand img { width: 44px; height: 44px; }
  .site-header nav { display: none; }
  .search-row { flex-direction: column; }
  .code-grid, .visual-grid, .footer-row { grid-template-columns: 1fr; }
  .check-list { grid-template-columns: 1fr; gap: 2px; }
  .check-list dd { margin-bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
