/* Ly v2 — tokens do design system (Identidade/03-Design/tokens.md) */
:root {
  --bg: #f2f1ee;
  --surface: #ffffff;
  --title: #1a1614;
  --text: #4a4541;
  --muted: #6e6862;
  --border: #e4e1dc;
  --accent: #2447c6;
  --accent-soft: #e4e9fa;
  --on-accent: #ffffff;

  --success: #2d7b4b;  --success-soft: #dce3db;
  --warning: #865c0a;  --warning-soft: #e7dfd2;
  --neutral-soft: #f7f6f4;

  --cta-bg: #1a1614;
  --cta-text: #f5f2ee;
  --cta-btn-bg: #ffffff;
  --cta-btn-text: #1a1614;

  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --logo: "Newsreader", Georgia, serif;

  --radius-card: 20px;
  --radius-pill: 999px;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f0d0c;
  --surface: #181513;
  --title: #f5f2ee;
  --text: #cfc8c0;
  --muted: #9c948b;
  --border: #2a2623;
  --accent: #7d9bff;
  --accent-soft: #1a2447;
  --on-accent: #0f0d0c;

  --success: #65c588;  --success-soft: #1c261e;
  --warning: #e2b560;  --warning-soft: #2d2518;
  --neutral-soft: #201c19;

  --cta-bg: #181513;
  --cta-text: #f5f2ee;
  --cta-btn-bg: #f5f2ee;
  --cta-btn-text: #1a1614;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--on-accent); }

a { color: inherit; }

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1, h2, h3 { color: var(--title); font-weight: 600; letter-spacing: -0.03em; line-height: 1.25; margin: 0; }

main, .nav-wrap, .footer-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Transição suave ao trocar de tema (a classe só existe durante a troca) */
html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .4s ease, color .4s ease, border-color .4s ease, fill .4s ease, stroke .4s ease, opacity .4s ease !important;
}

/* ---------- Logo "Ly." ---------- */

.logo {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  text-decoration: none;
  line-height: 1;
}
.logo-ly {
  display: block;
  width: 26px;
  height: 27px;
  background: var(--title);
  -webkit-mask: url("assets/logo-ly.png") center / contain no-repeat;
          mask: url("assets/logo-ly.png") center / contain no-repeat;
}
.logo::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-bottom: 3px;
  border-radius: 50%;
  background: var(--accent);
}
.logo.lg .logo-ly { width: 34px; height: 36px; }
.logo.lg::after { width: 8px; height: 8px; margin-bottom: 4px; }

/* ---------- Navbar em pílula ---------- */

.nav-wrap { position: sticky; top: 14px; z-index: 10; padding-top: 14px; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 8px 8px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.nav-links { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 28px); }
.nav-links a:not(.btn) { text-decoration: none; font-size: 14px; color: var(--text); transition: color .2s; }
.nav-links a:not(.btn):hover { color: var(--title); }

.theme-toggle {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text);
  transition: background .2s, color .2s;
}
.theme-toggle:hover { background: var(--neutral-soft); color: var(--title); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }

/* ---------- Botões ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font: 500 14px/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: opacity .2s, background .2s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { opacity: .9; }
.btn-secondary { border-color: var(--title); color: var(--title); background: transparent; }
.btn-secondary:hover { background: var(--surface); }
.btn.lg { padding: 14px 26px; font-size: 15px; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Badge / eyebrow / status ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  line-height: 1.5;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.neutral { background: var(--neutral-soft); color: var(--title); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }

/* ---------- Abertura ---------- */

.intro {
  text-align: center;
  padding-top: clamp(56px, 10vh, 110px);
  padding-bottom: clamp(48px, 8vh, 88px);
}

.intro h1 {
  font-size: clamp(38px, 6.6vw, 64px);
  line-height: 1.08;
  max-width: 17ch;
  margin: 24px auto 0;
}
.intro h1 em { font-style: normal; color: var(--accent); }

.intro-body { max-width: 54ch; margin: 24px auto 0; }
.intro-body p { margin: 0 0 12px; }
.intro-body .aside { color: var(--muted); font-size: 15px; }

.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }

/* ---------- Agora (faixa de destaque) ---------- */

.now {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 24px;
  padding: 28px clamp(20px, 3vw, 36px);
  background: var(--accent-soft);
  border-radius: var(--radius-card);
  font-size: 15.5px;
}

.now .label {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: start;
  padding-top: 3px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}
.now .label::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .3; } }

.now ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.now li span { color: var(--muted); }
.now cite { font-style: italic; }

/* ---------- Seções ---------- */

.work, .about, .notes { padding-top: clamp(72px, 12vh, 128px); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin-bottom: 32px;
}
.section-head h2 { font-size: clamp(30px, 4vw, 40px); line-height: 1.15; }
.section-head p { margin: 0; color: var(--muted); max-width: 44ch; }

/* ---------- Cards de projeto ---------- */

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.card h3 { font-size: 22px; line-height: 1.25; }
.card > p { margin: 0; font-size: 15px; }

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

.arrow {
  width: 18px; height: 18px;
  color: var(--muted);
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
  transition: color .2s, transform .2s;
}
a.card { text-decoration: none; transition: border-color .2s; }
a.card:hover { border-color: var(--muted); }
a.card:hover .arrow, .card .arrow-link:hover .arrow { color: var(--accent); transform: translate(2px, -2px); }
.arrow-link { display: inline-flex; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.tags li {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font: 400 12.5px/1.6 var(--mono);
  color: var(--text);
}

.more { margin-top: auto; padding-top: 4px; }
.more summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "+"; font-family: var(--mono); transition: transform .2s; }
.more[open] summary::after { content: "−"; }

.facts { margin: 16px 0 0; display: grid; gap: 8px; font-size: 14.5px; }
.facts div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.facts dt { font: 400 12.5px/1.8 var(--mono); color: var(--muted); }
.facts dd { margin: 0; }

.lesson { margin: 14px 0 0; padding: 12px 14px; background: var(--accent-soft); border-radius: 12px; font-size: 14.5px; color: var(--title); }
.lesson strong { color: var(--accent); font-weight: 600; margin-right: 4px; }

.link { display: inline-block; margin-top: 14px; font-size: 14px; font-weight: 500; color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 4px; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--neutral-soft);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 6px;
}

/* ---------- Paginação ---------- */

.pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 28px; }
.pager[hidden], .card[hidden] { display: none; }
.pager button {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  min-width: 40px;
  height: 40px;
  padding: 0 14px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--title);
  font: 500 14px/1 var(--font);
  transition: border-color .2s, background .2s;
}
.pager button:hover:not(:disabled):not([aria-current]) { border-color: var(--muted); }
.pager button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pager button:disabled { opacity: .4; cursor: default; }

/* ---------- Sobre ---------- */

.about-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }

.about-text p { margin: 0 0 18px; max-width: 62ch; }
.about-text .lead { font-size: clamp(22px, 2.6vw, 28px); line-height: 1.35; letter-spacing: -0.02em; font-weight: 500; color: var(--title); margin-bottom: 28px; }

.about-side { padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.about-side h3 { font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin: 0 0 12px; }

.timeline { list-style: none; margin: 0 0 32px; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  column-gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  font-size: 15px;
}
.timeline li:first-child { border-top: 0; padding-top: 4px; }
.timeline .yr { grid-row: span 2; font: 400 12.5px/1.9 var(--mono); color: var(--muted); }
.timeline .role { color: var(--title); font-weight: 500; }
.timeline .org { color: var(--muted); font-size: 14px; }

.tools { margin: 0; font-size: 15px; }

/* ---------- Notas ---------- */

.note-card { align-self: stretch; gap: 28px; justify-content: space-between; min-height: 150px; }
.note-card h3 { font-size: 19px; line-height: 1.35; letter-spacing: -0.02em; }
.note-card time { font: 400 12.5px/1.4 var(--mono); color: var(--muted); }

/* ---------- Contato (CTA escuro) ---------- */

.cta {
  margin: clamp(80px, 13vh, 140px) auto 0;
  max-width: var(--wrap);
  padding: 0 var(--gutter);
}
.cta-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 28px 40px;
  padding: clamp(28px, 5vw, 56px);
  background: var(--cta-bg);
  color: var(--cta-text);
  border: 1px solid var(--border);
  border-radius: 28px;
}
.cta-box h2 { color: var(--cta-text); font-size: clamp(28px, 4.4vw, 40px); line-height: 1.15; }
.cta-box p { margin: 10px 0 0; max-width: 46ch; color: var(--cta-text); opacity: .72; }
.cta-box .btn { background: var(--cta-btn-bg); color: var(--cta-btn-text); }
.cta-box .btn:hover { opacity: .9; }
.cta-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.cta-actions .btn { font-size: 15px; padding: 12px 24px; }

/* ---------- Rodapé ---------- */

.site-footer { margin-top: clamp(64px, 10vh, 96px); border-top: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 20px 40px; padding-top: 28px; padding-bottom: 36px; font-size: 13px; color: var(--muted); }
.signature { display: flex; align-items: center; gap: 12px; }
.signature b { display: block; color: var(--title); font-weight: 500; font-size: 14px; line-height: 1.3; }
.signature span { display: block; line-height: 1.3; }
.footer-meta { text-align: right; }
.footer-meta p { margin: 0; }
.footer-meta .site { color: var(--title); font-weight: 600; }
.social { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 20px; }
.social a { color: var(--title); text-decoration: none; }
.social a:hover { color: var(--accent); }

/* ---------- Entrada suave ---------- */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

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

/* ---------- Telas menores ---------- */

@media (max-width: 900px) {
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .now { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .footer-meta { text-align: left; }
  .social { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .grid, .grid.three { grid-template-columns: minmax(0, 1fr); }
  .nav { padding-left: 18px; }
  .nav-links a:not(.btn) { display: none; }
  .hero-actions .btn { flex: 1 1 100%; }
  .facts div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .cta-actions, .cta-actions .btn { width: 100%; }
}

/* ---------- Página de nota ---------- */

.article { max-width: 680px; margin: 0 auto; padding: clamp(48px, 9vh, 96px) 0 24px; }

.article h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.1; margin-top: 20px; }

.article .dek {
  font-size: clamp(18px, 2vw, 20px);
  line-height: 1.55;
  color: var(--muted);
  margin: 20px 0 0;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.article-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; font: 400 13px/1.5 var(--mono); color: var(--muted); }
.article-meta time { color: var(--muted); }

.article-body { padding-top: 32px; font-size: 17.5px; line-height: 1.75; }
.article-body p { margin: 0 0 22px; }
.article-body h2 { font-size: clamp(22px, 2.6vw, 27px); margin: 44px 0 14px; }
.article-body ol, .article-body ul { margin: 0 0 22px; padding-left: 22px; }
.article-body li { margin-bottom: 10px; }
.article-body li::marker { color: var(--accent); }
.article-body strong { font-weight: 600; color: var(--title); }

.article-body blockquote {
  margin: 32px 0;
  padding: 18px 22px;
  background: var(--accent-soft);
  border-radius: 16px;
  font-size: 19px;
  line-height: 1.55;
  color: var(--title);
}

.article-end {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  font-size: 14px;
}
.article-end a { text-decoration: none; color: var(--muted); }
.article-end a:hover { color: var(--accent); }

@media (max-width: 600px) {
  .article-body { font-size: 17px; }
}
