/* =================================================================
   Luiz Valério Neto — Senior QA Engineer
   Main stylesheet
   ================================================================= */

:root {
  /* Color */
  --paper: #f6eedf;
  --paper-deep: #efe1c8;
  --surface: #fffbf3;
  --ink: #33261c;
  --ink-soft: #6b5a48;
  --rust: #b8511f;
  --rust-dark: #8a3d17;
  --marigold: #d89a2e;
  --marigold-dark: #8a6415;
  --moss: #5c6b47;
  --espresso: #241812;
  --espresso-text: #f1e4ce;
  --line: rgba(51, 38, 28, 0.16);
  --line-light: rgba(241, 228, 206, 0.22);

  /* Type */
  --font-display: "Fraunces", serif;
  --font-body: "Work Sans", sans-serif;

  /* Layout */
  --container-w: 1160px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 40px rgba(36, 24, 18, 0.12);
  --header-h: 76px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body, h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  color: var(--ink);
}

h1 { font-size: clamp(2.6rem, 5.5vw, 4.4rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); letter-spacing: -0.005em; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

p { max-width: 62ch; }
p.wide { max-width: none; }

.text-soft { color: var(--ink-soft); }

/* Focus visibility */
a:focus-visible, button:focus-visible, .filter-tab:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -60px;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 999;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 1rem; }

/* ---------- Layout helpers ---------- */
.container {
  max-width: var(--container-w);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.section {
  padding-block: clamp(3.5rem, 8vw, 6rem);
}
.section--tight { padding-block: clamp(2.5rem, 5vw, 3.5rem); }
.section--alt { background: var(--paper-deep); }
.section--dark { background: var(--espresso); color: var(--espresso-text); }
.section--dark h1, .section--dark h2, .section--dark h3 { color: var(--espresso-text); }
.section--dark .text-soft { color: rgba(241, 228, 206, 0.72); }

.section-head { max-width: 640px; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head p { margin-top: 0.85rem; }

.stack { display: flex; flex-direction: column; gap: 1rem; }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  z-index: 100;
  transition: background-color 0.35s ease, box-shadow 0.35s ease, height 0.3s ease;
}
.site-header.is-scrolled {
  background: rgba(246, 238, 223, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--line);
  height: 64px;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.logo__mark { color: var(--rust); }

.main-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(1.1rem, 2vw, 2rem);
}
.nav-link {
  position: relative;
  padding-block: 0.3rem;
  font-size: 0.98rem;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -2px;
  height: 2px;
  background: var(--rust);
  transition: right 0.25s ease;
}
.nav-link:hover::after, .nav-link.is-active::after { right: 0; }
.nav-link.is-active { color: var(--rust-dark); }

.nav-cta {
  background: var(--rust);
  color: var(--surface) !important;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.25s ease, transform 0.25s ease;
}
.nav-cta::after { display: none; }
.nav-cta:hover { background: var(--rust-dark); transform: translateY(-1px); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
  z-index: 110;
}
.nav-toggle__bar {
  width: 24px; height: 2px;
  background: var(--ink);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
body.nav-open .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle__bar:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .main-nav {
    position: fixed;
    inset: 0;
    background: var(--paper-deep);
    transform: translateX(100%);
    transition: transform 0.35s ease;
    padding-top: var(--header-h);
  }
  body.nav-open .main-nav { transform: translateX(0); }
  .main-nav ul {
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem clamp(1.25rem, 4vw, 2.5rem);
    gap: 1.6rem;
  }
  .nav-link { font-size: 1.3rem; }
  .nav-cta { margin-top: 0.5rem; }
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.98rem;
  overflow: hidden;
  isolation: isolate;
}
.btn--primary {
  background: var(--rust);
  color: var(--surface);
}
.btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--rust-dark);
  transform: translateX(-101%);
  transition: transform 0.3s ease;
  z-index: -1;
}
.btn--primary:hover::before { transform: translateX(0); }

.btn--outline {
  border: 1.5px solid var(--ink);
  color: var(--ink);
}
.btn--outline::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: translateX(-101%);
  transition: transform 0.3s ease;
  z-index: -1;
}
.btn--outline:hover { color: var(--paper); }
.btn--outline:hover::before { transform: translateX(0); }

.btn--outline-light {
  border: 1.5px solid rgba(241, 228, 206, 0.55);
  color: var(--espresso-text);
}
.btn--outline-light::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--espresso-text);
  transform: translateX(-101%);
  transition: transform 0.3s ease;
  z-index: -1;
}
.btn--outline-light:hover { color: var(--espresso); }
.btn--outline-light:hover::before { transform: translateX(0); }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.9rem; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  border-bottom: 1.5px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.text-link:hover { border-color: var(--rust); color: var(--rust-dark); }
.text-link svg { width: 14px; height: 14px; }

/* ---------- Icons ---------- */
.icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-top: calc(var(--header-h) + clamp(2rem, 6vw, 4rem));
  padding-bottom: clamp(3rem, 7vw, 5rem);
  overflow: hidden;
}
.hero__inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__visual { order: -1; max-width: 280px; margin-inline: auto; }
}

.hero__role {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  color: var(--rust-dark);
  margin-top: 0.35rem;
}
.hero__tagline-row {
  margin-top: 1.4rem;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  min-height: 1.6em;
  color: var(--ink-soft);
}
.hero__caret {
  display: inline-block;
  width: 2px;
  margin-left: 2px;
  background: var(--rust);
  animation: caretBlink 1s steps(1) infinite;
}
.hero__lede { margin-top: 1.4rem; font-size: 1.05rem; }
.hero__actions { margin-top: 2.2rem; }

.hero__visual {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.leaves {
  position: absolute;
  inset: -10% -10% -10% -10%;
  pointer-events: none;
  z-index: 0;
}
.leaf {
  position: absolute;
  top: 0;
  border-radius: 0 60% 0 60%;
  opacity: 0;
  animation-name: leafFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.stamp-wrapper {
  position: relative;
  z-index: 1;
  width: min(300px, 82%);
  animation: stampFloat 6s ease-in-out infinite;
}
.stamp { width: 100%; height: auto; overflow: visible; }
.stamp-ring {
  transform-origin: 110px 110px;
  animation: stampSpin 60s linear infinite;
}
.stamp-outer-ring { fill: none; stroke: var(--rust); stroke-width: 1.4; opacity: 0.75; }
.stamp-inner-ring { fill: none; stroke: var(--rust); stroke-width: 3; }
.stamp-ring-text {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 1px;
  fill: var(--rust-dark);
}
.stamp-ticks line { stroke: var(--rust); stroke-width: 3; stroke-linecap: round; }
.stamp-check { fill: none; stroke: var(--rust-dark); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Fact strip ---------- */
.fact-strip {
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.fact-strip__item {
  flex: 1 1 220px;
  padding: 1.4rem clamp(1rem, 2vw, 1.8rem);
  border-left: 1px solid var(--line);
  font-size: 0.98rem;
}
.fact-strip__item:first-child { border-left: none; }
@media (max-width: 640px) {
  .fact-strip__item { border-left: none; border-top: 1px solid var(--line); }
  .fact-strip__item:first-child { border-top: none; }
}

/* ---------- Ledger rows ---------- */
.ledger { border-top: 1px solid var(--line); }
.ledger-row {
  display: flex;
  gap: 1.4rem;
  padding-block: 1.9rem;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.ledger-row__icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--paper-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rust-dark);
}
.section--dark .ledger-row__icon { background: rgba(241, 228, 206, 0.1); color: var(--marigold); }
.section--dark .ledger { border-color: var(--line-light); }
.section--dark .ledger-row { border-color: var(--line-light); }
.ledger-row__content h3 { margin-bottom: 0.35rem; }
.ledger-row__meta { color: var(--ink-soft); font-size: 0.95rem; margin-top: 0.2rem; }
.ledger-row__underline {
  display: block;
  height: 1px;
  background: var(--rust);
  width: 0;
  margin-top: 0.6rem;
  transition: width 0.7s ease;
}
[data-reveal].is-in .ledger-row__underline { width: 46px; }

/* ---------- Tag cloud ---------- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.tag:nth-child(3n+1) { color: var(--rust-dark); background: rgba(184, 81, 31, 0.1); border-color: rgba(184, 81, 31, 0.28); }
.tag:nth-child(3n+2) { color: var(--marigold-dark); background: rgba(216, 154, 46, 0.14); border-color: rgba(216, 154, 46, 0.3); }
.tag:nth-child(3n) { color: var(--moss); background: rgba(92, 107, 71, 0.12); border-color: rgba(92, 107, 71, 0.3); }

/* ---------- Index cards (services / portfolio) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
}
.index-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--rust);
  padding: 1.8rem 1.6rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}
.index-card::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 22px 22px 0;
  border-color: transparent var(--paper-deep) transparent transparent;
  transition: border-color 0.3s ease;
}
.index-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
}
.index-card:nth-child(3n+2) { border-top-color: var(--marigold); }
.index-card:nth-child(3n) { border-top-color: var(--moss); }
.index-card__icon { color: var(--rust-dark); margin-bottom: 1rem; }
.index-card__title { margin-bottom: 0.6rem; }
.index-card__meta {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.index-card--placeholder {
  border-top-style: dashed;
  border-top-width: 3px;
  background: rgba(255, 251, 243, 0.5);
}
.index-card--placeholder .index-card__title { color: var(--ink-soft); }

/* ---------- Engagement models ---------- */
.model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; }
.model {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-deep);
}
.model h3 { margin-bottom: 0.5rem; }

/* ---------- Filter bar (portfolio) ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.filter-tab {
  padding: 0.55rem 1.1rem 0.5rem;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: var(--paper-deep);
  font-size: 0.92rem;
  font-weight: 600;
  transform: translateY(2px);
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.filter-tab:hover { color: var(--rust-dark); }
.filter-tab.is-active {
  background: var(--surface);
  border-color: var(--line);
  transform: translateY(0);
  color: var(--rust-dark);
  box-shadow: 0 -2px 0 var(--rust) inset;
}
.portfolio-grid { border-top: 1px solid var(--line); padding-top: 2rem; }
.project-card { display: none; }
.project-card.is-visible { display: block; }

/* ---------- Timeline (about) ---------- */
.timeline { position: relative; padding-left: 2.2rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--line);
}
.timeline-item { position: relative; padding-bottom: 2.1rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -2.2rem;
  top: 5px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--rust);
}
.timeline-item__year { color: var(--rust-dark); font-weight: 700; font-size: 0.92rem; }
.timeline-item__title { margin-top: 0.2rem; }
.timeline-item__meta { color: var(--ink-soft); font-size: 0.95rem; margin-top: 0.15rem; }

/* ---------- Pull quote ---------- */
.pull-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  line-height: 1.4;
  border-left: 3px solid var(--rust);
  padding-left: 1.5rem;
  max-width: 46ch;
  color: var(--ink);
}

/* ---------- Torn edge divider ---------- */
.torn-edge {
  height: 44px;
  background: var(--espresso);
  clip-path: polygon(0% 100%,0% 42%,4% 68%,9% 22%,14% 58%,19% 16%,24% 62%,29% 26%,34% 70%,39% 12%,44% 52%,49% 20%,54% 66%,59% 30%,64% 56%,69% 18%,74% 62%,79% 24%,84% 70%,89% 20%,94% 56%,100% 34%,100% 100%);
}

/* ---------- CTA band ---------- */
.cta-band { text-align: center; }
.cta-band h2 { max-width: 20ch; margin-inline: auto; }
.cta-band p { margin: 1rem auto 0; }
.cta-band .btn-row { justify-content: center; margin-top: 1.8rem; }

/* ---------- Postcard (contact) ---------- */
.postcard {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  padding: clamp(1.8rem, 4vw, 2.8rem);
  max-width: 620px;
  transform: rotate(-0.6deg);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: center;
}
@media (max-width: 560px) {
  .postcard { grid-template-columns: 1fr; text-align: left; }
  .postcard__postmark { margin: 0 auto; }
}
.postcard__postmark { width: 110px; }
.postcard__lines { display: flex; flex-direction: column; gap: 0.9rem; }
.postcard__line-label { display: block; font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 0.15rem; }
.postcard__line-value { font-size: 1.05rem; font-weight: 600; }

/* ---------- Blog ---------- */
.blog-empty {
  border: 1px dashed var(--line);
  padding: 2.4rem;
  text-align: center;
  border-radius: var(--radius-sm);
}
.blog-template-card {
  border: 1px dashed var(--rust);
  padding: 1.6rem;
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: rgba(184, 81, 31, 0.05);
}

/* ---------- Article (blog post) ---------- */
.article-meta { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.article-header { max-width: 68ch; }
.article-body { max-width: 68ch; margin-top: 2.2rem; }
.article-body p { margin-bottom: 1.3rem; }
.article-body p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.4em;
  float: left;
  line-height: 0.85;
  padding-right: 0.12em;
  padding-top: 0.05em;
  color: var(--rust);
}
.article-body h2 { margin: 2.2rem 0 1rem; font-size: 1.5rem; }
.article-body blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.25rem;
  border-left: 3px solid var(--rust);
  padding-left: 1.3rem;
  margin: 1.8rem 0;
  color: var(--ink);
}
.article-image-placeholder {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--paper-deep), var(--surface));
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 2rem 0;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--espresso); color: var(--espresso-text); }
.footer__inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
  padding-block: clamp(3rem, 6vw, 4rem);
}
@media (max-width: 640px) {
  .footer__inner { grid-template-columns: 1fr; gap: 2rem; }
}
.footer__brand p { margin-top: 0.8rem; color: rgba(241, 228, 206, 0.7); max-width: 32ch; }
.footer__col h4 { font-family: var(--font-body); font-size: 0.92rem; font-weight: 600; margin-bottom: 0.9rem; color: var(--marigold); }
.footer__col a, .footer__col span { display: block; color: rgba(241, 228, 206, 0.82); margin-bottom: 0.6rem; }
.footer__col a:hover { color: var(--marigold); }
.footer__bottom {
  border-top: 1px solid var(--line-light);
  padding-block: 1.4rem;
  font-size: 0.85rem;
  color: rgba(241, 228, 206, 0.6);
  text-align: center;
}

/* ---------- Utility: staggered children ---------- */
.stagger > *:nth-child(1) { transition-delay: 0ms; }
.stagger > *:nth-child(2) { transition-delay: 70ms; }
.stagger > *:nth-child(3) { transition-delay: 140ms; }
.stagger > *:nth-child(4) { transition-delay: 210ms; }
.stagger > *:nth-child(5) { transition-delay: 280ms; }
.stagger > *:nth-child(6) { transition-delay: 350ms; }
.stagger > *:nth-child(7) { transition-delay: 420ms; }
.stagger > *:nth-child(8) { transition-delay: 490ms; }
