/* ============================================================
   PORTFÓLIO — Nicolas Costa
   Direção visual única: Corporate
   Tema claro. Acento azul.
   ============================================================ */

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #fff; }
h1,h2,h3,h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.05; margin: 0; letter-spacing: -0.02em; }
h1,h2,.section-title,.hero-title,.xp-company { font-weight: 800; letter-spacing: -0.035em; }
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Design tokens ---------- */
:root {
  --bg:        oklch(1 0 0);
  --surface:   oklch(0.984 0.004 255);
  --surface-tint: oklch(0.972 0.008 255);
  --ink:       oklch(0.22 0.012 260);
  --ink-soft:  oklch(0.46 0.012 260);
  --ink-faint: oklch(0.62 0.010 260);
  --line:      oklch(0.88 0.010 255);
  --line-soft: oklch(0.93 0.007 255);
  --accent:    oklch(0.55 0.20 264);
  --accent-deep: oklch(0.46 0.19 264);
  --accent-tint: oklch(0.95 0.045 264);
  --accent-2:  oklch(0.62 0.15 162);
  --font-head: "Schibsted Grotesk", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --maxw: 1080px;
  --pad: clamp(20px, 5vw, 56px);
  --radius: 16px;
}

/* ---------- Layout helpers ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }
.section { padding-block: clamp(64px, 9vw, 120px); border-top: 1px solid var(--line); }
.section + .section { border-top: 1px solid var(--line); }
main > section:nth-of-type(even) { background: var(--surface-tint); }
.section-head {
  display: block;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 20px;
  margin-bottom: clamp(36px, 5vw, 56px);
}
.section-kicker {
  display: inline;
  vertical-align: middle;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  font-weight: 500;
  white-space: nowrap;
}
.section-title { display: block; margin-top: 18px; font-size: clamp(32px, 5.2vw, 56px); }
.section-num {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 7px;
  margin-right: 14px;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header .bar {
  max-width: var(--maxw); margin: 0 auto; padding: 14px var(--pad);
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.brand .handle { color: var(--ink-faint); font-family: var(--font-mono); font-size: 12px; font-weight: 400; }
.nav { display: flex; gap: 6px; margin-inline: auto; }
.nav a {
  font-size: 14px; color: var(--ink-soft); padding: 7px 12px; border-radius: 8px;
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--ink); background: var(--line-soft); }
.controls { display: flex; align-items: center; gap: 10px; }

/* segmented */
.seg { display: inline-flex; background: var(--line-soft); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; cursor: pointer; font: inherit;
  font-size: 12.5px; font-weight: 500; color: var(--ink-soft);
  padding: 5px 10px; border-radius: 7px; transition: all .15s; letter-spacing: 0.01em;
}
.seg button[aria-pressed="true"], .seg button.active {
  background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; padding: 9px 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-faint); transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn svg { width: 16px; height: 16px; }
@media (max-width: 900px) { .nav { display: none; } }

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(56px, 10vw, 120px) clamp(48px, 7vw, 90px);
  border-bottom: 1px solid var(--line);
}
.hero-grid { display: grid; grid-template-columns: 1.5fr 0.9fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono);
  font-size: 13px; color: var(--ink-soft); margin-bottom: 22px;
}
.hero-eyebrow .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 var(--accent-2); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent-2) 60%, transparent);} 70%{ box-shadow:0 0 0 8px transparent;} 100%{box-shadow:0 0 0 0 transparent;} }
.hero-title { font-size: clamp(44px, 9vw, 96px); letter-spacing: -0.04em; }
.hero-role { font-size: clamp(20px, 3vw, 27px); font-family: var(--font-head); font-weight: 500; color: var(--accent); margin-top: 10px; letter-spacing: -0.02em; }
.hero-sub { font-family: var(--font-mono); font-size: 14px; color: var(--ink-faint); margin-top: 8px; }
.hero-tag { font-size: clamp(18px, 2.3vw, 22px); color: var(--ink-soft); max-width: 30ch; margin-top: 26px; line-height: 1.45; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 26px; font-size: 14px; color: var(--ink-soft); }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--accent); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

/* photo placeholder */
.portrait {
  aspect-ratio: 4/5; border-radius: var(--radius); overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line); position: relative;
}
.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
@media (max-width: 760px) { .hero-grid { grid-template-columns: 1fr; } .portrait { max-width: 280px; } }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.6fr 0.9fr; gap: clamp(28px, 5vw, 64px); }
.about-text p { font-size: clamp(17px, 1.7vw, 19px); color: var(--ink-soft); margin-bottom: 18px; }
.about-text p:first-child { font-size: clamp(20px, 2.3vw, 24px); color: var(--ink); line-height: 1.4; }
.about-side { border-left: 3px solid var(--accent); padding-left: 28px; }
.about-side h4 { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 16px; }
.lang-row { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.lang-row:last-child { border-bottom: 0; }
.lang-row b { font-weight: 600; }
.lang-row span { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } .about-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 28px; } }

/* ---------- Experience ---------- */
.xp-list { display: flex; flex-direction: column; gap: 16px; }
.xp-item {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: clamp(20px, 4vw, 56px);
  padding: clamp(24px, 3vw, 34px);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg);
  position: relative;
}
main > section:nth-of-type(even) .xp-item { background: var(--surface); }
.xp-item:first-child { border-top: 1px solid var(--line); }
.xp-period { font-family: var(--font-mono); font-size: 13px; color: var(--ink-faint); padding-top: 4px; }
.xp-period .badge-current {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  font-size: 11px; color: var(--accent-2); background: color-mix(in oklab, var(--accent-2) 12%, transparent);
  padding: 3px 9px; border-radius: 20px; font-weight: 600; letter-spacing: 0.02em;
}
.xp-period .badge-current::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }
.xp-company { font-family: var(--font-head); font-size: clamp(21px, 2.6vw, 27px); }
.xp-role { color: var(--accent); font-size: 16px; margin-top: 3px; font-weight: 500; }
.xp-bullets { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 9px; }
.xp-bullets li { position: relative; padding-left: 20px; color: var(--ink-soft); font-size: 15.5px; line-height: 1.5; }
.xp-bullets li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 6px; height: 1.5px; background: var(--accent); }
.xp-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.tag {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft);
  border: 1px solid var(--line); padding: 4px 9px; border-radius: 7px; background: var(--surface);
  white-space: nowrap;
}
@media (max-width: 720px) { .xp-item { grid-template-columns: 1fr; gap: 14px; } }

/* ---------- Stack ---------- */
.stack-shell {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 34px);
  align-items: start;
}
.stack-lead {
  position: sticky;
  top: 92px;
  padding: 28px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, color-mix(in oklab, var(--accent) 15%, white) 0, transparent 48%),
    linear-gradient(180deg, var(--surface) 0%, color-mix(in oklab, var(--surface-tint) 86%, white) 100%);
  border: 1px solid var(--line);
  box-shadow: 0 24px 50px -34px rgba(42, 56, 120, 0.28);
}
.stack-lead-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.stack-lead-copy {
  font-size: clamp(18px, 2.1vw, 24px);
  line-height: 1.35;
  letter-spacing: -0.025em;
  max-width: 16ch;
}
.stack-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.stack-card {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(246,248,255,0.96) 100%);
  box-shadow: 0 20px 46px -34px rgba(26, 34, 84, 0.34);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.stack-card::after {
  content: "";
  position: absolute;
  inset: auto -38px -38px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--accent) 16%, transparent);
  filter: blur(6px);
}
.stack-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in oklab, var(--accent) 24%, var(--line));
  box-shadow: 0 26px 58px -34px rgba(26, 34, 84, 0.42);
}
.stack-card.tone-b::after { background: color-mix(in oklab, var(--accent-2) 18%, transparent); }
.stack-card.tone-c::after { background: color-mix(in oklab, var(--accent-deep) 16%, transparent); }
.stack-card.tone-d::after { background: color-mix(in oklab, var(--ink-soft) 14%, transparent); }
.stack-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.stack-index,
.stack-count {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}
.stack-index {
  color: var(--accent);
  font-weight: 700;
}
.stack-count {
  color: var(--ink-faint);
  text-transform: uppercase;
}
.stack-card h4 {
  font-size: clamp(24px, 3vw, 30px);
  margin-bottom: 18px;
}
.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stack-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid color-mix(in oklab, var(--line) 78%, white);
}
.stack-item:first-child { border-top: 0; padding-top: 0; }
.stack-item-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 10%, transparent);
}
.stack-item-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}
@media (max-width: 960px) {
  .stack-shell { grid-template-columns: 1fr; }
  .stack-lead { position: static; }
}
@media (max-width: 760px) { .stack-grid { grid-template-columns: 1fr; } }

/* ---------- Projects ---------- */
.proj-note { color: var(--ink-soft); font-size: 15px; margin-bottom: 32px; max-width: 52ch; }
.proj-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.proj-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: all .2s;
}
.proj-card:hover { transform: translateY(-3px); border-color: var(--ink-faint); box-shadow: 0 22px 48px -26px rgba(30,40,90,.4); }
.proj-thumb {
  aspect-ratio: 16/10;
  background: repeating-linear-gradient(135deg, var(--line-soft) 0 9px, var(--surface) 9px 18px);
  display: grid; place-items: center; border-bottom: 1px solid var(--line);
}
.proj-thumb span { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); background: var(--surface); padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line); }
.proj-thumb.has-img { padding: 0; background: var(--surface); }
.proj-img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.proj-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.proj-body h3 { font-size: 19px; }
.proj-body p { color: var(--ink-soft); font-size: 14.5px; flex: 1; }
.proj-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.proj-links { display: flex; gap: 14px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.proj-links a { font-family: var(--font-mono); font-size: 13px; color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.proj-links a:hover { text-decoration: underline; }
@media (max-width: 880px) { .proj-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .proj-grid { grid-template-columns: 1fr; } }

/* ---------- Certs ---------- */
.certs-list { display: flex; flex-direction: column; }
.cert-row { display: grid; grid-template-columns: 80px 1fr auto; gap: 24px; align-items: baseline; padding: 22px 0; border-top: 1px solid var(--line); }
.cert-row:first-child { border-top: 0; }
.cert-year { font-family: var(--font-mono); font-size: 14px; color: var(--accent); }
.cert-name { font-size: 16.5px; font-weight: 500; }
.cert-org { font-family: var(--font-mono); font-size: 13px; color: var(--ink-faint); }
@media (max-width: 560px) { .cert-row { grid-template-columns: 60px 1fr; } .cert-org { grid-column: 2; } }

/* ---------- Contact ---------- */
.contact {
  background: var(--accent);
  color: #fff;
}
.contact .section-head { border-bottom-color: rgba(255,255,255,.35); }
.contact .section-num { background: #fff; color: var(--accent); }
.contact .section-kicker { color: rgba(255,255,255,.75); }
.contact-inner { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.contact-lead { font-size: clamp(26px, 4vw, 42px); font-family: var(--font-head); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.contact-lead .accent { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,.4); }
.contact-sub { color: rgba(255,255,255,.85); margin-top: 16px; font-size: 17px; max-width: 38ch; }
.contact-cards { display: flex; flex-direction: column; gap: 12px; }
.contact-card {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); border-radius: 12px; transition: all .15s; color: #fff;
}
.contact-card:hover { border-color: rgba(255,255,255,.5); transform: translateX(3px); }
.contact-card .ico { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.contact-card .ico svg { width: 20px; height: 20px; }
.contact-card .meta small { display: block; font-family: var(--font-mono); font-size: 11px; color: rgba(255,255,255,.7); text-transform: uppercase; letter-spacing: 0.06em; }
.contact-card .meta b { font-weight: 600; font-size: 15.5px; }
.contact-card.primary { background: #fff; border-color: #fff; color: var(--accent); }
.contact-card.primary .ico { background: var(--accent-tint); color: var(--accent); }
.contact-card.primary .meta small { color: var(--accent-deep); }
@media (max-width: 720px) { .contact-inner { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.footer { padding: 40px var(--pad); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; max-width: var(--maxw); margin: 0 auto; }
.footer small { color: var(--ink-faint); font-size: 13px; }
.footer .links { display: flex; gap: 18px; font-family: var(--font-mono); font-size: 13px; }
.footer .links a { color: var(--ink-soft); }
.footer .links a:hover { color: var(--accent); }

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