/* ==========================================================================
   Felipe Freitas — Portfolio v4 "Anti-Portfolio"
   Direction C: Clinical. Controlled. Slightly uncomfortable.
   If you're reading this, you're thorough. I respect that.
   ========================================================================== */

:root {
  color-scheme: only light;

  --bg:       #C0BFBC;
  --surface:  #B6B5B2;
  --text:     #181818;
  --dim:      #404040;
  --border:   #A8A7A4;
  --accent:   #8B1A2B;
  --accent-strong: #791221;
  --accent-soft: rgba(139, 26, 43, 0.12);
  --accent-mid:  rgba(139, 26, 43, 0.2);

  --display: 'Instrument Sans', sans-serif;
  --mono:    'IBM Plex Mono', monospace;
  --body:    'Inter', sans-serif;
  --sig:     'Tahoma', 'Geneva', sans-serif;
}

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

html {
  color-scheme: only light;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}

body {
  color-scheme: only light;
  font-family: var(--body);
  background: var(--bg);
  color: var(--dim);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

@media (hover: hover) and (pointer: fine) {
  html, body, a, button { cursor: none; }
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 1rem;
  z-index: 10001;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-decoration: none;
  transition: top 0.3s;
}
.skip-link:focus {
  top: 0;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ==========================================================================
   Custom Cursor — oxblood dot + ring
   ========================================================================== */

.cursor-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background 0.2s;
  left: -100px;
  top: -100px;
}

.cursor-ring {
  position: fixed;
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(139, 26, 43, 0.25);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, border-color 0.3s;
  left: -100px;
  top: -100px;
}

body.cursor-hover .cursor-dot {
  width: 40px;
  height: 40px;
  background: var(--accent-soft);
}

body.cursor-hover .cursor-ring {
  width: 60px;
  height: 60px;
  border-color: var(--accent);
}

/* ==========================================================================
   Noise texture — heathered sweatshirt mélange (two-layer)
   Layer 1: fine grain (the cotton fibers)
   Layer 2: vertical streaks (the mélange weave)
   ========================================================================== */

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
}

.noise::before,
.noise::after {
  content: '';
  position: absolute;
  inset: 0;
}

/* Fine grain — cotton fiber texture */
.noise::before {
  opacity: 0.12;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.8' numOctaves='6' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* Vertical streaks — heathered fiber mixing */
.noise::after {
  opacity: 0.06;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='h'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.15 0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23h)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 400px;
}

/* ==========================================================================
   Scroll Progress — left edge, oxblood
   ========================================================================== */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 3px;
  height: 0%;
  background: var(--accent);
  z-index: 9999;
  will-change: height;
}

/* ==========================================================================
   Navigation — clean, institutional
   ========================================================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(192, 191, 188, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 100%;
  padding: 0 4vw;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  transition: color 0.3s;
}

.nav-logo:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 0;
  list-style: none;
}

.nav-links a {
  font-family: var(--sig);
  color: var(--dim);
  text-decoration: none;
  font-size: 0.6rem;
  padding: 0.5rem 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color 0.3s;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 1.25rem;
  padding: 0.5rem;
}

/* ==========================================================================
   Hero — THE FIRST IMPRESSION
   ========================================================================== */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 100px 4vw 6rem;
  position: relative;
  overflow: hidden;
}

.hero-tag {
  font-family: var(--sig);
  font-size: 0.5rem;
  color: var(--dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeIn 0.8s 1.8s forwards;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.systems-label {
  color: var(--dim);
}

.systems-list {
  color: var(--accent);
  letter-spacing: 0.08em;
}

.systems-count {
  color: var(--dim);
}

.hero-name-small {
  font-family: var(--sig);
  font-size: 0.7rem;
  color: var(--dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeIn 0.8s 0.1s forwards;
}

.hero-headline {
  font-family: var(--display);
  font-size: clamp(4rem, 14vw, 13rem);
  font-weight: 700;
  line-height: 0.85;
  letter-spacing: -0.05em;
  text-transform: uppercase;
  margin-bottom: 2.5rem;
  position: relative;
}

.hero-headline:hover {
  animation: nameGlitch 0.4s ease-in-out;
}

@keyframes nameGlitch {
  0%, 100% { text-shadow: none; }
  20% { text-shadow: 3px 0 var(--accent), -3px 0 #5B3A8C; }
  40% { text-shadow: -2px 1px #9B2948, 2px -1px #5B3A8C; }
  60% { text-shadow: 2px -1px #5B3A8C, -2px 1px var(--accent); }
  80% { text-shadow: -1px 0 #9B2948, 1px 0 var(--accent); }
}

.hero-word {
  display: block;
  color: var(--text);
  opacity: 0;
  filter: blur(12px);
  transform: translateY(30px);
  animation: letterIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--w) * 250ms + 0.15s);
}

.hero-word--accent {
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
  animation: none !important;
  color: var(--accent);
}

.hero-word--accent .letter {
  color: var(--accent);
  animation-delay: calc(var(--i) * 60ms + 0.65s);
}

/* Per-letter blur-in animation */
.letter {
  display: inline-block;
  opacity: 0;
  filter: blur(12px);
  transform: translateY(30px);
  animation: letterIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--i) * 60ms + 0.15s);
}

@keyframes letterIn {
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.hero-meta {
  max-width: 560px;
  opacity: 0;
  animation: fadeSlideUp 0.8s 1.2s forwards;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-role {
  font-family: var(--sig);
  font-size: 0.7rem;
  color: var(--dim);
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.hero-typing {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  min-height: 1.5rem;
}

.typing-prefix {
  color: var(--dim);
  margin-right: 0.3rem;
}

.cursor {
  animation: blink 1s step-end infinite;
  color: var(--accent);
}

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

/* Currently building micro-section */
.hero-current {
  font-family: var(--sig);
  font-size: 0.65rem;
  color: var(--dim);
  margin-top: 1rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  letter-spacing: 0.02em;
  opacity: 0;
  animation: fadeSlideUp 0.8s 1.8s forwards;
}

.hero-current span {
  display: block;
}

.hero-current span + span {
  margin-top: 0.35rem;
}

.hero-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 3rem;
  opacity: 0;
  animation: fadeSlideUp 0.8s 1.6s forwards;
}

.hero-bio {
  font-size: 0.85rem;
  color: var(--dim);
  line-height: 1.8;
  max-width: 480px;
}

.hero-bio strong {
  color: var(--accent);
  font-weight: 600;
}

.hero-stats {
  display: flex;
  gap: 3.5rem;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-num {
  font-family: var(--display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-family: var(--sig);
  font-size: 0.5rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 0.4rem;
}

/* Scroll indicator */
.hero-scroll {
  position: absolute;
  bottom: 2rem;
  right: 4vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  animation: fadeIn 1s 2.5s forwards;
}

.hero-scroll span {
  font-family: var(--sig);
  font-size: 0.45rem;
  color: var(--dim);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

.hero-scroll-line {
  width: 1px;
  height: 40px;
  background: var(--accent);
  animation: scrollPulse 2s ease-in-out infinite;
  transform-origin: top;
}

@keyframes scrollPulse {
  0%, 100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(0.3); opacity: 0.3; }
}

/* ==========================================================================
   Dual Marquee
   ========================================================================== */

.marquee-section {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  padding: 0.25rem 0;
  position: relative;
}

.marquee-toggle {
  position: absolute;
  top: 0.45rem;
  right: 4vw;
  z-index: 2;
  font-family: var(--mono);
  font-size: 0.52rem;
  color: var(--dim);
  background: rgba(192, 191, 188, 0.86);
  border: 1px solid var(--border);
  padding: 0.32rem 0.55rem;
  transition: color 0.3s, border-color 0.3s, background-color 0.3s;
}

.marquee-toggle:hover,
.marquee-toggle:focus-visible,
.marquee-toggle[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(192, 191, 188, 0.96);
}

.marquee-row {
  white-space: nowrap;
  padding: 0.5rem 0;
  overflow: hidden;
}

.marquee-track {
  display: inline-flex;
  gap: 3rem;
  animation: marqueeLeft 50s linear infinite;
}

.marquee-row--reverse .marquee-track {
  animation: marqueeRight 38s linear infinite;
}

.marquee-track span {
  font-family: var(--display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  flex-shrink: 0;
  transition: color 0.4s;
}

.marquee-track span:nth-child(odd) {
  color: var(--accent);
}

.marquee-section:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-section.is-paused .marquee-track {
  animation-play-state: paused;
}

.marquee-section:hover .marquee-track span {
  color: var(--text);
}

@keyframes marqueeLeft {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes marqueeRight {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

/* ==========================================================================
   Section System — numbered labels
   ========================================================================== */

.section {
  padding: 7rem 4vw;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

.section-num {
  font-family: var(--display);
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 700;
  color: #646361;
  line-height: 1;
}

.section-label {
  font-family: var(--sig);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Accent divider between sections */
.accent-line {
  height: 1px;
  background: var(--border);
}

/* ==========================================================================
   Recruiter Brief + Proof Ledger
   ========================================================================== */

.brief {
  padding-top: 5.5rem;
  padding-bottom: 5.5rem;
}

.brief-kicker {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.brief-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 4rem;
  align-items: end;
}

.brief-copy h2 {
  font-family: var(--display);
  font-size: 2.15rem;
  font-weight: 700;
  line-height: 1.08;
  color: var(--text);
  margin-bottom: 1rem;
  max-width: 720px;
}

.brief-copy p {
  max-width: 700px;
  color: var(--dim);
  font-size: 0.9rem;
}

.brief-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.4rem;
}

.brief-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.62rem;
  text-decoration: none;
  transition: color 0.3s, border-color 0.3s, background-color 0.3s;
}

.brief-link:hover,
.brief-link:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.brief-signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.brief-signal {
  min-height: 128px;
  padding: 1rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background-color 0.3s, border-color 0.3s;
}

.brief-signal:hover {
  background: var(--accent-soft);
  border-color: var(--accent-mid);
}

.brief-signal--credential {
  grid-column: 1 / -1;
  min-height: 104px;
  border-top: 1px solid var(--accent-mid);
}

.brief-value,
.proof-metric {
  font-family: var(--display);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.brief-value {
  font-size: 2rem;
}

.brief-label {
  font-family: var(--sig);
  font-size: 0.62rem;
  color: var(--dim);
  line-height: 1.45;
}

.proof-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.proof-item {
  min-height: 220px;
  padding: 1.35rem;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background-color 0.3s;
}

.proof-item:hover {
  background: rgba(139, 26, 43, 0.06);
}

.proof-item--credential {
  grid-column: 1 / -1;
  border-top: 1px solid var(--accent-mid);
}

.proof-item--credential .proof-metric {
  color: var(--accent);
}

.proof-metric {
  font-size: 2.2rem;
}

.proof-item h3 {
  font-family: var(--display);
  font-size: 0.9rem;
  color: var(--text);
  margin: 1.5rem 0 0.55rem;
}

.proof-item p {
  color: var(--dim);
  font-size: 0.78rem;
  line-height: 1.65;
}

/* ==========================================================================
   Scroll Reveal
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-d1 { transition-delay: 0.1s; }
.reveal-d2 { transition-delay: 0.2s; }
.reveal-d3 { transition-delay: 0.3s; }
.reveal-d4 { transition-delay: 0.4s; }

/* ==========================================================================
   About — split layout
   ========================================================================== */

.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 4rem;
  align-items: start;
}

.about-text p {
  color: var(--dim);
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
}

/* First paragraph as pull-quote */
.about-text p:first-child {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  padding-left: 1.25rem;
  border-left: 3px solid var(--accent);
  margin-bottom: 2rem;
}

.about-text strong {
  color: var(--accent);
  font-weight: 600;
}

.stack-wrapper {
  border-left: 3px solid var(--border);
  padding-left: 1.25rem;
  margin-bottom: 2.5rem;
  transition: border-color 0.4s;
}

.stack-wrapper:hover {
  border-color: var(--accent);
}

.stack-section {
  margin-bottom: 1.5rem;
}

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

.stack-heading {
  font-family: var(--sig);
  font-size: 0.55rem;
  font-weight: 500;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.6rem;
}

.stack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag {
  font-family: var(--mono);
  font-size: 0.55rem;
  padding: 0.25rem 0.5rem;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--border);
  transition: border-color 0.3s, color 0.3s, background-color 0.3s;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.education-heading {
  font-family: var(--sig);
  font-size: 0.55rem;
  font-weight: 500;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.75rem;
}

.education-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.education-item {
  padding: 0.75rem;
  border-left: 2px solid var(--border);
  transition: border-color 0.3s, background 0.3s;
}

.education-item:hover {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.education-item-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.education-item-sub {
  font-family: var(--sig);
  font-size: 0.55rem;
  color: var(--dim);
}

.credential-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-mid);
  transition: border-color 0.3s, color 0.3s;
}

.credential-link:hover,
.credential-link:focus-visible {
  color: var(--text);
  border-color: var(--accent);
}

/* ==========================================================================
   Experience — timeline
   ========================================================================== */

.timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent) 0%, var(--border) 35%, var(--border) 100%);
}

.timeline-item {
  position: relative;
  padding-bottom: 2.5rem;
  padding-left: 1.5rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.1rem;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s, box-shadow 0.3s;
}

.timeline-item:first-child::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 20px rgba(139, 26, 43, 0.15);
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 20px rgba(139, 26, 43, 0.15); }
  50% { box-shadow: 0 0 0 8px var(--accent-soft), 0 0 30px rgba(139, 26, 43, 0.2); }
}

.timeline-item:hover::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-role {
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.timeline-prompt {
  color: var(--accent);
  margin-right: 0.3rem;
  font-family: var(--mono);
}

.timeline-company {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.timeline-date {
  font-family: var(--sig);
  font-size: 0.6rem;
  color: var(--dim);
  margin-bottom: 0.5rem;
}

.timeline-desc {
  font-size: 0.8rem;
  color: var(--dim);
  line-height: 1.7;
}

.experience-map {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.experience-map-title {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.experience-map-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.experience-map article {
  border-left: 2px solid var(--border);
  padding: 0.25rem 0 0.25rem 1rem;
  transition: border-color 0.3s, background-color 0.3s;
}

.experience-map article:hover,
.experience-map article:focus-within {
  border-color: var(--accent);
  background: rgba(139, 26, 43, 0.05);
}

.experience-map h3 {
  font-family: var(--display);
  font-size: 0.82rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.experience-map p {
  font-size: 0.76rem;
  color: var(--dim);
  line-height: 1.65;
}

/* ==========================================================================
   Portfolio — bento grid with 3D tilt
   ========================================================================== */

.project-explorer {
  display: grid;
  grid-template-columns: minmax(260px, 0.74fr) minmax(0, 1.26fr);
  gap: 2rem;
  align-items: start;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.project-explorer-copy p {
  font-size: 0.82rem;
  color: var(--dim);
  max-width: 520px;
}

.project-explorer-copy h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  color: var(--text);
  margin-bottom: 0.45rem;
}

.project-tools {
  display: grid;
  gap: 0.75rem;
}

.project-search-label {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--accent);
}

.project-search {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.65rem 0.75rem;
  outline: none;
  transition: border-color 0.3s, background-color 0.3s;
}

.project-search:focus {
  border-color: var(--accent);
  background: rgba(139, 26, 43, 0.06);
}

.project-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-btn {
  min-height: 31px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.58rem;
  padding: 0.35rem 0.55rem;
  transition: color 0.3s, border-color 0.3s, background-color 0.3s;
}

.filter-btn:hover,
.filter-btn:focus-visible,
.filter-btn.active {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.project-count {
  min-height: 1.4rem;
  font-family: var(--sig);
  font-size: 0.62rem;
  color: var(--dim);
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.project-card {
  grid-column: span 2;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.75rem;
  padding-bottom: 3rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s, box-shadow 0.4s;
  transform-style: preserve-3d;
}

.project-card:hover {
  will-change: transform;
}

.project-card[hidden] {
  display: none !important;
}

/* Bento layout — explicit card hierarchy */
.project-card--hero {
  grid-column: 1 / -1;
  grid-row: span 1;
  padding: 2.5rem;
  padding-bottom: 3.5rem;
}

.project-card--wide {
  grid-column: span 4;
}

.project-card--half {
  grid-column: span 3;
}

.project-card--tall {
  grid-row: span 2;
}

/* Category color system — adjusted for light bg */
.project-card[data-cat="ai"]       { --cat: #8B1A2B; }
.project-card[data-cat="hardware"] { --cat: #9B2948; }
.project-card[data-cat="finance"]  { --cat: #5B3A8C; }
.project-card[data-cat="infra"]    { --cat: #1A6B3C; }
.project-card[data-cat="business"] { --cat: #7A7A7A; }
.project-card[data-cat="data"]     { --cat: #1F5F73; }
.project-card[data-cat="security"] { --cat: #6A4C93; }
.project-card[data-cat="mobile"]   { --cat: #174A31; }

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--cat, var(--border));
  opacity: 0.5;
  transition: opacity 0.4s;
}

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

.project-card:hover {
  border-color: var(--cat, var(--accent));
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--cat, var(--accent));
}

/* Watermark number */
.project-number {
  position: absolute;
  top: -8px;
  right: 12px;
  font-family: var(--display);
  font-size: 5rem;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.025);
  line-height: 1;
  pointer-events: none;
  transition: color 0.5s, transform 0.5s;
  user-select: none;
}

.project-card--hero .project-number {
  font-size: 8rem;
}

.project-card:hover .project-number {
  color: rgba(139, 26, 43, 0.06);
  transform: translate(4px, -4px);
}

.project-title {
  font-family: var(--display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}

.project-card--hero .project-title {
  font-size: 1.15rem;
}

.project-desc {
  font-size: 0.78rem;
  color: var(--dim);
  line-height: 1.7;
  margin-bottom: 1rem;
  flex: 1;
  position: relative;
  z-index: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  position: relative;
  z-index: 1;
}

/* Project card one-liner — hidden until hover */
.project-quip {
  position: absolute;
  bottom: 0.75rem;
  left: 1.75rem;
  right: 1.75rem;
  font-family: var(--sig);
  font-size: 0.6rem;
  font-style: italic;
  color: var(--text);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s, transform 0.4s;
  z-index: 1;
}

.project-card--hero .project-quip {
  left: 2.5rem;
  right: 2.5rem;
}

.project-card:hover .project-quip {
  opacity: 1;
  transform: translateY(0);
}

.project-card:focus-within {
  border-color: var(--cat, var(--accent));
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--cat, var(--accent));
}

.project-card:focus-within::before {
  opacity: 1;
}

.project-card:focus-within .project-quip {
  opacity: 1;
  transform: translateY(0);
}

.case-file {
  position: relative;
  z-index: 1;
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(168, 167, 164, 0.68);
}

.case-file summary {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: var(--cat, var(--accent));
  font-family: var(--mono);
  font-size: 0.6rem;
  list-style: none;
  user-select: none;
}

.case-file summary::-webkit-details-marker {
  display: none;
}

.case-file summary::before {
  content: '+';
  margin-right: 0.4rem;
  color: var(--dim);
}

.case-file[open] summary::before {
  content: '-';
}

.case-file p {
  margin-top: 0.55rem;
  color: var(--dim);
  font-size: 0.72rem;
  line-height: 1.58;
}

.case-file strong {
  color: var(--text);
  font-weight: 600;
}

/* Other projects */
.other-projects {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.other-projects-title {
  font-family: var(--sig);
  font-size: 0.55rem;
  font-weight: 500;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.75rem;
}

.other-projects-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.other-tag {
  font-family: var(--mono);
  font-size: 0.55rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  color: var(--dim);
  transition: border-color 0.3s, color 0.3s, background-color 0.3s;
}

.other-tag:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

/* Anchor variant of .other-tag — public repo link affordance */
a.other-tag {
  text-decoration: none;
  cursor: pointer;
}

/* Reserve horizontal space on title when card has a GitHub icon */
.project-card[data-repo] .project-title {
  padding-right: 32px;
}

/* GitHub icon on featured cards with public repo */
.project-github {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--dim);
  opacity: 0.4;
  transition: opacity 0.3s, color 0.3s, transform 0.3s;
  text-decoration: none;
}

.project-card:hover .project-github {
  opacity: 0.85;
  color: var(--cat, var(--accent));
}

.project-github:hover,
.project-github:focus-visible {
  opacity: 1;
  color: var(--cat, var(--accent));
  transform: translateY(-1px);
  outline: none;
}

/* FOSS badge — corner ribbon on open-source featured cards */
.project-card[data-foss]::after {
  content: 'FOSS';
  position: absolute;
  top: 0;
  left: 0;
  font-family: var(--mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--bg);
  background: var(--cat, var(--accent));
  padding: 0.28rem 0.55rem 0.22rem;
  pointer-events: none;
  z-index: 3;
}

/* ==========================================================================
   CTA — full-width statement
   ========================================================================== */

.cta {
  padding: 8rem 4vw;
  text-align: center;
  position: relative;
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
}

.cta-link {
  font-family: var(--display);
  font-size: clamp(1.8rem, 5.5vw, 4.5rem);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: inline-block;
  transition: transform 0.3s;
  line-height: 1.1;
}

.cta-link:hover {
  transform: scale(1.03);
}

.cta-accent {
  color: var(--accent);
  animation: funPulse 2.5s ease-in-out infinite;
}

@keyframes funPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.cta-link[data-coordinates]:hover::after {
  content: attr(data-coordinates);
  position: absolute;
  bottom: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.55rem;
  color: var(--dim);
  white-space: nowrap;
  opacity: 0.6;
  pointer-events: none;
}

.cta-sub {
  font-family: var(--sig);
  font-size: 0.55rem;
  color: var(--dim);
  margin-top: 1.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ==========================================================================
   Contact — statement style
   ========================================================================== */

.contact-heading {
  font-family: var(--display);
  font-size: clamp(4rem, 14vw, 11rem);
  font-weight: 700;
  color: var(--text);
  line-height: 0.85;
  letter-spacing: -0.04em;
  margin-bottom: 2rem;
}

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

.contact-intro {
  font-size: 0.88rem;
  color: var(--dim);
  margin-bottom: 3rem;
  max-width: 420px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 420px;
}

.contact-link {
  font-family: var(--sig);
  font-size: 0.78rem;
  color: var(--dim);
  text-decoration: none;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.3s, padding-left 0.3s;
}

.contact-link:first-child {
  border-top: 1px solid var(--border);
}

.contact-link:hover {
  color: var(--accent);
  padding-left: 1rem;
}

.contact-link .arrow {
  transition: transform 0.3s;
  color: var(--border);
}

.contact-link:hover .arrow {
  transform: translateX(6px);
  color: var(--accent);
}

/* ==========================================================================
   Footer — with philosophy
   ========================================================================== */

.footer {
  padding: 2.5rem 4vw 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  font-family: var(--sig);
  font-size: 0.55rem;
  color: var(--dim);
}

.footer-line {
  max-width: 70%;
}

.footer-eof {
  color: var(--dim);
  font-size: 0.55rem;
  text-align: right;
}

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

@media (max-width: 900px) {
  .brief-layout,
  .project-explorer {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .proof-grid,
  .experience-map-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portfolio-grid {
    grid-template-columns: 1fr 1fr;
  }

  .project-card,
  .project-card--half {
    grid-column: span 1;
  }

  .project-card--hero,
  .project-card--wide,
  .project-card--tall {
    grid-column: 1 / -1;
    grid-row: span 1;
  }
}

@media (max-width: 768px) {
  :root,
  html,
  body {
    color-scheme: only light;
  }

  .cursor-dot, .cursor-ring { display: none !important; }
  html, body, a, button { cursor: auto !important; }

  .hero {
    min-height: 90vh;
    padding-top: 80px;
  }

  .hero-headline {
    font-size: clamp(3rem, 12vw, 6rem);
  }

  .hero-word,
  .nav-logo,
  .brief-copy h2,
  .brief-value,
  .proof-metric,
  .about-text p:first-child,
  .project-title,
  .timeline-role,
  .education-item-title,
  .stat-num,
  .contact-heading,
  .brief-link,
  .filter-btn,
  .project-search {
    color: var(--text);
    -webkit-text-fill-color: var(--text);
  }

  .hero-word--accent,
  .hero-word--accent .letter,
  .systems-list,
  .hero-typing,
  .cursor,
  .section-label,
  .timeline-company,
  .credential-link,
  .proof-item--credential .proof-metric,
  .project-quip,
  .case-file summary {
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
  }

  .hero-tag,
  .hero-name-small,
  .hero-role,
  .nav-toggle,
  .typing-prefix,
  .brief-copy p,
  .brief-label,
  .proof-item p,
  .about-text p,
  .education-item-sub,
  .timeline-date,
  .timeline-desc,
  .project-desc,
  .tag,
  .other-tag,
  .stat-label,
  .footer-line,
  .footer-eof {
    color: var(--dim);
    -webkit-text-fill-color: var(--dim);
  }

  .systems-count {
    color: var(--dim);
    -webkit-text-fill-color: var(--dim);
  }

  .hero-current {
    color: #333333;
    -webkit-text-fill-color: #333333;
    background: rgba(139, 26, 43, 0.08);
  }

  .hero-bottom {
    flex-direction: column;
    gap: 2.5rem;
    align-items: flex-start;
  }

  .hero-stats {
    gap: 2.5rem;
  }

  .stat {
    align-items: flex-start;
  }

  .stat-num {
    font-size: 2.5rem;
  }

  .hero-scroll { display: none; }

  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(192, 191, 188, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 0.75rem 4vw 1.25rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }

  .section { padding: 5rem 4vw; }
  .section-head { gap: 1rem; }
  .section-num { font-size: 3rem; }

  .brief {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }

  .brief-copy h2 {
    font-size: 1.65rem;
  }

  .brief-signal-grid,
  .proof-grid,
  .experience-map-grid {
    grid-template-columns: 1fr;
  }

  .proof-item {
    min-height: 180px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .education-grid { grid-template-columns: 1fr; }

  .portfolio-grid { grid-template-columns: 1fr; }

  .project-card--hero,
  .project-card--half,
  .project-card--wide,
  .project-card--tall {
    grid-column: span 1;
    grid-row: span 1;
  }

  .project-number { font-size: 3rem !important; }
  .project-quip {
    position: static;
    display: block;
    opacity: 1;
    transform: none;
    margin-top: 1rem;
  }

  .project-card--hero .project-quip {
    left: auto;
    right: auto;
  }

  .case-file summary {
    font-size: 0.68rem;
  }

  .contact-heading {
    font-size: clamp(3rem, 14vw, 6rem);
  }

  .marquee-track span { font-size: 0.65rem; }

  .marquee-toggle {
    position: static;
    display: inline-flex;
    margin: 0.35rem 4vw 0.1rem;
  }

  .footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .footer-line { max-width: 100%; }

  .hero-tag { font-size: 0.65rem; }
  .tag, .other-tag { font-size: 0.65rem; }
  .footer-line, .footer-eof { font-size: 0.65rem; }
}

@media (max-width: 480px) {
  .hero-headline { font-size: 2.5rem; }
  .stat-num { font-size: 2rem; }
  .hero-stats { gap: 2rem; }
  .brief-signal { min-height: 112px; }
  .proof-metric { font-size: 1.85rem; }
  .project-card { padding: 1.35rem; padding-bottom: 1.35rem; }
  .project-card--hero { padding: 1.55rem; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

/* ==========================================================================
   Print — for the recruiter who hits Ctrl+P
   ========================================================================== */

@media print {
  .noise, .cursor-dot, .cursor-ring, .scroll-progress,
  .hero-scroll, .nav-toggle, .marquee-section, .project-explorer,
  .cta, .nav { display: none !important; }

  body { background: #fff !important; color: #000 !important; }

  .hero { min-height: auto; padding: 2rem 0; }
  .section { padding: 2rem 0; }
  .hero-headline { font-size: 3rem !important; }

  .reveal, .hero-word, .letter, .hero-tag, .hero-meta,
  .hero-bottom, .hero-name-small, .hero-current {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
    animation: none !important;
  }

  a { color: #000; text-decoration: underline; }

  a[href^="http"]::after {
    content: ' (' attr(href) ')';
    font-family: var(--mono);
    font-size: 0.6rem;
    color: #666;
  }

  .brief-layout, .about-grid, .experience-map-grid, .portfolio-grid, .proof-grid {
    display: block !important;
  }

  .brief-signal, .proof-item, .project-card, .experience-map article {
    break-inside: avoid;
    margin-bottom: 1rem;
  }

  .project-quip,
  .case-file {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
  }

  body::after {
    content: 'Printed from ffreitasb.github.io  |  The version I actually enjoy building lives at ffreitasb.cc  |  No frameworks. No tracking. No excuses.';
    display: block;
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #ccc;
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 0.55rem;
    color: #999;
    text-align: center;
  }

  @page { margin: 2cm; }
}

/* ==========================================================================
   Dark mode crossover — .cc DNA bleeds through
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  ::selection {
    background: #00FF41;
    color: #0D0D0D;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #00FF41;
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor-dot, .cursor-ring { display: none; }
  html, body, a, button { cursor: auto; }

  .letter, .hero-word {
    opacity: 1;
    filter: none;
    transform: none;
    animation: none;
  }

  .hero-tag, .hero-meta, .hero-bottom, .hero-scroll, .hero-name-small, .hero-current {
    opacity: 1;
    animation: none;
  }

  .marquee-track { animation: none; }
  .scroll-progress { display: none; }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
