/* ─────────────────────────────────────────────
   André Machado — Portfolio  ·  Bento Box Design
   Light + Dark mode   ·   Grid background
   ───────────────────────────────────────────── */

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

:root,
[data-theme="dark"] {
  --bg:           #050505;
  --bg-alt:       #0a0a0a;
  --text-primary: #f5f5f7;
  --text-second:  #a1a1a6;
  --accent:       #2997ff;
  --accent-hover: #51a9ff;
  --card-bg:      rgba(15, 15, 15, 0.6);
  --card-border:  rgba(255, 255, 255, 0.06);
  --border:       rgba(255, 255, 255, 0.08);
  --nav-bg:       rgba(5, 5, 5, 0.85);
  --radius-sm:    12px;
  --radius-md:    20px;
  --radius-lg:    28px;
  --max-w:        1120px;
  --gutter:       clamp(20px, 5vw, 80px);
  --section-pad:  clamp(80px, 12vw, 160px);
}

[data-theme="light"] {
  --bg:           #f5f5f7;
  --bg-alt:       #ffffff;
  --text-primary: #1d1d1f;
  --text-second:  #6e6e73;
  --accent:       #0071e3;
  --accent-hover: #0077ed;
  --card-bg:      rgba(255, 255, 255, 0.7);
  --card-border:  rgba(0, 0, 0, 0.08);
  --border:       rgba(0, 0, 0, 0.08);
  --nav-bg:       rgba(245, 245, 247, 0.85);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.47;
  letter-spacing: -0.022em;
  overflow-x: hidden;
  transition: background .4s, color .4s;
}

img, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #fff; }

/* ── GRID BACKGROUND ─────────────────────── */
.grid-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}
[data-theme="light"] .grid-bg { opacity: 1; }

/* ── NEON CURSOR TRAIL ───────────────────── */
.neon-trail {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 9999;
  pointer-events: none;
}
[data-theme="light"] .neon-trail { opacity: 0.4; }

/* ── NAV (removed) ───────────────────────── */

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: var(--card-bg); color: var(--text-primary);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border);
  cursor: pointer; transition: color .25s, background .25s, border-color .25s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.theme-toggle:hover { background: var(--accent); color: #fff; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="dark"]  .icon-moon { display: none; }

.overline {
  font-size: .75rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 12px;
}

/* ═══ HERO — BENTO BOX ═══════════════════════ */
.hero-bento {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 80px var(--gutter) 80px;
}
.hero-bento-header { text-align: center; margin-bottom: 48px; }
.hero-title {
  font-size: clamp(2.4rem, 6.5vw, 4.5rem);
  font-weight: 700; line-height: 1.05; letter-spacing: -0.04em;
  margin-bottom: 12px;
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-second); max-width: 500px; margin: 0 auto;
}

/* ── BENTO GRID ──────────────────────────── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto;
  gap: 16px;
  max-width: var(--max-w);
  width: 100%;
}
.bento-about   { grid-column: 1; grid-row: 1 / 3; }
.bento-3d      { grid-column: 2; grid-row: 1; }
.bento-web     { grid-column: 3; grid-row: 1; }
.bento-apps    { grid-column: 2; grid-row: 2; }
.bento-anim    { grid-column: 3; grid-row: 2; }
.bento-contact { grid-column: 1 / 4; grid-row: 3; }

.bento-card {
  position: relative;
  background: rgba(15, 15, 15, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 3vw, 36px);
  cursor: pointer; overflow: hidden;
  /* Instant transform on hover (JS sets it), smooth return on leave */
  transition: transform 0.22s ease-out, box-shadow 0.3s, border-color 0.3s, background 0.4s;
  transform-style: preserve-3d;
  will-change: transform;
  -webkit-backdrop-filter: saturate(140%) blur(24px);
  backdrop-filter: saturate(140%) blur(24px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.06);
}
[data-theme="light"] .bento-card {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 20px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.7);
}
.bento-card:hover {
  border-color: rgba(41,151,255,0.3);
  box-shadow: 0 0 40px rgba(41,151,255,0.1), 0 8px 32px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}
[data-theme="light"] .bento-card:hover {
  border-color: rgba(0,113,227,0.25);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8);
}

.bento-shine {
  position: absolute; inset: 0;
  border-radius: inherit; pointer-events: none;
  transition: background 0.3s;
}

.bento-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; height: 100%;
}
.bento-icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  background: rgba(41,151,255,0.1);
  color: var(--accent); margin-bottom: 20px;
}
.bento-card:hover .bento-icon { background: rgba(41,151,255,0.18); }

.bento-title {
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 700; letter-spacing: -0.025em; line-height: 1.15;
  margin-bottom: 10px;
}
.bento-desc {
  font-size: .9375rem; color: var(--text-second); line-height: 1.55; flex: 1;
}
.bento-cta {
  display: inline-block; margin-top: 16px;
  font-size: .875rem; font-weight: 500; color: var(--accent);
}
.bento-card:hover .bento-cta { color: var(--accent-hover); }

.bento-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.bento-tags span {
  font-size: .75rem; font-weight: 500;
  padding: 5px 14px; border-radius: 980px;
  background: rgba(41,151,255,0.08); color: var(--accent);
  border: 1px solid rgba(41,151,255,0.15);
}

.bento-social { display: flex; gap: 12px; margin-top: 16px; }
.bento-social a {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--card-border); color: var(--text-second);
  transition: color .25s, border-color .25s, background .25s;
}
.bento-social a:hover {
  color: var(--accent); border-color: var(--accent);
  background: rgba(41,151,255,0.08);
}

/* ── SECTION TITLES ──────────────────────── */
.sec-title {
  font-size: clamp(1.9rem, 4.4vw, 3.25rem);
  font-weight: 700; line-height: 1.08; letter-spacing: -0.03em;
  max-width: 740px;
}
.sec-body {
  font-size: clamp(1rem, 1.8vw, 1.1875rem);
  color: var(--text-second); line-height: 1.58;
  max-width: 620px; margin-top: 16px;
}
.sec-body-small { font-size: .875rem; color: var(--text-second); margin-top: 12px; opacity: .7; }

/* ── 3D SHOWCASE ─────────────────────────── */
.sec-showcase {
  position: relative; z-index: 1;
  background: var(--bg-alt); transition: background .4s;
}
.showcase-intro {
  text-align: center;
  padding: var(--section-pad) var(--gutter) 0;
  display: flex; flex-direction: column; align-items: center;
}
.stage { position: relative; }
.stage-canvas {
  position: sticky; top: 0; width: 100%; height: 100vh;
  z-index: 1; cursor: grab; pointer-events: auto;
}
.stage-canvas:active { cursor: grabbing; }
.stage-canvas canvas { width: 100% !important; height: 100% !important; }
.stage-track { position: relative; z-index: 2; pointer-events: none; }
.stage-slide {
  height: 350vh; display: flex;
  align-items: flex-start; justify-content: flex-start;
  padding: 0 var(--gutter); pointer-events: auto;
}
.slide-text {
  max-width: 460px; position: sticky;
  top: 50%; transform: translateY(-50%);
  opacity: 0; transition: opacity .5s ease; padding: 40px 0;
}
.slide-text.visible { opacity: 1; }
.slide-title {
  font-size: clamp(1.8rem, 3.8vw, 2.75rem);
  font-weight: 700; line-height: 1.08; letter-spacing: -0.028em;
  margin-bottom: 16px; color: var(--text-primary);
}
.slide-body { font-size: 1rem; color: var(--text-second); line-height: 1.58; margin-bottom: 24px; }

[data-theme="dark"] .slide-title { color: #f5f5f7; }
[data-theme="dark"] .slide-body  { color: #d1d1d6; }
[data-theme="dark"] .stat-value  { color: #f5f5f7; }
[data-theme="dark"] .slide-text .overline { color: var(--accent); }

.slide-stats { display: flex; gap: 32px; }
.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .75rem; color: var(--text-second); margin-top: 2px; }

/* ── ABOUT ───────────────────────────────── */
.sec-about { position: relative; z-index: 1; padding: var(--section-pad) var(--gutter); }
.about-inner { max-width: var(--max-w); margin: 0 auto; }
.about-inner .sec-body { max-width: 700px; }
.skills-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.skill-chip {
  font-size: .8125rem; font-weight: 500;
  padding: 8px 18px; border-radius: 980px;
  background: var(--bg-alt); color: var(--text-second);
  border: 1px solid var(--border);
  transition: color .3s, border-color .3s, background .4s;
}
.skill-chip:hover { color: var(--text-primary); border-color: rgba(128,128,128,.35); }

/* ── CARD SECTIONS ───────────────────────── */
.sec-cards {
  position: relative; z-index: 1;
  padding: var(--section-pad) var(--gutter);
  max-width: calc(var(--max-w) + 2 * var(--gutter));
  margin: 0 auto; transition: background .4s;
}
.sec-cards:nth-of-type(even) { background: var(--bg-alt); max-width: none; }
.sec-cards:nth-of-type(even) .sec-cards-head,
.sec-cards:nth-of-type(even) .card-grid { max-width: var(--max-w); margin-left: auto; margin-right: auto; }
.sec-cards-head { margin-bottom: 48px; }
.card-grid { display: grid; gap: 20px; }
.card-grid.three-cols { grid-template-columns: repeat(3, 1fr); }
.card-grid.two-cols   { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: clamp(28px, 4vw, 44px);
  border: 1px solid var(--card-border);
  transition: transform .35s cubic-bezier(.25,.1,.25,1), box-shadow .35s, border-color .4s;
  overflow: hidden;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  border-color: rgba(41,151,255,0.15);
}
.card h3 { font-size: 1.3125rem; font-weight: 600; margin-bottom: 12px; letter-spacing: -0.015em; }
.card p { font-size: .9375rem; color: var(--text-second); line-height: 1.55; }
.card-img { padding: 0; }
.card-img img { width: 100%; height: auto; border-radius: var(--radius-md) var(--radius-md) 0 0; object-fit: cover; }
.card-img h3 { padding: 20px 24px 0; }
.card-img p  { padding: 0 24px 24px; }

/* ── CONTATO (final section) ──────────────── */
.sec-contato {
  position: relative; z-index: 2;
  background: var(--bg-alt); text-align: center;
  padding: var(--section-pad) var(--gutter) 40px; transition: background .4s;
}
.sec-contato-final {
  /* Solid background — grid squares do NOT show behind this */
  background: var(--bg-alt);
}
.contato-inner { max-width: var(--max-w); margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.contato-icons { display: flex; justify-content: center; gap: 24px; margin-top: 40px; }
.contato-icon {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  border: 1.5px solid var(--card-border); color: var(--text-second);
  transition: color .3s, border-color .3s, background .3s, transform .3s;
}
.contato-icon:hover {
  color: var(--accent); border-color: var(--accent);
  background: rgba(41,151,255,0.08); transform: scale(1.1);
}
.contato-icon svg { width: 24px; height: 24px; }
.contato-copyright {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: .75rem;
  color: var(--text-second);
  width: 100%;
}

/* ── REVEAL ──────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity .7s cubic-bezier(.25,.1,.25,1), transform .7s cubic-bezier(.25,.1,.25,1);
}
.reveal.visible { opacity: 1; transform: none; }
.reveal:nth-child(2) { transition-delay: .08s; }
.reveal:nth-child(3) { transition-delay: .16s; }
.reveal:nth-child(4) { transition-delay: .22s; }
@keyframes revealFallback { to { opacity: 1; transform: none; } }
.reveal { animation: revealFallback .6s ease 1.8s forwards; }
.reveal.visible { animation: none; }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 980px) {
  .bento-grid { grid-template-columns: 1fr 1fr; }
  .bento-about   { grid-column: 1 / 3; grid-row: auto; }
  .bento-3d      { grid-column: 1; grid-row: auto; }
  .bento-web     { grid-column: 2; grid-row: auto; }
  .bento-apps    { grid-column: 1; grid-row: auto; }
  .bento-anim    { grid-column: 2; grid-row: auto; }
  .bento-contact { grid-column: 1 / 3; grid-row: auto; }

  .card-grid.three-cols { grid-template-columns: 1fr; }
  .card-grid.two-cols   { grid-template-columns: 1fr; }
  /* nav removed */

  .stage-canvas { height: 50vh; }
  .stage-slide  { height: 250vh; }
  .slide-text { max-width: 100%; top: 55vh; transform: none; padding: 20px 0 60px; }
}

@media (max-width: 600px) {
  .bento-grid { grid-template-columns: 1fr; }
  .bento-about, .bento-contact { grid-column: 1; }
  .bento-3d, .bento-web, .bento-apps, .bento-anim { grid-column: 1; }
  .slide-stats { gap: 20px; flex-wrap: wrap; }
  .hero-title { font-size: clamp(2rem, 8vw, 3rem); }
  .contato-icons { gap: 16px; }
  .contato-icon { width: 48px; height: 48px; }
  .contato-icon svg { width: 20px; height: 20px; }
}
