/* ============================================================
   José Kakopa — portfolio
   Design tokens: Terra Ink / Bone Paper / Kwanza Gold / Muxima Red
   Layout: narrow phone-first column, sections as "screens"
   ============================================================ */

:root {
  --ink: #12130F;
  --ink-2: #1A1B15;
  --bone: #EDE8DD;
  --gold: #D4A017;
  --red: #8C2F1B;
  --ash: #6E6A5F;
  --ash-dark: #AAA491;
  --line-dark: rgba(237, 232, 221, 0.14);
  --line-light: rgba(18, 19, 15, 0.16);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  --header-h: 58px;
  --ease-out: cubic-bezier(0.2, 0.65, 0.25, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  background: var(--ink);
  color: var(--bone);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, p, ul, dl {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

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

img, svg {
  display: block;
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

[hidden] {
  display: none !important;
}

/* ---------- theme text ---------- */

[data-theme="dark"] {
  background: var(--ink);
  color: var(--bone);
}

[data-theme="light"] {
  background: var(--bone);
  color: var(--ink);
}

/* ---------- layout ---------- */

.wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
}

[id] {
  scroll-margin-top: calc(var(--header-h) + 8px);
}

.section {
  padding: 72px 0 80px;
}

/* ---------- scroll progress ---------- */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 40;
  pointer-events: none;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(18, 19, 15, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-dark);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.wordmark-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--bone);
}

.wordmark-loc {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--ash-dark);
}

.site-nav {
  display: none;
  gap: 20px;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ash-dark);
  padding: 4px 0;
  background-image: linear-gradient(var(--gold), var(--gold));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: left 100%;
  transition: color 0.2s ease, background-size 0.25s ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active {
  color: var(--bone);
  background-size: 100% 1px;
}

/* language switch */

.lang-switch {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  overflow: hidden;
}

.lang-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--ash-dark);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  padding: 5px 9px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-btn:hover {
  color: var(--bone);
}

.lang-btn.is-active {
  background: var(--gold);
  color: var(--ink);
  font-weight: 500;
}

/* ---------- build log ticker ---------- */

.ticker-viewport {
  overflow: hidden;
  border-bottom: 1px solid var(--line-dark);
  background: var(--ink-2);
}

.ticker-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: ticker-scroll 42s linear infinite;
  will-change: transform;
}

.ticker-viewport:hover .ticker-track {
  animation-play-state: paused;
}

.ticker-group {
  display: flex;
  align-items: center;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px 11px 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ticker-date {
  color: var(--gold);
  font-weight: 500;
}

.ticker-body {
  color: var(--ash-dark);
}

.ticker-sep {
  color: var(--line-dark);
  padding-left: 12px;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 84px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(237, 232, 221, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237, 232, 221, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 28% 18%, #000 28%, transparent 78%);
  mask-image: radial-gradient(ellipse 85% 75% at 28% 18%, #000 28%, transparent 78%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(560px 380px at 80% 6%, rgba(212, 160, 23, 0.14), transparent 70%);
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

/* phone skeleton motif (desktop only) */

.hero-skeleton {
  position: absolute;
  left: 44px;
  top: 50%;
  width: 250px;
  transform: translateY(-40%);
  color: var(--gold);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

@media (max-width: 1199px) {
  .hero-skeleton {
    display: none;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ash-dark);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(212, 160, 23, 0.55);
  animation: pulse 2.6s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(212, 160, 23, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(212, 160, 23, 0); }
  100% { box-shadow: 0 0 0 0 rgba(212, 160, 23, 0); }
}

.hero-title {
  margin-top: 26px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 8.4vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  max-width: 20ch;
}

.hero-title em {
  font-style: normal;
  color: var(--gold);
}

.hero-sub {
  margin-top: 22px;
  max-width: 44ch;
  color: var(--ash-dark);
  font-size: 1rem;
  line-height: 1.65;
}

.proof {
  margin-top: 30px;
  display: grid;
  gap: 9px;
}

.proof li {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.015em;
  color: var(--ash-dark);
}

.proof-k {
  color: var(--gold);
  font-weight: 500;
}

.hero-cta {
  margin-top: 38px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 13px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary {
  background: var(--gold);
  color: var(--ink);
  font-weight: 500;
}

.btn-primary:hover {
  background: #e3b32e;
  transform: translateY(-1px);
}

.btn-arrow {
  transition: transform 0.2s ease;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(3px);
}

.btn-ghost {
  border: 1px solid var(--line-dark);
  color: var(--bone);
}

.btn-ghost:hover {
  border-color: rgba(237, 232, 221, 0.4);
  transform: translateY(-1px);
}

.hero-spec {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line-dark);
  color: var(--ash-dark);
}

.hero-spec .spec-k {
  color: var(--gold);
  margin-right: 6px;
}

/* ---------- screen labels & section titles ---------- */

.screen-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ash);
  margin-bottom: 18px;
}

.sq {
  width: 7px;
  height: 7px;
  background: var(--gold);
  display: inline-block;
}

[data-theme="dark"] .screen-label {
  color: var(--ash-dark);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 5.4vw, 2.3rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.section-note {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ash);
}

[data-theme="dark"] .section-note {
  color: var(--ash-dark);
}

/* ---------- about ---------- */

.lede {
  margin-top: 22px;
  max-width: 58ch;
  font-size: 1.05rem;
  line-height: 1.7;
}

.profile {
  margin-top: 34px;
  border-top: 1px solid var(--line-light);
}

.profile-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-light);
}

.profile-row dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
}

.profile-row dd {
  font-size: 0.94rem;
  color: #3A392F;
}

/* ---------- projects ---------- */

.projects {
  margin-top: 34px;
  display: grid;
  gap: 16px;
}

.project-card {
  position: relative;
  background:
    radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%), rgba(212, 160, 23, 0.08), transparent 65%),
    var(--ink-2);
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  padding: 22px 20px 18px;
  transition: transform 0.2s ease, border-color 0.25s ease;
}

.project-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 2px;
  background: var(--gold);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s var(--ease-out);
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: rgba(212, 160, 23, 0.45);
}

.project-card:hover::before {
  transform: scaleY(1);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.card-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.card-period {
  color: var(--ash-dark);
  white-space: nowrap;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--bone);
  background: var(--red);
  border-radius: 4px;
  padding: 3px 8px;
}

.card-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ash-dark);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot-gold { background: var(--gold); }

.dot-red {
  background: var(--red);
  animation: blink 2.4s ease-in-out infinite;
}

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

.card-desc {
  margin-top: 14px;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ash-dark);
  max-width: 52ch;
}

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.stack li {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.03em;
  color: var(--bone);
  border: 1px solid var(--line-dark);
  border-radius: 4px;
  padding: 3px 8px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.project-card:hover .stack li {
  border-color: rgba(212, 160, 23, 0.35);
}

.card-log {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line-dark);
}

.log-dot {
  width: 6px;
  height: 6px;
  background: var(--gold);
  transform: rotate(45deg);
  flex: none;
}

.card-log .mono {
  color: var(--ash-dark);
}

/* ---------- skills ledger ---------- */

.ledger {
  margin-top: 30px;
}

.ledger-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-light);
  transition: padding-left 0.2s ease;
}

.ledger-row:hover {
  padding-left: 6px;
}

.ledger-row dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
}

.ledger-row dd {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #3A392F;
}

/* ---------- beyond code ---------- */

.beyond-list {
  margin-top: 30px;
  display: grid;
  gap: 26px;
}

.beyond-k {
  display: inline-block;
  color: var(--gold);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding-left: 15px;
  position: relative;
}

.beyond-k::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  background: var(--red);
}

.beyond-list p {
  color: var(--ash-dark);
  max-width: 50ch;
  font-size: 0.98rem;
  line-height: 1.65;
}

/* ---------- contact ---------- */

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  padding: 8px 12px;
  border: 1px solid var(--line-light);
  border-radius: 6px;
  color: #3A392F;
  background: rgba(18, 19, 15, 0.03);
}

.contact-list {
  margin-top: 34px;
  border-top: 1px solid var(--line-light);
}

.contact-list li {
  border-bottom: 1px solid var(--line-light);
}

.contact-link {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 17px 0;
  transition: padding-left 0.2s ease;
}

.contact-link:hover {
  padding-left: 8px;
}

.contact-k {
  color: var(--red);
  min-width: 68px;
  text-transform: uppercase;
}

.contact-v {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1rem;
  word-break: break-word;
}

/* underline draw-on for light sections */
.link-under {
  background-image: linear-gradient(var(--red), var(--red));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: left calc(100% - 2px);
  transition: background-size 0.28s ease, padding-left 0.2s ease;
}

.link-under:hover {
  background-size: 100% 2px;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line-dark);
}

.footer-build-row {
  text-align: center;
  padding-top: 26px;
}

.footer-build {
  color: var(--ash-dark);
}

.footer-build .ticker-date {
  margin-right: 4px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 18px;
  padding-bottom: 34px;
}

.footer-line {
  color: var(--ash-dark);
}

.to-top {
  color: var(--ash-dark);
  transition: color 0.2s ease;
}

.to-top:hover {
  color: var(--gold);
}

/* ---------- rail (desktop scrollspy) ---------- */

.rail {
  position: fixed;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  display: none;
}

@media (min-width: 1140px) {
  .rail {
    display: block;
  }
}

.rail-pill {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  background: rgba(18, 19, 15, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-dark);
  border-radius: 999px;
}

.rail-link {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 5px 0;
}

.rail-link::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-dark);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.rail-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  text-transform: lowercase;
  color: var(--bone);
  opacity: 0.45;
  transition: opacity 0.25s ease, color 0.25s ease;
}

.rail-link:hover .rail-label,
.rail-link.is-active .rail-label {
  opacity: 1;
  color: var(--bone);
}

.rail-link.is-active::before {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(212, 160, 23, 0.6);
}

/* ---------- language toggle (no-JS safe) ---------- */

[data-pt] {
  display: none;
}

html[lang="pt"] [data-pt] {
  display: revert;
}

html[lang="pt"] [data-en] {
  display: none;
}

/* ---------- hero load sequence ---------- */

.hero [data-reveal] {
  opacity: 0;
  animation: rise 0.65s var(--ease-out) forwards;
  animation-delay: var(--reveal-delay, 0s);
}

.hero [data-reveal="0"] { --reveal-delay: 0.05s; }
.hero [data-reveal="1"] { --reveal-delay: 0.2s; }
.hero [data-reveal="2"] { --reveal-delay: 0.35s; }
.hero [data-reveal="3"] { --reveal-delay: 0.5s; }
.hero [data-reveal="4"] { --reveal-delay: 0.65s; }
.hero [data-reveal="5"] { --reveal-delay: 0.8s; }

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

/* ---------- scroll reveals (JS-enabled only) ---------- */

html.js [data-scroll] .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s var(--ease-out);
  will-change: opacity, transform;
}

html.js [data-scroll].is-in .reveal {
  opacity: 1;
  transform: none;
}

/* ---------- focus ---------- */

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

[data-theme="light"] :focus-visible {
  outline-color: var(--red);
}

/* ---------- reduced motion ---------- */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }

  .ticker-track {
    animation: none;
    width: auto;
    flex-wrap: wrap;
  }

  .ticker-track .ticker-group[aria-hidden="true"] {
    display: none;
  }

  .live-dot {
    animation: none;
  }

  .hero [data-reveal],
  .ticker-viewport[data-reveal] {
    opacity: 1;
  }

  html.js [data-scroll] .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---------- responsive ---------- */

@media (min-width: 520px) {
  .site-nav {
    display: flex;
  }

  .profile-row {
    flex-direction: row;
    align-items: baseline;
    gap: 20px;
  }

  .profile-row dt {
    min-width: 92px;
  }

  .ledger-row {
    flex-direction: row;
    align-items: baseline;
    gap: 24px;
  }

  .ledger-row dt {
    min-width: 120px;
    flex: none;
  }

  .beyond-k {
    padding-left: 0;
  }

  .beyond-k::before {
    display: none;
  }
}

@media (min-width: 720px) {
  .section {
    padding: 104px 0 116px;
  }

  .hero {
    padding: 104px 0 120px;
  }
}
