/*
  Design system: Tobias Chavarria — Data Platform Engineer
  - Inter Tight (display) + Inter (body)
  - Monochrome foundation + terracotta accent
  - Sidebar layout on desktop, sticky header on mobile
  - Mobile-first, accessible, light/dark
*/

:root {
  --bg: #ffffff;
  --surface: #f8f8f7;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e8e8e6;
  --accent: #c45d3e;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-hover: #a84a30;
  --brand: #1a1a1a;
  --brand-ink: #ffffff;
  --ring: color-mix(in srgb, var(--accent) 40%, transparent);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);

  --font-display: 'Inter Tight', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --fs-hero: clamp(2.5rem, 6vw, 4.25rem);
  --fs-h2: clamp(1.5rem, 3vw, 2rem);
  --fs-h3: 1.1rem;
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-xs: 0.8rem;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;
  --space-3xl: 96px;

  --radius: 8px;
  --radius-lg: 12px;
}

body.theme-dark {
  color-scheme: dark;
  --bg: #0b0b0b;
  --surface: #141414;
  --text: #e4e4e4;
  --muted: #8a8a8a;
  --border: #2a2a2a;
  --accent: #d4704f;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-hover: #e07a58;
  --brand: #e4e4e4;
  --brand-ink: #0b0b0b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 2px 12px rgba(0,0,0,0.4);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
:where(a, button) { min-height: 44px; }
:where(button) { touch-action: manipulation; }

/* Utility */
.container { width: min(1080px, 100% - 48px); margin-inline: auto; }
.content-narrow { max-width: 720px; }
.muted { color: var(--muted); }
.show-on-mobile { display: none; }
.hide-on-mobile { display: inline-flex; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: start;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--space-xl) var(--space-lg);
  gap: var(--space-lg);
}
.sidebar-top { display: flex; flex-direction: column; gap: var(--space-sm); }
.sidebar-bottom { margin-top: auto; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: 6px;
  font-weight: 700;
  font-size: var(--fs-xs);
  letter-spacing: 0.5px;
  font-family: var(--font-display);
}
.brand-name { font-weight: 600; font-size: var(--fs-small); }

.role {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-small);
  font-family: var(--font-mono);
}
.availability { margin-top: 2px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
}
.pill-available {
  color: #22c55e;
  border-color: color-mix(in srgb, #22c55e 30%, var(--border));
  background: color-mix(in srgb, #22c55e 8%, var(--bg));
  text-decoration: none;
  cursor: pointer;
  transition: border-color 120ms ease;
}
.pill-available::before { background: #22c55e; }
.pill-available:hover { border-color: #22c55e; }
.pill-accent {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 120ms ease;
}
.pill-accent::before { background: var(--accent); }
.pill-accent:hover { border-color: var(--accent); }

.sidebar-label {
  margin: 0 0 var(--space-sm);
  color: var(--muted);
  text-transform: uppercase;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* Sidebar nav */
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.site-nav a {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  font-size: var(--fs-small);
  position: relative;
  transition: background 120ms ease;
}
.site-nav a:hover { background: color-mix(in srgb, var(--border) 50%, transparent); }
.site-nav a.active { font-weight: 600; color: var(--accent); }

.socials { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-small); color: var(--muted); }
.socials a { color: inherit; text-decoration: none; transition: color 120ms ease; }
.socials a:hover { color: var(--text); }

/* Header (mobile) */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(120%) blur(10px);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
}
.header-inner {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--space-lg);
}
.header-actions { display: flex; align-items: center; gap: 8px; }

.menu-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: var(--fs-small);
}
.menu-toggle:hover { border-color: var(--muted); }

.header-nav { display: none; border-top: 1px solid var(--border); background: var(--bg); }
.header-nav ul { list-style: none; margin: 0; padding: var(--space-sm) var(--space-lg) var(--space-md); display: flex; flex-direction: column; gap: 2px; }
.header-nav a { color: inherit; text-decoration: none; padding: 10px 4px; font-size: var(--fs-small); }
.header.open .header-nav { display: block; }

/* Theme toggle */
.theme-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  border-radius: 999px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: border-color 120ms ease;
}
.theme-toggle::before { content: "\2600\FE0E"; font-size: 14px; line-height: 1; }
body.theme-dark .theme-toggle::before { content: "\263E"; }
.theme-toggle:hover { border-color: var(--muted); }
.theme-fixed { position: fixed; top: 14px; right: 16px; z-index: 60; }

/* Main content */
.content { padding: var(--space-xl) 0 var(--space-2xl); }

/* Sections */
.section { padding: var(--space-2xl) 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-title {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 var(--space-xl);
}

/* Hero */
.hero { padding: var(--space-3xl) 0 var(--space-2xl); border-bottom: 1px solid var(--border); }
.hero-badge { display: flex; align-items: center; gap: 12px; margin-bottom: var(--space-lg); }
.hero-title {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 var(--space-lg);
}
.hero-sub {
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 52ch;
  margin: 0 0 var(--space-lg);
  line-height: 1.6;
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: var(--space-md); }
.hero-meta { color: var(--muted); font-size: var(--fs-small); margin: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  font-size: var(--fs-small);
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { background: color-mix(in srgb, var(--surface) 80%, var(--text) 5%); border-color: var(--muted); }
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover { border-color: var(--muted); background: var(--surface); }
.btn-small { padding: 7px 12px; font-size: var(--fs-xs); }

/* Clients */
.eyebrow {
  text-transform: uppercase;
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 var(--space-md);
  font-weight: 500;
}
.logo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.logo-item {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
}

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--space-lg);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:first-child { padding-top: 0; }
.timeline-item:last-child { border-bottom: none; }
.timeline-period { font-size: var(--fs-small); color: var(--muted); font-family: var(--font-mono); padding-top: 2px; }
.timeline-body h3 { margin: 0 0 var(--space-sm); font-size: var(--fs-h3); font-weight: 600; line-height: 1.4; }
.timeline-body p { margin: 0; color: var(--muted); font-size: var(--fs-small); line-height: 1.6; }

/* About */
.about-lead { margin-bottom: var(--space-xl); }
.about-lead p { margin: 0 0 var(--space-md); line-height: 1.7; }
.about-lead p:last-child { margin-bottom: 0; }
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
}
.about-col h3 { margin: 0 0 var(--space-sm); font-size: var(--fs-small); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.about-col ul { margin: 0; padding: 0; list-style: none; }
.about-col li { padding: 4px 0; font-size: var(--fs-small); line-height: 1.5; }
.about-col a { color: inherit; text-decoration-color: var(--border); }
.about-col a:hover { text-decoration-color: var(--accent); }
.about-cta { margin-top: var(--space-lg); }

/* Services */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}
.service-item {
  padding: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 160ms ease;
}
.service-item:hover { border-color: var(--ring); }
.service-number {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--accent);
  margin-bottom: var(--space-sm);
  font-weight: 600;
}
.service-item h3 { margin: 0 0 var(--space-sm); font-size: var(--fs-h3); font-weight: 600; }
.service-item p { margin: 0; color: var(--muted); font-size: var(--fs-small); line-height: 1.6; }

/* Tech stack */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-xl);
}
.tech-col h3 { margin: 0 0 var(--space-sm); font-size: var(--fs-small); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tech-col ul { margin: 0; padding: 0; list-style: none; }
.tech-col li { padding: 3px 0; font-size: var(--fs-small); }

/* Projects */
.project-list { display: flex; flex-direction: column; }
.project-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  cursor: default;
}
.project-row:first-child { border-top: 1px solid var(--border); }
.project-info { display: flex; flex-direction: column; gap: 4px; }
.project-title { font-size: var(--fs-h3); font-weight: 600; margin: 0; }
.project-desc { margin: 0; font-size: var(--fs-small); color: var(--muted); line-height: 1.5; max-width: 55ch; }
.project-meta { margin: 0; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); }
.project-arrow { font-size: 1.25rem; opacity: 0.2; transition: transform 160ms ease, opacity 160ms ease; }
.project-row:hover .project-arrow { transform: translateX(4px); opacity: 0.6; }

/* Process */
.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
  list-style: none;
  margin: 0;
  padding: 0;
}
.process-step {
  padding: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.process-number {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--accent);
  margin-bottom: var(--space-sm);
  font-weight: 600;
}
.process-step h3 { margin: 0 0 var(--space-sm); font-size: var(--fs-h3); font-weight: 600; }
.process-step p { margin: 0; color: var(--muted); font-size: var(--fs-small); line-height: 1.5; }

/* Testimonials */
.testimonial-list { display: flex; flex-direction: column; gap: var(--space-xl); }
.testimonial {
  padding: var(--space-xl);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  position: relative;
  margin: 0;
}
.testimonial::before {
  content: "\201C";
  position: absolute;
  top: var(--space-md);
  left: var(--space-lg);
  font-size: 2.5rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.5;
}
.testimonial blockquote { margin: 0 0 var(--space-md); }
.testimonial blockquote p { margin: 0; font-size: var(--fs-body); line-height: 1.7; }
.testimonial figcaption { color: var(--muted); font-size: var(--fs-small); font-weight: 500; }

/* Contact */
.section-contact { background: var(--surface); border-radius: 0; }
.contact-lead { font-size: 1.125rem; line-height: 1.6; margin: 0 0 var(--space-lg); max-width: 50ch; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: var(--space-md); }
.contact-note { font-size: var(--fs-small); margin: 0; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) 0;
  margin-top: 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-small);
  color: var(--muted);
}
.footer-inner a { color: inherit; text-decoration: none; }
.footer-inner a:hover { color: var(--text); }

/* Accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  left: var(--space-lg);
  top: var(--space-lg);
  width: auto;
  height: auto;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius);
  z-index: 999;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Reveal animation */
[data-reveal] { opacity: 0; transform: translateY(6px); transition: opacity 400ms ease, transform 400ms ease; }
.in-view { opacity: 1 !important; transform: translateY(0) !important; }

/* Responsive */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .header-inner { display: flex; }
  .show-on-mobile { display: flex; }
  .hide-on-mobile { display: none; }
  .theme-fixed { display: none; }
  .content { padding: var(--space-lg) 0 var(--space-xl); }
  .hero { padding: var(--space-2xl) 0 var(--space-xl); }
  .section { padding: var(--space-xl) 0; }
  .timeline-item { grid-template-columns: 1fr; gap: var(--space-sm); }
  .timeline-period { font-size: var(--fs-xs); }
}

@media (max-width: 540px) {
  .container { width: min(1080px, 100% - 32px); }
  .hero-title { font-size: clamp(2rem, 8vw, 2.75rem); }
  .hero-ctas { flex-direction: column; }
  .hero-ctas .btn { width: 100%; }
  .services-grid { grid-template-columns: 1fr; }
  .process-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .logo-row { flex-direction: column; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
}

/* Lock scroll on mobile menu open */
@media (max-width: 880px) {
  body.menu-open { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
