/* =========================================================
   Ricky Martin Villafañe — Portfolio
   Dark theme · orange accent · Lato
   ========================================================= */

:root {
  --bg: #1e1e1e;
  --surface: #262626;
  --surface-2: #2e2e2e;
  --line: #3d3d3d;

  --text: #ffffff;
  --text-2: #c4c4c4;
  --muted: #8f8f8f;

  --accent: #fd6f00;
  --accent-2: #e46400;
  --grad: linear-gradient(90deg, #fd6f00 0%, #e46400 100%);

  --container: 1280px;
  --nav-h: 88px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
ul, ol { list-style: none; }

.container {
  width: 100%;
  max-width: calc(var(--container) + 48px);
  margin: 0 auto;
  padding: 0 24px;
}

.ic {
  width: 1em; height: 1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Logo ---------- */
.logo {
  display: inline-block;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: .03em;
  line-height: 1;
  background: linear-gradient(90deg, #fd6f00, #e8261a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 38px;
  border: 0; border-radius: 6px;
  font-size: 18px; font-weight: 700; white-space: nowrap;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s, color .2s;
}
.btn .ic { font-size: 20px; }
.btn--primary { background: var(--grad); color: #fff; }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(253, 111, 0, .32); }
.btn--outline { background: transparent; border: 2px solid #b4b4b4; color: #d2d2d2; }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }
.btn--sm { height: 46px; padding: 0 30px; font-size: 16px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  transition: background-color .3s, box-shadow .3s;
}
.nav.is-scrolled {
  background: rgba(30, 30, 30, .88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}
.nav__inner {
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav__menu { display: flex; gap: clamp(28px, 4vw, 60px); }
.nav__menu a { font-size: 18px; color: var(--text-2); transition: color .2s; }
.nav__menu a:hover,
.nav__menu a.is-active { color: var(--accent); }
.nav__toggle {
  display: none;
  width: 44px; height: 44px; margin-left: -10px;
  place-items: center;
  background: none; border: 0; cursor: pointer;
  font-size: 26px; color: var(--text);
}

/* ---------- Hero ---------- */
.hero { padding: 40px 0 110px; }
.hero__grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 48px;
}
.hero__hi { font-size: 22px; color: var(--muted); }
.hero__name { font-size: 26px; font-weight: 700; color: #a9a9a9; margin-top: 2px; }
.hero__title {
  margin: 22px 0 32px;
  font-size: clamp(40px, 5vw, 66px);
  font-weight: 700;
  line-height: 1.12;
  background: linear-gradient(90deg, #b95300 0%, #fd6f00 40%, #ff8a1c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.socials { display: flex; flex-wrap: wrap; gap: 16px; }
.socials a {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid #5c5c5c; border-radius: 50%;
  background: #262626; color: #c9c9c9;
  font-size: 18px;
  transition: color .2s, border-color .2s, transform .25s var(--ease);
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

.hero__cta { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 52px; }

.stats {
  display: inline-flex;
  margin-top: 64px;
  padding: 26px 0;
  background: var(--surface);
  border-radius: 8px;
}
.stats li { padding: 0 26px; }
.stats li + li { border-left: 1px solid #4a4a4a; }
.stats strong { display: block; font-size: 24px; font-weight: 900; color: var(--accent); line-height: 1.3; }
.stats span { font-size: 18px; font-weight: 700; color: #e4e4e4; white-space: nowrap; }

/* circle + portrait that pops out of the top */
.hero__visual {
  position: relative;
  width: 100%; max-width: 560px;
  justify-self: end;
  aspect-ratio: 1 / 1.25;
}
.hero__circle {
  position: absolute; left: 0; right: 0; bottom: 0;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #2d2d2d 0%, #252525 65%, #222 100%);
  box-shadow: 0 0 140px rgba(253, 111, 0, .07);
}
.hero__clip {
  position: absolute; inset: 0;
  overflow: hidden;
  /* bottom half matches the circle (radius = width / 2) */
  border-radius: 0 0 50% 50% / 0 0 40% 40%;
}
.hero__clip img {
  position: absolute; bottom: 0; left: 50%;
  width: 124%; max-width: none;
  transform: translateX(-50%);
}

/* ---------- Sections ---------- */
.section { padding: 100px 0; }
.section-head { text-align: center; margin-bottom: 64px; }
.section-head h2 { font-size: clamp(32px, 3.4vw, 40px); font-weight: 700; line-height: 1.2; }
.section-head p { margin-top: 14px; font-size: 18px; color: var(--muted); }

/* ---------- Services ---------- */
.services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  max-width: 1160px;
  margin: 0 auto;
}
.service {
  padding: 40px 40px 46px;
  text-align: center;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 16px;
  transition: transform .3s var(--ease), border-color .3s;
}
.service:hover { transform: translateY(-6px); border-color: rgba(253, 111, 0, .35); }
.service .ic { font-size: 46px; color: var(--accent); stroke-width: 1.5; margin: 0 auto; }
.service h3 { margin: 18px 0 20px; font-size: 22px; font-weight: 700; color: var(--accent); }
.service p { font-size: 17px; line-height: 1.75; color: var(--muted); }

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: minmax(280px, 400px) 1fr;
  gap: clamp(48px, 7vw, 96px);
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
}
.about__visual { position: relative; aspect-ratio: 1 / 1.3; }
.about__arch {
  position: absolute; left: 0; right: 0; bottom: 0; top: 22%;
  background: var(--surface);
  /* top corners form a half-circle (radius = width / 2) */
  border-radius: 50% 50% 14px 14px / 49.3% 49.3% 14px 14px;
}
.about__clip {
  position: absolute; inset: 0;
  clip-path: inset(-10% 0 0 0 round 0 0 14px 14px);
}
.about__clip img {
  position: absolute; bottom: 0; left: 50%;
  width: 115%; max-width: none;
  transform: translateX(-50%);
}

.about__text { padding-top: 24px; }
.about__bio { font-size: 17px; line-height: 1.95; color: var(--text-2); text-align: justify; hyphens: auto; }

.exp { margin: 40px 0 40px; }
.exp__heading {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
  font-size: 20px; font-weight: 700;
}
.exp__heading .ic { color: var(--accent); font-size: 22px; }
.exp__list { display: grid; gap: 30px; padding-left: 30px; border-left: 2px solid var(--line); margin-left: 8px; }
.exp__item { position: relative; }
.exp__item::before {
  content: "";
  position: absolute; left: -39px; top: 5px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}
.exp__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.exp__role { font-size: 19px; font-weight: 700; }
.exp__date { font-size: 14px; color: var(--muted); white-space: nowrap; }
.exp__org { margin-top: 2px; font-size: 15px; font-weight: 700; color: var(--accent); }
.exp__desc { margin-top: 8px; font-size: 16px; line-height: 1.75; color: var(--muted); }

/* Skills */
.skills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px 24px;
  max-width: 1000px;
  margin: 110px auto 0;
  text-align: center;
}
.ring { position: relative; width: 128px; height: 128px; margin: 0 auto 20px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 13; }
.ring__track { stroke: #3e3e3e; }
.ring__bar {
  --p: 0;
  stroke: var(--accent);
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--p));
  transition: stroke-dashoffset 1.6s var(--ease);
}
.tool-icon {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border: 2.5px solid #a3a3a3; border-radius: 10px;
  font-size: 19px; font-weight: 700; color: #a3a3a3;
}
.skill__pct { display: block; font-size: 24px; font-weight: 900; color: var(--accent); }
.skill__name { font-size: 19px; font-weight: 700; color: #b3b3b3; }

/* ---------- Portfolio ---------- */
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-bottom: 60px; }
.filter {
  height: 54px; padding: 0 34px;
  border: 0; border-radius: 6px;
  background: var(--surface-2); color: #d0d0d0;
  font-size: 17px; font-weight: 700;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.filter:hover { color: #fff; background: #383838; }
.filter.is-active { background: var(--grad); color: #fff; }

.works { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 18px; }
.work {
  overflow: hidden;
  background: #2a2a2a;
  border-radius: 20px;
  transition: transform .3s var(--ease), box-shadow .3s;
}
.work[hidden] { display: none; }
.work:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0, 0, 0, .35); }
.work__thumb {
  position: relative;
  display: block; width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #151515;
  border: 0; cursor: default;
}
button.work__thumb { cursor: pointer; }
.work__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.work:hover .work__thumb img { transform: scale(1.05); }
.work__play {
  position: absolute; left: 50%; top: 50%;
  width: 64px; height: 64px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--grad); color: #fff;
  font-size: 24px;
  transform: translate(-50%, -50%) scale(.9);
  box-shadow: 0 10px 30px rgba(253, 111, 0, .4);
  transition: transform .3s var(--ease);
}
.work__play .ic { margin-left: 3px; }
.work:hover .work__play { transform: translate(-50%, -50%) scale(1); }
.work__meta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px;
  font-size: 16px;
}
.work__title { font-weight: 700; color: #e2e2e2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work__cat { color: var(--muted); white-space: nowrap; }

/* placeholder art until real work is added */
.ph {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  color: #727272; text-align: center;
  background:
    radial-gradient(110% 75% at var(--gx, 85%) var(--gy, 0%), rgba(253, 111, 0, .2), transparent 60%),
    linear-gradient(160deg, #1c1c1c, #121212);
}
.ph::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 80%);
  mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 80%);
}
.ph .ic { position: relative; font-size: 58px; color: var(--accent); stroke-width: 1.3; }
.ph span { position: relative; font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.ph--motion  { --gx: 15%; --gy: 100%; }
.ph--graphic { --gx: 100%; --gy: 100%; }
.ph--social  { --gx: 0%;  --gy: 0%; }

/* Lightbox */
.lightbox {
  width: min(1100px, 92vw);
  max-height: 92vh;
  margin: auto;
  padding: 0;
  border: 0; border-radius: 16px;
  background: #111; color: var(--text);
  overflow: visible;
}
.lightbox::backdrop { background: rgba(0, 0, 0, .82); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.lightbox__media { border-radius: 16px 16px 0 0; overflow: hidden; background: #000; }
.lightbox__media iframe,
.lightbox__media video { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.lightbox__media img { width: 100%; max-height: 80vh; object-fit: contain; }
.lightbox__caption { padding: 14px 20px; font-weight: 700; }
.lightbox__caption small { margin-left: 8px; font-weight: 400; color: var(--muted); font-size: 14px; }
.lightbox__close {
  position: absolute; top: -18px; right: -18px; z-index: 1;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--grad); color: #fff;
  font-size: 22px; cursor: pointer;
}

/* ---------- Contact ---------- */
.section--contact { padding-bottom: 120px; }
.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  max-width: 800px;
  margin: 0 auto;
}
.field { display: block; }
.field input,
.field select,
.field textarea {
  width: 100%;
  height: 50px;
  padding: 0 18px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 6px;
  color: #fff;
  font: inherit; font-size: 15px;
  transition: border-color .2s, background-color .2s;
}
.field textarea { height: 128px; padding: 14px 18px; resize: vertical; }
.field select {
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b4b4b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 20px;
  padding-right: 48px;
}
.field select:has(option[value=""]:checked),
.field select option[value=""] { color: #9a9a9a; }
.field select option { color: #fff; background: #262626; }
.field input::placeholder,
.field textarea::placeholder { color: #9a9a9a; }
.field input:focus,
.field select:focus,
.field textarea:focus { outline: none; border-color: var(--accent); background: #2a2a2a; }
.field.is-invalid input,
.field.is-invalid textarea { border-color: #e5484d; }
.field--timeline { align-self: start; }
.form__actions {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: flex-end; gap: 20px;
  margin-top: 4px;
}
.form__status { font-size: 15px; color: var(--muted); }
.form__status.is-error { color: #ff6b6b; }
.btn--send { height: 46px; padding: 0 40px; font-size: 17px; }

/* ---------- Footer ---------- */
.footer { padding: 56px 0 28px; background: var(--surface); text-align: center; }
.footer .logo { font-size: 32px; }
.footer__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 44px; margin: 34px 0; }
.footer__nav a { font-size: 18px; color: #b5b5b5; transition: color .2s; }
.footer__nav a:hover { color: var(--accent); }
.footer .socials { justify-content: center; }
.footer__contact {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 44px;
  margin-top: 36px;
  font-size: 18px; color: #c4c4c4;
}
.footer__contact li { display: flex; align-items: center; gap: 12px; }
.footer__contact .ic { font-size: 22px; color: #a3a3a3; }
.footer__contact a:hover { color: var(--accent); }
.footer__copy {
  max-width: 480px;
  margin: 34px auto 0; padding-top: 14px;
  border-top: 1px solid #555;
  font-size: 14px; color: #8a8a8a;
}

/* ---------- Reveal on scroll (only when JS runs) ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

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

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1100px) {
  .services { gap: 24px; }
  .service { padding: 34px 26px 38px; }
  .stats li { padding: 0 20px; }
}

@media (max-width: 880px) {
  :root { --nav-h: 72px; }

  /* nav: hamburger · logo · hire me */
  .nav { background: rgba(30, 30, 30, .92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .nav__toggle { display: grid; }
  .logo { font-size: 24px; }
  .nav__inner > .logo { position: absolute; left: 50%; transform: translateX(-50%); }
  .nav__cta { height: 40px; padding: 0 20px; font-size: 15px; }
  .nav__menu {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    padding: 8px 24px 20px;
    background: rgba(30, 30, 30, .98);
    border-bottom: 1px solid var(--line);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .25s, transform .25s var(--ease), visibility .25s;
  }
  .nav__menu a { padding: 14px 0; border-bottom: 1px solid #2c2c2c; }
  .nav__menu a:last-child { border-bottom: 0; }
  .nav.is-open .nav__menu { opacity: 1; visibility: visible; transform: none; }

  /* hero: centered, photo below */
  .hero { padding: 28px 0 72px; }
  .hero__grid { grid-template-columns: 1fr; gap: 56px; text-align: center; }
  .hero__hi { font-size: 18px; }
  .hero__name { font-size: 22px; }
  .hero__title { margin: 14px 0 26px; }
  .socials { justify-content: center; }
  .hero__cta { justify-content: center; margin-top: 32px; gap: 16px; }
  .stats { margin-top: 40px; }
  .hero__visual { justify-self: center; max-width: 440px; }

  .section { padding: 72px 0; }
  .section-head { margin-bottom: 44px; }
  .section-head p { font-size: 16px; }

  .services { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .service { padding: 28px 16px 30px; border-radius: 12px; }
  .service .ic { font-size: 38px; }
  .service h3 { font-size: 19px; margin: 14px 0 12px; }
  .service p { font-size: 15px; }

  .about { grid-template-columns: 1fr; gap: 40px; }
  .about__visual { width: 100%; max-width: 360px; margin: 0 auto; }
  .about__text { padding-top: 0; }
  .about__text > .btn { display: flex; width: fit-content; margin: 0 auto; }

  .skills { grid-template-columns: repeat(2, 1fr); margin-top: 72px; }

  /* portfolio becomes a swipe carousel */
  .filters { gap: 10px; margin-bottom: 36px; }
  .filter { height: 44px; padding: 0 20px; font-size: 15px; }
  .works {
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: 78%;
    gap: 16px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    margin: 0 -24px; padding: 0 24px 12px;
    scroll-padding: 0 24px;
    scrollbar-width: none;
  }
  .works::-webkit-scrollbar { display: none; }
  .work { scroll-snap-align: start; border-radius: 16px; }
  .work:hover { transform: none; }

  .form { grid-template-columns: 1fr; }
  .form__actions { justify-content: center; flex-direction: column-reverse; }

  .footer__nav { gap: 10px 26px; }
  .footer__nav a, .footer__contact { font-size: 16px; }
  .footer__contact { flex-direction: column; align-items: center; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .works { margin: 0 -16px; padding: 0 16px 12px; scroll-padding: 0 16px; }
  .nav__toggle { margin-left: -8px; }
  .hero__title { font-size: 38px; }
  .btn { height: 50px; padding: 0 26px; font-size: 16px; }
  .stats { padding: 18px 0; }
  .stats li { padding: 0 12px; }
  .stats strong { font-size: 20px; }
  .stats span { font-size: 13px; }
  .service h3 { font-size: 17px; }
  .service p { font-size: 14px; line-height: 1.6; }
  .about__bio { font-size: 16px; }
  .exp__list { padding-left: 24px; }
  .exp__item::before { left: -33px; }
  .ring { width: 108px; height: 108px; }
  .skill__name { font-size: 16px; }
  .lightbox__close { top: -54px; right: 0; }
}
