/* =========================================================
   Joaquín Tebez — Portfolio
   CSS vanilla. Sin frameworks. Mobile-first, fluid con clamp().
   ========================================================= */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100svh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, picture, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Tokens ---------- */
:root {
  --bg: #0a0a0b;
  --bg-elevated: #131315;
  --bg-elevated-2: #1a1a1d;
  --fg: #f4f3ef;
  --fg-muted: rgba(244, 243, 239, 0.62);
  --fg-faint: rgba(244, 243, 239, 0.36);
  --border: rgba(244, 243, 239, 0.12);
  --border-soft: rgba(244, 243, 239, 0.07);
  --accent: #e3b567;
  --accent-fg: #14110a;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  --wrap: min(1180px, 100% - 3rem);
  --header-h: 76px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 640px) {
  :root { --wrap: min(1180px, 100% - 6rem); }
}

/* ---------- Base ---------- */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
}

.wrap { width: var(--wrap); margin-inline: auto; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0.75rem 1.25rem;
  z-index: 200;
}
.skip-link:focus { left: 1rem; top: 1rem; }

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

/* ---------- Typography helpers ---------- */
.eyebrow, .section-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(227, 181, 103, 0.18);
}

.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin-top: 0.6em;
  max-width: 18ch;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.4s var(--ease), background-color 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
  white-space: nowrap;
}
.btn-solid { background: var(--accent); color: var(--accent-fg); }
.btn-solid:hover { transform: translateY(-2px); background: #edc47c; }

.btn-ghost { border-color: var(--border); color: var(--fg); background: transparent; }
.btn-ghost:hover { border-color: var(--fg-muted); }

.btn-text { padding: 0.5rem 0; border-radius: 0; color: var(--fg); }
.btn-text span { transition: transform 0.3s var(--ease); display: inline-block; }
.btn-text:hover span { transform: translateX(4px); }

.btn-small { padding: 0.6rem 1.2rem; font-size: 0.85rem; }
.btn-large { padding: 1.1rem 2.2rem; font-size: 1.05rem; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 100;
  display: flex;
  align-items: center;
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), height 0.3s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--border-soft); }

.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.logo {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.main-nav { display: none; align-items: center; gap: 2.1rem; }
.main-nav a {
  font-size: 0.92rem;
  color: var(--fg-muted);
  position: relative;
  padding: 0.3rem 0;
  transition: color 0.25s var(--ease);
}
.main-nav a:hover { color: var(--fg); }
.main-nav a::after {
  content: '';
  position: absolute; left: 0; right: 100%; bottom: -2px;
  height: 1px; background: var(--accent);
  transition: right 0.3s var(--ease);
}
.main-nav a:hover::after { right: 0; }

.header-actions { display: flex; align-items: center; gap: 1.1rem; }

.lang-switch { display: none; align-items: center; gap: 0.4em; font-family: var(--mono); font-size: 0.8rem; color: var(--fg-faint); }
.lang-switch a { color: var(--fg-faint); transition: color 0.25s var(--ease); }
.lang-switch a.is-active { color: var(--fg); }
.lang-switch a:hover { color: var(--fg); }

.header-cta { display: none; }

.nav-toggle {
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 34px; height: 34px;
}
.nav-toggle span { width: 100%; height: 1px; background: var(--fg); transition: transform 0.3s var(--ease), opacity 0.3s var(--ease); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (min-width: 900px) {
  .main-nav { display: flex; }
  .lang-switch { display: flex; }
  .header-cta { display: inline-flex; }
  .nav-toggle { display: none; }
}

/* Mobile full-screen nav overlay */
@media (max-width: 899.98px) {
  #main-nav {
    position: fixed; inset: 0;
    background: var(--bg);
    display: flex; flex-direction: column;
    align-items: flex-start; justify-content: center;
    gap: 1.4rem;
    padding: 2rem var(--wrap-side, 1.5rem);
    padding-left: 1.75rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
    z-index: 90;
  }
  #main-nav.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  #main-nav a { font-family: var(--serif); font-size: 2.1rem; color: var(--fg); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--header-h) + 2rem);
  padding-bottom: 4rem;
}

.hero-inner {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1fr;
}

.hero-text { order: 2; }
.hero-photo { order: 1; }

.hero-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 12vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin-top: 0.5rem;
}

.hero-headline {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.15rem, 2.6vw, 1.55rem);
  line-height: 1.4;
  color: var(--fg-muted);
  max-width: 30ch;
  margin-top: 1.4rem;
}

.hero-subline {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  color: var(--fg-faint);
  margin-top: 1.4rem;
  text-transform: uppercase;
}

.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; margin-top: 2.4rem; }

.eyebrow { margin-bottom: 0; }

.hero-photo-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  width: min(360px, 78vw);
  margin-inline: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-photo-frame img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(0.55) contrast(1.05);
}
.photo-placeholder-label {
  display: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
  text-align: center;
  padding: 1rem;
  border: 1px dashed var(--border);
  margin: 1.5rem;
  border-radius: 4px;
}
.hero-photo-frame.is-placeholder { border-style: dashed; }
.hero-photo-frame.is-placeholder .photo-placeholder-label { display: block; }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 1.75rem;
  transform: translateX(-50%);
  display: none;
}
.scroll-cue span {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

@media (min-width: 860px) {
  .hero-inner { grid-template-columns: 1.15fr 0.85fr; align-items: center; gap: 3rem; }
  .hero-text { order: 1; }
  .hero-photo { order: 2; }
  .hero-photo-frame { width: 100%; max-width: 420px; margin-inline: 0 0 0 auto; }
  .scroll-cue { display: block; }
}

/* ---------- Reveal animation ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Section spacing ---------- */
section:not(.hero) { padding-block: clamp(4.5rem, 9vw, 8rem); }

/* ---------- About ---------- */
.about-inner { }
.about-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 4.6vw, 3.2rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  max-width: 16ch;
  margin-top: 0.7rem;
}
.about-body {
  margin-top: 2.5rem;
  display: grid;
  gap: 1.4rem;
  max-width: 62ch;
}
.about-body p { font-size: clamp(1rem, 1.6vw, 1.15rem); color: var(--fg-muted); line-height: 1.7; }

@media (min-width: 860px) {
  .about-inner { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 3rem; align-items: start; }
  .about-title { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: calc(var(--header-h) + 2rem); }
  .section-label { grid-column: 1; }
  .about-body { grid-column: 2; margin-top: 0.5rem; }
}

/* ---------- Services ---------- */
.services-list { margin-top: 2.5rem; border-top: 1px solid var(--border-soft); }
.service-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 1.5rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--border-soft);
  transition: padding-left 0.4s var(--ease), background-color 0.4s var(--ease);
}
.service-row:hover { padding-left: 0.75rem; background: var(--bg-elevated); }
.service-num {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  align-self: start;
  padding-top: 0.3rem;
}
.service-title {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.6vw, 1.8rem);
  font-weight: 500;
}
.service-desc {
  grid-column: 2;
  color: var(--fg-muted);
  max-width: 52ch;
  font-size: 0.98rem;
}

.services-note { margin-top: 2rem; color: var(--fg-faint); font-size: 0.9rem; max-width: 50ch; }

@media (min-width: 720px) {
  .service-row { grid-template-columns: 4rem 1fr 1fr; align-items: baseline; }
  .service-desc { grid-column: 3; }
}

/* ---------- Projects / Case studies ---------- */
.projects-intro { margin-top: 1.2rem; color: var(--fg-muted); max-width: 50ch; }

.project-cases { margin-top: 3.5rem; display: grid; gap: clamp(3rem, 6vw, 6rem); }

.case { display: grid; gap: 1.75rem; }

.case-media-placeholder {
  aspect-ratio: 16 / 11;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.case-media-placeholder span {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.case-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.case-meta { margin-top: 1.5rem; display: grid; gap: 1.1rem; }
.case-meta dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 0.35rem;
}
.case-meta dd { color: var(--fg-muted); max-width: 48ch; line-height: 1.6; }

.case-stack { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.case-stack li {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

@media (min-width: 860px) {
  .case { grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 3.5rem; }
  .case-reverse .case-media { order: 2; }
  .case-reverse .case-content { order: 1; }
}

/* ---------- Tech marquee ---------- */
.tech { overflow: hidden; }
.tech-marquee {
  margin-top: 2rem;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding-block: 1.6rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.tech-track {
  display: flex;
  width: max-content;
  gap: clamp(2rem, 5vw, 4rem);
  animation: marquee 28s linear infinite;
}
.tech-item {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  color: var(--fg-faint);
  white-space: nowrap;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .tech-track { animation: none; flex-wrap: wrap; }
}

/* ---------- Why ---------- */
.why-grid {
  margin-top: 2.5rem;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border-soft);
}
.why-item {
  padding: 1.8rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.why-item h3 { font-family: var(--serif); font-weight: 500; font-size: 1.2rem; }
.why-item p { margin-top: 0.6rem; color: var(--fg-muted); font-size: 0.95rem; line-height: 1.6; max-width: 40ch; }

@media (min-width: 720px) {
  .why-grid { grid-template-columns: repeat(2, 1fr); column-gap: 3rem; }
}
@media (min-width: 1080px) {
  .why-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact-inner { display: flex; flex-direction: column; align-items: center; }
.contact-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  max-width: 18ch;
  margin-top: 0.9rem;
}
.contact-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  color: var(--fg-muted);
  margin-top: 0.6rem;
}
.contact .btn-large { margin-top: 2.6rem; }

.contact-channels { margin-top: 3.5rem; }
.contact-channels > p {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.contact-channels ul {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.8rem;
}
.contact-channels a {
  font-size: 0.95rem;
  color: var(--fg-muted);
  position: relative;
  padding-bottom: 2px;
}
.contact-channels a::after {
  content: '';
  position: absolute; left: 0; right: 100%; bottom: 0;
  height: 1px; background: var(--accent);
  transition: right 0.3s var(--ease);
}
.contact-channels a:hover { color: var(--fg); }
.contact-channels a:hover::after { right: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border-soft); padding-block: 2.4rem; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--fg-faint);
}
.logo-small { font-size: 0.95rem; color: var(--fg-muted); }
.back-to-top { color: var(--fg-faint); transition: color 0.25s var(--ease); }
.back-to-top:hover { color: var(--fg); }

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