/* ============================================================
   digitalknow.how/cv — João Antunes
   Dark editorial-tech aesthetic
   ============================================================ */

:root {
  --bg:        #0a0d10;
  --bg-2:      #0e1317;
  --surface:   #131b21;
  --surface-2: #18222a;
  --line:      #223038;
  --line-soft: #1a242b;

  --ink:    #e9eef1;
  --muted:  #93a1ab;
  --faint:  #5c6b75;

  --teal:   #5cc8d2;
  --teal-d: #2c7c86;
  --amber:  #d8a85f;

  --maxw: 1180px;
  --gutter: clamp(20px, 5vw, 64px);

  --f-display: 'Space Grotesk', system-ui, sans-serif;
  --f-body:    'IBM Plex Sans', system-ui, sans-serif;
  --f-mono:    'IBM Plex Mono', ui-monospace, monospace;

  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  cursor: none;
}
@media (pointer: coarse) { body { cursor: auto; } }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::selection { background: var(--teal); color: #06181b; }

/* grain + base atmosphere ----------------------------------- */
.atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 600px at 78% -8%, rgba(92,200,210,.10), transparent 60%),
    radial-gradient(820px 560px at 6% 18%, rgba(216,168,95,.06), transparent 62%);
}
.atmosphere::after {
  content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
  opacity: .025; mix-blend-mode: overlay;
}

/* layout ---------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
main { position: relative; z-index: 1; }
section { position: relative; padding-block: clamp(80px, 12vh, 150px); }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--teal);
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ""; width: 26px; height: 1px; background: var(--teal-d);
}

.section-head { margin-bottom: clamp(36px, 6vw, 64px); }
.section-head h2 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.04;
  letter-spacing: -.02em;
  margin: 18px 0 0;
  max-width: 18ch;
  text-wrap: balance;
}

/* ===== NAV ================================================== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px var(--gutter);
  transition: background .4s var(--ease), border-color .4s var(--ease), padding .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line-soft);
  padding-block: 11px;
}
.brand { display: flex; align-items: baseline; gap: 10px; font-family: var(--f-mono); font-size: 13px; letter-spacing: .04em; }
.brand b { color: var(--ink); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.brand .path { color: var(--faint); }
.brand .path .slash { color: var(--teal); }
.nav-links { display: flex; align-items: center; gap: 30px; font-family: var(--f-mono); font-size: 13px; }
.nav-links a { color: var(--muted); position: relative; transition: color .25s; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -5px; width: 0; height: 1px;
  background: var(--teal); transition: width .3s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { width: 100%; }
.nav-links .num { color: var(--faint); margin-right: 4px; }
@media (max-width: 820px) { .nav-links { display: none; } }

/* ===== HERO ================================================= */
.hero { min-height: 100svh; display: flex; align-items: center; padding-top: 120px; overflow: hidden; }
.hero-grid {
  position: absolute; inset: -10% -10% 0 -10%; z-index: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(120% 90% at 70% 20%, #000 30%, transparent 78%);
          mask-image: radial-gradient(120% 90% at 70% 20%, #000 30%, transparent 78%);
  opacity: .5;
}
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; z-index: 0; }
.blob.teal  { width: 540px; height: 540px; right: -120px; top: 4%;  background: radial-gradient(circle, rgba(92,200,210,.42), transparent 68%); }
.blob.amber { width: 440px; height: 440px; left: -160px; bottom: -10%; background: radial-gradient(circle, rgba(216,168,95,.30), transparent 68%); }

.hero-inner { position: relative; z-index: 2; width: 100%; }
.hero .status {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 12.5px; letter-spacing: .12em;
  color: var(--muted); padding: 7px 14px; border: 1px solid var(--line);
  border-radius: 100px; background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 rgba(92,200,210,.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(92,200,210,.55);} 70%{box-shadow:0 0 0 9px rgba(92,200,210,0);} 100%{box-shadow:0 0 0 0 rgba(92,200,210,0);} }

.hero h1 {
  font-family: var(--f-display); font-weight: 600;
  font-size: clamp(58px, 12.5vw, 178px);
  line-height: .92; letter-spacing: -.04em;
  margin: 26px 0 0;
}
.hero h1 .line { display: block; overflow: hidden; }
.hero h1 .line > span { display: block; transform: translateY(0); }
@media (prefers-reduced-motion: no-preference) {
  .hero h1 .line > span { animation: heroUp 1s var(--ease) both; }
  .hero h1 .line:nth-child(1) > span { animation-delay: .12s; }
  .hero h1 .line:nth-child(2) > span { animation-delay: .22s; }
}
@keyframes heroUp { from { transform: translateY(108%); } to { transform: translateY(0); } }
.hero h1 em { font-style: normal; color: var(--teal); }
.hero .lede {
  margin-top: 30px; max-width: 46ch;
  font-size: clamp(18px, 2.3vw, 23px); line-height: 1.5; color: var(--muted);
  text-wrap: pretty;
}
.hero .lede strong { color: var(--ink); font-weight: 500; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 40px; }
.hero-meta {
  position: absolute; right: 0; bottom: 6%; z-index: 2;
  display: flex; flex-direction: column; gap: 4px; text-align: right;
  font-family: var(--f-mono); font-size: 12px; color: var(--faint); letter-spacing: .08em;
}
.hero-meta b { color: var(--muted); font-weight: 500; }
@media (max-width: 820px){ .hero-meta { display: none; } }

.scroll-cue {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 2;
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .3em; color: var(--faint);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.scroll-cue .bar { width: 1px; height: 42px; background: linear-gradient(var(--teal), transparent); animation: drop 1.8s var(--ease) infinite; }
@keyframes drop { 0%{transform:scaleY(0);transform-origin:top;} 45%{transform:scaleY(1);transform-origin:top;} 55%{transform:scaleY(1);transform-origin:bottom;} 100%{transform:scaleY(0);transform-origin:bottom;} }

/* ===== buttons ============================================= */
.btn {
  --c: var(--teal);
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 13.5px; letter-spacing: .04em;
  padding: 14px 22px; border-radius: 12px; border: 1px solid var(--line);
  color: var(--ink); background: var(--surface);
  transition: border-color .3s, background .3s, color .3s, transform .2s;
  will-change: transform;
}
.btn .ar { transition: transform .3s var(--ease); }
.btn:hover { border-color: var(--c); background: var(--surface-2); }
.btn:hover .ar { transform: translate(3px,-3px); }
.btn.primary { background: var(--teal); color: #06181b; border-color: var(--teal); font-weight: 500; }
.btn.primary:hover { background: #74d6df; border-color: #74d6df; }
.btn .ico { width: 16px; height: 16px; }

/* ===== ABOUT / NOW ========================================= */
.about-grid { display: grid; grid-template-columns: 1fr; gap: clamp(40px, 7vw, 90px); }
@media (min-width: 900px){ .about-grid { grid-template-columns: 1.25fr .85fr; align-items: start; } }
.about-copy p { font-size: clamp(19px, 2.4vw, 25px); line-height: 1.5; color: var(--ink); margin: 0 0 26px; text-wrap: pretty; }
.about-copy p.sub { font-size: 18px; color: var(--muted); }
.about-copy .mark { color: var(--teal); }

.now-card {
  border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, var(--surface), var(--bg-2));
  padding: 28px; position: relative; overflow: hidden;
}
.now-card h3 { font-family: var(--f-mono); font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--teal); margin: 0 0 20px; }
.now-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.now-list li { display: grid; grid-template-columns: 20px 1fr; gap: 14px; font-size: 16px; color: var(--muted); line-height: 1.45; }
.now-list li .idx { font-family: var(--f-mono); font-size: 12px; color: var(--faint); padding-top: 3px; }
.now-list li b { color: var(--ink); font-weight: 500; }

/* stats row */
.stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 1px; margin-top: clamp(48px,7vw,80px); background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 16px; overflow: hidden; }
@media (min-width: 760px){ .stats { grid-template-columns: repeat(4,1fr); } }
.stat { background: var(--bg); padding: 26px 24px; }
.stat .n { font-family: var(--f-display); font-weight: 600; font-size: clamp(34px, 5vw, 50px); letter-spacing: -.02em; line-height: 1; }
.stat .n .suf { color: var(--teal); }
.stat .l { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .1em; color: var(--faint); text-transform: uppercase; margin-top: 12px; line-height: 1.5; }

/* ===== EXPERIENCE TIMELINE ================================= */
.timeline { position: relative; margin-top: 10px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 0; width: 1px;
  background: linear-gradient(var(--line), var(--line) 70%, transparent);
}
@media (min-width: 760px){ .timeline::before { left: 168px; } }

.tl-item { position: relative; padding: 0 0 clamp(38px,5vw,58px) 34px; }
@media (min-width: 760px){ .tl-item { display: grid; grid-template-columns: 168px 1fr; gap: 0; padding-left: 0; } }
.tl-node { position: absolute; left: 0; top: 6px; width: 15px; height: 15px; border-radius: 50%; background: var(--bg); border: 1px solid var(--teal-d); display: grid; place-items: center; }
.tl-node::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); transition: transform .3s var(--ease); }
@media (min-width: 760px){ .tl-node { left: 162px; } }
.tl-item:hover .tl-node::after { transform: scale(1.7); }

.tl-meta { font-family: var(--f-mono); font-size: 12px; color: var(--faint); padding-right: 28px; padding-top: 3px; }
.tl-meta .yr { color: var(--muted); display: block; }
.tl-meta .loc { display: block; margin-top: 4px; }
@media (max-width: 759px){ .tl-meta { margin-bottom: 8px; } }

.tl-body { padding-left: clamp(20px, 3vw, 40px); }
@media (max-width: 759px){ .tl-body { padding-left: 0; } }
.tl-role { font-family: var(--f-display); font-weight: 600; font-size: clamp(21px, 3vw, 28px); letter-spacing: -.01em; line-height: 1.15; }
.tl-org { font-family: var(--f-mono); font-size: 13.5px; color: var(--teal); margin-top: 6px; }
.tl-note { color: var(--muted); margin: 14px 0 0; font-size: 16px; max-width: 62ch; }
.tl-points { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 64ch; }
.tl-points li { position: relative; padding-left: 22px; color: var(--muted); font-size: 15.5px; line-height: 1.5; }
.tl-points li::before { content: ""; position: absolute; left: 0; top: 11px; width: 9px; height: 1px; background: var(--teal-d); }
.tl-points li b { color: var(--ink); font-weight: 500; }
.tl-points li .hl { color: var(--teal); font-family: var(--f-mono); font-size: 14px; }

.tl-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .03em; color: var(--muted); padding: 4px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-2); white-space: nowrap; }
.skill-card .k { white-space: nowrap; }

.tl-more { margin-top: 4px; }
.tl-toggle {
  display: inline-flex; align-items: center; gap: 10px; cursor: none;
  font-family: var(--f-mono); font-size: 12.5px; color: var(--muted);
  background: none; border: 1px dashed var(--line); border-radius: 10px; padding: 11px 16px;
  transition: color .25s, border-color .25s;
}
@media (pointer:coarse){ .tl-toggle{cursor:pointer;} }
.tl-toggle:hover { color: var(--teal); border-color: var(--teal-d); }
.tl-hidden { display: none; }
.tl-hidden.open { display: block; }

/* ===== STACK / SKILLS ====================================== */
.stack { background: var(--bg-2); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.skill-cards { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: clamp(44px,6vw,64px); }
@media (min-width: 680px){ .skill-cards { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 1000px){ .skill-cards { grid-template-columns: repeat(4,1fr); } }
.skill-card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 24px; height: 100%; }
.skill-card .k { font-family: var(--f-mono); font-size: 12px; color: var(--teal); letter-spacing: .14em; }
.skill-card h4 { font-family: var(--f-display); font-weight: 600; font-size: 21px; margin: 14px 0 8px; letter-spacing: -.01em; }
.skill-card p { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.5; }

.marquee-wrap { display: flex; flex-direction: column; gap: 14px; }
.tech-chip {
  font-family: var(--f-mono); font-size: 15px; color: var(--muted);
  padding: 9px 18px; border: 1px solid var(--line); border-radius: 100px; background: var(--bg);
  white-space: nowrap; transition: color .25s, border-color .25s;
}
.tech-chip:hover { color: var(--teal); border-color: var(--teal-d); }
.tech-chip .star { color: var(--teal-d); margin-right: 8px; }

/* ===== OPEN SOURCE / HIGHLIGHTS ============================ */
.hl-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 760px){ .hl-grid { grid-template-columns: repeat(2,1fr); } }
.hl-card {
  position: relative; border: 1px solid var(--line); border-radius: 18px; padding: 30px;
  background: linear-gradient(180deg, var(--surface), var(--bg-2)); overflow: hidden;
  transform-style: preserve-3d; will-change: transform;
}
.hl-card .glow { position: absolute; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, rgba(92,200,210,.16), transparent 65%); pointer-events: none; opacity: 0; transition: opacity .35s; }
.hl-card:hover .glow { opacity: 1; }
.hl-card .yr { font-family: var(--f-mono); font-size: 12px; color: var(--faint); letter-spacing: .1em; }
.hl-card h4 { font-family: var(--f-display); font-weight: 600; font-size: clamp(20px,2.6vw,26px); margin: 14px 0 0; letter-spacing: -.01em; }
.hl-card .who { font-family: var(--f-mono); font-size: 13px; color: var(--teal); margin-top: 6px; }
.hl-card p { color: var(--muted); font-size: 15.5px; line-height: 1.55; margin: 16px 0 0; }
.hl-card .badge { position: absolute; top: 26px; right: 26px; font-family: var(--f-mono); font-size: 11px; color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); padding: 4px 9px; border-radius: 7px; }

/* ===== CONTACT ============================================= */
.contact { text-align: center; }
.contact h2 { font-family: var(--f-display); font-weight: 600; font-size: clamp(40px, 8vw, 104px); letter-spacing: -.03em; line-height: .98; margin: 22px auto 0; max-width: 14ch; }
.contact h2 em { font-style: normal; color: var(--teal); }
.contact .sub { color: var(--muted); margin: 26px auto 0; max-width: 50ch; font-size: clamp(17px,2.2vw,20px); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: 42px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 28px; justify-content: center; margin-top: 56px; font-family: var(--f-mono); font-size: 13px; color: var(--faint); }
.contact-links a { color: var(--muted); transition: color .25s; }
.contact-links a:hover { color: var(--teal); }

/* ===== FOOTER ============================================= */
.foot { border-top: 1px solid var(--line-soft); padding-block: 40px; }
.foot-inner { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; font-family: var(--f-mono); font-size: 12px; color: var(--faint); }
.foot-inner .brand b { color: var(--muted); }

/* ===== reveal animation =================================== */
[reveal] { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
[reveal].in { opacity: 1; transform: none; }
[reveal][data-d="1"] { transition-delay: .08s; }
[reveal][data-d="2"] { transition-delay: .16s; }
[reveal][data-d="3"] { transition-delay: .24s; }
[reveal][data-d="4"] { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) {
  [reveal] { opacity: 1 !important; transform: none !important; }
  .blob, .status .dot, .scroll-cue .bar { animation: none !important; }
}

/* placeholder visual ------------------------------------- */
.ph {
  background-image: repeating-linear-gradient(135deg, var(--line-soft) 0 10px, transparent 10px 20px);
  border: 1px solid var(--line); border-radius: 14px;
  display: grid; place-items: center; color: var(--faint);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
}
