/* =========================================================
   Santiago Ferreira — Portfolio
   Editorial minimalism · Inter · Black & White
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f5f3;
  --ink: #0a0a0a;
  --ink-muted: #6b6b6b;
  --rule: #e6e4e0;
  --rule-strong: #1a1a1a;

  --max: 1320px;
  --gutter: clamp(20px, 5vw, 64px);

  --t-display: clamp(3.25rem, 9vw, 8rem);
  --t-h1: clamp(2.25rem, 5.5vw, 4.5rem);
  --t-h2: clamp(1.75rem, 3vw, 2.5rem);
  --t-h3: 1.25rem;
  --t-body: 1.0625rem;
  --t-small: 0.875rem;
  --t-eyebrow: 0.75rem;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, ol, figure { margin: 0; padding: 0; }
ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; cursor: pointer; color: inherit; }

/* ---------- Base ---------- */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: 'ss01' on, 'cv11' on;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Layout primitives ---------- */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.rule { height: 1px; background: var(--rule); border: 0; }

/* ---------- Type utilities ---------- */
.eyebrow {
  font-size: var(--t-eyebrow);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.display {
  font-size: var(--t-display);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); }

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--rule);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  max-width: var(--max);
  margin: 0 auto;
}

.nav__brand {
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1rem;
}

.nav__links {
  display: flex;
  gap: clamp(20px, 3vw, 40px);
  font-size: 0.9375rem;
}

.nav__links a {
  position: relative;
  padding: 4px 0;
  color: var(--ink);
  transition: opacity 0.2s var(--ease);
}

.nav__links a::after {
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transition: right 0.3s var(--ease);
}

.nav__links a:hover::after { right: 0; }

.nav__toggle { display: none; }

@media (max-width: 720px) {
  .nav__links { display: none; }
  .nav__links.is-open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    padding: 8px var(--gutter) 24px;
  }
  .nav__links.is-open a {
    padding: 14px 0;
    border-top: 1px solid var(--rule);
  }
  .nav__toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
  }
  .nav__toggle span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--ink);
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(60px, 12vw, 160px) 0 clamp(40px, 8vw, 80px);
}

.hero__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: clamp(60px, 10vw, 120px);
}

.hero__title {
  max-width: 14ch;
  margin-bottom: clamp(40px, 6vw, 64px);
}

.hero__intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 5vw, 80px);
  align-items: start;
  padding-top: clamp(24px, 4vw, 40px);
  border-top: 1px solid var(--rule);
}

.hero__intro p {
  font-size: clamp(1.0625rem, 1.6vw, 1.375rem);
  line-height: 1.45;
  max-width: 42ch;
}

.hero__intro p + p {
  color: var(--ink-muted);
}

@media (max-width: 720px) {
  .hero__intro { grid-template-columns: 1fr; gap: 24px; }
}

/* ---------- Section heading ---------- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: clamp(40px, 6vw, 72px);
}

.section-head h2 { font-size: var(--t-h3); font-weight: 500; letter-spacing: -0.01em; }

.section-head .count {
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  font-size: var(--t-small);
}

/* ---------- Work grid ---------- */
.work { padding: clamp(40px, 8vw, 100px) 0; }

.work__list {
  display: flex;
  flex-direction: column;
  gap: clamp(60px, 10vw, 120px);
}

.project-card {
  display: block;
  position: relative;
}

.project-card__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 11;
  background: var(--bg-alt);
}

.project-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease), filter 0.6s var(--ease);
}

.project-card:hover .project-card__media img { transform: scale(1.025); }

.project-card__footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(16px, 3vw, 48px);
  align-items: baseline;
  padding-top: 24px;
}

.project-card__index {
  font-variant-numeric: tabular-nums;
  font-size: var(--t-small);
  color: var(--ink-muted);
}

.project-card__title {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.project-card__meta {
  display: flex;
  gap: 12px;
  font-size: var(--t-small);
  color: var(--ink-muted);
  white-space: nowrap;
}

.project-card__meta span:not(:last-child)::after {
  content: '·';
  margin-left: 12px;
  color: var(--rule);
}

@media (max-width: 720px) {
  .project-card__footer {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .project-card__meta { white-space: normal; }
}

/* ---------- About ---------- */
.about { padding: clamp(60px, 10vw, 140px) 0; }

.about__grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(24px, 5vw, 80px);
  align-items: start;
}

.about__grid h3 {
  font-size: var(--t-small);
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

.about__body p {
  font-size: clamp(1.125rem, 1.6vw, 1.5rem);
  line-height: 1.45;
  letter-spacing: -0.01em;
  max-width: 28ch;
}

.about__body p + p {
  margin-top: 1em;
  color: var(--ink-muted);
  max-width: 50ch;
  font-size: var(--t-body);
  line-height: 1.6;
  letter-spacing: 0;
}

@media (max-width: 720px) {
  .about__grid { grid-template-columns: 1fr; gap: 12px; }
}

/* ---------- Skills ---------- */
.skills { padding: clamp(60px, 10vw, 140px) 0; }

.skills__grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(24px, 5vw, 80px);
  align-items: start;
}

.skills__grid h3 {
  font-size: var(--t-small);
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

.skills__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}

.skills__list li {
  font-size: clamp(1.125rem, 1.8vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.skills__list li:nth-last-child(-n+2) { border-bottom: 1px solid var(--rule); }

.skills__list li span {
  font-size: var(--t-small);
  font-weight: 400;
  color: var(--ink-muted);
  letter-spacing: 0;
}

@media (max-width: 720px) {
  .skills__grid { grid-template-columns: 1fr; gap: 12px; }
  .skills__list { grid-template-columns: 1fr; }
  .skills__list li:nth-last-child(2) { border-bottom: 0; }
}

/* ---------- Contact / Footer ---------- */
.contact { padding: clamp(80px, 12vw, 180px) 0; }

.contact__inner {
  border-top: 1px solid var(--rule-strong);
  padding-top: clamp(40px, 6vw, 80px);
}

.contact__eyebrow { margin-bottom: 24px; }

.contact__title {
  font-size: clamp(2.5rem, 7vw, 6rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 32px;
}

.contact__email {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
}

.contact__email::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transform-origin: right;
  transform: scaleX(1);
  transition: transform 0.5s var(--ease);
}

.contact__email:hover::after { transform-origin: left; transform: scaleX(0); }

footer.foot {
  padding: 40px 0 60px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--t-small);
  color: var(--ink-muted);
  flex-wrap: wrap;
  gap: 16px;
}

footer.foot a:hover { color: var(--ink); }

/* =========================================================
   CASE STUDY PAGE
   ========================================================= */

.case-hero { padding: clamp(60px, 12vw, 140px) 0 clamp(40px, 6vw, 80px); }

.case-hero__eyebrow { margin-bottom: 32px; }

.case-hero__title {
  font-size: clamp(2.75rem, 8vw, 7rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin-bottom: 32px;
}

.case-hero__tagline {
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.35;
  max-width: 32ch;
  color: var(--ink);
}

/* Metadata strip */
.case-meta {
  padding: clamp(40px, 6vw, 72px) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.case-meta__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(20px, 3vw, 40px);
}

.case-meta__item dt {
  font-size: var(--t-eyebrow);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.case-meta__item dd {
  font-size: var(--t-body);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

@media (max-width: 900px) {
  .case-meta__grid { grid-template-columns: repeat(3, 1fr); gap: 32px 24px; }
}

@media (max-width: 480px) {
  .case-meta__grid { grid-template-columns: repeat(2, 1fr); }
}

/* Hero image */
.case-image {
  padding: clamp(40px, 6vw, 80px) 0;
}

.case-image figure {
  background: var(--bg-alt);
}

.case-image img { width: 100%; height: auto; }

/* Story sections */
.case-story {
  padding: clamp(40px, 6vw, 100px) 0 clamp(60px, 10vw, 140px);
}

.case-story__block {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(24px, 5vw, 80px);
  padding: clamp(40px, 5vw, 64px) 0;
  border-top: 1px solid var(--rule);
}

.case-story__block:last-child { border-bottom: 1px solid var(--rule); }

.case-story__block h3 {
  font-size: var(--t-small);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.case-story__block p {
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  letter-spacing: -0.005em;
  max-width: 55ch;
}

.case-story__block p + p { margin-top: 1.25em; }

.case-story__block ul {
  margin-top: 1em;
  padding-left: 0;
}

.case-story__block li {
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  padding: 12px 0;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.case-story__block li::before {
  content: '—';
  color: var(--ink-muted);
  flex-shrink: 0;
}

.case-story__block li:last-child { border-bottom: 1px solid var(--rule); }

/* Favorite */
.case-favorite {
  padding: clamp(60px, 10vw, 140px) 0;
  text-align: center;
}

.case-favorite__eyebrow { margin-bottom: 32px; }

.case-favorite blockquote {
  font-size: clamp(1.75rem, 4vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  max-width: 22ch;
  margin: 0 auto;
}

@media (max-width: 720px) {
  .case-story__block { grid-template-columns: 1fr; gap: 16px; }
}

/* Next project */
.next-project {
  padding: clamp(60px, 10vw, 140px) 0 clamp(40px, 8vw, 100px);
  border-top: 1px solid var(--rule-strong);
}

.next-project a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  padding: 16px 0;
}

.next-project__label {
  margin-bottom: 16px;
  display: block;
}

.next-project__title {
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.95;
  transition: transform 0.5s var(--ease);
}

.next-project a:hover .next-project__title { transform: translateX(8px); }

.next-project__arrow {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  font-weight: 300;
  transition: transform 0.5s var(--ease);
}

.next-project a:hover .next-project__arrow { transform: translateX(8px); }

/* =========================================================
   Reveal on scroll
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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