:root {
  --bg: #0c0e12;
  --bg-elevated: #14171d;
  --surface: #191d24;
  --surface-hover: #1e232b;
  --line: #262b34;
  --line-soft: rgba(255, 255, 255, 0.07);
  --ink: #f0ece0;
  --ink-soft: #a3a1a6;
  --ink-faint: #909096;
  --gold: #d7ae4e;
  --gold-bright: #eccd82;
  --gold-ink: #171205;
  --sage: #8bb37e;
  --sage-soft: rgba(139, 179, 126, 0.14);
  --amber: #c99a5b;
  --amber-soft: rgba(201, 154, 91, 0.14);

  --font-display: "Barlow Condensed", "Roboto Condensed", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --font-serif: "Source Serif 4", "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  --font-body: "Source Sans 3", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
/* japonés: cortar líneas por frases, no en medio de una palabra */
:lang(ja) body { line-break: strict; word-break: auto-phrase; }

a { color: inherit; }
img { max-width: 100%; display: block; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  background: var(--gold);
  color: var(--gold-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 4px;
  text-decoration: none;
  transition: top 0.15s ease-out;
}
.skip-link:focus { top: 12px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 14px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(12, 14, 18, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.site-nav {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  row-gap: 8px;
}
.brand {
  display: inline-block;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--ink);
}
.nav-links { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; }
.nav-links a { display: inline-block; padding: 4px 0; text-decoration: none; color: var(--ink-soft); transition: color 0.15s, text-shadow 0.4s ease; }
.nav-links a:hover, .nav-links a:focus-visible {
  color: var(--gold-bright);
  text-shadow: 0 0 8px rgba(215, 174, 78, 0.6), 0 0 18px rgba(215, 174, 78, 0.35);
}
@media (max-width: 480px) { .nav-links { gap: 6px 14px; font-size: 13px; } }
.lang-switch { display: inline-flex; margin-left: 6px; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.lang-switch button {
  padding: 6px 9px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.lang-switch button:hover { color: var(--gold-bright); }
.lang-switch button[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); }

/* ---------- Buttons ---------- */

.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
  padding: 13px 26px;
  border-radius: 3px;
  text-decoration: none;
  display: inline-block;
  border: 1px solid transparent;
  transition: filter 0.4s ease, background 0.15s, border-color 0.15s, box-shadow 0.4s ease;
}
.btn:hover, .btn:focus-visible {
  filter: brightness(1.18);
  box-shadow:
    0 0 10px 1px rgba(215, 174, 78, 0.55),
    0 0 26px 6px rgba(215, 174, 78, 0.35),
    0 0 50px 16px rgba(215, 174, 78, 0.16);
}
.btn-primary { background: var(--gold); color: var(--gold-ink); }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover, .btn-ghost:focus-visible { border-color: var(--gold); color: var(--gold-bright); }

/* ---------- Hero ---------- */

.hero { padding: 100px 28px 90px; overflow-x: clip; }
.hero-grid {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
}
@media (max-width: 800px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.3rem, 5.4vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
}
.hero-title em { font-style: normal; color: var(--gold); }

.hero-lede {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 0 32px;
}

.hero-highlight {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  border-left: 3px solid var(--gold);
  padding-left: 16px;
  margin: 0 0 28px;
}

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

#mesh-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.spark-control {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(25, 29, 36, 0.92);
  border: 1px solid var(--line);
  border-radius: 20px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.spark-control label {
  font-size: 14px;
  line-height: 1;
  cursor: default;
}
.spark-control input[type="range"] {
  accent-color: var(--gold);
  width: 90px;
  height: 24px;
  cursor: pointer;
}
@media (max-width: 480px) {
  .spark-control { right: 12px; bottom: 12px; padding: 6px 12px; }
  .spark-control input[type="range"] { width: 70px; }
}

.hero-photo-wrap {
  position: relative;
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}
.hero-photo-wrap::before {
  content: "";
  position: absolute;
  inset: max(-14%, -24px);
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(215, 174, 78, 0.22), rgba(215, 174, 78, 0) 70%);
  filter: blur(10px);
}
.hero-photo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-elevated);
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
}

/* Aros tipo giroscopio alrededor de la foto, en el dorado de los puntitos */
.gyro {
  position: absolute;
  inset: 0;
  pointer-events: none;
  perspective: 1400px;
  transform-style: preserve-3d;
}
.gyro-back { z-index: 0; }
/* la copia de arriba solo se ve sobre la foto (recortada al círculo) y más transparente: los aros pasan "por delante" */
.gyro-front { z-index: 2; clip-path: circle(50%); opacity: 0.6; }
.gyro-ring {
  position: absolute;
  border-radius: 50%;
  border: 3.5px solid rgba(215, 174, 78, 0.55);
  box-shadow: 0 0 8px rgba(215, 174, 78, 0.3);
  transform-style: preserve-3d;
}
/* los ángulos (--a1..--a3) los avanza el JS: giran lento y aceleran mientras el mouse está cerca */
.gyro-ring-1 { inset: -22px; transform: rotateZ(25deg) rotateX(var(--a1, 0deg)); }
.gyro-ring-2 { inset: -32px; border-color: rgba(236, 205, 130, 0.45); transform: rotateZ(-40deg) rotateY(var(--a2, 0deg)); }
.gyro-ring-3 { inset: -42px; border-color: rgba(215, 174, 78, 0.32); transform: rotateX(65deg) rotateZ(var(--a3, 0deg)); }
@media (max-width: 480px) {
  .gyro-ring-1 { inset: -14px; }
  .gyro-ring-2 { inset: -22px; }
  .gyro-ring-3 { inset: -30px; }
}

/* ---------- Sections ---------- */

.section { padding: 88px 28px; border-top: 1px solid var(--line-soft); }
.section-inner { max-width: 1040px; margin: 0 auto; }
.section-narrow { max-width: 680px; }

.section-head { margin-bottom: 48px; }
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  letter-spacing: -0.005em;
}
.section-sub { margin: 12px 0 0; color: var(--ink-soft); font-size: 15px; max-width: 60ch; }

/* ---------- Case studies ---------- */

.case {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 44px 0;
  border-top: 1px solid var(--line-soft);
}
.case:first-of-type { border-top: none; padding-top: 0; }
@media (max-width: 760px) {
  .case, .case-02 { grid-template-columns: 1fr; }
  .case-02 .case-media { order: -1; }
}

.case-media {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease-out;
  transform-style: preserve-3d;
  will-change: transform;
}
.case-media a { display: block; cursor: pointer; }
.case-media img { width: 100%; height: 100%; aspect-ratio: 4/3; object-fit: cover; object-position: left center; }

.case-index {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold);
  display: block;
  margin-bottom: 10px;
}

.badge-insignia {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-ink);
  background: var(--gold);
  padding: 4px 10px;
  border-radius: 20px;
}

.case-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 8px;
}
.case-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.55rem;
  margin-bottom: 12px;
}
.case-desc { color: var(--ink-soft); font-size: 15px; margin: 0 0 18px; max-width: 48ch; }

.case-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.metric {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 12px;
}
.metric-highlight { color: var(--gold-bright); border-color: rgba(215, 174, 78, 0.4); }
.metric-secondary { color: var(--ink-faint); font-size: 11px; background: transparent; }

.status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 20px;
  margin-bottom: 14px;
  margin-right: 14px;
}
.status-live { background: var(--sage-soft); color: var(--sage); }
.status-building { background: var(--amber-soft); color: var(--amber); }

.case-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.15s, color 0.4s ease, text-shadow 0.4s ease;
}
.case-link:hover, .case-link:focus-visible {
  border-bottom-color: var(--gold);
  color: var(--gold-bright);
  text-shadow: 0 0 8px rgba(215, 174, 78, 0.6), 0 0 18px rgba(215, 174, 78, 0.35);
}

/* ---------- Caso insignia: tarjeta destacada ---------- */

.flagship {
  margin: 0 0 12px;
  padding: 32px;
  border: 1px solid rgba(215, 174, 78, 0.45);
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(215, 174, 78, 0.09), rgba(25, 29, 36, 0.85) 45%);
  box-shadow: 0 0 44px -14px rgba(215, 174, 78, 0.28);
}
.flagship-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.flagship-head .case-tag { margin: 0; }
.flagship-main { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 36px; align-items: center; }
.flagship-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  line-height: 1.1;
  margin-bottom: 14px;
}
.step-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}
.flagship-lede { margin: 0 0 22px; color: var(--ink-soft); font-size: 15px; max-width: 46ch; }
.flagship-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.stat {
  background: rgba(12, 14, 18, 0.55);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px;
}
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.1;
  color: var(--gold);
  margin-bottom: 6px;
}
.stat-desc { display: block; font-size: 12px; line-height: 1.4; color: var(--ink-soft); }
.flagship-foot { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.flagship-steps {
  list-style: none;
  margin: 28px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  counter-reset: step;
}
.flagship-steps li { counter-increment: step; }
.flagship-steps .step-label::before { content: "0" counter(step) " · "; color: var(--ink-faint); }
.flagship-steps p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.55; }
@media (max-width: 900px) {
  .flagship-main { grid-template-columns: 1fr; }
  .flagship-steps { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 480px) {
  .flagship { padding: 20px 16px; }
  .flagship-stats { grid-template-columns: 1fr; }
}

/* ---------- Aparición al scrollear + levantado en hover ---------- */

/* .reveal la agrega el JS (sin JS o con "reducir movimiento" todo queda visible) */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.is-visible { opacity: 1; transform: none; }

.case-media { transition: transform 0.25s ease-out, box-shadow 0.35s ease, border-color 0.35s ease; }
.case:hover .case-media,
.flagship:hover .case-media {
  border-color: rgba(215, 174, 78, 0.5);
  box-shadow: 0 34px 60px -24px rgba(0, 0, 0, 0.8), 0 0 34px -8px rgba(215, 174, 78, 0.35);
}
.flagship { transition: border-color 0.35s ease, box-shadow 0.35s ease; }
.flagship:hover {
  border-color: rgba(215, 174, 78, 0.7);
  box-shadow: 0 0 60px -12px rgba(215, 174, 78, 0.4);
}

.subsection-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  margin: 56px 0 20px;
}

.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.mini-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.2s ease-out, box-shadow 0.4s ease;
  transform-style: preserve-3d;
  will-change: transform;
}
.mini-card:hover, .mini-card:focus-visible {
  border-color: var(--gold);
  box-shadow:
    0 0 10px 1px rgba(215, 174, 78, 0.5),
    0 0 26px 6px rgba(215, 174, 78, 0.3),
    0 0 50px 16px rgba(215, 174, 78, 0.14);
}
.mini-card img, .mini-emoji {
  width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
}
.mini-emoji { display: flex; align-items: center; justify-content: center; background: var(--bg-elevated); font-size: 24px; }
.mini-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.mini-card p { margin: 0; font-size: 12.5px; color: var(--ink-soft); }

/* ---------- About ---------- */

.prose { display: flex; flex-direction: column; gap: 18px; font-size: 15.5px; color: var(--ink-soft); }
.prose blockquote {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--ink);
  border-left: 3px solid var(--gold);
  padding-left: 20px;
  margin: 4px 0;
}

/* ---------- Skills ---------- */

.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 32px; }
.skills-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.tag {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink-soft);
  transition: border-color 0.15s, color 0.4s ease, box-shadow 0.4s ease;
}
.tag:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow:
    0 0 8px 1px rgba(215, 174, 78, 0.5),
    0 0 20px 4px rgba(215, 174, 78, 0.3),
    0 0 38px 10px rgba(215, 174, 78, 0.14);
}

/* ---------- Contact ---------- */

.contact-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
}
.contact-card p { color: var(--ink-soft); max-width: 44ch; margin: 14px auto 28px; }
.contact-links { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Footer ---------- */

/* ---------- Formulario de contacto (Escribirme) ---------- */

.contact-dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 0 60px -20px rgba(215, 174, 78, 0.25);
}
.contact-dialog::backdrop { background: rgba(6, 8, 11, 0.8); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
body:has(.contact-dialog[open]) { overflow: hidden; }
.contact-form { display: flex; flex-direction: column; gap: 14px; padding: 28px 28px 24px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.8rem; line-height: 1.1; }
.dialog-close {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.dialog-close:hover { border-color: var(--gold); color: var(--gold-bright); }
.dialog-sub { margin: 0; color: var(--ink-soft); font-size: 14.5px; }
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.field input, .field textarea {
  font-family: var(--font-body);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(215, 174, 78, 0.18);
}
.form-hint { margin: 0; min-height: 1.3em; font-size: 12.5px; color: var(--ink-faint); }
.dialog-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 2px; }
.dialog-actions .btn { text-align: center; padding: 12px 8px; font-size: 14px; cursor: pointer; }
.dialog-actions .btn-ghost { background: transparent; }
.dialog-actions .btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; box-shadow: none; }
@media (max-width: 560px) {
  .contact-form { padding: 22px 18px 18px; }
  .dialog-actions { grid-template-columns: 1fr; }
}

.site-footer {
  padding: 32px 28px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line-soft);
}

@media (prefers-reduced-motion: reduce) {
  .case-media, .mini-card { transition: none; }
  .spark-control { display: none; }
}

/* pantallas táctiles: objetivos de toque más grandes */
@media (pointer: coarse) {
  .lang-switch button { padding: 10px 11px; }
  .nav-links a, .brand { padding: 9px 0; }
  .case-link { padding: 10px 0; }
  .spark-control input[type="range"] { height: 32px; }
}

/* impresión / guardar como PDF: todo visible, sin efectos ni controles flotantes */
@media print {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .site-header { position: static; }
  #mesh-bg, .spark-control, .skip-link, .gyro, .lang-switch, dialog { display: none !important; }
}
