/* ============================================================
   João Dias Gaiteiro — Cinematic (dark / cyan / engineered)
   ============================================================ */

:root {
  --bg:        #0A0B0D;
  --bg-1:      #0E1014;
  --bg-2:      #121519;
  --ink:       #F4F6F8;
  --ink-soft:  #9AA1A9;
  --ink-faint: #5C636C;
  --line:      rgba(255,255,255,0.09);
  --line-2:    rgba(255,255,255,0.05);
  --cyan:      #0595DB;
  --cyan-lit:  #35B8F2;
  --cyan-dim:  rgba(5,149,219,0.14);

  --maxw: 1240px;
  --gutter: clamp(22px, 5.5vw, 88px);

  --font: "Sora", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }

/* ---------- language visibility ---------- */
.l { display: none; }
body.is-en .l.en { display: revert; }
body.is-pt .l.pt { display: revert; }
span.l { display: none; }
body.is-en span.l.en { display: inline; }
body.is-pt span.l.pt { display: inline; }
.lb { display: none; }
body.is-en .lb.en { display: block; }
body.is-pt .lb.pt { display: block; }

/* ============================================================
   FIXED CHROME — grain, grid, wordmark, progress, section label
   ============================================================ */
#net { position: fixed; inset: 0; width: 100vw; height: 100svh; z-index: 0; pointer-events: none; display: block; }

.grain {
  position: fixed; inset: -50%; z-index: 60; pointer-events: none;
  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='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05; mix-blend-mode: screen;
  animation: grain 0.6s steps(2) infinite;
}
@keyframes grain { 0%{transform:translate(0,0)} 50%{transform:translate(-3%,2%)} 100%{transform:translate(2%,-2%)} }

.grid-bg {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image:
    linear-gradient(var(--line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(130% 100% at 50% 0%, black 0%, transparent 70%);
  opacity: var(--grid-op, 0.5);
  transition: opacity .6s linear;
}

/* content sits above bg layers */
.shell { position: relative; z-index: 2; }

.wordmark {
  position: fixed; top: 26px; left: var(--gutter); z-index: 70;
  font-family: var(--mono); font-weight: 500; font-size: 15px; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 9px; color: var(--ink);
}
.wordmark .blk { width: 26px; height: 26px; border: 1px solid var(--cyan); display: grid; place-items: center; font-size: 10px; color: var(--cyan); border-radius: 4px; }

.topright {
  position: fixed; top: 24px; right: var(--gutter); z-index: 70;
  display: flex; align-items: center; gap: 18px;
}
.lang-toggle { display: inline-flex; gap: 2px; font-family: var(--mono); font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: rgba(255,255,255,0.02); backdrop-filter: blur(8px); }
.lang-toggle button { border: none; background: none; color: var(--ink-faint); cursor: pointer; font: inherit; padding: 5px 11px; border-radius: 999px; transition: color .2s, background .25s; }
.lang-toggle button.active { background: var(--ink); color: var(--bg); }

/* top progress bar */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 0%; background: var(--cyan); z-index: 80; box-shadow: 0 0 12px var(--cyan); }

/* section index label, bottom-right (clear of hero CTAs / scroll cue) */
.section-id {
  position: fixed; bottom: 26px; right: var(--gutter); z-index: 70;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; color: var(--ink-faint);
  display: flex; align-items: center; gap: 10px;
}
.section-id .bar { width: 26px; height: 1px; background: var(--cyan); }
.section-id .cur { color: var(--ink); }
@media (max-width: 720px){ .section-id { display: none; } }

/* ============================================================
   TYPE
   ============================================================ */
h1,h2,h3 { font-weight: 600; line-height: 1.0; letter-spacing: -0.03em; }
.eyebrow { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--cyan-lit); }
.idx { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; color: var(--ink-faint); }

/* line-clip reveal primitives — hidden states gated behind html.anim
   so content is always visible if JS/GSAP can't run (progressive enhancement).
   NOTE: never hide the span via a CSS % transform — gsap would parse it into an
   absolute px y and yPercent:0 would leave it offset. Hide the block via opacity;
   gsap owns yPercent for the clip motion. */
.line { display: block; overflow: hidden; }
.line > span { display: block; }
html.anim [data-lines] { opacity: 0; }
html.anim .reveal-up { opacity: 0; transform: translateY(30px); }
html.anim .reveal-fade { opacity: 0; }

/* ============================================================
   layout
   ============================================================ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
section { position: relative; }
.sect { padding-block: clamp(110px, 17vh, 220px); }
.sect-head { margin-bottom: clamp(48px, 7vh, 90px); }
.sect-head .eyebrow { display: block; margin-bottom: 22px; }
.sect-title { font-size: clamp(2.1rem, 5vw, 3.6rem); max-width: 20ch; }

/* ============================================================
   00 HERO
   ============================================================ */
.hero { min-height: 100svh; display: flex; align-items: center; padding-top: 90px; }
.hero-video {
  position: absolute; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(78% 68% at 62% 42%, rgba(5,149,219,0.06), transparent 60%),
    repeating-linear-gradient(115deg, rgba(255,255,255,0.012) 0 2px, transparent 2px 9px);
}
.hero-video::after { /* dark gradient overlay so text stays legible */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bg) 8%, rgba(10,11,13,0.45) 46%, transparent 78%),
              linear-gradient(0deg, var(--bg) 2%, transparent 30%);
}
.hero-video .slot-tag {
  position: absolute; right: 22px; top: 84px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; color: var(--ink-faint);
  border: 1px dashed var(--line); border-radius: 6px; padding: 5px 10px;
}
.hero .wrap { width: 100%; }
.hero-eyebrow { margin-bottom: 30px; }
.hero h1 { font-size: clamp(2.9rem, 8.4vw, 7rem); line-height: 0.98; letter-spacing: -0.045em; margin-bottom: 34px; }
.hero h1 .accent { color: var(--cyan); }
.hero-sub { font-size: clamp(1.05rem, 1.7vw, 1.4rem); color: var(--ink-soft); max-width: 46ch; line-height: 1.5; margin-bottom: 44px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; gap: 10px; padding: 15px 26px; border-radius: 999px; font-family: var(--font); font-weight: 600; font-size: 15px; cursor: pointer; border: 1px solid transparent; white-space: nowrap; transition: transform .35s var(--ease), background .3s, color .3s, border-color .3s, box-shadow .3s; }
.btn .ar { transition: transform .35s var(--ease); }
.btn:hover .ar { transform: translateX(5px); }
.btn-primary { background: var(--cyan); color: #04121a; }
.btn-primary:hover { background: var(--cyan-lit); transform: translateY(-2px); box-shadow: 0 16px 40px -14px var(--cyan); }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-soft); background: rgba(255,255,255,0.03); transform: translateY(-2px); }

.scroll-cue { position: absolute; left: var(--gutter); bottom: 30px; display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.scroll-cue .ln { width: 1px; height: 40px; background: var(--line); position: relative; overflow: hidden; }
.scroll-cue .ln::after { content: ""; position: absolute; inset: 0; background: var(--cyan); animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { 0%{transform:translateY(-100%)} 60%,100%{transform:translateY(100%)} }
@media (max-width: 720px){ .scroll-cue { display: none; } }

/* ============================================================
   01 ABOUT
   ============================================================ */
.about .wrap { max-width: 1000px; }
.about-lead { font-size: clamp(1.6rem, 3.6vw, 2.9rem); line-height: 1.18; letter-spacing: -0.025em; font-weight: 500; }
.about-lead .dim { color: var(--ink-faint); }
.about-lead .accent { color: var(--cyan); }
.about-foot { margin-top: 56px; display: flex; flex-wrap: wrap; gap: 14px 46px; }
.about-foot .kv { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
.about-foot .kv b { color: var(--ink); font-weight: 500; }

/* ============================================================
   02 SKILLS
   ============================================================ */
.skills-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
@media (max-width: 1000px){ .skills-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px){ .skills-grid { grid-template-columns: 1fr; } }
.skill-col { background: var(--bg-1); padding: 30px 26px 34px; position: relative; transition: background .4s; }
.skill-col::before { content: ""; position: absolute; left: 0; top: 0; height: 2px; width: 0; background: var(--cyan); transition: width .5s var(--ease); }
.skill-col:hover { background: var(--bg-2); }
.skill-col:hover::before { width: 100%; }
.skill-col .sn { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); letter-spacing: 0.1em; }
.skill-col h3 { font-size: 1.18rem; margin: 14px 0 20px; letter-spacing: -0.01em; }
.skill-col ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.skill-col li { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 9px; transition: color .25s; }
.skill-col li::before { content: ""; width: 4px; height: 4px; background: var(--ink-faint); border-radius: 1px; transition: background .25s, box-shadow .25s; }
.skill-col:hover li { color: var(--ink); }
.skill-col li:hover::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

/* ============================================================
   03 EXPERIENCE (sticky left, scrubbed rail)
   ============================================================ */
.exp-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: clamp(30px, 6vw, 90px); align-items: start; }
@media (max-width: 880px){ .exp-grid { grid-template-columns: 1fr; gap: 40px; } }
.exp-left { position: sticky; top: 22vh; }
@media (max-width: 880px){ .exp-left { position: static; } }
.exp-left .eyebrow { display:block; margin-bottom: 20px; }
.exp-left h2 { font-size: clamp(2rem, 4vw, 3rem); }
.exp-left .count { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); margin-top: 26px; }
.exp-left .count b { color: var(--cyan-lit); }

.tl { position: relative; padding-left: 34px; }
.tl .rail { position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl .rail-fill { position: absolute; left: 5px; top: 6px; width: 1px; height: 0; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.tl-item { position: relative; padding-bottom: 54px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item .node { position: absolute; left: -34px; top: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 1px solid var(--ink-faint); transition: border-color .3s, background .3s, box-shadow .3s; }
.tl-item.lit .node { border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 0 4px var(--cyan-dim), 0 0 14px var(--cyan); }
.tl-item .date { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; color: var(--cyan-lit); text-transform: uppercase; margin-bottom: 8px; }
.tl-item h3 { font-size: 1.32rem; letter-spacing: -0.015em; }
.tl-item h3 .org { color: var(--ink-soft); font-weight: 400; }
.tl-item p { color: var(--ink-soft); font-size: 14.5px; margin-top: 8px; max-width: 56ch; line-height: 1.55; }

/* ============================================================
   04 PROJECTS
   ============================================================ */
.proj-grouplabel { font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.proj-grouplabel::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.proj-group + .proj-group { margin-top: 70px; }
.proj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
@media (max-width: 760px){ .proj-grid { grid-template-columns: 1fr; } }
.proj { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--bg-1); transition: border-color .4s, transform .5s var(--ease); }
.proj:hover { border-color: rgba(5,149,219,0.5); transform: translateY(-4px); }
.proj-media { position: relative; aspect-ratio: 16/10; overflow: hidden; background:
    radial-gradient(60% 80% at 50% 0%, rgba(5,149,219,0.10), transparent 70%),
    repeating-linear-gradient(125deg, rgba(255,255,255,0.02) 0 2px, transparent 2px 11px),
    var(--bg-2); }
.proj-media .pimg { position: absolute; inset: -8% 0; background-size: cover; background-position: center; will-change: transform; }
.proj-media .slot-tag { position: absolute; left: 16px; top: 16px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--ink-faint); border: 1px dashed var(--line); border-radius: 5px; padding: 4px 9px; background: rgba(10,11,13,0.5); }
.proj-overlay { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 22px; background: linear-gradient(0deg, rgba(10,11,13,0.92), rgba(10,11,13,0.1) 60%, transparent); opacity: 0; transition: opacity .45s var(--ease); }
.proj:hover .proj-overlay { opacity: 1; }
.proj-overlay p { font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.proj-body { padding: 22px 24px 24px; display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.proj-body h3 { font-size: 1.3rem; letter-spacing: -0.015em; }
.proj-body .dom { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }
.proj .tagrole { position: absolute; right: 16px; top: 16px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan-lit); border: 1px solid rgba(5,149,219,0.4); border-radius: 999px; padding: 4px 10px; background: rgba(5,149,219,0.08); }

/* ============================================================
   05 CONTACT
   ============================================================ */
.contact { min-height: 96svh; display: flex; align-items: center; }
.contact .wrap { width: 100%; }
.contact h2 { font-size: clamp(2.4rem, 6vw, 5rem); line-height: 1.0; letter-spacing: -0.04em; max-width: 16ch; margin-bottom: 50px; }
.contact h2 .accent { color: var(--cyan); }
.contact-links { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; max-width: 760px; }
@media (max-width: 560px){ .contact-links { grid-template-columns: 1fr; } }
.clink { background: var(--bg-1); padding: 22px 24px; display: flex; flex-direction: column; gap: 8px; transition: background .3s; }
.clink:hover { background: var(--bg-2); }
.clink .lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.clink .val { font-size: 1.05rem; display: flex; align-items: center; gap: 10px; transition: color .25s; }
.clink:hover .val { color: var(--cyan-lit); }
.clink .ar { opacity: 0; transform: translateX(-6px); transition: .3s var(--ease); margin-left: auto; }
.clink:hover .ar { opacity: 1; transform: translateX(0); }

.footer { border-top: 1px solid var(--line); padding: 26px var(--gutter); }
.footer .wrap { max-width: var(--maxw); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer .fm { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); letter-spacing: 0.04em; }
.footer .fm b { color: var(--ink-soft); font-weight: 500; }

/* ============================================================
   reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .scroll-cue .ln::after { animation: none; }
  .line > span { transform: none; }
  .reveal-up, .reveal-fade { opacity: 1; transform: none; }
}

/* ============================================================
   CONTACT FORM (added) — joaodg.pt-style, dark / cyan
   ============================================================ */
[hidden] { display: none !important; }
/* with a form, the contact section flows from the top instead of centring */
.contact { align-items: flex-start; }

.cform { margin-top: clamp(48px, 7vh, 80px); max-width: 760px; }
.cform-head { margin-bottom: 26px; }
.cform-eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cyan-lit); }
.cform-note { color: var(--ink-soft); font-size: 15px; margin-top: 8px; max-width: 52ch; }

#cform { display: flex; flex-direction: column; gap: 18px; }
.cform-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 560px){ .cform-row { grid-template-columns: 1fr; } }
.cfield { display: flex; flex-direction: column; gap: 9px; }
.clbl { font-size: 13.5px; font-weight: 500; color: var(--ink); letter-spacing: -0.01em; }
.clbl .opt { color: var(--ink-faint); font-weight: 400; }
.cfield input, .cfield textarea {
  width: 100%; background: var(--bg-1); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-family: var(--font); font-size: 15px; padding: 13px 15px;
  outline: none; transition: border-color .25s, box-shadow .25s, background .25s;
}
.cfield input { height: 50px; }
.cfield textarea { resize: vertical; min-height: 130px; line-height: 1.55; }
.cfield input::placeholder, .cfield textarea::placeholder { color: var(--ink-faint); }
.cfield input:focus, .cfield textarea:focus { border-color: var(--cyan); background: var(--bg-2); box-shadow: 0 0 0 3px var(--cyan-dim); }
.ccheck { display: flex; align-items: flex-start; gap: 11px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.ccheck input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--cyan); flex: none; }
#cform .btn-primary { align-self: flex-start; margin-top: 4px; }
.cform-err { color: #ff6b6b; font-size: 13.5px; }
.cform-foot { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-faint); }

.cform-success { margin-top: clamp(48px, 7vh, 80px); max-width: 760px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-1); padding: 44px 40px; text-align: center; }
.cform-success .cs-check { width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; font-weight: 700; color: #04121a; background: var(--cyan); box-shadow: 0 0 0 4px var(--cyan-dim), 0 0 22px var(--cyan); }
.cform-success h3 { font-size: 1.5rem; }
.cform-success p { color: var(--ink-soft); margin-top: 10px; }

/* ---- contact: form beside the cards (2 cols) ---- */
.contact-cols { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: clamp(32px, 5vw, 64px); align-items: start; }
@media (max-width: 880px){ .contact-cols { grid-template-columns: 1fr; gap: 40px; } }
.contact-cols .contact-links { grid-template-columns: 1fr; max-width: none; }
.contact-cols .cform { margin-top: 0; max-width: none; }

/* ---- footer credit (site built by joaodg.pt) ---- */
.footer .credit { color: var(--cyan-lit); text-decoration: none; transition: color .2s; }
.footer .credit:hover { color: var(--cyan); text-decoration: underline; }

/* ---- project domain as external link ---- */
.proj-body .dom a { color: inherit; text-decoration: none; transition: color .2s; }
.proj-body .dom a:hover { color: var(--cyan-lit); }

/* ---- keep domain + arrow together on one line (wrap whole domain instead) ---- */
.proj-body { flex-wrap: wrap; gap: 6px 14px; }
.proj-body .dom, .proj-body .dom a { white-space: nowrap; }

/* ============================================================
   QUICK CONTACTS (fixed, bottom-left, vertical) + BACK TO TOP
   ============================================================ */
.quick-contacts {
  position: fixed; left: var(--gutter); bottom: 26px; z-index: 75;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.quick-contacts a { color: var(--ink-faint); display: grid; place-items: center; transition: color .25s var(--ease), transform .25s var(--ease); }
.quick-contacts a:hover { color: var(--cyan-lit); transform: translateY(-3px); }
.quick-contacts .qc-line { width: 1px; height: 64px; background: var(--line); margin-top: 6px; }

/* scroll cue moves to centre so it doesn't clash with the contacts */
.scroll-cue { left: 50%; transform: translateX(-50%); }

.to-top {
  position: fixed; right: var(--gutter); bottom: 64px; z-index: 75;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink); background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease), color .25s, border-color .25s, background .25s;
}
.to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.to-top:hover { color: var(--cyan-lit); border-color: var(--cyan); background: var(--cyan-dim); transform: translateY(-3px); }

@media (max-width: 720px){
  .quick-contacts { gap: 14px; bottom: 18px; }
  .quick-contacts .qc-line { display: none; }
  .to-top { bottom: 18px; right: 18px; }
}
