/* =========================================================
   RESET + FULL BLEED
   ========================================================= */
html, body{
  margin: 0 !important;
  padding: 0 !important;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

/* =========================================================
   PAGE BACKGROUND (rompe wrappers centrados)
   ========================================================= */
.code-page{
  width: 100vw;
  min-height: 100vh;
  margin: 0;
  padding: 0;

  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;

  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.code-overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}

/* =========================================================
   CONTENT WRAP (CLAVE: max-width)
   ========================================================= */
.code-wrap{
  position: relative;
  z-index: 2;

  width: min(92%, 1400px); /* 🔥 en monitor no se estira infinito */
  margin: 0 auto;

  padding: 90px 0 80px;
}

/* =========================================================
   HERO
   ========================================================= */
.code-hero{
  text-align: center;
  color: #fff;
  margin-bottom: 45px;
}

.code-hero h1{
  font-size: 64px;
  margin: 0;
  font-weight: 900;
}

.code-hero p{
  margin-top: 10px;
  font-size: 18px;
  opacity: .85;
}

/* =========================================================
   GRID (RESPONSIVE REAL)
   ========================================================= */
.code-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

/* =========================================================
   BREAKPOINTS
   ========================================================= */
@media (max-width: 1100px){
  .code-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px){
  .code-grid{
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   CODE BLOCK (FIXED HEIGHT)
   ========================================================= */
.code-block{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 22px;

  display: flex;
  flex-direction: column;

  height: 540px;
  width: 100%;
  min-width: 0;

  box-shadow: 0 14px 40px rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
}

/* =========================================================
   HEADER (DOTS WITH CSS)
   ========================================================= */
.code-head{
  position: relative;
  padding: 14px 16px 14px 72px;
  background: rgba(0,0,0,.30);
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.code-head::before{
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 10px;

  background:
    radial-gradient(circle, rgba(255,255,255,.45) 60%, transparent 61%) 0 0/10px 10px,
    radial-gradient(circle, rgba(255,255,255,.45) 60%, transparent 61%) 18px 0/10px 10px,
    radial-gradient(circle, rgba(255,255,255,.45) 60%, transparent 61%) 36px 0/10px 10px;
  background-repeat: no-repeat;
}

.code-head h3{
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .4px;
}

/* =========================================================
   LANGUAGE COLORS
   ========================================================= */
.code-block.html h3{ color:#a855f7; }
.code-block.css  h3{ color:#3b82f6; }
.code-block.js   h3{ color:#facc15; }

/* =========================================================
   BODY
   ========================================================= */
.code-body{
  padding: 14px;
  flex: 1;
  overflow: hidden;
}

/* =========================================================
   EDITOR AREA + LINE NUMBERS
   ========================================================= */
.code-pre{
  height: 100%;
  margin: 0;
  padding: 0;

  background: rgba(10,10,16,.85);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);

  overflow-y: auto;
  overflow-x: auto;
}

.code-lines{
  margin: 0;
  padding: 14px 14px 14px 56px;
  list-style: decimal;

  min-height: 100%;
  box-sizing: border-box;

  color: rgba(255,255,255,.35);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
}

.code-lines li{
  color: rgba(255,255,255,.92);
  white-space: pre-wrap;
  word-break: break-word;
  padding-left: 10px;
}

/* =========================================================
   SCROLLBAR
   ========================================================= */
.code-pre::-webkit-scrollbar{ width: 10px; height: 10px; }
.code-pre::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.25);
  border-radius: 10px;
}
.code-pre::-webkit-scrollbar-track{
  background: rgba(255,255,255,.08);
}

/* ===== Animación líneas de código ===== */
.code-lines li{
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity .35s ease, transform .35s ease;
}

.code-lines li.is-in{
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   BOTÓN COPIAR
   ========================================================= */
.code-body{ position: relative; }

.code-copy{
  position: absolute;
  top: 22px;
  right: 26px;
  z-index: 5;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 7px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 9px;
  background: rgba(20,20,30,.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);

  color: rgba(255,255,255,.88);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  line-height: 1;
  cursor: pointer;

  opacity: .8;
  transition: opacity .2s ease, background .2s ease, border-color .2s ease, color .2s ease, transform .1s ease;
}
.code-block:hover .code-copy{ opacity: 1; }
.code-copy:hover{
  background: rgba(123,92,255,.9);
  border-color: rgba(181,108,255,.9);
  color: #fff;
}
.code-copy:active{ transform: scale(.96); }
.code-copy svg{ display: block; }

.code-copy.copied{
  opacity: 1;
  background: rgba(34,197,94,.92);
  border-color: rgba(34,197,94,.92);
  color: #fff;
}

