/* =========================================================
   INFO DRAWER (.info-drawer)
   "Sobre este portafolio": purpose, visual kit, repos, stack,
   thanks. Left edge on wide screens (next to the avatar that
   opens it), bottom sheet on narrow ones.
   Same visual language as .exp-drawer (experience-drawer.css).
   The close button reuses .dialog-close (popup.css).
========================================================= */

.info-drawer {
  /* reset dialog defaults (UA) */
  position: fixed;
  inset: 0 auto 0 0;
  width: min(30rem, 100vw);
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line-color);
  border-radius: 0;
  overflow: hidden;

  color: var(--accent-color);
  font-family: var(--font-body);
  line-height: var(--lh-base);

  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  box-shadow: 1rem 0 3rem rgba(0, 0, 0, 0.08);

  &[open] {
    display: flex;
    flex-direction: column;
  }

  &::backdrop {
    background: var(--overlay-color);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

.dark .info-drawer {
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 1rem 0 3rem rgba(0, 0, 0, 0.3);
}

.info-drawer__close {
  top: 1rem;
  right: 1rem;
  i {
    font-size: 1.5rem;
  }
}

/* ---------- Scrollable content ---------- */
.info-drawer__inner {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4.5rem clamp(1.5rem, 4vw, 2.5rem) 2rem;
}

.info-drawer__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;

  h2 {
    margin: 0;
    font-size: var(--fs-3);
  }
}

/* crop, background and ring: .avatar-crop (styles.css), same as the header .avatar-btn */
.info-drawer__avatar {
  flex: none;
  width: 3.25rem;
}

.info-drawer__block {
  padding-block: 1.25rem;
  border-top: 1px solid var(--line-color);

  h3 {
    margin-bottom: 0.5rem;
    font-size: var(--fs-7);
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-muted);
  }

  p {
    margin-bottom: 0;
    font-size: var(--fs-7);
    color: color-mix(in srgb, var(--accent-color) 86%, transparent);
    text-wrap: pretty;
    /* links in running text (e.g. "Gracias"): same look as the credits' links */
    a {
      color: var(--link-color);
      text-underline-offset: 0.2em;
    }
  }
}

/* temporary content, remove the class when the final text lands */
.info-drawer__placeholder {
  font-style: italic;
  opacity: 0.6;
}

.info-drawer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Small secondary action inside panels (.link-btn): shared by the drawers, the CV footer and the kit */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.4em 0.85em;
  font: inherit;
  font-size: var(--fs-8);
  font-weight: 500;
  color: var(--accent-color);
  text-decoration: none;
  background: var(--surface-light-color);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-chip);
  cursor: pointer;
  transition: background 0.2s ease-out;

  &:hover {
    background: var(--surface-color);
  }
  &:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
  }
  /* link without a URL yet (placeholder, "próximamente"): not interactive */
  &:is(a):not([href]) {
    opacity: 0.55;
    cursor: default;
    &:hover {
      background: var(--surface-light-color);
    }
  }
}

/* main action of a panel (e.g. the CV's download): accent fill, one per context,
   same treatment as .hero__cta--primary and the form's submit */
.link-btn--primary {
  color: #fff;
  background: var(--form-accent);
  border-color: var(--form-accent);
  transition: opacity 0.2s ease-out;
  &:hover {
    background: var(--form-accent);
    opacity: 0.85;
  }
}

/* same look as .badge in the experience drawer */
.info-drawer__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;

  li {
    margin: 0;
    padding: 0.15em 0.65em;
    font-size: var(--fs-9);
    font-weight: 500;
    line-height: 1.5;
    border: 1px solid var(--line-color);
    border-radius: 1em;
  }
}

/* ---------- Lab: experimental switch ---------- */
.info-drawer__switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
  font-size: var(--fs-8);
  font-weight: 500;
  cursor: pointer;

  /* visually hidden, still focusable and announced as a switch */
  input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
  }
}

.info-drawer__switch-track {
  position: relative;
  flex: none;
  width: 2.25rem;
  height: 1.25rem;
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: 100vw;
  transition: background 0.2s ease-out;

  &::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0.15rem;
    width: 0.85rem;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0.6;
    transform: translateY(-50%);
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
  }
}

.info-drawer__switch input:checked + .info-drawer__switch-track {
  background: var(--form-accent);
  &::before {
    opacity: 1;
    transform: translate(1rem, -50%);
  }
}

.info-drawer__switch input:focus-visible + .info-drawer__switch-track {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ---------- Credits ---------- */
.info-drawer__credits {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-8);

  li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0;
    padding-block: 0.35rem;
    > span:first-child {
      color: var(--text-muted);
    }
  }

  a {
    color: var(--link-color);
    text-underline-offset: 0.2em;
  }
}

.info-drawer__footer {
  padding: 0.75rem clamp(1.5rem, 4vw, 2.5rem);
  border-top: 1px solid var(--line-color);

  p {
    margin: 0;
    font-size: var(--fs-9);
    color: var(--text-muted);
  }
}

/* Lab (custom cursors): only useful with a mouse, so never on mobile or touch */
@media (max-width: 600px), (pointer: coarse) {
  .info-drawer__lab {
    display: none;
  }
}

/* ---------- Narrow screens: bottom sheet ---------- */
@media (max-width: 600px) {
  .info-drawer {
    inset: auto 0 0 0;
    width: 100%;
    height: auto;
    max-height: 88dvh;
    border-right: 0;
    border-top: 1px solid var(--line-color);
    border-radius: 1.25rem 1.25rem 0 0;
    box-shadow: 0 -1rem 3rem rgba(0, 0, 0, 0.12);
  }
  .info-drawer__inner {
    padding-top: 3.5rem;
  }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .info-drawer[open] {
    animation: info-drawer-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  @media (max-width: 600px) {
    .info-drawer[open] {
      animation-name: info-drawer-up;
    }
  }
}

@keyframes info-drawer-in {
  from {
    opacity: 0;
    transform: translateX(-2rem);
  }
}

@keyframes info-drawer-up {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
}
