/* ═══════════════════════════════════════════════════════
   SHARED BASE STYLES — Juan Martinez Portfolio v11
   Edit here to update all pages at once.
   ═══════════════════════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── TOKENS ── */
:root {
  /* Surface */
  --bg:          #f2f1ef;
  --bg2:         #eceae7;
  --white:       #ffffff;

  /* Ink */
  --ink:         #1a1814;
  --ink-mid:     #3d3a34;
  --ink-muted:   #7a756c;
  --ink-faint:   #b0aa9f;

  /* Accent — default (homepage + pcap) */
  --accent:      #6b3fa0;
  --accent-mid:  #5a2d8f;
  --accent-light:#9b72cc;
  --accent-pale: #f0eaf8;

  /* Aliases kept for legacy */
  --grape:       #6b3fa0;
  --grape-mid:   #5a2d8f;
  --grape-light: #9b72cc;
  --grape-pale:  #f0eaf8;

  /* Elevation */
  --rule:        rgba(26,24,20,0.08);
  --shadow-sm:   0 2px 12px rgba(26,24,20,0.06);
  --shadow-md:   0 8px 32px rgba(26,24,20,0.09);
  --shadow-lg:   0 20px 60px rgba(26,24,20,0.12);

  /* Type */
  --serif: 'Instrument Sans', sans-serif;
  --sans:  'Outfit', sans-serif;
  --mono:  'Outfit', sans-serif;

  /* Radii */
  --r:     28px;
  --r-sm:  16px;
  --r-pill:100px;

  /* Layout */
  --content-w: 860px;
  --content-pad: calc(100% - 6rem);
}

/* ── BASE ── */
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg); color: var(--ink);
  font-weight: 400; line-height: 1.6;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
p   { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; }

/* ── NAV PILL ── */
.nav-wrap {
  position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);
  z-index: 200;
  width: calc(100% - 6rem); max-width: var(--content-w);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap;
  background: rgba(255,255,255,0.88); backdrop-filter: blur(20px);
  border-radius: var(--r-pill);
  padding: 0.5rem 0.5rem 0.5rem 0.65rem;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(26,24,20,0.06);
}
.nav-id   { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0; box-shadow: 0 2px 8px rgba(107,63,160,0.2); }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nav-name-wrap { display: flex; flex-direction: column; gap: 0; }
.nav-name  { font-family: var(--serif); font-size: 14px; letter-spacing: 0.02em; color: var(--ink); font-weight: 600; line-height: 1.2; }
.nav-title { font-family: var(--sans);  font-size: 11px; letter-spacing: 0.01em; color: var(--ink-faint); }
.nav-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; flex-wrap: nowrap; }
.nav-links { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.nav-link  {
  font-family: var(--sans); font-size: 13px; font-weight: 400;
  color: var(--ink-muted); text-decoration: none;
  padding: 8px 14px; border-radius: var(--r-pill);
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--bg2); color: var(--ink); }
.nav-cv {
  font-family: var(--sans); font-size: 12px; font-weight: 400;
  color: var(--ink); text-decoration: none;
  padding: 0 14px; height: 34px;
  border-radius: var(--r-pill);
  border: 1.5px solid rgba(26,24,20,0.12);
  background: transparent;
  display: flex; align-items: center; gap: 5px;
  transition: border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.nav-cv:hover { border-color: var(--grape-light); }
html.dark .nav-cv { color: #f2f1ef; border-color: rgba(255,255,255,0.15); }
.nav-cta  {
  font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: 0.01em;
  color: #fff; background: var(--ink);
  padding: 9px 20px; border-radius: var(--r-pill);
  text-decoration: none; transition: transform 0.15s;
  display: flex; align-items: center; gap: 6px;
  position: relative; overflow: hidden; isolation: isolate;
}
.nav-cta::before {
  content: '';
  position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: linear-gradient(110deg, #7b4fcc, #5b8fff, #9b72cc, #5b8fff);
  background-size: 250% 100%;
  opacity: 0;
  transition: opacity 0.25s;
  animation: gradShift 3s linear infinite;
  animation-play-state: paused;
}
.nav-cta:hover::before { opacity: 1; animation-play-state: running; }
.nav-cta:hover  { transform: translateY(-1px); }
.nav-cta:active { transform: translateY(1px) scale(0.97); transition: transform 0.08s; }
.nav-open-dot { width: 6px; height: 6px; border-radius: 50%; background: #4caf50; animation: blink 2s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* Hamburger */
.nav-hamburger {
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  width: 36px; height: 36px; background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: 50%; transition: background 0.15s;
}
.nav-hamburger:hover { background: var(--bg2); }
.nav-hamburger span { display: block; width: 18px; height: 1.5px; background: var(--ink); border-radius: 2px; transition: transform 0.25s, opacity 0.2s; transform-origin: center; }
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile pill expand */
.nav-pill-menu { display: none; }

@media (max-width: 680px) {
  .nav-right    { display: none; }
  .nav-links    { display: none; }
  .nav-hamburger{ display: flex; }
  .nav-wrap     { width: calc(100% - 2.5rem); flex-wrap: wrap; transition: border-radius 0.3s ease; }
  .nav-wrap.open { border-radius: 20px; }
  .nav-id { flex: 1; }
  .nav-pill-menu {
    display: grid; grid-template-rows: 0fr; width: 100%;
    transition: grid-template-rows 0.32s cubic-bezier(0.4,0,0.2,1);
  }
  .nav-wrap.open .nav-pill-menu { grid-template-rows: 1fr; }
  .nav-pill-inner { overflow: hidden; min-height: 0; }
  .nav-pill-content {
    display: flex; align-items: center; gap: 0;
    border-top: 1px solid rgba(26,24,20,0.07);
    padding: 0.55rem 0.5rem 0.4rem 0.65rem;
    margin: 0.5rem -0.5rem 0 -0.65rem;
  }
  .nav-pill-link {
    font-family: var(--sans); font-size: 14px; font-weight: 500;
    color: var(--ink); text-decoration: none;
    padding: 6px 10px; border-radius: 8px; transition: color 0.15s; white-space: nowrap;
  }
  .nav-pill-link:active { color: var(--grape); }
  .nav-pill-sep { color: rgba(26,24,20,0.2); font-size: 11px; user-select: none; flex-shrink: 0; padding: 0 2px; }
  .nav-pill-contact {
    margin-left: auto; flex-shrink: 0;
    display: flex; align-items: center; gap: 6px;
    font-family: var(--sans); font-size: 13px; font-weight: 500;
    color: #fff; background: var(--ink); padding: 8px 14px; border-radius: var(--r-pill);
    text-decoration: none; transition: background 0.2s; white-space: nowrap;
  }
  .nav-pill-contact:active { background: linear-gradient(110deg,#7b4fcc,#5b8fff); }
  html.dark .nav-pill-content { border-top-color: rgba(255,255,255,0.07); }
  html.dark .nav-pill-link { color: #f0ece4; }
  html.dark .nav-pill-sep { color: rgba(255,255,255,0.2); }
  html.dark .nav-pill-contact { background: #f0ece4; color: #1a1814; }
  .sec-inner, .sec-wrap, .content-wrap { width: calc(100% - 2.5rem); }
  [style*="calc(100% - 6rem)"] { width: calc(100% - 2.5rem) !important; }
}

/* ── LAYOUT ── */
.content-wrap {
  max-width: var(--content-w);
  width: var(--content-pad);
  margin: 0 auto;
}

/* ── TYPE UTILITIES ── */
.sec-eyebrow {
  font-family: var(--serif); font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint); display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem;
}
.sec-eyebrow::before { content: ''; width: 16px; height: 1px; background: var(--ink-faint); }
.sec-title {
  font-family: var(--serif); font-size: clamp(1.6rem,3vw,2.2rem);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; color: var(--ink);
}
.sec-title em {
  font-style: normal;
  background: linear-gradient(110deg, #7b4fcc, #5b8fff);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ── ANIMATED GRADIENT (shared by .btn and .btn-dark) ── */
@keyframes gradShift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ── BUTTONS ── */
/* .btn / .btn-ghost used by case study bottom navs */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 13px; font-weight: 500; letter-spacing: 0.01em;
  padding: 10px 22px; min-height: 44px; border-radius: var(--r-pill);
  background: var(--ink); color: #fff; text-decoration: none;
  border: none; cursor: pointer;
  position: relative; overflow: hidden; isolation: isolate;
  transition: transform 0.15s;
  box-shadow: 0 4px 20px rgba(26,24,20,0.2);
}
.btn::before {
  content: '';
  position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: linear-gradient(110deg, #7b4fcc, #5b8fff, #9b72cc, #5b8fff);
  background-size: 250% 100%;
  opacity: 0;
  transition: opacity 0.25s;
  animation: gradShift 3s linear infinite;
  animation-play-state: paused;
}
.btn:hover::before  { opacity: 1; animation-play-state: running; }
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.97); transition: transform 0.08s; }
.btn-ghost {
  background: transparent; color: var(--ink-muted);
  border: 1px solid var(--rule); box-shadow: none;
}
.btn-ghost::before { display: none; }
.btn-ghost:hover  { background: var(--bg2); color: var(--ink); transform: translateY(-1px); }
.btn-ghost:active { transform: translateY(1px) scale(0.97); transition: transform 0.08s; }
html.dark .btn { background: #f0ece4; color: #1a1814; }
html.dark .btn:hover::before { opacity: 1; }
html.dark .btn:hover { color: #fff; }

/* .bottom-nav used by case study pages */
.bottom-nav {
  background: var(--white); border-radius: var(--r);
  padding: 1.75rem 2rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem;
  box-shadow: var(--shadow-sm); border: 1px solid var(--rule);
  margin-bottom: 3rem;
}

.btn-dark {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 14px; font-weight: 500; letter-spacing: 0.01em;
  padding: 12px 24px; border-radius: var(--r-pill);
  background: var(--ink); color: #fff; text-decoration: none;
  position: relative; overflow: hidden; isolation: isolate;
  transition: transform 0.15s;
  box-shadow: 0 4px 20px rgba(26,24,20,0.2);
}
.btn-dark::before {
  content: '';
  position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: linear-gradient(110deg, #7b4fcc, #5b8fff, #9b72cc, #5b8fff);
  background-size: 250% 100%;
  opacity: 0;
  transition: opacity 0.25s;
  animation: gradShift 3s linear infinite;
  animation-play-state: paused;
}
.btn-dark:hover::before { opacity: 1; animation-play-state: running; }
.btn-dark:hover  { transform: translateY(-1px); }
.btn-dark:active { transform: translateY(1px) scale(0.97); transition: transform 0.08s; }
.btn-light {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 14px; font-weight: 400; letter-spacing: 0.01em;
  padding: 12px 24px; border-radius: var(--r-pill);
  background: var(--white); color: var(--ink); text-decoration: none;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--rule);
  transition: background 0.18s, transform 0.15s;
}
.btn-light:hover  { background: var(--bg2); transform: translateY(-1px); }
.btn-light:active { transform: translateY(1px) scale(0.97); transition: transform 0.08s; }

/* ── TAGS ── */
.tag {
  font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: 0.01em;
  padding: 4px 12px; border-radius: var(--r-pill);
  background: var(--bg2); color: var(--ink-muted); border: 1px solid var(--rule);
}
.tag.grape { background: var(--grape-pale); color: var(--grape); border-color: rgba(107,63,160,0.15); }

/* ── CARDS ── */
.card { background: var(--white); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; }

/* ── STATS ROW (hero stats on case study pages) ── */
.stats-row {
  display: flex; flex-wrap: wrap; gap: 0;
  background: var(--white); border-radius: var(--r);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.stat-cell { flex: 1; min-width: 130px; padding: 1.25rem 1.5rem; border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: 4px; }
.stat-cell:last-child { border-right: none; }
.stat-k { font-family: var(--sans); font-size: 10px; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.stat-v { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; color: var(--ink-mid); letter-spacing: -0.01em; line-height: 1.2; }

/* ── QUOTE BLOCK ── */
.quote-block {
  border-radius: var(--r);
  padding: 3.5rem clamp(2rem,5vw,4rem);
}
.quote-text {
  font-family: var(--serif); font-size: clamp(1.3rem,3vw,2rem);
  font-weight: 300; font-style: italic; line-height: 1.5;
  letter-spacing: -0.01em; margin-bottom: 1rem;
}
.quote-attr {
  font-family: var(--sans); font-size: 11px; font-weight: 400;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(245,240,232,0.25);
}

/* ── IMAGE FRAMES ── */
.img-frame  { width: 100%; border-radius: var(--r-sm); overflow: hidden; box-shadow: var(--shadow-md); }
.img-frame img { width: 100%; display: block; object-fit: cover; }
.img-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.img-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
@media(max-width:640px){ .img-grid-2, .img-grid-3 { grid-template-columns: 1fr; } }

/* ── BOTTOM NAV (case study pages) ── */
.bottom-nav-wrap {
  max-width: var(--content-w);
  width: var(--content-pad);
  margin: 0 auto; padding: 2.5rem 0;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem;
  border-top: 1px solid var(--rule);
}
.bn-copy  { font-family: var(--sans); font-size: 11px; font-weight: 400; letter-spacing: 0.06em; color: var(--ink-faint); }
.bn-links { display: flex; gap: 10px; flex-wrap: wrap; }
.bn-link  {
  font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: 0.01em;
  color: var(--ink-muted); text-decoration: none;
  padding: 9px 20px; border-radius: var(--r-pill);
  border: 1px solid var(--rule); transition: all 0.15s;
}
.bn-link:hover { background: var(--white); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ── FOOTER ── */
footer {
  padding: 1.5rem clamp(1.5rem,4vw,3rem) 2rem;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1rem;
}
.ft-copy { font-family: var(--sans); font-size: 13px; font-weight: 400; color: var(--ink-faint); }
.ft-links { display: flex; gap: 8px; align-items: center; }
.ft-link  {
  font-family: var(--sans); font-size: 13px; font-weight: 400;
  color: var(--ink-muted); text-decoration: none;
  padding: 6px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--rule); transition: all 0.15s;
}
.ft-link:hover { background: var(--white); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ── DARK TOGGLE (fixed icon button) ── */
.dark-toggle {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid rgba(26,24,20,0.12);
  background: var(--bg2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  outline: none; padding: 0;
  flex-shrink: 0;
}
.dark-toggle:hover { border-color: var(--grape-light); }
.toggle-icon { width: 13px; height: 13px; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toggle-sun  { stroke: var(--ink-muted); display: block; }
.toggle-moon { stroke: var(--ink-muted); display: none; }
html.dark .dark-toggle { background: var(--grape-mid); border-color: var(--grape-mid); }
html.dark .toggle-sun  { display: none; }
html.dark .toggle-moon { display: block; stroke: #fff; }

/* ── SCROLL REVEAL ── */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible  { opacity: 1; transform: none; }
.reveal-delay-1  { transition-delay: 0.1s; }
.reveal-delay-2  { transition-delay: 0.2s; }
.reveal-delay-3  { transition-delay: 0.3s; }


/* ── SPAM PROTECTION ── */
.form-hp-field { display: none !important; }

/* ── GLOBAL MOBILE: single-column ── */
/* Timeline sidebar collapses at 700px */
@media(max-width:700px) {
  .ss-timeline { grid-template-columns: 1fr !important; gap: 1.5rem; }
  .ss-left { display: none; }
  .ss-era { width: 100% !important; align-self: stretch !important; flex-direction: column; }
  .ss-era::after { display: none !important; }
  .ss-right::before { display: none !important; }
  .ss-era-img { width: 100% !important; max-width: 200px; }
}

/* Everything else collapses at 640px */
@media(max-width:640px) {
  .img-grid-2,
  .img-grid-3 { grid-template-columns: 1fr; }
  .feat-card { grid-template-columns: 1fr !important; }
  .chapter-grid { grid-template-columns: 1fr !important; }
}
