/*
  Mathias Becerra — Portfolio Styles
  Tech: CSS custom properties, Grid, Flexbox, prefers-color-scheme, reduced motion
*/

:root {
  --bg: #0f1115;
  --surface: #151923;
  --text: #e6e8ef;
  --muted: #a6adc8;
  --primary: #6ea8fe; /* blue */
  --secondary: #7ee787; /* green */
  --border: #262b36;
  --shadow: 0 10px 30px rgba(0,0,0,0.25);
  --radius: 12px;
  --font-sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme='light'] {
  --bg: #ffffff;
  --surface: #f6f7fb;
  --text: #111827;
  --muted: #6b7280;
  --primary: #1f6feb; /* blue */
  --secondary: #16a34a; /* green */
  --border: #e6e8ef;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }

.container { width: min(1100px, 92%); margin-inline: auto; }
.narrow { width: min(800px, 92%); }

.section { position: relative; }
.pad-lg { padding: 64px 0; }
.pad-xl { padding: 96px 0; }
.center { text-align: center; }
.max-60ch { max-width: 60ch; margin: 0 auto; }
.max-70ch { max-width: 70ch; }
.stack-sm > * + * { margin-top: 8px; }
.stack-md > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 24px; }

.lead { font-size: 1.125rem; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; color: var(--secondary); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; padding: 14px 0;
  backdrop-filter: blur(10px);
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  border-bottom: 1px solid var(--border);
  padding-left: 64px; /* move avatar ~2-3cm to the right on typical displays */
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.site-nav { display: flex; gap: 20px; flex: 1; justify-content: center; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.site-nav a.active, .site-nav a:hover { color: var(--text); }
.header-socials { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.header-socials a { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.header-socials a:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 20%, transparent); }
.header-socials img, .header-socials svg { width: 16px; height: 16px; }
.icon-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 8px 12px; cursor: pointer; margin-left: 6px; }
.icon-btn:hover { background: color-mix(in oklab, var(--bg) 92%, transparent); border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent); }
.icon-btn .icon { display: inline-block; filter: none; }

/* Dark mode: make social chips high-contrast (white chip, black glyph) */
[data-theme="dark"] .header-socials a { background: #fff; border-color: #fff; color: #000; }
[data-theme="dark"] .header-socials a:hover { box-shadow: 0 0 0 3px rgba(255,255,255,.2); color: var(--primary); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; background: color-mix(in oklab, var(--bg) 90%, transparent); }
.footer-grid .socials a { color: var(--text); opacity: .9; text-decoration: none; margin-left: 14px; font-size: 1.05rem; }
.footer-grid .socials a:hover { color: var(--primary); opacity: 1; }

/* Hero */
.hero { position: relative; overflow: clip; }
.hero__bg { position: absolute; inset: 0; background: linear-gradient(135deg, color-mix(in oklab, var(--primary) 30%, transparent), transparent), radial-gradient(1200px 600px at 20% 0%, color-mix(in oklab, var(--secondary) 25%, transparent), transparent); filter: blur(40px) saturate(120%); opacity: 0.35; z-index: 0; pointer-events: none; }
.hero .container { position: relative; z-index: 1; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; text-decoration: none; font-weight: 600; border: 1px solid var(--border); color: var(--text); }
.btn-primary { background: var(--primary); color: #fff; border-color: color-mix(in oklab, var(--primary) 80%, #0000); }
.btn-secondary { background: var(--surface); }
.btn-ghost { background: transparent; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* Cards & Grid */
.grid { display: grid; gap: 20px; }
.projects-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 0 rgba(0,0,0,0.04); transition: transform .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-media { aspect-ratio: 16/10; object-fit: cover; background: linear-gradient(135deg, color-mix(in oklab, var(--primary) 18%, transparent), color-mix(in oklab, var(--secondary) 12%, transparent)); }
.card-body { padding: 16px; }

/* Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filter-btn { padding: 8px 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; cursor: pointer; }
.filter-btn.active { outline: 2px solid var(--primary); }

/* About */
.about-grid { grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
.about-photo { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.pill-list li { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 8px 10px; border-radius: 999px; font-size: .95rem; }

/* Case Study */
.hero-image { border-radius: var(--radius); border: 1px solid var(--border); }
.process { padding-left: 20px; }
.case-nav { display: flex; justify-content: space-between; margin-top: 24px; }

/* Forms */
.form .field { display: grid; gap: 6px; }
.form label { font-weight: 600; }
.form input, .form textarea { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.form input:focus, .form textarea:focus { outline: 2px solid color-mix(in oklab, var(--primary) 55%, transparent); outline-offset: 2px; }
.error { color: #ef4444; min-height: 18px; }
.form-status { color: var(--secondary); min-height: 20px; }

/* CTA */
.cta { background: linear-gradient(180deg, color-mix(in oklab, var(--primary) 6%, transparent), transparent); }

/* Utilities */
.link { color: var(--primary); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Reveal animations (IntersectionObserver) */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* Collapsible */
.collapsible { max-height: 0; opacity: 0; overflow: hidden; transition: max-height .6s ease, opacity .4s ease; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: color-mix(in oklab, var(--bg) 96%, transparent); }
.collapsible.is-open { opacity: 1; }
/* Large max-height to allow content expansion; adjusted via JS */
.collapsible.is-open { max-height: 1200px; }

/* Gallery */
.gallery-3 { grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gallery-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.gallery-card img { width: 100%; height: 220px; object-fit: cover; display: block; }
.gallery-card figcaption { padding: 10px 12px; color: var(--muted); font-size: .95rem; }

/* Responsive */
@media (max-width: 800px) {
  .about-grid { grid-template-columns: 1fr; }
  .gallery-3 { grid-template-columns: 1fr; }
  .site-header { flex-wrap: wrap; row-gap: 10px; }
  .site-header { padding-left: 16px; }
  .site-nav { order: 3; justify-content: flex-start; }
  .header-socials { order: 2; }
}

/* Contact page */
.contact-hero { background: linear-gradient(180deg, color-mix(in oklab, var(--primary) 12%, transparent), transparent); }
.contact-hero .container { text-align: center; align-items: center; }
.contact-hero .display { margin-bottom: 8px; }
.contact-hero p { margin: 0 auto; font-size: 1.125rem; line-height: 1.6; }
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 28px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.04)); }
.pad-md { padding: 18px; }
.pad-lg { padding: 24px; }

.info-card .info-item { display: flex; gap: 12px; align-items: start; padding: 12px 0; }
.info-card .info-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in oklab, var(--primary) 18%, transparent); }
.info-list .tick-list { padding: 0; margin: 0; display: grid; gap: 8px; }
.info-list .tick-list li::before { content: '✓'; color: var(--primary); margin-right: 8px; }

.form-grid-2 { grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.form .field { margin-bottom: 14px; }
.form .field:last-child { margin-bottom: 0; }
.form select, .form input, .form textarea { background: color-mix(in oklab, var(--bg) 92%, transparent); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color: var(--text); }
.form select:focus, .form input:focus, .form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 25%, transparent); }

.segmented { display: inline-flex; background: color-mix(in oklab, var(--bg) 92%, transparent); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; }
.segmented .seg { border: 0; background: transparent; color: var(--text); padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.segmented .seg[aria-selected="true"] { background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--border); }

.contact-cta .card { background: linear-gradient(180deg, color-mix(in oklab, var(--primary) 12%, transparent), transparent); border-color: color-mix(in oklab, var(--primary) 28%, var(--border)); }
.contact-cta { margin-top: 36px; }
.contact-cta .card h3 { font-size: 1.4rem; }
.contact-cta .card p { font-size: 1.05rem; color: color-mix(in oklab, var(--text) 92%, transparent); }
.contact-cta .socials a { color: white; background: color-mix(in oklab, var(--primary) 60%, #0000); border-radius: 10px; display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; margin: 6px; font-size: 1.1rem; }
.contact-cta .socials a:hover { background: var(--primary); }

@media (max-width: 960px) {
  .contact-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .contact-hero p { font-size: 1.05rem; }
}
