/* ============================================
   Alvaro Votan — Personal Site
   ============================================ */

@font-face {
  font-family: 'Greybeard';
  src: url('/fonts/Greybeard-16px.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Greybeard';
  src: url('/fonts/Greybeard-16px-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Greybeard';
  src: url('/fonts/Greybeard-16px-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Departure';
  src: url('/fonts/DepartureMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --- Reset --- */

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

/* --- Tokens — Light (default) --- */

:root {
  --font-serif: 'Greybeard', 'Courier New', monospace;
  --font-sans:  'Greybeard', 'Courier New', monospace;
  --greybeard-body-size: 16px;
  --greybeard-body-line: 32px;
  --greybeard-ui-size: 16px;
  --greybeard-ui-line: 16px;
  --greybeard-title-size: 32px;
  --greybeard-title-line: 32px;
  --greybeard-measure: 60ch;
  --top-toggle-offset: max(1rem, env(safe-area-inset-top));
  --mobile-nav-offset: max(1rem, env(safe-area-inset-bottom));
--mobile-nav-height: 6.5rem;
  --mobile-footer-height: 7.75rem;

  --bg:         #D9D9D9;
  --bg-hover:   #c4c4c4;
  --text-900:   #111111;
  --text-800:   #111111;
  --text-500:   #58585C;
  --text-300:   #999999;
  --text-accessible-muted: #58585C;
  --border:     #c4c4c4;
  --cv-btn-bg:  #D3D3D3;
  --cv-btn-hover:#D3D3D3;
  --img-reveal-mask: rgba(217, 217, 217, 0.94);
  --img-reveal-grid-line: rgba(0, 0, 0, 0.16);
}

/* --- Tokens — Dark --- */

[data-theme="dark"] {
  --bg:         #131211;
  --bg-hover:   #1A1918;
  --text-900:   #f0ece6;
  --text-800:   #A0A0A0;
  --text-500:   #DEDEDE;
  --text-300:   #48443f;
  --text-accessible-muted: #807C74;
  --border:     #2c2926;
  --cv-btn-bg:  #1A1918;
  --cv-btn-hover:#22201E;
  --img-reveal-mask: rgba(19, 18, 17, 0.92);
  --img-reveal-grid-line: rgba(240, 236, 230, 0.14);
}

/* --- Now Playing widget --- */

.now-playing {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
}

.now-playing.is-visible {
  display: flex;
}

.now-playing svg {
  width: 0.72rem;
  height: 0.72rem;
  stroke: currentColor;
  stroke-width: 2.5;
  color: #40C47C;
  flex-shrink: 0;
}

.now-playing-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.now-playing-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  text-decoration: none;
  color: inherit;
}

.now-playing-arrow {
  display: none;
  align-items: center;
  color: var(--text-500);
  flex-shrink: 0;
}

.now-playing-arrow svg {
  width: 0.85em;
  height: 0.85em;
  stroke: currentColor;
  stroke-width: 2;
  color: inherit;
}

.now-playing-link:hover .now-playing-arrow {
  display: inline-flex;
}

.now-playing-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-500);
  line-height: 1;
}

.now-playing-track {
  font-size: 0.72rem;
  color: var(--text-800);
  line-height: 1.3;
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-track.is-scrolling {
  text-overflow: clip;
}

.now-playing-track.is-scrolling .np-scroll-inner {
  display: inline-block;
  animation: npScroll var(--np-scroll-duration, 8s) linear infinite;
  padding-right: 3rem;
}

@keyframes npScroll {
  0%, 10%  { transform: translateX(0); }
  45%, 55% { transform: translateX(var(--np-scroll-dist)); }
  90%, 100% { transform: translateX(0); }
}

/* --- Now Playing album tooltip --- */

.now-playing.has-album {
  position: relative;
  cursor: default;
}

.now-playing-tooltip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.6rem);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.now-playing-tooltip img {
  display: block;
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  transition: border-color 0.25s ease;
}

.now-playing.has-album:hover .now-playing-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 767px) {
  .now-playing-track {
    max-width: 11rem;
  }
}

/* --- Image reveal grid overlay --- */

.white-grid-overlay,
.black-grid-overlay {
  position: fixed;
  pointer-events: none;
  z-index: 900;
  opacity: 0;
  transition: opacity 0.1s ease-out;
}

.white-grid-overlay {
  background-color: #f5f5f5;
}

.black-grid-overlay {
  background-color: #1F1F20;
}

/* --- Base --- */

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-serif);
  color: var(--text-800);
  background-color: var(--bg);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: auto;
  font-variant-ligatures: none;
  font-kerning: none;
  font-feature-settings: "liga" 0, "calt" 0, "kern" 0;
  font-synthesis: none;
  text-rendering: optimizeSpeed;
  letter-spacing: 0;
  line-height: var(--greybeard-body-line);
  transition: background-color 0.25s ease, color 0.25s ease;
}

button,
input,
textarea,
select {
  font-family: var(--font-sans);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: auto;
  font-variant-ligatures: none;
  font-kerning: none;
  font-feature-settings: "liga" 0, "calt" 0, "kern" 0;
  font-synthesis: none;
  text-rendering: optimizeSpeed;
}

/* --- Layout --- */

.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 5rem 1.5rem 1.5rem;
}

.sidebar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.content {
  flex: 1;
  width: 100%;
  max-width: 42rem;
}

/* --- Avatar row (avatar + now playing) --- */

.avatar-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 0 0 1.4rem 0.35rem;
}

.hero-avatar {
  position: relative;
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.hero-avatar:hover {
  cursor: none;
}

.hero-avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transition: opacity 0.25s ease;
}

.hero-avatar-dark {
  opacity: 0;
  pointer-events: none;
}

[data-theme="dark"] .hero-avatar-light {
  opacity: 0;
}

[data-theme="dark"] .hero-avatar-dark {
  opacity: 1;
}

/* --- Avatar fullscreen effects --- */

.avatar-fx-overlay {
  position: fixed;
  inset: 0;
  z-index: 15000;
  background: #131211;
  opacity: 0;
  pointer-events: none;
  touch-action: manipulation;
  transition: opacity 0.18s ease;
}

.avatar-fx-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.avatar-fx-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

body.avatar-fx-open {
  overflow: hidden;
  cursor: none;
}

body.avatar-fx-open * {
  cursor: none !important;
}

.avatar-cursor-hint {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2147483647;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.12s ease;
  color: #f0ece6;
  font-family: 'Departure', 'Courier New', monospace;
  font-size: 12px;
  line-height: 12px;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.65);
}

.avatar-cursor-hint.is-visible {
  opacity: 1;
}

@media (min-width: 768px) {
  .site {
    flex-direction: row;
    padding: 5.5rem 6rem 4rem;
    gap: 0;
    align-items: flex-start;
    min-height: 100vh;
    max-width: 72rem;
    margin: 0 auto;
    justify-content: center;
  }

  .sidebar {
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    width: 10.5rem;
    flex-shrink: 0;
    align-self: flex-start;
    position: sticky;
    top: 4rem;
    margin-bottom: 0;
    min-height: 8rem;
    gap: 2rem;
  }

  .content {
    border-left: 1px solid var(--border);
    padding-left: 4rem;
    margin-left: 4rem;
    transition: border-color 0.25s ease;
  }

  .site-footer {
    display: none;
  }
}

/* --- Navigation --- */

nav {
  position: static;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.5rem;
  width: 100%;
}

.nav-list li {
  flex: 1 1 0;
}

.nav-list a {
  font-family: 'Departure', 'Courier New', monospace;
  font-size: 0.72rem;
  color: var(--text-500);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  text-align: center;
  padding: 0.35rem 0.25rem;
  border-radius: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-list a:hover {
  color: var(--text-800);
}

.nav-list a.active {
  color: var(--text-900);
  font-weight: 400;
}

/* --- Sidebar bottom cluster --- */

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  width: 100%;
  position: static;
  padding: 0;
  border-top: 0;
  background: none;
  margin-top: auto;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  width: 100%;
}

.sidebar-links a {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-500);
  text-decoration: none;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
}

.sidebar-links a:hover {
  color: var(--text-900);
}

.sidebar-links .sidebar-cv-button {
  margin-top: 0.35rem;
  padding: 0.38rem 0.7rem;
  border: 1px solid var(--cv-btn-bg);
  border-radius: 999px;
  color: var(--text-800);
  background-color: var(--cv-btn-bg);
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
}

.sidebar-links .sidebar-cv-button:hover {
  color: var(--text-900);
  border-color: var(--cv-btn-hover);
  background-color: var(--cv-btn-hover);
  transform: translateY(-1px);
}

/* --- Dark mode toggle --- */

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-500);
  padding: 0;
  line-height: 1;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 1.25rem;
  align-self: flex-end;
  vertical-align: middle;
}

.theme-toggle:hover {
  color: var(--text-900);
}

/* --- Desktop sidebar --- */

@media (min-width: 768px) {
  .sidebar nav {
    display: block;
    position: static;
    padding: 0;
  }

  .nav-list {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    width: auto;
  }

  .nav-list li {
    flex: initial;
  }

  .nav-list a {
    font-size: 1rem;
    text-transform: none;
    letter-spacing: 0;
    text-align: right;
    padding: 0;
  }
}

/* --- Mobile bottom nav bar --- */

@media (max-width: 767px) {
  .site {
    padding: calc(env(safe-area-inset-top) + 4.2rem) 1.25rem calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    touch-action: manipulation;
  }

  .avatar-row {
    margin: 0 0 1.15rem;
  }

  /* Collapse sidebar wrapper so it takes no space, but children can still be fixed */
  .sidebar {
    display: block;
    width: 0;
    height: 0;
    overflow: visible;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
  }

  /* Fixed bottom navigation bar */
  .sidebar nav {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.75rem 1.2rem max(0.85rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background-color: var(--bg);
    z-index: 1200;
    transition: background-color 0.25s ease, border-color 0.25s ease;
    touch-action: manipulation;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
    gap: 0;
    width: 100%;
    overflow: visible;
  }

  .nav-list li {
    min-width: 0;
    flex: initial;
  }

  .nav-list a {
    font-size: 0.78rem;
    letter-spacing: 0.09em;
    padding: 0.25rem 0;
    white-space: nowrap;
    text-align: center;
    text-transform: none;
  }

  /* Hide sidebar-bottom entirely on mobile */
  .sidebar .sidebar-bottom {
    display: none !important;
  }

  .sidebar > .theme-toggle {
    display: none !important;
  }

  /* Dedicated top navbar for mobile theme toggle */
  .mobile-top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1250;
    height: calc(env(safe-area-inset-top) + 3.2rem);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 1.25rem 0.65rem;
    background-color: var(--bg);
    transition: background-color 0.25s ease, border-color 0.25s ease;
  }

  .mobile-top-nav .theme-toggle {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    z-index: auto !important;
    width: 1.25rem;
    height: 1.25rem;
    font-size: 1rem;
    color: var(--text-500);
  }

  .site-footer {
    display: none;
  }

  #maymay-cat {
    bottom: 3.5rem !important;
  }

  #maymay-food {
    bottom: calc(3.5rem + 140px) !important;
  }

  .maymay-hint {
    margin-bottom: 0.45rem;
  }

  .about-mobile-links {
    margin-top: 0;
  }

  .about-mobile-controls {
    display: none;
    margin-top: 0.4rem;
  }

  .about-inline-theme-toggle {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    z-index: auto;
  }
}

/* --- Typography --- */

h1 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--text-900);
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-bottom: 1.75rem;
}

.title-row {
  display: block;
}

p {
  text-align: left;
  hyphens: none;
  -webkit-hyphens: none;
  margin-bottom: 1rem;
  color: var(--text-800);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--text-800);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--text-300);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  color: var(--text-900);
  text-decoration-color: var(--text-900);
}

/* --- About --- */

.about-section {
  margin-bottom: 0;
}

.about-section p {
  line-height: 1.85;
}

.about-mobile-links {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.about-mobile-links a {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-500);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.about-mobile-controls {
  display: none;
}

.about-mobile-links .mobile-cv-button {
  border: 1px solid var(--cv-btn-bg);
  background-color: var(--cv-btn-bg);
  border-radius: 999px;
  color: var(--text-800);
  padding: 0.28rem 0.52rem;
  line-height: 1;
}

.about-mobile-links .mobile-cv-button:hover {
  border-color: var(--cv-btn-hover);
  background-color: var(--cv-btn-hover);
}

@media (min-width: 768px) {
  .about-mobile-links {
    display: none;
  }
}

.about-see-more {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-500);
  font-style: normal;
  margin-top: 0.25rem;
  margin-bottom: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: color 0.2s ease;
}

.about-section .about-see-more {
  font-size: 0.82rem;
}

.about-see-more:hover {
  color: var(--text-800);
}

.about-see-more--inline {
  margin-top: 0.5rem;
}

.about-toggle-icon {
  display: inline-flex;
  align-items: center;
  transition: transform 0.25s ease;
}

.about-toggle-icon svg {
  width: 0.75rem;
  height: 0.75rem;
  stroke-width: 2.5;
}

.about-see-more[aria-expanded="true"] .about-toggle-icon {
  transform: rotate(180deg);
}

.about-expanded,
.about-now {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

.about-expanded.is-open,
.about-now.is-open {
  max-height: 2000px;
  opacity: 1;
  overflow: visible;
}

.about-expanded {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.about-expanded p {
  line-height: 1.85;
  color: var(--text-800);
  margin-bottom: 0.75rem;
}

.about-now {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.about-now-section {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.about-now-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-accessible-muted);
}

.about-now-section p {
  font-size: 0.85rem;
  line-height: 1.75;
  color: var(--text-800);
  margin: 0;
}

.about-section em {
  font-style: normal;
}

.about-name-trigger {
  position: relative;
  display: inline;
}

.about-name-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--bg-hover);
  border-radius: 4px;
  padding: 0 0.3rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.about-name-badge svg {
  width: 0.75rem;
  height: 0.75rem;
  stroke-width: 2;
  color: var(--text-500);
  flex-shrink: 0;
}

.about-name-badge:hover {
  background: var(--border);
}

.about-name-photo {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}

.about-name-photo img {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.about-name-trigger:hover .about-name-photo,
.about-name-trigger.is-tapped .about-name-photo {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}

.maymay-hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #58585C;
  font-style: normal;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

[data-theme="dark"] .maymay-hint {
  color: #A0A0A0;
}

.clients {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-500);
  line-height: 1.7;
  margin-top: 1.25rem;
  text-align: left;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  color: var(--text-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

.hero-status-badge {
  display: none;
}

@media (max-width: 767px) {
  .title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
  }

  .title-row h1 {
    margin-bottom: 0;
  }

  .hero-status-badge {
    display: inline-flex;
    flex-shrink: 0;
  }

  .about-section > p:first-child {
    font-size: 0.96rem;
    line-height: 1.75;
  }
}

@media (min-width: 768px) {
  .sidebar-bottom .status-badge {
    display: inline-flex;
  }

  .hero-status-badge {
    display: none;
  }
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #40C47C;
  flex-shrink: 0;
}

/* --- Article List (thoughts-style with leader line) --- */

.article-list {
  list-style: none;
}

.article-list li {
  transition: border-color 0.25s ease;
}

.article-list a {
  display: flex;
  align-items: baseline;
  gap: 0;
  padding: 0.75rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease, color 0.2s ease;
}

.article-list a:hover {
  background-color: var(--bg-hover);
}

.article-list a:hover .article-title {
  color: var(--text-900);
}

.article-list a:hover .article-date {
  color: var(--text-800);
}

.article-hover-arrow {
  display: none;
  align-items: center;
  margin-left: 0.35em;
  color: var(--text-500);
}

.article-hover-arrow svg {
  width: 0.85em;
  height: 0.85em;
  stroke: currentColor;
  stroke-width: 2;
}

.article-list a:hover .article-hover-arrow {
  display: inline-flex;
}

.article-title {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  color: var(--text-800);
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.article-leader {
  flex: 1;
  min-width: 1rem;
  height: 0;
  border-bottom: 1px solid var(--border);
  margin: 0 0.6rem;
  position: relative;
  top: -0.35em;
  transition: border-color 0.25s ease;
}

.article-date {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-500);
  flex-shrink: 0;
  transition: color 0.2s ease;
}

@media (max-width: 767px) {
  .article-list .article-date {
    color: transparent !important;
    font-size: 0 !important;
    line-height: 1 !important;
    white-space: nowrap;
  }

  .article-list .article-date::before {
    content: attr(data-mobile);
    color: var(--text-500);
    font-size: 0.8rem;
  }

  .artigos-content .article-list .article-title {
    font-size: 0.84rem;
  }
}

/* --- Project List --- */

.project-list {
  list-style: none;
}

.project-item {
  padding: 1.1rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 4px;
  transition: background-color 0.15s ease, border-color 0.25s ease;
}

.project-item:hover {
  background-color: var(--bg-hover);
}

.project-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.project-name {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-800);
}

.project-link,
.project-link * {
  text-decoration: none;
  color: inherit;
}

.project-link {
  display: block;
}

.project-link:hover .project-name {
  color: var(--text-900);
}

.project-badge {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  color: var(--text-500);
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: border-color 0.25s ease;
}

.project-desc {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--text-500);
  text-align: left;
  line-height: 1.65;
}

/* --- Article detail --- */

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-500);
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 0.2s ease;
}

.article-back:hover {
  color: var(--text-900);
}

.article-back svg {
  width: 0.85rem;
  height: 0.85rem;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}

.article-meta {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-500);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.article-body {
  margin-top: 2rem;
}

.article-body p {
  line-height: 1.9;
  margin-bottom: 1.4rem;
}

.article-body p:last-child {
  margin-bottom: 0;
}

.article-body h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-900);
  margin-top: 2.5rem;
  margin-bottom: 0.4rem;
}

.article-body h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-900);
  margin-top: 3rem;
  margin-bottom: 0.75rem;
  text-transform: none;
  letter-spacing: -0.01em;
}

.article-body em {
  font-style: italic;
  color: var(--text-800);
}

.article-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-800);
  font-style: italic;
  transition: border-color 0.25s ease;
}

.article-body ul {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.article-body ul li {
  padding: 0.35rem 0;
  padding-left: 1rem;
  position: relative;
  color: var(--text-800);
  line-height: 1.7;
}

.article-body ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--text-300);
}

.article-body strong {
  font-weight: 500;
  color: var(--text-900);
}

.article-body figure {
  margin: 2rem 0;
}

.article-body figure img {
  display: block;
  width: 100%;
  border-radius: 8px;
}

.article-body figcaption {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-500);
  line-height: 1.5;
  font-style: italic;
}

.article-body .video-embed {
  margin: 2rem 0;
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
}

.article-body .video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
}

/* --- Project images --- */

.project-images {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-images img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.25s ease;
}

.project-images img:hover {
  border-color: var(--text-300);
}

/* --- Album entries (blog music posts) --- */

.album-entry {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.album-entry h3 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-900);
  margin-bottom: 0.6rem;
  margin-top: 0;
}

.album-entry p {
  font-size: 0.9rem;
  color: var(--text-500);
  margin-bottom: 1rem;
  text-align: left;
}

.album-embeds {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.album-embeds iframe {
  width: 100%;
  height: 80px;
  border: none;
  border-radius: 6px;
  display: block;
}

.album-section-title {
  font-size: 0.7rem;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-accessible-muted);
  margin-top: 3.5rem;
  margin-bottom: 0;
}

/* --- Arrow links --- */

.link-arrow {
  font-style: normal;
  margin-left: 0.2em;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  transition: transform 0.15s ease;
}

.link-arrow svg {
  width: 0.85em;
  height: 0.85em;
  stroke: currentColor;
  stroke-width: 2;
}

a:hover .link-arrow {
  transform: translate(2px, -2px);
}

/* --- Theme toggle icon --- */

.theme-toggle svg {
  width: 1rem;
  height: 1rem;
  display: block;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2;
}

/* --- Footer --- */

.site-footer {
  margin-top: 4rem;
  padding-top: 1.75rem;
  transition: border-color 0.25s ease;
}

.footer-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-500);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-900);
}

/* --- Email copy tooltip --- */

.email-copy {
  position: relative;
  cursor: pointer;
}

.email-copy-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text-900);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.55rem;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.email-copy:hover .email-copy-tip,
.email-copy:focus .email-copy-tip {
  opacity: 1;
}

/* --- Fade-in --- */

@keyframes fadeIn {
  from { transform: translateY(5px); }
  to   { transform: translateY(0);   }
}
.content > * {
  animation: fadeIn 0.35s ease-out;
}

/* --- Visitor count --- */

.visitor-count {
  position: fixed;
  bottom: 0.8rem;
  right: 1rem;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  color: #58585C;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  z-index: 10;
  opacity: 1;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .visitor-count {
  color: #DEDEDE;
}

.visitor-count svg {
  width: 11px;
  height: 11px;
}

/* --- Censored word effect --- */

.censored {
  display: inline-block;
  position: relative;
  vertical-align: middle;
  cursor: help;
  touch-action: manipulation;
}

.censored canvas {
  display: inline-block;
  height: 0.85em;
  width: 4.5em;
  vertical-align: middle;
  image-rendering: pixelated;
  border-radius: 2px;
  opacity: 0.85;
}

.censored-tip {
  display: none !important;
}

.censor-tooltip {
  position: fixed;
  z-index: 2147482500;
  width: max-content;
  max-width: min(230px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 6px;
  background: #363636;
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.26);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.28;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.censor-tooltip.is-open {
  opacity: 1;
  transform: translateY(0);
}

.censor-tooltip::after {
  content: "";
  position: absolute;
  left: var(--censor-arrow-x, 50%);
  bottom: -6px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #363636;
}

.censor-tooltip.is-below::after {
  top: -6px;
  bottom: auto;
  border-top: 0;
  border-bottom: 6px solid #363636;
}

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

/* Duplicate mobile nav rules removed - consolidated above */

/* --- Greybeard typography --- */

h1,
.title-row h1,
.article-header h1,
.article-body h2,
.article-body h3,
.project-name,
.about-see-more,
.article-back,
.album-entry h3 {
  font-family: var(--font-serif);
  letter-spacing: 0;
}

h1,
.title-row h1,
.article-header h1 {
  font-size: var(--greybeard-title-size);
  line-height: var(--greybeard-title-line);
  margin-bottom: 32px;
}

p,
li,
figcaption,
blockquote,
code,
.about-section p,
.about-expanded p,
.about-now-section p,
.article-body p,
.article-body ul li,
.project-desc,
.album-entry p {
  font-family: var(--font-serif);
  font-size: var(--greybeard-body-size);
  line-height: var(--greybeard-body-line);
  letter-spacing: 0;
}

.about-section p,
.about-expanded p,
.about-now-section p,
.article-body p,
.article-body ul li,
.project-desc,
.album-entry p,
.article-body blockquote {
  max-width: var(--greybeard-measure);
}

.nav-list a,
.sidebar-links a,
.about-mobile-links a,
.mobile-top-nav .mobile-top-cv,
.footer-links a,
.status-badge,
.about-now-label,
.now-playing,
.now-playing-label,
.now-playing-track,
.maymay-hint,
.clients,
.article-title,
.article-date,
.project-badge,
.article-meta,
.article-back,
.about-see-more,
.email-copy-tip,
.visitor-count,
.censored-tip {
  font-family: var(--font-sans);
  font-size: var(--greybeard-ui-size);
  line-height: var(--greybeard-ui-line);
  letter-spacing: 0;
}

.about-now-label,
.article-body strong,
.album-entry h3 {
  font-weight: 700;
}

.project-name,
.article-title,
.article-date,
.project-badge,
.article-meta,
.article-back,
.about-now-label,
.now-playing-label,
.now-playing-track {
  line-height: var(--greybeard-ui-line);
}

.project-name,
.article-title,
.article-body h3,
.album-entry h3 {
  font-size: var(--greybeard-ui-size);
}

.article-body h2 {
  font-size: var(--greybeard-title-size);
  line-height: var(--greybeard-title-line);
}

.article-body blockquote {
  font-family: var(--font-serif);
  font-size: var(--greybeard-body-size);
  line-height: var(--greybeard-body-line);
  letter-spacing: 0;
}

@media (max-width: 767px) {
  :root {
    --greybeard-body-size: 14px;
    --greybeard-body-line: 28px;
    --greybeard-ui-size: 13px;
    --greybeard-ui-line: 13px;
    --greybeard-title-size: 26px;
    --greybeard-title-line: 26px;
    --greybeard-measure: 100%;
  }

  .site {
    padding: calc(env(safe-area-inset-top) + 4.2rem) 1.25rem calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .content {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  body {
    overflow-x: hidden;
  }

  .mobile-top-nav {
    height: calc(env(safe-area-inset-top) + 3.2rem);
    padding: 0 1.25rem 0.65rem;
  }

  .avatar-row {
    align-items: center;
    gap: 1rem;
    margin: 0 0 1.15rem;
  }

  .hero-avatar {
    width: 72px;
    height: 72px;
  }

  .now-playing {
    gap: 0.35rem;
    padding-top: 0;
  }

  .now-playing svg {
    width: 0.65rem;
    height: 0.65rem;
  }

  .now-playing-text,
  .now-playing-link {
    min-width: 0;
  }

  .now-playing-link {
    max-width: calc(100vw - 7.5rem);
  }

  .now-playing-track {
    max-width: 11.25rem;
  }

  .title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .title-row h1 {
    margin-bottom: 0;
  }

  .hero-status-badge {
    display: inline-flex;
    flex-shrink: 0;
  }

  .about-section > p:first-child,
  .about-section p,
  .about-expanded p,
  .about-now-section p,
  .article-body p,
  .article-body ul li,
  .article-body blockquote,
  .project-desc,
  .album-entry p {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .about-section > p:first-child {
    margin-bottom: 0.9rem;
  }

  .about-section .about-see-more {
    font-size: 0.75rem;
    margin-top: 0;
  }

  .maymay-hint {
    margin-top: 0.9rem;
    line-height: 24px;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
  }

  .about-mobile-links {
    gap: 0.7rem;
    row-gap: 0.6rem;
    margin-top: 0.8rem;
  }

  .about-mobile-links .mobile-cv-button {
    padding: 0.25rem 0.48rem;
  }

  .sidebar nav {
    padding: 0.65rem 1.25rem max(0.75rem, env(safe-area-inset-bottom));
  }

  .nav-list a {
    font-size: 12px;
    line-height: 12px;
    letter-spacing: 0;
    padding: 0.35rem 0;
  }

  .article-list a {
    width: 100%;
    align-items: center;
    gap: 0.35rem;
    padding: 0.62rem 0;
    margin: 0;
  }

  .article-title {
    min-width: 0;
    flex: 0 1 auto;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .article-leader {
    min-width: 0.4rem;
    margin: 0 0.2rem;
    top: 0;
    align-self: center;
  }

  .article-list .article-date {
    flex: 0 0 4.25rem;
    width: 4.25rem;
    text-align: right;
  }

  .article-list .article-date::before {
    display: block;
    font-size: 11px;
    line-height: 11px;
    text-align: right;
  }

  .artigos-content .article-list .article-title {
    font-size: 13px;
  }

  .project-item {
    padding: 0.9rem 0;
    margin: 0;
  }

  .project-header {
    gap: 0.45rem;
    margin-bottom: 0.2rem;
  }
}

@media (min-width: 768px) {
  .sidebar,
  .sidebar * {
    text-rendering: auto;
  }

  .nav-list a,
  .status-badge,
  .sidebar-links a,
  .sidebar-links .sidebar-cv-button {
    font-family: 'Departure', 'Courier New', monospace;
    font-weight: 400;
    font-size: 12px;
    line-height: 13px;
    letter-spacing: 0;
  }

  .nav-list {
    gap: 0.52rem;
  }

  .nav-list a,
  .sidebar-links a {
    padding: 0.08rem 0;
  }

  .status-badge,
  .sidebar-links a {
    color: var(--text-800);
  }

  .sidebar-bottom {
    gap: 0.9rem;
  }

  .sidebar-links {
    gap: 0.44rem;
  }

  .sidebar-links .email-copy,
  .sidebar-links a[href*="linkedin.com"] {
    color: var(--text-500);
  }

  .sidebar-links .email-copy:hover,
  .sidebar-links a[href*="linkedin.com"]:hover {
    color: var(--text-500);
  }

  .sidebar-links .sidebar-cv-button {
    margin-top: 0.16rem;
    padding: 0.32rem 0.58rem;
  }

  .maymay-hint {
    font-size: 13px;
    line-height: 20px;
  }

  .project-list,
  .project-item,
  .project-link {
    width: 100%;
  }

  .project-desc {
    max-width: none;
  }
}

::selection { background: #10766D; color: #fff; }

/* --- Contrast hardening for Lighthouse (dark mode) --- */
[data-theme="dark"] .nav-list a,
[data-theme="dark"] .sidebar-links .email-copy,
[data-theme="dark"] .sidebar-links a[href*="linkedin.com"],
[data-theme="dark"] .now-playing-label,
[data-theme="dark"] .about-see-more,
[data-theme="dark"] .maymay-hint,
[data-theme="dark"] .status-badge,
[data-theme="dark"] .visitor-count {
  color: #A0A0A0;
}

[data-theme="dark"] .nav-list a:hover,
[data-theme="dark"] .nav-list a.active,
[data-theme="dark"] .sidebar-links .email-copy:hover,
[data-theme="dark"] .sidebar-links a[href*="linkedin.com"]:hover,
[data-theme="dark"] .about-see-more:hover {
  color: #F0ECE6;
}

[data-theme="dark"] .status-badge {
  color: #F0ECE6;
}
