/* ==========================================================================
   Stylesheet for goncalocanha.com, shared by every page.

   Contents:
     1. Fonts
     2. Design tokens (colours, sizes)
     3. Base elements
     4. Page frame and shared components
     5. Home page: profile card
     6. Home page: section tabs
     7. Home page: sections (about, experience, projects, education)
     8. Footer
     9. Project pages
    10. 404 page
    11. Animations
    12. Responsive layouts (small phones, wide screens)
    13. Reduced motion
   ========================================================================== */


/* ==========================================================================
   1. Fonts
   Space Grotesk is self-hosted, split in two files so browsers only
   download the character ranges a page actually uses.
   ========================================================================== */

/* Extended Latin characters (rarely needed) */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Basic Latin characters, including Portuguese accents */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


/* ==========================================================================
   2. Design tokens
   ========================================================================== */

:root {
  --color-background: #0b0b0c;
  --color-panel: rgba(255, 255, 255, 0.04);
  --color-border: rgba(255, 255, 255, 0.09);
  --color-text: #e6e6e6;
  --color-muted: #9a9a9a;
  --color-accent: #7dd3fc;
  --color-accent-soft: rgba(125, 211, 252, 0.14);
  --color-teal: #2dd4bf;
  --color-online: #4ade80;
  --panel-border-radius: 16px;
  --font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}


/* ==========================================================================
   3. Base elements
   ========================================================================== */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Faint grid and green glow behind everything, fading out towards the bottom */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(125, 211, 252, 0.13), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 40px 40px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 75%);
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 4px; }


/* ==========================================================================
   4. Page frame and shared components
   ========================================================================== */

/* Centred column used by every page on narrow and medium screens */
.site-header, main, footer, .project-bar {
  max-width: 760px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* Inline SVG icons */
.icon { width: 18px; height: 18px; flex: none; }

/* Translucent card that most content sits in */
.panel {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--panel-border-radius);
}
/* Entrance animation only for what is on screen at load; the rest is simply there */
.site-header .panel, #sobre .panel, .project-page main .panel { animation: rise 0.5s ease-out backwards; }

/* PT / EN pill switch */
.language-switch {
  display: flex;
  width: max-content;
  margin-left: auto;
  gap: 2px;
  padding: 3px;
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}
.language-switch a, .language-switch [aria-current] { padding: 2px 10px; border-radius: 999px; }
.language-switch a { color: var(--color-muted); }
.language-switch a:hover { color: var(--color-text); text-decoration: none; }
.language-switch a:focus-visible { border-radius: 999px; }
.language-switch [aria-current] { background: var(--color-accent); color: var(--color-background); font-weight: 700; }

/* Live green dots; the ring animates with transform/opacity only (GPU-composited) */
.online-dot, .pulse-dot {
  position: relative;
  flex: none;
  border-radius: 50%;
  background: var(--color-online);
}
.online-dot { width: 9px; height: 9px; }
.pulse-dot { width: 8px; height: 8px; }
.online-dot::after, .pulse-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-online);
  animation: ping 2s ease-out infinite;
}

/* Small grey line under a heading (company, dates, etc.) */
.metadata { margin: 2px 0 12px; color: var(--color-muted); font-size: 0.9375rem; }

/* Rounded pills listing skills or areas */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.tags li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}
.tags .icon { width: 15px; height: 15px; color: var(--color-accent); }

/* Rounded square holding an icon */
.icon-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.icon-badge .icon { width: 22px; height: 22px; }

/* Text link followed by an arrow, e.g. "See all projects →" */
.see-all { display: inline-flex; gap: 6px; margin-top: 16px; font-weight: 600; }

/* Solid green button */
.call-to-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-background);
  font-weight: 700;
  transition: box-shadow 0.2s;
}
.call-to-action:hover { text-decoration: none; box-shadow: 0 0 24px rgba(125, 211, 252, 0.5); }
.call-to-action:focus-visible { border-radius: 999px; }


/* ==========================================================================
   5. Home page: profile card
   ========================================================================== */

.site-header { padding-top: 32px; }
.profile { padding: 20px 28px 28px; }

/* Avatar next to the name and job title */
.profile-main { display: flex; align-items: center; gap: 20px; margin-top: 12px; }
.avatar {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
  background: radial-gradient(circle at 30% 30%, #1d2410, var(--color-background));
  box-shadow: 0 0 0 3px var(--color-background), 0 0 0 5px var(--color-accent), 0 0 28px rgba(125, 211, 252, 0.45);
}
.profile h1 {
  font-size: clamp(1.75rem, 6vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0;
}
.title { margin: 6px 0 0; font-weight: 600; }
.status { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; color: var(--color-muted); font-size: 0.9375rem; }

/* Number boxes ("in retail since 2016"); the value is shown above its label */
.statistics { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; }
.statistic {
  flex: 1 1 0;
  min-width: min-content;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}
.statistic dd { margin: 0; font-size: clamp(1.375rem, 5vw, 1.75rem); font-weight: 700; line-height: 1.1; color: var(--color-accent); }
.statistic dt { margin-top: 4px; color: var(--color-muted); font-size: 0.8125rem; line-height: 1.3; }


/* ==========================================================================
   6. Home page: section tabs
   A floating dock that sticks to the top while scrolling.
   ========================================================================== */

.tabs {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  gap: 2px;
  width: fit-content;
  max-width: calc(100% - 32px);
  margin: 16px auto 0;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(20, 20, 22, 0.72);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--color-text);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tabs a:hover { text-decoration: none; color: var(--color-accent); background: var(--color-accent-soft); border-color: rgba(125, 211, 252, 0.5); }
.tabs a:focus-visible { border-radius: 999px; outline-offset: 2px; }


/* ==========================================================================
   7. Home page: sections
   ========================================================================== */

main { padding-top: 4px; }
/* scroll-margin keeps headings visible below the sticky tabs */
section { padding: 24px 0; scroll-margin-top: 72px; }

/* Section titles: small uppercase green label with a glowing dash before it */
h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-accent);
}
h2::before {
  content: "";
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-accent);
  box-shadow: 0 0 10px var(--color-accent);
}
h3 { margin: 0; font-size: 1.25rem; line-height: 1.3; }

/* --- About --- */
.about { padding: 24px; }
.about p { margin: 0; }
.about p + p { margin-top: 12px; }

/* --- Experience: each job is shown as a game achievement --- */
.achievements { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.achievement { padding: 18px 24px 24px; }
.achievement-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-muted);
}
.date-range { margin-left: auto; font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.03em; text-transform: none; }
/* The current job glows green */
.unlocked {
  border-color: rgba(125, 211, 252, 0.45);
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.07), var(--color-panel) 60%);
  box-shadow: 0 0 32px -8px rgba(125, 211, 252, 0.4), inset 0 1px 0 rgba(125, 211, 252, 0.15);
}
.unlocked .achievement-header { color: var(--color-accent); }
.highlight { margin: 0 0 14px; }

/* --- Projects: clickable project tile (also used on the projects page) --- */
.tile {
  position: relative;
  display: block;
  overflow: hidden;
  color: var(--color-text);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.tile:hover {
  text-decoration: none;
  transform: translateY(-4px);
  border-color: rgba(125, 211, 252, 0.5);
  box-shadow: 0 16px 40px -16px rgba(125, 211, 252, 0.45);
}
/* The whole tile is clickable through an overlay on the title link */
.tile-link { color: inherit; }
.tile-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--panel-border-radius); }
.tile-link:hover { text-decoration: none; }
.tile-link:focus-visible { outline: none; }
.tile:has(.tile-link:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 3px; }
/* Cover: dotted blue-to-teal gradient with the project name, unless a screenshot is used */
.tile-cover {
  display: flex;
  align-items: flex-end;
  height: 150px;
  padding: 16px 24px;
  background:
    radial-gradient(rgba(11, 11, 12, 0.22) 1.2px, transparent 1.6px) 0 0 / 14px 14px,
    linear-gradient(135deg, var(--color-accent), var(--color-teal));
  color: var(--color-background);
  font-size: clamp(1.5rem, 6vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
/* Screenshot cover: the image fills the cover box, cropped from the top-left */
.screenshot { position: relative; padding: 0; background: #f4f1ea; }
.screenshot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.tile-body { padding: 20px 24px 24px; }
.tile-body .metadata { margin: 2px 0 0; }
.tile-body p:not(.metadata) { margin: 10px 0 16px; color: var(--color-muted); }
/* "Playing now" label with a pulsing dot */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-online);
}
.view-project { color: var(--color-accent); font-weight: 600; }

/* --- Education and skills --- */
.badges { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.badge-card { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; }
.badge-card h4 { margin: 0; font-size: 1rem; line-height: 1.3; }
.badge-card .metadata { margin: 2px 0 0; font-size: 0.875rem; }

/* Grey uppercase titles inside a section ("Education", "Skills", "Languages") */
h2 + .subheading { margin-top: 0; }
.subheading {
  margin: 28px 0 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-muted);
}

/* Languages: name and level on one row, a level bar below.
   The bar's fill comes from --fill-level in the HTML (0 to 10). */
.language-list { list-style: none; margin: 0; padding: 18px 20px; display: grid; gap: 14px; }
.language {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "name level" "bar bar";
  gap: 6px 12px;
  align-items: baseline;
}
.language-name { grid-area: name; font-weight: 600; }
.language-level { grid-area: level; color: var(--color-muted); font-size: 0.875rem; }
.level-bar { grid-area: bar; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.level-bar span {
  display: block;
  width: calc(var(--fill-level) * 10%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-accent), var(--color-teal));
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.5);
}


/* ==========================================================================
   8. Footer
   ========================================================================== */

footer { padding-top: 32px; padding-bottom: 48px; color: var(--color-muted); font-size: 0.8125rem; text-align: center; }
footer a { color: var(--color-muted); text-decoration: underline; text-decoration-color: var(--color-border); text-underline-offset: 3px; }
footer a:hover { color: var(--color-accent); text-decoration-color: currentColor; }


/* ==========================================================================
   9. Project pages (projects list and each project)
   ========================================================================== */

/* Footer stays at the bottom even when the page is short */
.project-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.project-page header, .project-page main, .project-page footer { width: 100%; }
.project-page main { flex: 1; padding-top: 24px; }

/* Top bar: breadcrumbs on the left, language switch on the right */
.project-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 24px; }
.project-bar .language-switch { margin-left: 0; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--color-muted); font-size: 0.9375rem; font-weight: 500; }
.breadcrumbs a { color: var(--color-muted); }
.breadcrumbs a:hover { color: var(--color-accent); text-decoration: none; }
.breadcrumbs [aria-current] { color: var(--color-text); }

.page-title { margin: 0; font-size: clamp(1.75rem, 6vw, 2.5rem); line-height: 1.1; letter-spacing: -0.03em; }
.page-introduction { margin: 8px 0 24px; color: var(--color-muted); }

/* --- Projects list --- */
.project-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
/* Project names are h2 here but look like the h3 tile titles on the home page */
.project-list h2 { display: block; margin: 0; font-size: 1.25rem; line-height: 1.3; letter-spacing: 0; text-transform: none; color: var(--color-text); }
.project-list h2::before { content: none; }

/* --- Single project --- */
.project-page article { overflow: hidden; }
.project-cover { height: 220px; font-size: clamp(2rem, 9vw, 3.5rem); }
.project-body { padding: 24px; }
.project-body h1 { margin: 0; font-size: clamp(1.75rem, 6vw, 2.5rem); line-height: 1.1; letter-spacing: -0.03em; }
.project-body .metadata { margin: 6px 0 0; }
.project-body p:not(.metadata) { margin: 16px 0 0; }
.project-body h2 { margin: 28px 0 12px; }
.project-body .steps { margin: 12px 0 0; padding-left: 1.25em; }
.project-body .steps li + li { margin-top: 6px; }
.project-body .steps strong { color: var(--color-text); }

/* --- "Now" list at the bottom of the home profile card --- */
.now { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--color-border); }
.now h2 { margin-bottom: 12px; }
.now ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.now li { display: flex; gap: 12px; align-items: flex-start; font-size: 0.9375rem; line-height: 1.4; }
.now .icon-badge { width: 32px; height: 32px; border-radius: 10px; }
.now .icon-badge .icon { width: 18px; height: 18px; }
.now .metadata { display: block; margin: 2px 0 0; font-size: 0.8125rem; }


/* ==========================================================================
   10. 404 page
   ========================================================================== */

.not-found main { padding-top: 48px; }
.not-found .error-code { margin: 0; font-size: clamp(4rem, 20vw, 7rem); font-weight: 700; line-height: 1; letter-spacing: -0.04em; color: var(--color-accent); }
/* The English line sits right under the Portuguese one */
.not-found .page-introduction + .page-introduction { margin-top: -16px; }
.not-found .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 28px; }
.not-found .actions > * { margin-top: 0; }


/* ==========================================================================
   11. Animations
   ========================================================================== */

/* Panels slide up and fade in */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
/* Ring that grows and fades out around the live dots */
@keyframes ping { 0% { transform: scale(1); opacity: 0.6; } 80%, 100% { transform: scale(2.6); opacity: 0; } }


/* ==========================================================================
   12. Responsive layouts
   ========================================================================== */

/* Small phones: tighter profile card */
@media (max-width: 400px) {
  .profile { padding: 16px 20px 20px; }
  .profile-main { gap: 16px; }
  .avatar { width: 64px; height: 64px; font-size: 1.25rem; }
}

/* Phones: smaller tabs so all four fit */
@media (max-width: 480px) {
  .tabs { max-width: calc(100% - 16px); gap: 0; }
  .tabs a { padding: 6px 8px; font-size: 0.875rem; }
}

/* Wide screens: the profile becomes a sticky sidebar and the content fills the rest */
@media (min-width: 1024px) {
  /* --- Home page grid --- */
  .home {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 40px;
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 40px;
  }
  .home .site-header, .home main, .home footer { max-width: none; margin: 0; padding-left: 0; padding-right: 0; }
  .site-header { grid-column: 1; grid-row: 1 / 4; }
  .profile { position: sticky; top: 32px; }
  .profile-main { flex-direction: column; align-items: flex-start; gap: 16px; }
  .profile h1 { font-size: 2.25rem; }
  /* Statistics stack vertically, label on the left and value on the right */
  .statistics { flex-direction: column; }
  .statistic { flex-direction: row-reverse; justify-content: space-between; align-items: baseline; }
  .statistic dt { margin-top: 0; }
  /* The sticky sidebar already anchors the page, so the tabs scroll away instead of floating over content */
  .tabs { position: static; grid-column: 2; max-width: 100%; margin: 32px 0 0; box-shadow: none; }
  section { scroll-margin-top: 32px; }
  main, footer { grid-column: 2; }
  .home footer { text-align: left; }

  /* Tiles: cover on the left, text on the right */
  .tile { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .tile .tile-cover { height: auto; min-height: 180px; }

  /* --- Project pages use the same wide frame as the home page --- */
  .project-page .project-bar, .project-page main, .project-page footer { max-width: 1360px; padding-left: 40px; padding-right: 40px; }
  .project-page main { padding-top: 32px; }
  .project-list .tile-cover { min-height: 260px; }
  .project-list .tile-body { display: flex; flex-direction: column; justify-content: center; padding: 32px 40px; }
  /* Single project: cover and text side by side */
  .project-page article.panel:not(.tile) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .project-cover { height: auto; min-height: 420px; }
  .project-body { padding: 40px; }
}


/* ==========================================================================
   13. Reduced motion: turn off all animations for people who ask for it
   ========================================================================== */

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