/* ==========================================================================
   Marc Diaz — Portfolio. Dark, industrial, minimal. No gradients.
   ========================================================================== */

:root {
  --bg: #0F1115;
  --surface: #1A1D24;
  --accent: #00FF66;
  --border: #2D313A;
  --text-h: #F1F5F9;
  --text-body: #94A3B8;
  --text-meta: #475569;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --sidebar-w: 340px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

/* Subtle blueprint texture — technical, not social-grid */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.05;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  max-width: 1680px;
  margin: 0 auto;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: rgba(26, 29, 36, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 40px 36px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-mark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--text-h);
  border: 1px solid var(--border);
  padding: 6px 10px;
}

.brand-dot { color: var(--accent); }

.status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 1px rgba(0, 255, 102, 0.7);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.status-text {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-meta);
}

.identity { margin-top: 56px; }

.identity-name {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-h);
  margin: 0 0 18px;
}

.identity-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin: 0 0 20px;
  line-height: 1.5;
}

.identity-tagline {
  font-size: 14px;
  color: var(--text-body);
  margin: 0;
  max-width: 30ch;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.lang-link { color: var(--text-meta); transition: color 0.15s ease; }
.lang-link:hover { color: var(--text-h); }
.lang-link.is-active { color: var(--accent); pointer-events: none; }
.lang-sep { color: var(--border); }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 56px;
}

.side-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, padding-left 0.15s ease;
}

.side-nav-link:hover,
.side-nav-link.is-active {
  color: var(--text-h);
  padding-left: 10px;
}

.side-nav-link.is-active .nav-index { color: var(--accent); }

.nav-index {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-meta);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: auto;
  padding-top: 56px;
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-body);
  padding: 8px 10px;
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.social-link:hover {
  color: var(--text-h);
  border-color: var(--accent);
  background: rgba(0, 255, 102, 0.04);
}

.social-icon {
  width: 14px;
  height: 14px;
  filter: none;
}

.sidebar-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-meta);
  letter-spacing: 0.04em;
  margin: 0;
}

/* ==========================================================================
   Main content
   ========================================================================== */

.content {
  padding: 0 72px;
  max-width: 1180px;
}

.section {
  padding: 120px 0 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type { border-bottom: none; }

.hero { padding-top: 100px; }

.section-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0 0 20px;
}

.section-label-bracket { color: var(--text-meta); }

.section-heading {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-h);
  margin: 0 0 12px;
}

.section-subtext {
  color: var(--text-body);
  font-size: 14px;
  max-width: 56ch;
  margin: 0 0 44px;
}

.hero-bio {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-body);
  max-width: 62ch;
  margin: 0 0 48px;
}

.axioms {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 100px;
}

.axiom {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-body);
  border: 1px solid var(--border);
  padding: 11px 16px;
}

.axiom-index { color: var(--accent); }

/* ==========================================================================
   Projects
   ========================================================================== */

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  padding-bottom: 100px;
}

.project-card {
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.project-image {
  position: relative;
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 9px, rgba(45, 49, 58, 0.5) 9px, rgba(45, 49, 58, 0.5) 10px);
  overflow: hidden;
}

.project-image-mark {
  width: 46px;
  height: 46px;
  opacity: 0.5;
  filter: grayscale(1) brightness(1.3);
}

.project-image-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-meta);
  text-align: center;
  padding: 0 20px;
}

.project-image-ratio {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-meta);
}

.corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--border);
}

.corner-tl { top: 10px; left: 10px; border-width: 1px 0 0 1px; }
.corner-tr { top: 10px; right: 10px; border-width: 1px 1px 0 0; }
.corner-bl { bottom: 10px; left: 10px; border-width: 0 0 1px 1px; }
.corner-br { bottom: 10px; right: 10px; border-width: 0 1px 1px 0; }

/* ==========================================================================
   Project media carousel (real screenshots, click-to-expand)
   ========================================================================== */

.project-media {
  position: relative;
  padding: 28px 24px;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.carousel {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1080 / 2116;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.carousel-track {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  transition: transform 0.35s ease;
}

.carousel-slide { flex: 0 0 100%; height: 100%; }

.carousel-slide-btn {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.carousel-slide-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-h);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.carousel-arrow:hover { border-color: var(--accent); color: var(--accent); }
.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 1px solid rgba(241, 245, 249, 0.55);
  background: transparent;
  cursor: pointer;
}

.carousel-dot.is-active { background: var(--accent); border-color: var(--accent); }

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(4, 5, 7, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox-img {
  max-width: min(90vw, 560px);
  max-height: 88vh;
  border: 1px solid var(--border);
}

.lightbox-close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-h);
  font-size: 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.lightbox-close:hover { border-color: var(--accent); color: var(--accent); }

.project-body {
  padding: 26px 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--text-body);
  border: 1px solid var(--border);
  padding: 4px 9px;
}

.role-tag {
  display: inline-block;
  width: fit-content;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 4px 9px;
}

.project-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-h);
  margin: 0;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-h);
  transition: color 0.15s ease;
}

.project-link:hover { color: var(--accent); }

.project-link-arrow {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-meta);
  transition: color 0.15s ease;
}

.project-link:hover .project-link-arrow { color: var(--accent); }

.project-desc {
  font-size: 13.5px;
  color: var(--text-body);
  line-height: 1.65;
  margin: 0;
}

/* ==========================================================================
   Research
   ========================================================================== */

.research-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.research-item {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 20px;
  align-items: start;
  padding: 30px 0;
  border-bottom: 1px solid var(--border);
}

.research-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-meta);
}

.research-icon svg { width: 17px; height: 17px; }

.research-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-h);
  margin: 0 0 8px;
}

.research-desc {
  font-size: 13.5px;
  color: var(--text-body);
  line-height: 1.65;
  margin: 0 0 12px;
  max-width: 62ch;
}

.research-meta {
  display: flex;
  gap: 14px;
}

.research-meta-item {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-meta);
}

.research-download {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-body);
  justify-self: end;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.research-download svg { width: 15px; height: 15px; }

.research-download:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.degree-note {
  margin-top: 44px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 100px;
}

.degree-note-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}

.degree-note-value {
  font-size: 13.5px;
  color: var(--text-body);
}

/* ==========================================================================
   Contact
   ========================================================================== */

.section-contact { padding-bottom: 100px; }

.contact-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 36px;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-h);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.contact-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 255, 102, 0.04);
}

.contact-arrow {
  font-size: 13px;
  color: var(--text-meta);
}

.contact-link:hover .contact-arrow { color: var(--accent); }

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 32px 0 60px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-meta);
}

/* ==========================================================================
   Mobile top bar (hidden on desktop)
   ========================================================================== */

.mobile-bar {
  display: none;
  align-items: center;
  gap: 10px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  padding: 0 70px 0 20px;
  background: rgba(15, 17, 21, 0.97);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  border-bottom: 1px solid var(--border);
  z-index: 14;
}

.mobile-bar-mark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-h);
  border: 1px solid var(--border);
  padding: 4px 8px;
  flex-shrink: 0;
}

.mobile-bar-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-h);
}

/* ==========================================================================
   Mobile nav toggle (hidden on desktop)
   ========================================================================== */

.nav-toggle {
  display: none;
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  width: 42px;
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}

.nav-toggle span {
  width: 18px;
  height: 1px;
  background: var(--text-h);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
  .content { padding: 0 40px; }
  .project-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }

  /* Only lift .layout above the fixed mobile bar while the menu is
     open — otherwise normal page content (inside .layout's own
     stacking context) would sit above the bar during scroll too. */
  .layout:has(.sidebar.is-open) { z-index: 16; }

  .nav-toggle { display: flex; top: 9px; }

  .mobile-bar { display: flex; }

  .sidebar {
    position: fixed;
    inset: 0;
    height: 100vh;
    width: min(320px, 85vw);
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 15;
    background: rgba(15, 17, 21, 0.98);
    backdrop-filter: blur(20px);
  }

  .sidebar.is-open { transform: translateX(0); }

  .content { padding: 60px 24px 0; }

  .section { padding-top: 90px; }

  .hero { padding-top: 90px; }

  .research-item {
    grid-template-columns: 36px 1fr;
  }

  .research-download {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 520px) {
  .identity-name { font-size: 32px; }
  .footer { flex-direction: column; }
}
