/* v2.css — mpbarbosa.com Technical Minimalist
   Design tokens sourced from DESIGN.md
*/

/* ── Tokens ───────────────────────────────────────────────── */
:root {
  /* Color System */
  --color-bg: #141313;
  --color-primary: #ffffff;
  --color-surface-var: #c4c7c8;
  --color-surface: rgba(255, 255, 255, 0.04);
  --color-border: rgba(255, 255, 255, 0.12);
  --color-border-hover: rgba(255, 255, 255, 0.5);
  --color-border-active: rgba(255, 255, 255, 0.8);

  /* Typography */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Montserrat', system-ui, sans-serif;

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;

  /* Borders */
  --round-xs: 2px;
  --round-sm: 4px;

  /* Grid */
  --grid-size: 40px;
  --grid-color: rgba(255, 255, 255, 0.03);
}

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

/* ── Base ─────────────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

@media (max-width: 1680px) {
  html {
    font-size: 13px;
  }
}
@media (max-width: 736px) {
  html {
    font-size: 11px;
  }
}
@media (max-width: 360px) {
  html {
    font-size: 10px;
  }
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.7;
  color: var(--color-primary);
  background-color: var(--color-bg);
  /* 40px computational grid */
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  min-height: 100vh;
}

/* ── Background overlay ───────────────────────────────────── */
#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  /* 80% overlay depth per DESIGN.md */
  opacity: 0.06;
  filter: grayscale(1) brightness(0.4);
  transition: background-image 0.4s ease;
  pointer-events: none;
}

/* ── Layout wrapper ───────────────────────────────────────── */
#wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top App Bar ──────────────────────────────────────────── */
#top-bar {
  background: rgba(20, 19, 19, 0.9);
  color: var(--color-primary);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  white-space: nowrap;
}

/* Diamond Emblem */
.diamond-emblem {
  width: 1em;
  height: 1em;
  fill: var(--color-primary);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.brand:hover .diamond-emblem {
  transform: rotate(45deg) scale(1.15);
}

#top-bar nav {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

#top-bar nav a {
  color: var(--color-surface-var);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.8rem;
  border: 1px solid transparent;
  border-radius: var(--round-xs);
  transition:
    color 0.2s,
    border-color 0.2s;
}

#top-bar nav a:hover,
#top-bar nav a:focus-visible {
  color: var(--color-primary);
  border-color: var(--color-border);
  outline: none;
}

#top-bar nav a.active {
  color: var(--color-primary);
  border-color: var(--color-border-hover);
}

/* ── Main content ─────────────────────────────────────────── */
#main {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: var(--space-xxl) auto;
  padding: 0 var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

@media (max-width: 600px) {
  #main {
    padding: 0 var(--space-md);
    margin: var(--space-xl) auto;
  }
}

/* ── Connector lines (schematic flow) ─────────────────────── */
.connector {
  width: 1px;
  height: 48px;
  margin: 0 auto;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.25) 40%,
    rgba(255, 255, 255, 0.25) 60%,
    transparent
  );
  position: relative;
}

.connector::before,
.connector::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transform: translateX(-50%) rotate(45deg);
}

.connector::before {
  top: -2px;
}
.connector::after {
  bottom: -2px;
}

/* ── Section cards ────────────────────────────────────────── */
.section-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--round-sm);
  padding: var(--space-xxl);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease;

  /* Staggered entrance — starts invisible */
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.65s ease,
    transform 0.65s ease,
    border-color 0.3s ease;
}

.section-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-card:hover {
  border-color: var(--color-border-hover);
}

/* Top accent rule */
.section-card::before {
  content: '';
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4) 50%, transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.section-card:hover::before {
  opacity: 1;
}

/* ── Section headings ─────────────────────────────────────── */
.section-card h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: var(--space-lg);
  color: var(--color-primary);
}

/* ── Section image ────────────────────────────────────────── */
.section-img {
  width: 100%;
  border-radius: var(--round-xs);
  margin-bottom: var(--space-lg);
  display: block;
  filter: grayscale(0.6) brightness(0.85);
  border: 1px solid var(--color-border);
}

/* ── Card decoration SVG (latent space / kernel map) ─────── */
.card-decoration {
  display: block;
  width: 100%;
  height: 48px;
  color: var(--color-primary);
  margin-bottom: var(--space-lg);
  overflow: visible;
}

/* ── Body text ────────────────────────────────────────────── */
.section-card p {
  color: var(--color-surface-var);
  margin-bottom: var(--space-md);
  letter-spacing: 0.01em;
  font-weight: 300;
}

.section-card p:last-child {
  margin-bottom: 0;
}

/* ── Project list ─────────────────────────────────────────── */
.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.project-list li {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--round-xs);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.95rem;
  color: var(--color-surface-var);
  transition:
    border-color 0.25s ease,
    background 0.25s ease;
}

.project-list li:hover {
  border-color: var(--color-border-hover);
  background: rgba(255, 255, 255, 0.03);
}

.project-list a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.project-list a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Tooltip image ────────────────────────────────────────── */
.img-tooltip {
  position: relative;
  cursor: default;
  font-weight: 500;
  color: var(--color-primary);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.3);
}

.img-tooltip .tooltip-img {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 200;
  background: #1e1d1d;
  border: 1px solid var(--color-border);
  border-radius: var(--round-xs);
  padding: 4px;
}

.img-tooltip .tooltip-img img {
  width: 240px;
  border-radius: var(--round-xs);
  display: block;
}

.img-tooltip:hover .tooltip-img,
.img-tooltip:focus-within .tooltip-img {
  display: block;
}

/* ── Contact form ─────────────────────────────────────────── */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.form-row {
  display: flex;
  gap: var(--space-md);
}

@media (max-width: 480px) {
  .form-row {
    flex-direction: column;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1;
}

.form-field label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-surface-var);
}

.form-field input,
.form-field textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--round-xs);
  padding: 0.7rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--color-primary);
  transition: border-color 0.2s;
  resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-border-hover);
}

.form-actions {
  display: flex;
  gap: var(--space-md);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  border-radius: var(--round-xs);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: rgba(255, 255, 255, 0.85);
}

.btn-primary:active {
  background: rgba(255, 255, 255, 0.7);
}

.btn-outlined {
  background: transparent;
  color: var(--color-surface-var);
  border-color: var(--color-border);
}

.btn-outlined:hover {
  border-color: var(--color-border-hover);
  color: var(--color-primary);
}

/* ── Social icons ─────────────────────────────────────────── */
.social-icons {
  list-style: none;
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-lg);
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--round-xs);
  border: 1px solid var(--color-border);
  color: var(--color-surface-var);
  text-decoration: none;
  font-size: 1rem;
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
}

.social-icons a:hover {
  color: var(--color-primary);
  border-color: var(--color-border-hover);
  background: rgba(255, 255, 255, 0.06);
}

/* ── Footer ───────────────────────────────────────────────── */
#footer {
  text-align: center;
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
  padding: var(--space-lg) var(--space-xl);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-top: 1px solid var(--color-border);
}

#footer a {
  color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
}

#footer a:hover {
  color: var(--color-surface-var);
}
