/* =========================================================
   kitan.cl — estilos globales
   Estructura: 1) reset  2) temas (dark/light)  3) base
   4) utilidades  5) nav  6) hero  7) secciones/servicios
   8) proceso  9) portafolio  10) contacto  11) footer
   12) responsive
   ========================================================= */

/* ---------- 1. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
ul, ol { list-style: none; }

/* ---------- 2. Temas ---------- */
:root,
html[data-theme="dark"] {
  --bg: #0d1117;
  --bg-alt: #10151c;
  --bg-card: #131a23;
  --bg-mid: #0b0f15;
  --nav-bg: rgba(13, 17, 23, 0.88);

  --tx: #f0f2f5;
  --tx-2: #e7eaf0;
  --tx-3: #c3c9d4;
  --tx-5: #8b93a3;
  --tx-7: #6b7383;
  --tx-9: #565e6e;
  --tx-11: #454c5a;
  --tx-16: #363c48;
  --tx-19: #2c313b;

  --bd-1: #323a48;
  --bd-2: #262d38;
  --bd-3: #1f2530;
  --bd-4: #1a2029;

  --accent: #3b6fe0;
  --accent-hover: #5484ec;
  --accent-10: rgba(59, 111, 224, 0.1);
  --accent-15: rgba(59, 111, 224, 0.15);
  --accent-20: rgba(59, 111, 224, 0.2);
  --accent-30: rgba(59, 111, 224, 0.3);

  --accent2: #e0693b;
  --accent2-hover: #ec8354;
  --accent2-07: rgba(224, 105, 59, 0.07);
  --accent2-70: rgba(224, 105, 59, 0.7);

  --green: #52d68a;
  --green-6: rgba(82, 214, 138, 0.06);
  --green-20: rgba(82, 214, 138, 0.2);

  --scan: rgba(255, 255, 255, 0.012);
  --shadow: rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] {
  --bg: #f8f9fb;
  --bg-alt: #f1f3f6;
  --bg-card: #ffffff;
  --bg-mid: #ffffff;
  --nav-bg: rgba(248, 249, 251, 0.92);

  --tx: #12151c;
  --tx-2: #1a1f29;
  --tx-3: #363d4a;
  --tx-5: #5c6474;
  --tx-7: #707890;
  --tx-9: #838ba0;
  --tx-11: #8b93a6;
  --tx-16: #97a0b3;
  --tx-19: #a3abbd;

  --bd-1: #d7dbe4;
  --bd-2: #e0e3ea;
  --bd-3: #e6e9ef;
  --bd-4: #ecedf3;

  --accent: #3159c4;
  --accent-hover: #2749ab;
  --accent-10: rgba(49, 89, 196, 0.08);
  --accent-15: rgba(49, 89, 196, 0.12);
  --accent-20: rgba(49, 89, 196, 0.18);
  --accent-30: rgba(49, 89, 196, 0.28);

  --accent2: #c1502a;
  --accent2-hover: #a84322;
  --accent2-07: rgba(193, 80, 42, 0.06);
  --accent2-70: rgba(193, 80, 42, 0.6);

  --green: #1e9e5a;
  --green-6: rgba(30, 158, 90, 0.06);
  --green-20: rgba(30, 158, 90, 0.18);

  --scan: rgba(0, 0, 0, 0.018);
  --shadow: rgba(20, 25, 40, 0.12);
}

/* ---------- 3. Base ---------- */
body {
  background: var(--bg);
  color: var(--tx-3);
  font-family: 'Space Grotesk', sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4 { color: var(--tx); font-weight: 700; letter-spacing: -0.02em; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  z-index: 1000;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- 4. Utilidades ---------- */
.container { max-width: 1240px; margin: 0 auto; }
.accent { color: var(--accent); }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.section { padding: 100px 24px; background: var(--bg); }
.section--alt { background: var(--bg-alt); }
.section__head { text-align: center; margin-bottom: 64px; }
.section__head h2 { font-size: clamp(30px, 4vw, 52px); line-height: 1.1; }

.grid { display: grid; gap: 20px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 600; padding: 13px 28px; border-radius: 8px;
  text-decoration: none; border: none; transition: background 0.2s, transform 0.15s, box-shadow 0.2s, border-color 0.2s, color 0.2s;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 8px 32px var(--accent-30); }
.btn--ghost { background: transparent; color: var(--tx-3); border: 1px solid var(--bd-1); }
.btn--ghost:hover { border-color: var(--accent); background: var(--accent-10); color: var(--tx); }
.btn--sm { padding: 9px 20px; font-size: 14px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

[data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s ease; }
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* ---------- 5. Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100; height: 64px;
  background: var(--nav-bg); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bd-3);
}
.nav__inner {
  max-width: 1240px; margin: 0 auto; height: 100%; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav__logo {
  font-family: 'JetBrains Mono', monospace; font-size: 17px; font-weight: 600;
  color: var(--tx); text-decoration: none; letter-spacing: -0.01em; flex-shrink: 0;
}
.nav__menu { display: flex; align-items: center; gap: 4px; }
.nav__link {
  font-size: 14px; font-weight: 500; color: var(--tx-5); text-decoration: none;
  padding: 8px 16px; border-radius: 7px; transition: color 0.2s, background 0.2s;
}
.nav__link:hover { color: var(--tx); background: var(--bd-4); }

.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--bd-2);
  background: transparent; display: inline-flex; align-items: center; justify-content: center;
  color: var(--tx-5); margin-left: 4px; flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { background: var(--bd-4); border-color: var(--bd-1); color: var(--tx); }
.icon-moon { display: none; }
html[data-theme="light"] .icon-moon { display: block; }
html[data-theme="light"] .icon-sun { display: none; }

.nav__toggle {
  display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 6px;
}
.nav__toggle span { width: 22px; height: 2px; background: var(--tx-3); border-radius: 2px; transition: transform 0.25s, opacity 0.25s; }

/* ---------- 6. Hero ---------- */
.hero {
  position: relative; min-height: calc(100vh - 64px);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 52px 24px 64px; overflow: hidden;
}
@media (min-width: 900px) { .hero { padding: 52px 80px 64px; } }

.hero__scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(0deg, var(--scan) 0px, var(--scan) 1px, transparent 1px, transparent 4px);
}
.hero__glow {
  position: absolute; bottom: -100px; right: -60px; width: 700px; height: 580px; pointer-events: none;
  background: radial-gradient(ellipse at 65% 65%, var(--accent-15) 0%, transparent 68%);
}
.hero__glow--accent2 {
  top: -80px; left: -80px; bottom: auto; right: auto; width: 620px; height: 520px;
  background: radial-gradient(ellipse at 30% 30%, var(--accent2-07) 0%, transparent 65%);
}
.hero__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  opacity: 0; animation: canvasFadeIn 2.5s 0.4s ease forwards;
}

.hero__headline { position: relative; z-index: 1; }
.hero__line-wrap { overflow: hidden; margin-bottom: 4px; }
.hero__line-wrap:first-child { margin-bottom: 22px; }
.hero__line {
  font-size: clamp(40px, 7.8vw, 112px); font-weight: 700; letter-spacing: -0.04em;
  line-height: 0.92; color: var(--tx); margin: 0;
}
.hero__line--accent2 { color: var(--accent2); }
.hero__accent-dash {
  display: inline-block; width: 18px; height: 4px; background: var(--accent2);
  border-radius: 2px; margin-left: 16px; vertical-align: middle; position: relative; top: -6px;
}
.hero__cycle {
  font-size: clamp(52px, 10.8vw, 155px); font-weight: 700; letter-spacing: -0.045em;
  line-height: 0.88; color: var(--accent); margin: 0; display: block;
}
.hero__slideup { animation: slideUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) both; }

.hero__bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero__desc { font-size: 17px; line-height: 1.78; color: var(--tx-7); max-width: 420px; }
.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; flex-shrink: 0; }
.hero__cta .btn--ghost-accent2:hover { border-color: var(--accent2-70); background: var(--accent2-07); color: var(--tx); }

/* ---------- 7. Cards / Servicios ---------- */
.card {
  background: var(--bg-card); border: 1px solid var(--bd-2); border-radius: 16px; padding: 36px;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.card:hover { transform: translateY(-6px); border-color: var(--accent-30); box-shadow: 0 20px 52px var(--accent-10); }
.card--featured { border-color: var(--accent-30); position: relative; overflow: hidden; }
.card--featured::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.card__icon {
  width: 52px; height: 52px; border-radius: 12px; background: var(--accent-15);
  border: 1px solid var(--accent-20); display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px; color: var(--accent);
}
.card h3 { font-size: 21px; margin-bottom: 12px; }
.card p { font-size: 15px; line-height: 1.75; color: var(--tx-5); }

/* ---------- 8. Proceso ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); }
.step { padding: 36px 40px; border-right: 1px solid var(--bd-3); }
.step:last-child { border-right: none; }
.step__num {
  display: block; font-family: 'JetBrains Mono', monospace; font-size: 56px; font-weight: 700;
  color: var(--accent-20); line-height: 1; margin-bottom: 20px; letter-spacing: -0.04em;
}
.step h3 { font-size: 20px; margin-bottom: 12px; }
.step p { font-size: 15px; line-height: 1.75; color: var(--tx-5); }

/* ---------- 9. Portafolio ---------- */
.project {
  background: var(--bg-card); border: 1px solid var(--bd-2); border-radius: 16px; overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
}
.project:hover { transform: translateY(-6px); box-shadow: 0 20px 52px var(--shadow); }
.project__thumb {
  height: 196px; display: flex; align-items: center; justify-content: center; position: relative;
  background: repeating-linear-gradient(135deg, var(--bg-alt) 0px, var(--bg-alt) 12px, var(--bd-4) 12px, var(--bd-4) 24px);
}
.project__thumb span { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--tx-19); }
.project__body { padding: 28px; }
.tag {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--accent);
  background: var(--accent-10); border: 1px solid var(--accent-20); padding: 3px 10px; border-radius: 4px;
  display: inline-block; margin-bottom: 16px;
}
.project h3 { font-size: 19px; margin-bottom: 10px; }
.project p { font-size: 14px; line-height: 1.75; color: var(--tx-7); margin-bottom: 24px; }
.link-arrow {
  font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; transition: gap 0.2s;
}
.link-arrow:hover { gap: 10px; }

/* ---------- 10. Contacto ---------- */
.contact__grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 60px; align-items: start; }
.contact__form-col h2 { font-size: clamp(28px, 3.5vw, 46px); line-height: 1.1; margin-bottom: 14px; }
.contact__lead { font-size: 16px; line-height: 1.75; color: var(--tx-5); margin-bottom: 32px; }

.contact-form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-field label { display: block; font-size: 13px; font-weight: 500; color: var(--tx-5); margin-bottom: 7px; }
.form-field input, .form-field textarea {
  width: 100%; padding: 12px 16px; background: var(--bg-mid); border: 1px solid var(--bd-2);
  border-radius: 8px; color: var(--tx); font-size: 15px; outline: none; line-height: 1.6;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--tx-16); }
.form-field input:focus, .form-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-15); }
.form-field--hidden { position: absolute; left: -9999px; top: -9999px; }

.form-success, .form-error {
  border-radius: 10px; padding: 20px 24px; display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
}
.form-success { background: var(--green-6); border: 1px solid var(--green-20); color: var(--green); }
.form-success__title { font-size: 15px; font-weight: 600; color: var(--tx); margin-bottom: 3px; }
.form-success__desc { font-size: 14px; color: var(--tx-5); }
.form-error { background: rgba(220, 80, 80, 0.06); border: 1px solid rgba(220, 80, 80, 0.25); }
.form-error p { font-size: 14px; color: var(--tx-3); }
.form-error a { color: var(--accent); }

/* [hidden] debe ganarle a los display:flex de arriba, que si no lo pisan */
.form-success[hidden],
.form-error[hidden],
.contact-form[hidden] {
  display: none;
}

.info-card {
  background: var(--bg-card); border: 1px solid var(--bd-2); border-radius: 16px; padding: 28px;
  display: flex; flex-direction: column; gap: 20px; margin-bottom: 16px;
}
.info-card h4 { font-size: 15px; margin-bottom: -4px; }
.info-row { display: flex; align-items: center; gap: 14px; }
.info-row__icon {
  width: 38px; height: 38px; border-radius: 9px; background: var(--accent-10); border: 1px solid var(--accent-20);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent);
}
.info-row__label { font-size: 12px; color: var(--tx-9); margin-bottom: 2px; }
.info-row__value { font-size: 15px; font-weight: 500; color: var(--tx); text-decoration: none; transition: color 0.2s; }
a.info-row__value:hover { color: var(--accent); }

.social-links { display: flex; flex-direction: column; gap: 12px; }
.social-link {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--bd-2); text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.social-link:hover { border-color: var(--accent-20); background: var(--accent-10); }
.social-link__icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.social-link__icon--linkedin { background: #0A66C2; }
.social-link__icon--github { background: #24292E; }
.social-link__title { font-size: 14px; font-weight: 500; color: var(--tx); margin-bottom: 1px; }
.social-link__sub { font-size: 12px; color: var(--tx-9); }

.info-note {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 10px;
  background: var(--green-6); border: 1px solid var(--green-20); color: var(--green);
}
.info-note p { font-size: 13px; }

/* ---------- 11. Footer ---------- */
.footer { padding: 30px 24px; border-top: 1px solid var(--bd-3); }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer__brand { display: flex; align-items: center; gap: 14px; }
.footer__logo { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 600; color: var(--tx); }
.footer__sep { color: var(--tx-19); }
.footer__author { font-size: 14px; color: var(--tx-9); }
.footer__copy { font-size: 13px; color: var(--tx-16); }

/* ---------- Animaciones ---------- */
@keyframes slideUp { from { transform: translateY(110%); } to { transform: translateY(0); } }
@keyframes canvasFadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- 12. Responsive ---------- */
@media (max-width: 900px) {
  .grid--3 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .step { border-right: none; border-bottom: 1px solid var(--bd-3); }
  .step:last-child { border-bottom: none; }
  .contact__grid { grid-template-columns: 1fr; gap: 48px; }
}

@media (max-width: 720px) {
  .nav__toggle { display: flex; }
  .nav__menu {
    position: absolute; top: 64px; left: 0; right: 0; background: var(--nav-bg); backdrop-filter: blur(20px);
    flex-direction: column; align-items: stretch; padding: 12px 24px 20px; gap: 6px;
    border-bottom: 1px solid var(--bd-3);
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: transform 0.2s, opacity 0.2s;
  }
  .nav__menu.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav__link, .theme-toggle, .nav__menu .btn { width: 100%; }
  .theme-toggle { justify-content: flex-start; gap: 10px; border-radius: 7px; padding: 8px 16px; width: 100%; }
  .nav__menu .btn { margin-left: 0; margin-top: 4px; }
  .form-row { grid-template-columns: 1fr; }
}
