/* ==========================================================================
   Jaime Rovira — Portfolio Stylesheet
   Standalone static rebuild (zero Webflow dependencies)
   ========================================================================== */

:root {
  --lh-heading: 1.15em;
  --ls-heading: -0.02em;
  --lh-body: 1.5em;
  --ls-body: -0.01em;

  --shade-10: #ffffff;
  --shade-20: #f2f2f2;
  --shade-30: #e3e3e3;
  --shade-40: #dcdcdc;
  --shade-50: #9f9f9f;
  --shade-60: #666666;
  --shade-70: #444444;
  --shade-80: #333333;
  --shade-90: #111111;
  --shade-100: #000000;
  --purple: #5d32c5;

  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2rem;
  --space-xl: 2.5rem;
  --space-2xl: 5rem;
  --space-3xl: 10rem;

  --layout-space: 15vh;
  --layout-space-small: 5vh;
  --rich-text-space: 3rem;
}

/* Reset & Base
   ========================================================================== */

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

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100%;
  background-color: var(--shade-10);
  color: var(--shade-90);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.3rem;
}

body.modal-open {
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  font-weight: 600;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; letter-spacing: 0; }
h6 { font-size: 1rem; letter-spacing: 0; }

p {
  margin: 0;
  font-size: 1rem;
  line-height: var(--lh-body);
}

a {
  color: var(--shade-90);
  line-height: var(--lh-heading);
  text-decoration: none;
}

ul, ol {
  margin: 0;
  padding-left: var(--space-l);
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  font-size: 1rem;
  line-height: var(--lh-heading);
}

img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

figure {
  margin: 0;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

/* Subtle Page Reveal Animation
   ========================================================================== */

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sidebar,
.content {
  animation: fadeSlideIn 0.55s cubic-bezier(0.165, 0.84, 0.44, 1) both;
}

.content {
  animation-delay: 0.06s;
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .content {
    animation: none;
  }
}

/* Typography Utilities
   ========================================================================== */

.display-2xl {
  font-size: 2.25rem;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  font-weight: 600;
}

.display-xl {
  font-size: 1.75rem;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  font-weight: 600;
}

.display-l {
  font-size: 1.5rem;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  font-weight: 600;
}

.display-m {
  font-size: 1.2rem;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  font-weight: 600;
}

.display-s {
  font-size: 1.1rem;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  font-weight: 600;
}

.display-xs {
  font-size: 1rem;
  line-height: var(--lh-heading);
  letter-spacing: 0;
  font-weight: 600;
}

.body {
  color: var(--shade-60);
  line-height: var(--lh-body);
}

.body-s {
  color: var(--shade-50);
  font-size: 0.9rem;
  line-height: var(--lh-body);
}

.link {
  color: var(--shade-90);
  border-bottom: 1px solid var(--shade-50);
  padding-bottom: 0.1em;
  transition: border-color 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.link:hover {
  border-bottom-color: var(--shade-100);
}

/* Core Page Shell & Grid
   ========================================================================== */

.section-layout {
  padding-top: var(--layout-space-small);
  padding-bottom: var(--layout-space-small);
}

.container {
  width: 100%;
  max-width: 1540px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--layout-space-small);
  padding-right: var(--layout-space-small);
}

.grid-layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0.5rem, 1fr));
  column-gap: var(--layout-space-small);
  row-gap: var(--layout-space-small);
  width: 100%;
}

.sidebar {
  grid-column: span 2;
}

.content {
  grid-column: span 10;
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  min-width: 0;
}

/* Sidebar Navigation
   ========================================================================== */

.sidebar-wrapper {
  position: sticky;
  top: 5vh;
  height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-l);
}

.sidebar-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  height: 33%;
}

.sidebar-item-brand {
  justify-content: flex-start;
  align-items: flex-start;
}

.sidebar-item-nav {
  justify-content: center;
  align-items: flex-start;
  color: var(--shade-90);
}

.sidebar-item-socials {
  flex-direction: row;
  align-items: flex-end;
  gap: var(--space-s);
}

.sidebar-item-menu {
  display: none;
}

.nav-brand {
  display: inline-block;
  line-height: 0;
}

.nav-logo {
  width: 2.5rem;
  height: 2.5rem;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 0;
  color: var(--shade-100);
  font-size: 1rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-link-text {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.15rem;
  transition: transform 0.28s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.nav-link-line-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  pointer-events: none;
}

.nav-link-line {
  width: 1rem;
  border-bottom: 0.1rem solid var(--shade-100);
  transform: translateX(-1.5rem);
  transition: transform 0.28s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@media (hover: hover) {
  .nav-link:hover .nav-link-text {
    transform: translateX(1.35rem);
  }
  .nav-link:hover .nav-link-line {
    transform: translateX(0);
  }
}

.nav-link.is-current .nav-link-text {
  color: var(--shade-90);
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.social-link:hover {
  opacity: 0.5;
}

.icon-m {
  width: 1rem;
  height: 1rem;
  min-height: 1rem;
  max-height: 1rem;
}

/* Mobile Menu Toggle Button (animated hamburger -> X) */
.nav-menu-button {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  gap: 4px;
}

.nav-menu-bar {
  display: block;
  width: 1.25rem;
  height: 1.5px;
  background-color: var(--shade-100);
  transition: transform 0.25s cubic-bezier(0.165, 0.84, 0.44, 1),
              opacity 0.2s ease;
  transform-origin: center;
}

.nav-menu-button.is-open .nav-menu-bar:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.nav-menu-button.is-open .nav-menu-bar:nth-child(2) {
  opacity: 0;
}

.nav-menu-button.is-open .nav-menu-bar:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* Homepage Project Grid
   ========================================================================== */

.grid-projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-s);
  row-gap: var(--layout-space-small);
  width: 100%;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
  color: var(--shade-90);
}

.project-card-image-wrapper {
  position: relative;
  overflow: hidden;
  background-color: #f9f9f9;
}

.project-card-image {
  aspect-ratio: 1 / 1;
  width: 100%;
  object-fit: cover;
  transition: transform 0.55s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.project-card-details {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-s);
}

.project-card-title {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.project-card-title-text-wrapper {
  position: relative;
  width: 100%;
  transition: transform 0.32s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.project-card-title-line-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  pointer-events: none;
}

.project-card-title-line {
  width: 2rem;
  border-bottom: 0.1rem solid var(--shade-100);
  transform: translateX(-2.25rem);
  transition: transform 0.32s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@media (hover: hover) {
  .project-card:hover .project-card-image {
    transform: scale(1.02);
  }
  .project-card:hover .project-card-title-text-wrapper {
    transform: translateX(2.5rem);
  }
  .project-card:hover .project-card-title-line {
    transform: translateX(0);
  }
}

.project-card-meta {
  display: flex;
  align-items: center;
  gap: 0.05rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* About Page
   ========================================================================== */

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  padding: 0 20px 20px;
}

.about-intro {
  grid-column: span 2;
}

.heading-2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
}

.about-photo-cell {
  display: flex;
  align-items: flex-start;
}

.image-2 {
  width: 95%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
}

.about-bio-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-s);
}

.paragraph-1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.25rem;
  line-height: var(--lh-body);
}

.spacer {
  width: 100%;
  height: 44px;
}

.divider {
  width: 100%;
  height: 1px;
  background-color: var(--shade-40);
}

.heading {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
}

.experience-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
}

.experience-company {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1rem;
  line-height: var(--lh-body);
  color: var(--shade-90);
}

.experience-dates {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1rem;
  line-height: var(--lh-body);
  text-align: right;
  color: var(--shade-90);
}

.experience-role {
  grid-column: span 2;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1rem;
  line-height: var(--lh-body);
  color: var(--shade-60);
}

.button-cv {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 40%;
  padding: 0.65rem 1.25rem;
  border: 1.5px solid var(--shade-100);
  border-radius: 20px;
  background-color: transparent;
  color: var(--shade-100);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1rem;
  text-align: center;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.button-cv:hover {
  border-color: var(--purple);
  background-color: var(--purple);
  color: var(--shade-10);
}

/* Project Detail Pages
   ========================================================================== */

.project-images-row-list {
  display: flex;
  gap: var(--space-s);
  width: 100%;
}

.project-images-row-item {
  width: 100%;
  flex: 1 1 0;
  background-color: #f9f9f9;
}

.project-images-row-item img {
  width: 100%;
  height: auto;
  display: block;
}

.project-content {
  padding-top: var(--layout-space);
  padding-bottom: var(--layout-space);
  border-top: 1px solid var(--shade-40);
  border-bottom: 1px solid var(--shade-40);
}

.project-content.project-content-last {
  border-bottom: none;
  padding-bottom: 15vh;
}

.grid-project-section {
  display: grid;
  grid-template-columns: repeat(12, minmax(0.5rem, 1fr));
  column-gap: var(--space-s);
  row-gap: var(--space-s);
  width: 100%;
}

.project-title-col {
  grid-column: 1 / 7;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-2xs);
}

.project-body-col {
  grid-column: 7 / 13;
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  min-width: 0;
}

.rich-text-content {
  max-width: 40rem;
  margin-bottom: -3rem;
  font-family: "Inter", sans-serif;
}

.rich-text-content h1,
.rich-text-content h2 {
  margin-bottom: 0.35em;
}

.rich-text-content h3 {
  margin-bottom: 0.4em;
}

.rich-text-content h4,
.rich-text-content h5,
.rich-text-content h6 {
  margin-bottom: 0.5em;
}

.rich-text-content p,
.rich-text-content blockquote,
.rich-text-content ol,
.rich-text-content ul {
  margin-bottom: var(--rich-text-space);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.15rem;
  line-height: var(--lh-body);
}

.rich-text-content ul,
.rich-text-content ol {
  gap: var(--space-s);
}

.rich-text-content li {
  line-height: var(--lh-body);
}

.rich-text-content figure {
  margin-bottom: var(--rich-text-space);
}

/* Self-hosted Video Showcase Container */
.video-embed {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0;
  background-color: var(--shade-10);
}

.video-embed video {
  display: block;
  height: 92vh;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  background-color: var(--shade-10);
}

.video-embed video::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none;
}

.video-play-btn {
  position: absolute;
  display: none;
  justify-content: center;
  align-items: center;
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background-color: rgba(17, 17, 17, 0.82);
  color: var(--shade-10);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.video-play-btn:hover {
  transform: scale(1.06);
  background-color: var(--shade-100);
}

.video-play-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.15rem;
  fill: currentColor;
}

.video-embed.needs-play .video-play-btn {
  display: flex;
}

@media screen and (max-width: 767px) {
  .video-embed video {
    width: 100%;
    height: auto;
  }
}

/* Related / Other Projects */
.related-projects {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
}

.related-projects-title {
  display: flex;
  justify-content: space-between;
  padding-bottom: var(--space-s);
  border-bottom: 1px solid var(--shade-40);
}

.grid-related-projects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-s);
  width: 100%;
}

/* Contact Modal
   ========================================================================== */

.contact-modal-wrapper {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.25rem;
  background-color: rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.contact-modal-wrapper.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.contact-modal {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
  width: 100%;
  max-width: 35rem;
  padding: var(--space-l);
  border-radius: var(--space-3xs);
  background-color: var(--shade-10);
  transform: translateY(0.75rem);
  transition: transform 0.28s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.contact-modal-wrapper.is-open .contact-modal {
  transform: translateY(0);
}

.contact-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.contact-modal-close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.contact-modal-close-button:hover {
  opacity: 0.55;
}

.contact-modal-close-button img {
  width: 1rem;
  height: 1rem;
}

.form-block {
  width: 100%;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  width: 100%;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  width: 100%;
}

.form-label {
  font-size: 0.85rem;
  line-height: var(--lh-heading);
  font-weight: 500;
  color: var(--shade-90);
}

.form-input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.75rem var(--space-s);
  border: 1px solid var(--shade-40);
  border-radius: var(--space-3xs);
  background-color: var(--shade-10);
  color: var(--shade-80);
  font-size: 0.9rem;
  line-height: 1.4;
  transition: border-color 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.form-input:hover {
  border-color: var(--shade-50);
}

.form-input:focus {
  outline: none;
  border-color: var(--shade-60);
}

.form-input::placeholder {
  color: var(--shade-50);
  font-size: 0.85rem;
}

.form-input-area {
  min-height: 7rem;
  resize: vertical;
}

.button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2xs);
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-2xs) var(--space-s);
  border: 1px solid var(--shade-40);
  border-radius: var(--space-3xs);
  background-color: transparent;
  color: var(--shade-90);
  font-size: 0.9rem;
  line-height: var(--lh-heading);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.button:hover:not(:disabled) {
  border-color: var(--shade-90);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.state-box {
  display: none;
  width: 100%;
  padding: var(--space-m);
  border: 1px solid var(--shade-40);
  border-radius: var(--space-3xs);
  background-color: var(--shade-10);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: var(--lh-body);
}

.state-box.is-visible {
  display: block;
}

.state-box-error {
  margin-top: var(--space-s);
  padding: var(--space-s);
  background-color: #ffdede;
  border-color: #ebc5c5;
  font-size: 0.85rem;
}

/* Responsive: Tablet (<= 991px)
   ========================================================================== */

@media screen and (max-width: 991px) {
  .section-layout {
    padding-top: var(--space-l);
    padding-bottom: var(--space-l);
  }

  .container {
    padding-left: var(--space-l);
    padding-right: var(--space-l);
  }

  .grid-layout {
    display: flex;
    flex-direction: column;
    gap: 4rem;
  }

  .sidebar {
    position: relative;
    z-index: 50;
  }

  .sidebar-wrapper {
    position: relative;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .sidebar-item {
    height: auto;
  }

  .sidebar-item-socials {
    display: none;
  }

  .sidebar-item-menu {
    display: flex;
  }

  .sidebar-item-nav {
    display: none;
    position: absolute;
    top: calc(100% + 1rem);
    left: 0;
    right: 0;
    padding: var(--space-l);
    gap: var(--space-m);
    background-color: var(--shade-20);
    z-index: 60;
  }

  .sidebar-item-nav.is-open {
    display: flex;
  }

  .content {
    gap: 4rem;
  }

  .grid-projects {
    row-gap: var(--space-l);
  }

  .display-2xl {
    font-size: 2rem;
  }

  .display-m {
    font-size: 1.3rem;
  }

  .about-layout {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .about-intro {
    grid-column: span 1;
  }

  .image-2 {
    width: 100%;
    max-width: 480px;
  }

  .project-content {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }

  .grid-project-section {
    grid-template-columns: 1fr;
    row-gap: var(--layout-space-small);
  }

  .project-title-col,
  .project-body-col {
    grid-column: 1 / -1;
  }

  .rich-text-content {
    max-width: 100%;
    margin-bottom: -1rem;
  }

  .rich-text-content p {
    margin-bottom: var(--space-l);
  }

  .grid-related-projects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Responsive: Mobile Landscape (<= 767px)
   ========================================================================== */

@media screen and (max-width: 767px) {
  .section-layout {
    padding-top: var(--space-m);
    padding-bottom: var(--space-m);
  }

  .container {
    padding-left: var(--space-m);
    padding-right: var(--space-m);
  }

  .grid-layout {
    gap: 3rem;
  }

  .grid-projects {
    grid-template-columns: 1fr;
  }

  .grid-related-projects {
    grid-template-columns: 1fr;
  }

  .project-images-row-list {
    flex-direction: column;
  }

  h1, .heading-2 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.35rem; }
  h4 { font-size: 1.2rem; }

  .display-2xl,
  .display-xl {
    font-size: 1.75rem;
  }

  .paragraph-1 {
    font-size: 1rem;
  }

  .rich-text-content {
    margin-bottom: -2rem;
  }

  .rich-text-content p {
    font-size: 1.1rem;
  }

  .button-cv {
    width: 60%;
  }
}

/* Responsive: Mobile Portrait (<= 479px)
   ========================================================================== */

@media screen and (max-width: 479px) {
  .display-2xl { font-size: 1.5rem; }
  .display-xl { font-size: 1.4rem; }
  .display-l { font-size: 1.3rem; }
  .display-m { font-size: 1.15rem; }

  .content {
    gap: 3rem;
  }

  .project-card {
    gap: var(--space-s);
  }

  .project-card-details {
    flex-direction: column;
    gap: var(--space-2xs);
  }

  .project-content {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  .contact-modal {
    padding: var(--space-m);
  }

  .button-cv {
    width: 100%;
  }
}
