/* ============================================================
   MGaliano.tech — Tokens (forked from design system colors_and_type.css)
   Kanit + JetBrains Mono via Google Fonts CDN (no self-hosted TTFs).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,600&family=IBM+Plex+Mono:wght@300;400;500;600;700&family=Kanit:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,700&display=swap');

:root {
  /* surfaces — phosphor monitor */
  --bg-0: #050805;
  --bg-1: #08120c;
  --bg-2: #0d1a12;
  --bg-3: #122218;
  --bg-4: #1a2e22;

  /* foregrounds */
  --fg-1: #d4f1d9;
  --fg-2: #9bc4a4;
  --fg-3: #6a9075;
  --fg-4: #466b4f;
  --fg-5: #2c4a35;

  /* phosphor green — signature */
  --green-100: #e8ffe8;
  --green-300: #8fff9e;
  --green-500: #5dff8a;
  --green-600: #2dff5d;
  --green-700: #1ec24a;
  --green-900: #0a5226;

  /* semantic accents */
  --amber-500: #f0c674;
  --amber-700: #c89a3c;
  --red-500:   #ff6e6e;
  --red-700:   #c83232;
  --cyan-500:  #6dd9e8;
  --cyan-700:  #3a9aae;
  --magenta-500: #d97aff;

  /* lines */
  --border-1: #1a2a1f;
  --border-2: #284535;
  --border-3: #3d6b4e;
  --border-glow: #5dff8a;

  --selection-bg: #5dff8a;
  --selection-fg: #050805;

  /* phosphor glow */
  --glow-sm: 0 0 6px rgba(93, 255, 138, 0.25);
  --glow-md: 0 0 12px rgba(93, 255, 138, 0.35), 0 0 2px rgba(93, 255, 138, 0.6);
  --glow-lg: 0 0 24px rgba(93, 255, 138, 0.45), 0 0 4px rgba(93, 255, 138, 0.8);
  --glow-amber: 0 0 12px rgba(240, 198, 116, 0.35);
  --glow-red: 0 0 12px rgba(255, 110, 110, 0.4);
  --shadow-inset: inset 0 0 0 1px var(--border-2);

  /* role tokens — these are swapped by the accent tweak */
  --role-bg:        var(--bg-1);
  --role-bg-elev:   var(--bg-2);
  --role-fg:        var(--fg-1);
  --role-fg-muted:  var(--fg-3);
  --role-accent:    var(--green-500);
  --role-accent-fg: var(--bg-0);
  --role-link:      var(--green-500);
  --role-link-hover:var(--green-300);
  --role-border:    var(--border-2);
  --role-focus:     var(--green-500);
  --role-success:   var(--green-500);
  --role-warning:   var(--amber-500);
  --role-error:     var(--red-500);
  --role-info:      var(--cyan-500);
  --role-prompt:    var(--green-500);
  --role-caret:     var(--green-500);

  /* type */
  --font-mono:    'JetBrains Mono', 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-display: 'Kanit', 'JetBrains Mono', ui-sans-serif, system-ui, sans-serif;
  --font-alt:     'IBM Plex Mono', 'JetBrains Mono', monospace;

  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   26px;
  --text-2xl:  34px;
  --text-3xl:  46px;
  --text-4xl:  62px;
  --text-5xl:  84px;

  --leading-tight:  1.15;
  --leading-snug:   1.35;
  --leading-normal: 1.55;
  --leading-loose:  1.8;

  --tracking-tight:  -0.02em;
  --tracking-normal: 0;
  --tracking-wide:   0.04em;
  --tracking-wider:  0.12em;

  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semi:    600;
  --weight-bold:    700;
  --weight-black:   900;

  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;
  --space-9:  96px;
  --space-10: 128px;

  --radius-0: 0;
  --radius-1: 2px;
  --radius-2: 4px;

  --stroke-1: 1px;
  --stroke-2: 2px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 80ms;
  --dur-med: 160ms;
  --dur-slow: 320ms;

  --z-base: 0;
  --z-elev: 10;
  --z-overlay: 100;
  --z-modal: 1000;
  --z-toast: 10000;
}

/* accent tweak overrides — applied via [data-accent="amber"|"cyan"] on <html> */
html[data-accent="amber"] {
  --role-accent:    var(--amber-500);
  --role-link:      var(--amber-500);
  --role-link-hover:#ffd998;
  --role-prompt:    var(--amber-500);
  --role-caret:     var(--amber-500);
  --role-focus:     var(--amber-500);
  --border-glow:    var(--amber-500);
  --glow-sm: 0 0 6px rgba(240, 198, 116, 0.30);
  --glow-md: 0 0 12px rgba(240, 198, 116, 0.40), 0 0 2px rgba(240, 198, 116, 0.6);
  --glow-lg: 0 0 24px rgba(240, 198, 116, 0.50), 0 0 4px rgba(240, 198, 116, 0.8);
}
html[data-accent="cyan"] {
  --role-accent:    var(--cyan-500);
  --role-link:      var(--cyan-500);
  --role-link-hover:#a9e8f3;
  --role-prompt:    var(--cyan-500);
  --role-caret:     var(--cyan-500);
  --role-focus:     var(--cyan-500);
  --border-glow:    var(--cyan-500);
  --glow-sm: 0 0 6px rgba(109, 217, 232, 0.30);
  --glow-md: 0 0 12px rgba(109, 217, 232, 0.40), 0 0 2px rgba(109, 217, 232, 0.6);
  --glow-lg: 0 0 24px rgba(109, 217, 232, 0.50), 0 0 4px rgba(109, 217, 232, 0.8);
}

/* base */
html, body {
  background: var(--bg-1);
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-feature-settings: "calt" 1, "liga" 0, "tnum" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  margin: 0;
}
body { min-height: 100vh; position: relative; }

::selection { background: var(--selection-bg); color: var(--selection-fg); }

/* the signature caret blink */
@keyframes caret-blink { 50% { opacity: 0; } }
@keyframes caret-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* link defaults */
a, .link {
  color: var(--role-link);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-3);
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              text-shadow var(--dur-fast) var(--ease-out);
}
a:hover, .link:hover {
  color: var(--role-link-hover);
  border-bottom-color: var(--role-accent);
  text-shadow: 0 0 8px currentColor;
}

code {
  font-family: var(--font-mono);
  font-size: 0.95em;
  background: var(--bg-2);
  color: var(--green-300);
  padding: 1px 6px;
  border: 1px solid var(--border-1);
  border-radius: var(--radius-1);
}
html[data-accent="amber"] code { color: #ffd998; }
html[data-accent="cyan"] code { color: #a9e8f3; }

/* focus ring */
:focus-visible {
  outline: 2px solid var(--role-accent);
  outline-offset: 2px;
  box-shadow: var(--glow-sm);
}

/* scrollbars — make them phosphor */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-3) var(--bg-1);
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--bg-1); }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 0; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-3); }

/* full-page CRT scanlines overlay (toggled on body via [data-scanlines]) */
body[data-scanlines="on"]::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.14) 3px,
    rgba(0,0,0,0) 4px
  );
  mix-blend-mode: multiply;
}
/* ambient corner phosphor glow */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(ellipse 60% 50% at 0% 0%, rgba(93,255,138,0.06), transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(93,255,138,0.04), transparent 60%);
}
html[data-accent="amber"] body::after {
  background:
    radial-gradient(ellipse 60% 50% at 0% 0%, rgba(240,198,116,0.06), transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(240,198,116,0.04), transparent 60%);
}
html[data-accent="cyan"] body::after {
  background:
    radial-gradient(ellipse 60% 50% at 0% 0%, rgba(109,217,232,0.06), transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(109,217,232,0.04), transparent 60%);
}

/* ── Responsive ─────────────────────────────────────────────── */

/* Desktop-only */
@media (min-width: 768px) {
  .rsp-nav-burger    { display: none !important; }
  .rsp-nav-mobile    { display: none !important; }
  .rsp-photo-mobile  { display: none !important; }
  .rsp-cv-hdr-grid   { display: grid; grid-template-columns: 1fr 170px; gap: 28px; align-items: start; }
}

/* Mobile overrides */
@media (max-width: 767px) {
  /* Nav */
  .rsp-nav         { padding-left: 16px !important; padding-right: 16px !important; }
  .rsp-nav-links   { display: none !important; }
  .rsp-nav-clock   { display: none !important; }
  .rsp-nav-burger  { display: flex !important; }

  /* Page padding */
  .rsp-p  { padding-left: 16px !important; padding-right: 16px !important; }

  /* Hero */
  .rsp-hero-grid   { grid-template-columns: 1fr !important; }
  .rsp-photo-hide  { display: none !important; }
  .rsp-hero-h1     { font-size: 44px !important; line-height: 1.0 !important; }

  /* Avatar mobile: float derecha junto al h1 */
  .rsp-photo-mobile {
    float: right;
    width: 88px;
    height: 118px;
    margin: 0 0 8px 12px;
    border: 1px solid var(--border-2);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(93,255,138,0.08);
  }

  /* Case study headers */
  .rsp-case-h1 { font-size: 46px !important; line-height: 1.0 !important; }

  /* SectionHeader typography */
  .rsp-sh-h1 { font-size: 28px !important; }
  .rsp-sh-h2 { font-size: 20px !important; }
  .rsp-sh-h3 { font-size: 17px !important; }

  /* 2-column grids → single column */
  .rsp-2col { grid-template-columns: 1fr !important; }

  /* Footer */
  .rsp-footer-grid { grid-template-columns: 1fr !important; }
  .rsp-footer-pre  { font-size: 9px !important; white-space: pre-wrap !important; overflow-wrap: break-word !important; }

  /* Terminal */
  .rsp-term-hint { display: none !important; }

  /* Presu page */
  .rsp-presu-layout       { grid-template-columns: 1fr !important; }
  .rsp-presu-sidebar      { display: none !important; }
  .rsp-presu-header-grid  { grid-template-columns: 1fr !important; }
  .rsp-presu-grid         { grid-template-columns: 1fr !important; }
  .rsp-presu-3col         { grid-template-columns: 1fr !important; }
}

/* Presu sidebar — desktop only */
@media (min-width: 768px) {
  .rsp-presu-sidebar { display: block !important; }
}

/* ============================================================
   PRINT / EXPORT
   ============================================================ */

/* A4 page size para cualquier print del CV */
@page { size: A4 portrait; margin: 15mm; }

@media print {
  /* ── Base: ocultar chrome del sitio ─────────────────────── */
  nav, footer, .twk-panel, .twk-toggle,
  [data-print-hide], .cv-print-modal { display: none !important; }

  /* ── Layout limpio ───────────────────────────────────────── */
  body { background: #fff !important; color: #111 !important; }
  body::before, body::after { display: none !important; }
  [data-screen-label="02 CV"] { max-width: 100% !important; padding: 8px !important; }
  .rsp-p { padding-left: 0 !important; padding-right: 0 !important; }

  /* ── Elementos del header CV ─────────────────────────────── */
  header {
    background: #f9f9f9 !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }
  header > div:first-child { display: none !important; } /* gradient strip */
  .rsp-cv-hdr-grid { display: grid; grid-template-columns: 1fr 140px; gap: 16px; }
  .rsp-photo-hide  { display: block !important; border: 1px solid #ccc !important; box-shadow: none !important; }

  /* ── Tipografía ──────────────────────────────────────────── */
  h1, h2, h3, h4 { color: #000 !important; text-shadow: none !important; }
  a { color: #0066cc !important; text-shadow: none !important; }
  code { background: #f0f0f0 !important; color: #333 !important; border: 1px solid #ddd !important; }

  /* ── Línea de tiempo de experiencia ─────────────────────── */
  article { border-left-color: #aaa !important; }
  article span:first-child { border-color: #aaa !important; box-shadow: none !important; }

  /* ── Tags ────────────────────────────────────────────────── */
  [class*="tag"], .cv-tag {
    border-color: #aaa !important;
    background: transparent !important;
    color: #333 !important;
  }

  /* ── Evitar cortes de página en medio de un trabajo ─────── */
  article { page-break-inside: avoid; break-inside: avoid; }
  section  { page-break-inside: avoid; break-inside: avoid; }

  /* ── Modo color: PDF con acento verde suavizado ─────────── */
  body:not(.cv-bw) h1 { color: #111 !important; }
  body:not(.cv-bw) [style*="role-accent"],
  body:not(.cv-bw) .role-accent { color: #1a7a35 !important; text-shadow: none !important; }

  /* ── Modo B&N: completamente monocromático ───────────────── */
  body.cv-bw * {
    color: #000 !important;
    background: transparent !important;
    text-shadow: none !important;
    box-shadow: none !important;
    border-color: #888 !important;
  }
  body.cv-bw header    { background: #f0f0f0 !important; }
  body.cv-bw a         { color: #000 !important; text-decoration: underline !important; }
  body.cv-bw .rsp-photo-hide img,
  body.cv-bw .rsp-photo-mobile img { filter: grayscale(100%) contrast(1.1); }
  body.cv-bw [style*="dot"],
  body.cv-bw [style*="accent"] { background: #666 !important; }
}
