/* Layout and tokens follow matiasbontempo.com, the reference the user asked to copy.
   avoid-ai-design-ignore: SD (brief: replicate reference design) */
:root {
  --color-primary: #0097c2;
  --color-secondary: #00a98e;
  --color-tertiary: #234;
  --color-text: #234;
  --color-page: #234;
  --color-card: #fafafa;
  --side-gradient: linear-gradient(-5deg, #015783, #0097c2, #00a98e);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-size: 8px;
  background-color: var(--color-page);
  color: var(--color-text);
  font-family: Nunito, Helvetica, Arial, sans-serif;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Card ---------- */
.cv {
  max-width: 1024px;
  margin: 5rem auto 10rem;
  background-color: var(--color-card);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 0.5rem 3rem -0.5rem rgba(0, 0, 0, 0.5);
  display: grid;
  grid-template: 'details side' auto / 1fr 300px;
}

/* ---------- Side ---------- */
.side {
  position: relative;
  grid-area: side;
  background-image: var(--side-gradient);
  background-attachment: fixed;
  color: white;
  padding: 3rem 4rem;
}

/* ES / EN switch: white pill in the sidebar corner, sliding thumb marks the active language */
.lang-switch {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(1, 87, 131, 0.35);
  color: white;
  font: 600 1.2rem/1 Nunito, Helvetica, Arial, sans-serif;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.lang-switch::before {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc(50% - 2px);
  border-radius: 999px;
  background: white;
  transition: transform 0.2s ease;
}

.lang-switch[data-active='en']::before {
  transform: translateX(100%);
}

.lang-switch span {
  position: relative;
  padding: 0.5rem 0.9rem;
  transition: color 0.2s ease;
}

.lang-switch[data-active='es'] [data-lang='es'],
.lang-switch[data-active='en'] [data-lang='en'] {
  color: var(--color-primary);
}

.lang-switch:focus-visible {
  outline: 2px solid white;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .lang-switch::before,
  .lang-switch span {
    transition: none;
  }
}

.avatar {
  width: 70%;
  padding-top: 70%;
  border-radius: 100%;
  border: 4px solid white;
  display: block;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  background: rgba(255, 255, 255, 0.15);
}

.avatar img,
.avatar span {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar span {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.side h1 {
  font-size: 3rem;
  font-weight: 500;
  text-align: center;
  margin: 2rem auto 0.5rem;
}

.side .role {
  font-size: 1.7rem;
  font-weight: 400;
  text-align: center;
  text-transform: uppercase;
  opacity: 0.8;
  margin: 0.5rem auto 3rem;
  letter-spacing: 0.2em;
  line-height: 1.5;
}

.social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3rem;
  margin-bottom: 5rem;
}

.social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  transition: opacity 0.15s;
}

.social a:hover {
  opacity: 0.75;
}

.social a:focus-visible {
  outline-color: white;
}

.social svg {
  width: 100%;
  height: 100%;
}

.side-block {
  margin: 4rem 0;
}

.side-block:last-child {
  margin-bottom: 2rem;
}

.side-block h2 {
  font-size: 2.2rem;
  font-weight: 400;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  margin: 0 auto 3rem;
}

.side-block h2::after {
  content: '';
  display: inline-block;
  margin-left: 2rem;
  height: 1px;
  background: #eee;
  opacity: 0.6;
  flex-grow: 1;
}

.side-block ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  grid-gap: 2rem;
}

.side-block li {
  font-size: 2rem;
}

.side-block .label,
.side-block .desc {
  opacity: 0.8;
  display: block;
  font-size: 1.5rem;
}

.side-block .value {
  margin: 0;
  font-weight: 500;
  font-size: 2rem;
  overflow-wrap: anywhere;
}

.side-block .value a {
  text-decoration: none;
}

.side-block .value a:hover {
  text-decoration: underline;
}

/* ---------- Details ---------- */
.details {
  position: relative;
  grid-area: details;
  padding: 2rem 4rem;
  min-width: 0;
}

.details h2 {
  font-size: 3rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.details > section > h2 {
  margin: 0 0 4rem;
}

.details > section > h2::after {
  content: '';
  display: inline-block;
  margin-left: 2rem;
  height: 1px;
  background: #eee;
  flex-grow: 1;
}

.details > section {
  margin: 4rem auto;
}

.details > section.intro {
  margin-top: 0;
}

.details > section.intro > h2 {
  margin: 2.5rem 0 2rem;
}

.details > section.intro > h2::after {
  content: none;
}

.icon {
  font-size: 2.6rem;
  line-height: 1;
}

.details p {
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.35;
}

.details p:first-of-type {
  margin-top: 0;
}

.details p:last-of-type {
  margin-bottom: 0;
}

/* ---------- Timeline entry ---------- */
.entry {
  --dot-distance: 22px;
  display: grid;
  grid-template-columns: 180px 1fr;
}

.entry-meta {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 100%;
  padding: 1rem 2rem 2rem 0;
  box-sizing: border-box;
  text-align: right;
}

.entry-meta::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-secondary);
  position: absolute;
  top: 15px;
  right: -4px;
}

.entry-meta::after {
  content: '';
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 100%;
  background-color: var(--color-secondary);
  z-index: 1;
}

.entry:first-of-type > .entry-meta::after {
  top: var(--dot-distance);
  height: calc(100% - var(--dot-distance));
}

.entry:last-of-type > .entry-meta::after {
  background: linear-gradient(180deg, var(--color-secondary), transparent);
}

/* Logo + company name on one row, LinkedIn-style */
.company {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

/* Company logo next to the place name; .logo-mono stands in
   with initials when the company has no logo available */
.logo {
  display: block;
  box-sizing: border-box;
  width: 4rem;
  height: 4rem;
  flex-shrink: 0;
  margin: 0;
  padding: 2px;
  border: 1px solid #e3e8ec;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
}

.logo-mono {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.place {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-tertiary);
  opacity: 0.8;
}

.time {
  margin: 0 0 0.5rem;
  opacity: 0.8;
  font-size: 1.5rem;
  font-weight: 300;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  list-style: none;
  margin: 1rem 0;
  padding: 0;
}

.tags li {
  padding: 0.3rem 0.8rem;
  border-radius: 5px;
  background-color: #fff;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
}

.entry-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem 0 2rem 2rem;
}

.entry-body h3 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  font-weight: 600;
}

.entry-body .sub {
  margin: 0 0 1rem;
  font-size: 1.6rem;
  opacity: 0.8;
}

.entry-body .sub + p {
  margin-top: 0;
}

.links {
  display: flex;
  margin-top: 2rem;
}

.links a {
  font-size: 2rem;
  color: var(--color-primary);
  border-right: 1px solid #eee;
  padding: 0 1rem;
}

.links a:first-child {
  padding-left: 0;
}

.links a:last-child {
  border-right: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .cv {
    margin: 0;
    border-radius: 0;
    grid-template: 'side' auto 'details' auto / auto;
  }

  .side {
    padding: 3rem;
  }

  .avatar {
    width: 30%;
    padding-top: 30%;
  }

  .details {
    padding: 2rem 3rem;
  }

  .entry {
    position: relative;
    grid-template-columns: 1fr;
  }

  .entry-meta {
    position: static;
    align-items: flex-start;
    text-align: left;
    padding: 1rem 0 0 2rem;
  }

  .entry-meta::before {
    right: auto;
    left: -4px;
  }

  .entry-meta::after {
    right: auto;
    left: -1px;
  }

  .company {
    justify-content: flex-start;
  }

  .tags {
    justify-content: flex-start;
    margin-top: 0;
    margin-bottom: 2rem;
  }

  .entry-body {
    padding: 0 0 3rem 2rem;
  }

  .entry-body h3 {
    font-size: 2.2rem;
  }
}

@media (max-width: 720px) {
  .avatar {
    width: 40%;
    padding-top: 40%;
  }

  .side,
  .details {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media print {
  .lang-switch {
    display: none;
  }

  html,
  body {
    background: white;
  }

  .cv {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
  }

  .side {
    background-attachment: scroll;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
