/* ==========================================================================
   AGENDRA — Case Study / Showcase
   Design system: tokens derived from the real product's brand (deep navy +
   cyan from the Agendra calendar mark) plus a rare amber used only for
   "live / en producción" signals. Display type is geometric (Space Grotesk),
   body is Inter, and JetBrains Mono is reserved for anything that reads like
   real system output: status strips, tenant subdomains, stack tags.
   ========================================================================== */

:root {
  /* ---- Color tokens ---- */
  --ink-950: #081521;
  --ink-900: #0F2A43;
  --ink-800: #163A5C;
  --ink-700: #24425F;
  --paper: #F7F9FB;
  --paper-alt: #EEF2F6;
  --paper-card: #FFFFFF;
  --line: rgba(15, 42, 67, 0.10);
  --line-strong: rgba(15, 42, 67, 0.18);
  --text-body: #1C2B3A;
  --text-muted: #5B7086;
  --text-on-dark: #E9F1F7;
  --text-on-dark-muted: #90A9BE;

  --accent: #1EA7E0;
  --accent-600: #0E86BA;
  --accent-100: #E4F4FB;
  --amber: #F2A93B;
  --amber-100: #FCF0DC;
  --amber-700: #9C6B14;
  --live: #34C77B;

  /* ---- Type ---- */
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  /* ---- Layout ---- */
  --container-max: 1180px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 1px 2px rgba(15, 42, 67, 0.04), 0 12px 28px -14px rgba(15, 42, 67, 0.18);
  --shadow-card-hover: 0 4px 10px rgba(15, 42, 67, 0.06), 0 22px 40px -16px rgba(15, 42, 67, 0.24);
}

/* ---- Base ---- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--text-body);
  background: var(--paper);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4,
.font-display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-900);
}

.font-mono { font-family: var(--font-mono); }

p { color: var(--text-body); }

a { color: var(--accent-600); text-decoration: none; }

::selection { background: var(--accent); color: #fff; }

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.container-narrow {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.section {
  padding-block: clamp(4rem, 8vw, 7rem);
}

.section-alt { background: var(--paper-alt); }

.section-dark {
  background: radial-gradient(120% 140% at 15% -10%, #123653 0%, var(--ink-950) 55%);
  color: var(--text-on-dark);
}
.section-dark h2, .section-dark h3 { color: #fff; }
.section-dark p { color: var(--text-on-dark-muted); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-600);
  background: var(--accent-100);
  border: 1px solid rgba(30, 167, 224, 0.25);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}
.section-dark .eyebrow {
  color: #8FE0FF;
  background: rgba(30, 167, 224, 0.12);
  border-color: rgba(30, 167, 224, 0.3);
}

.section-heading { max-width: 620px; }
.section-heading h2 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); margin-bottom: 0.9rem; }
.section-heading p { font-size: 1.05rem; color: var(--text-muted); }
.section-dark .section-heading p { color: var(--text-on-dark-muted); }

/* ---- Buttons ---- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.72rem 1.4rem;
  font-size: 0.98rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn-accent {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
}
.btn-accent:hover, .btn-accent:focus-visible {
  background: var(--accent-600);
  border-color: var(--accent-600);
  color: #fff;
  transform: translateY(-1px);
}
.btn-outline-light-custom {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-900);
}
.btn-outline-light-custom:hover, .btn-outline-light-custom:focus-visible {
  border-color: var(--ink-900);
  color: var(--ink-900);
  transform: translateY(-1px);
}
.section-dark .btn-outline-light-custom {
  border-color: rgba(233, 241, 247, 0.35);
  color: #fff;
}
.section-dark .btn-outline-light-custom:hover { border-color: #fff; }

/* ---- Nav ---- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(247, 249, 251, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.site-nav.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(15,42,67,0.02);
}
.site-nav .brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink-900);
}
.site-nav .brand .brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(155deg, var(--ink-900), var(--accent));
  display: grid; place-items: center;
  color: #fff; font-size: 0.95rem;
}
.site-nav .nav-link {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.4rem 0.7rem !important;
  border-radius: 6px;
}
.site-nav .nav-link:hover { color: var(--ink-900); }
.site-nav .nav-link.active { color: var(--ink-900); font-weight: 600; }

/* ---- Status strip (signature element) ---- */
.status-strip {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  background: rgba(8, 21, 33, 0.55);
  border: 1px solid rgba(233, 241, 247, 0.12);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  color: var(--text-on-dark-muted);
}
.status-strip .status-item { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.status-strip .status-item strong { color: #fff; font-weight: 500; }

.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--live);
  position: relative;
  flex-shrink: 0;
}
.pulse-dot::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--live);
  animation: pulse-ring 2.2s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.7); opacity: 0.9; }
  100% { transform: scale(2.1); opacity: 0; }
}

/* ---- Hero ---- */
.hero {
  position: relative;
  padding-top: clamp(4rem, 9vw, 6.5rem);
  padding-bottom: clamp(3.5rem, 7vw, 5rem);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -20%; right: -10%;
  width: 620px; height: 620px;
  background: radial-gradient(circle, rgba(30,167,224,0.16), transparent 70%);
  pointer-events: none;
}
.hero h1 {
  font-size: clamp(2.4rem, 5.4vw, 4rem);
  line-height: 1.05;
  max-width: 15ch;
}
.hero .lede {
  font-size: 1.18rem;
  color: var(--text-muted);
  max-width: 46ch;
  margin-top: 1.3rem;
}
.hero .hero-actions { margin-top: 2.1rem; }

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-800);
  background: var(--paper-card);
  border: 1px solid var(--line-strong);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
}
.badge-pill i { color: var(--accent-600); }

/* ---- Problem / Solution ---- */
.pain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.pain-list li {
  display: flex; align-items: flex-start; gap: 0.8rem;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.05rem;
  font-size: 0.98rem;
  color: var(--text-body);
}
.pain-list i { color: #C24444; margin-top: 0.18rem; }

.feature-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.6rem 1.5rem;
  height: 100%;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); border-color: rgba(30,167,224,0.3); }
.feature-card .icon-tile {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--accent-100);
  color: var(--accent-600);
  display: grid; place-items: center;
  font-size: 1.15rem;
  margin-bottom: 1rem;
}
.feature-card h3 { font-size: 1.08rem; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.94rem; color: var(--text-muted); margin: 0; }

/* ---- Production tenant cards ---- */
.tenant-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.tenant-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }

.tenant-banner {
  aspect-ratio: 16 / 10;
  background: var(--ink-950);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 0;
  padding: 0;
  width: 100%;
}
.tenant-banner img.is-cover { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.tenant-banner img.is-contain {
  max-height: 90%; max-width: 60%;
  object-fit: contain; border-radius: 10px;
  box-shadow: 0 14px 30px rgba(0,0,0,0.4);
}
.tenant-banner.is-demo { background: linear-gradient(155deg, var(--ink-900), var(--ink-950)); color: #fff; flex-direction: column; gap: 0.5rem; cursor: default; }
.tenant-banner.is-demo i { font-size: 2.1rem; color: var(--accent); }
.tenant-banner.is-demo span { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-on-dark-muted); }
button.tenant-banner { cursor: zoom-in; }
button.tenant-banner .zoom-hint {
  position: absolute; bottom: 0.6rem; right: 0.6rem;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(8,21,33,0.6); color: #fff;
  display: grid; place-items: center; font-size: 0.85rem;
  opacity: 0; transition: opacity 0.15s ease;
}
button.tenant-banner:hover .zoom-hint,
button.tenant-banner:focus-visible .zoom-hint { opacity: 1; }

.tenant-body { padding: 1.5rem 1.6rem 1.7rem; display: flex; flex-direction: column; flex-grow: 1; }
.tenant-card .tenant-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.tenant-status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #1E8E56; background: #E7F8EE;
  padding: 0.28rem 0.6rem; border-radius: 999px;
}
.tenant-card h3 { font-size: 1.2rem; margin-bottom: 0.15rem; }
.tenant-card .tenant-domain { font-family: var(--font-mono); font-size: 0.84rem; color: var(--accent-600); }
.tenant-card p.tenant-desc { color: var(--text-muted); font-size: 0.94rem; margin: 0.9rem 0 1.3rem; flex-grow: 1; }
.tenant-card .tenant-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.2rem; }
.tenant-tag {
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--text-muted); background: var(--paper-alt);
  border: 1px solid var(--line); padding: 0.2rem 0.55rem; border-radius: 6px;
}

/* ---- Architecture diagram ---- */
.arch-frame {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 3rem);
}
.arch-flow {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.arch-node {
  flex: 1 1 170px;
  min-width: 150px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 1rem 0.9rem;
  text-align: center;
}
.arch-node.is-accent { border-color: rgba(30,167,224,0.4); background: var(--accent-100); }
.arch-node i { font-size: 1.3rem; color: var(--accent-600); margin-bottom: 0.5rem; display: block; }
.arch-node .arch-title { font-weight: 600; font-size: 0.92rem; color: var(--ink-900); }
.arch-node .arch-sub { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; display: block; }
.arch-arrow { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1.1rem; flex-shrink: 0; }

.arch-branch {
  display: flex; align-items: center; gap: 0.75rem;
  margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line-strong);
  flex-wrap: wrap;
}
.arch-branch .arch-branch-label {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted);
}

.arch-note {
  display: flex; gap: 0.6rem; align-items: flex-start;
  font-size: 0.9rem; color: var(--text-muted);
  background: var(--paper-alt); border-radius: var(--radius-sm);
  padding: 0.85rem 1rem; margin-top: 1.5rem;
}
.arch-note i { color: var(--accent-600); margin-top: 0.15rem; }

/* Diagram scrolls horizontally on narrow screens instead of shrinking
   its labels to an illegible size. */
.arch-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}
.arch-scroll svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

/* ---- Device-frame: browser chrome wrapper for real product screenshots ---- */
.device-frame {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--paper-card);
  box-shadow: var(--shadow-card);
}
.device-frame .device-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
  background: var(--paper-alt);
  border-bottom: 1px solid var(--line);
}
.device-frame .device-dot { width: 8px; height: 8px; border-radius: 50%; }
.device-frame .device-dot:nth-child(1) { background: #D98884; }
.device-frame .device-dot:nth-child(2) { background: var(--amber); }
.device-frame .device-dot:nth-child(3) { background: #4FAE84; }
.device-frame .device-url {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.device-frame button.device-shot {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--ink-950);
  cursor: zoom-in;
}
.device-frame button.device-shot .zoom-hint {
  position: absolute; bottom: 0.6rem; right: 0.6rem;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(8,21,33,0.6); color: #fff;
  display: grid; place-items: center; font-size: 0.85rem;
  opacity: 0; transition: opacity 0.15s ease;
}
.device-frame button.device-shot:hover .zoom-hint,
.device-frame button.device-shot:focus-visible .zoom-hint { opacity: 1; }
.device-frame img {
  display: block;
  width: 100%;
  height: auto;
}
.shot-caption {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-top: 0.65rem;
}

#screenshotModal .modal-content {
  background: var(--ink-950);
  border: 1px solid rgba(233,241,247,0.12);
}
#screenshotModal .modal-body { padding: 0.75rem; }
#screenshotModal img { width: 100%; height: auto; border-radius: 8px; }
#screenshotModal .btn-close { filter: invert(1); }
#screenshotModal figcaption {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-on-dark-muted);
  padding: 0.75rem 0.25rem 0.25rem;
}

/* ---- Stack grid ---- */
.stack-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.3rem 1rem;
  text-align: center;
  height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stack-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.stack-card i { font-size: 1.6rem; color: var(--ink-900); display: block; margin-bottom: 0.6rem; }
.stack-card .stack-name { font-weight: 600; font-size: 0.9rem; color: var(--ink-900); }
.stack-card .stack-role { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ---- Challenges ---- */
.challenge-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.6rem;
  height: 100%;
}
.challenge-card .challenge-tag {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--accent-600); background: var(--accent-100);
  padding: 0.22rem 0.55rem; border-radius: 6px; margin-bottom: 0.9rem;
}
.challenge-card h3 { font-size: 1.02rem; margin-bottom: 0.6rem; line-height: 1.35; }
.challenge-card .challenge-row { display: flex; gap: 0.6rem; font-size: 0.9rem; margin-top: 0.7rem; }
.challenge-card .challenge-row i { margin-top: 0.2rem; flex-shrink: 0; }
.challenge-card .challenge-row.problem i { color: #C24444; }
.challenge-card .challenge-row.solution i { color: #1E8E56; }
.challenge-card .challenge-row span { color: var(--text-muted); }

/* ---- Timeline ---- */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 19px;
  width: 2px; background: var(--line-strong);
}
.timeline-item { position: relative; padding-left: 3.2rem; padding-bottom: 2.4rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute; left: 0; top: 0.15rem;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--paper-card); border: 2px solid var(--accent);
  display: grid; place-items: center; color: var(--accent-600);
  font-size: 1rem; z-index: 1;
}
.timeline-item.is-current .timeline-marker { background: var(--accent); color: #fff; }
.timeline-phase {
  font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-bottom: 0.2rem; display: block;
}
.timeline-item h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.timeline-item p { color: var(--text-muted); font-size: 0.95rem; max-width: 62ch; margin: 0; }

/* ---- Contact ---- */
.contact-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(233,241,247,0.14);
  border-radius: var(--radius-lg);
  padding: clamp(2rem, 5vw, 3.5rem);
}
.contact-links { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2rem; }
.contact-link {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.7rem 1.2rem; border-radius: var(--radius-sm);
  border: 1px solid rgba(233,241,247,0.2);
  color: #fff; font-weight: 500; font-size: 0.94rem;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.contact-link:hover { border-color: var(--accent); background: rgba(30,167,224,0.1); color: #fff; transform: translateY(-1px); }
.contact-link i { color: var(--accent); }

/* ---- Footer ---- */
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid rgba(233,241,247,0.1);
  font-size: 0.85rem;
  color: var(--text-on-dark-muted);
}

/* ---- Scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---- Utility ---- */
.divider-line { border: none; border-top: 1px solid var(--line); }
