/* =========================================================================
   PANTALLES: Sobre mi, Projectes, Detall, Contacte, Ajustos i Visor
   ========================================================================= */

/* =========================== SOBRE MI =========================== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--brand-violet), var(--brand-magenta), var(--brand-coral));
  color: #fff;
  text-align: center;
}
.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 108px; height: 108px;
  margin: 0 auto;
  border-radius: 50%;
  background: #fff;
  border: 5px solid rgba(255, 255, 255, .4);
  background-clip: padding-box;
  box-shadow: 0 6px 18px rgba(40, 0, 90, .25);
  color: var(--brand-violet);
  font-size: 38px;
  font-weight: 700;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero-text { position: relative; }
.hero-name { margin-top: 18px; font-size: 28px; font-weight: 700; line-height: 1.2; }
.hero-role { margin-top: 4px; font-size: 16px; font-weight: 500; opacity: .95; }
.hero .pill-glass { margin-top: 12px; }
.hero-actions { display: flex; gap: 12px; margin-top: 22px; }
.hero-actions .btn { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  border-radius: 20px;
  text-align: center;
}
.stat strong { font-size: 28px; font-weight: 700; line-height: 1.3; }
.stat span { font-size: 12px; font-weight: 500; line-height: 1.35; }

/* Habilitats: una per fila, amb logotip, nom i nivell */
.skill-list { display: grid; gap: 4px; padding: 10px; list-style: none; }
.skill {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-rows: auto auto;
  column-gap: 14px; row-gap: 6px; align-items: center;
  padding: 10px; border-radius: var(--r-sm);
}
.skill .skill-logo { grid-row: 1 / span 2; }
.skill.no-level .skill-logo { grid-row: 1; }
.skill-name { font-size: 15px; font-weight: 600; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.skill-pct { color: var(--on-variant); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.skill-bar { grid-column: 2 / -1; height: 6px; border-radius: 3px; background: var(--surface-high); overflow: hidden; }
.skill-bar > span {
  display: block; width: var(--lvl); height: 100%; border-radius: 3px; background: var(--primary);
  transform-origin: left center; animation: skill-grow .9s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes skill-grow { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .skill-bar > span { animation: none; } }
/* Ordinador: cada habilitat en una sola línia (logotip · nom · barra · percentatge) */
@media (min-width: 720px) {
  .skill-list { padding: 12px 16px; }
  .skill { grid-template-columns: 40px minmax(140px, 220px) minmax(0, 1fr) 52px; grid-template-rows: auto; column-gap: 18px; }
  .skill .skill-logo, .skill.no-level .skill-logo { grid-row: auto; }
  .skill-bar { grid-column: 3; grid-row: 1; height: 8px; border-radius: 4px; }
  .skill-bar > span { border-radius: 4px; }
  .skill-pct { grid-column: 4; grid-row: 1; text-align: right; }
  .skill.no-level { grid-template-columns: 40px minmax(0, 1fr); }
}

/* Ordinador: capçalera horitzontal i dues columnes */
@media (min-width: 840px) {
  .hero {
    display: flex;
    align-items: center;
    gap: 36px;
    padding: 44px 48px;
    text-align: left;
  }
  .avatar { width: 152px; height: 152px; font-size: 54px; margin: 0; flex: none; }
  .hero-name { margin-top: 0; font-size: clamp(36px, 4.4vw, 52px); letter-spacing: -.02em; line-height: 1.05; }
  .hero-role { font-size: 20px; margin-top: 8px; }
  .hero-actions { margin-top: 24px; }
  .hero-actions .btn { flex: none; min-height: 48px; padding: 0 24px 0 20px; font-size: 15px; }
  .deco-a { width: 340px; height: 340px; right: -90px; top: -150px; }
  .stat { padding: 22px 12px; }
  .stat strong { font-size: 36px; }
  .stat span { font-size: 14px; }
}

/* =========================== PROJECTES =========================== */
.filters {
  display: flex;
  gap: 8px;
  margin: 16px -16px 0;
  padding: 0 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--outline);
  border-radius: 10px;
  color: var(--on-variant);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.filter-chip .icon { width: 18px; height: 18px; color: var(--primary); }
.filter-chip:hover { background: var(--surface-low); }
.filter-chip[aria-pressed="true"] {
  background: var(--secondary-container);
  border-color: var(--secondary-container);
  color: var(--on-secondary-container);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 16px;
  margin-top: 16px;
}
.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface-low);
  cursor: pointer;
  transition: background-color .15s;
}
.project-card:hover { background: var(--surface); }
.project-card:focus-within { outline: 3px solid var(--primary); outline-offset: 2px; }
.project-card:focus-within .card-title a:focus-visible { outline: none; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 16px 20px 12px; }
.card-title { font-size: 22px; font-weight: 700; line-height: 1.25; }
.card-summary {
  margin: 4px 0 10px;
  color: var(--on-variant);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  margin-top: auto;
  padding-top: 10px;
}

/* =========================== DETALL =========================== */
.detail-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  margin: -16px -16px 8px;
  padding: 0 8px;
  background: var(--bg);
  transition: background-color .2s;
}
.detail-bar-title { font-size: 20px; font-weight: 500; opacity: 0; transition: opacity .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-bar.show-title { background: var(--surface); }
.detail-bar.show-title .detail-bar-title { opacity: 1; }

.banner-detail { height: 180px; border-radius: var(--r-lg); }
.banner-detail .banner-icon { width: 76px; height: 76px; }

/* Galeria: una targeta per captura, separades i amb vora */
.gallery { margin: 0 -16px; }
.shots {
  display: flex;
  gap: 12px;
  padding: 0 20px 4px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 20px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.shots::-webkit-scrollbar { display: none; }
.shot { flex: none; scroll-snap-align: center; }
.shot-btn {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--outline);
  border-radius: 20px;
  background: var(--surface-high);
  cursor: zoom-in;
}
.shot-btn img { height: 340px; width: auto; max-width: calc(100vw - 80px); object-fit: contain; }
.shots.is-single { padding: 0 16px; }
.shot.is-single { width: 100%; }
.shot.is-single .shot-btn { width: 100%; }
.shot.is-single .shot-btn img { width: 100%; height: auto; max-width: none; max-height: 420px; object-fit: cover; }
.shot-num { position: absolute; left: 10px; top: 10px; }
.zoom-badge {
  position: absolute;
  right: 10px; bottom: 10px;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(21, 19, 40, .62);
  color: #fff;
}
.zoom-badge .icon { width: 18px; height: 18px; }

.gallery-nav { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 10px; }
.gallery-arrow { display: none; width: 40px; height: 40px; color: var(--on-variant); }
.gallery-arrow .icon { width: 26px; height: 26px; }
@media (hover: hover) and (pointer: fine) { .gallery-arrow { display: inline-grid; } }
.dots { display: flex; justify-content: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--outline-variant); transition: width .2s, background-color .2s; }
.dot.is-active { width: 22px; background: var(--primary); }
.hint { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 8px; color: var(--on-variant); font-size: 12px; font-weight: 500; }
.hint .icon { width: 16px; height: 16px; }

.detail-info { padding: 0 4px; }
.meta { margin-top: 20px; color: var(--primary); font-size: 14px; font-weight: 700; }
.detail-title { margin-top: 2px; font-size: clamp(26px, 3.4vw, 36px); font-weight: 700; line-height: 1.2; }
.detail-desc { margin-top: 12px; color: var(--on-variant); font-size: 16px; line-height: 1.65; max-width: 62ch; }
.detail-info .btn-xl { width: 100%; margin-top: 20px; }
.detail-links { display: flex; gap: 12px; margin-top: 22px; }
.detail-links .btn { flex: 1; }

.empty { display: grid; justify-items: start; gap: 16px; padding: 24px; margin-top: 16px; }

/* Ordinador: galeria a l'esquerra i informació a la dreta */
@media (min-width: 840px) {
  .detail-bar { position: static; margin: -8px 0 16px -12px; padding: 0; height: auto; background: none !important; }
  .detail-bar-title { display: none; }
  .detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; align-items: start; }
  .detail-media { position: sticky; top: calc(var(--bar-h) + 24px); }
  .gallery { margin: 0; }
  .shots { padding: 0 0 6px; scroll-padding: 0; }
  .shots.is-single { padding: 0; }
  .shot { scroll-snap-align: start; }
  .shot-btn img { height: 460px; max-width: 560px; }
  .shot.is-single .shot-btn img { max-height: 520px; }
  .banner-detail { height: 320px; }
  .meta { margin-top: 4px; }
  .detail-info .btn-xl { width: auto; min-width: 280px; }
  .detail-links .btn { flex: none; min-width: 160px; }
}

/* =========================== CONTACTE =========================== */
.contact-hero {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--brand-teal), var(--brand-blue), var(--brand-violet));
  color: #fff;
}
.glass-icon {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
}
.glass-icon .icon { width: 28px; height: 28px; }
.contact-title { position: relative; margin-top: 16px; font-size: 28px; font-weight: 700; }
.contact-sub { position: relative; margin-top: 6px; font-size: 16px; line-height: 1.5; opacity: .95; max-width: 52ch; }
.contact-hero .btn { position: relative; margin-top: 20px; color: var(--brand-blue); }

.contact-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.contact-list > li { min-width: 0; }
.contact-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--surface-low);
  transition: background-color .15s;
}
a.contact-row:hover { background: var(--surface); }
.row-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; flex: none; }
.row-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-label { color: var(--on-variant); font-size: 12px; font-weight: 500; }
.row-value { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-chevron { width: 20px; height: 20px; color: var(--on-variant); }

@media (min-width: 840px) {
  .contact-hero { padding: 44px 48px; }
  .contact-title { font-size: 44px; letter-spacing: -.02em; }
  .contact-sub { font-size: 18px; }
  .contact-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =========================== AJUSTOS =========================== */
.page-settings { max-width: 720px; }
.lang-list { display: grid; gap: 12px; }
.lang-option {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--surface-low);
  text-align: left;
  transition: background-color .15s;
}
.lang-option:hover { background: var(--surface); }
.lang-option.is-selected {
  background: var(--primary-container);
  box-shadow: inset 0 0 0 2px var(--primary);
  cursor: default;
}
.flag {
  width: 48px; height: 48px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid var(--outline-variant);
}
.flag svg { display: block; width: 100%; height: 100%; }
.lang-text { display: flex; flex-direction: column; flex: 1; }
.lang-name { font-size: 16px; font-weight: 700; }
.lang-sub { color: var(--on-variant); font-size: 14px; }
.lang-check { width: 28px; height: 28px; color: var(--primary); }

.about-app { display: flex; align-items: center; gap: 16px; padding: 16px; }
.app-badge {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-violet), var(--brand-magenta), var(--brand-coral));
  color: #fff;
}
.about-name, .about-version { display: block; }
.about-name { font-weight: 700; }
.about-version { color: var(--on-variant); font-size: 14px; }

/* =========================== VISOR =========================== */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--viewer-bg);
  color: #fff;
  opacity: 0;
  transform: scale(.96);
  transition: opacity .2s, transform .2s;
}
.viewer.is-open { opacity: 1; transform: none; }
.viewer-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
}
.viewer-stage.is-zoomed { cursor: grab; }
.viewer-stage.is-zoomed:active { cursor: grabbing; }
.viewer-img {
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}
.viewer-top {
  position: absolute;
  left: 0; right: 0; top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 28px 8px;
  background: linear-gradient(180deg, rgba(14, 12, 28, .8), rgba(14, 12, 28, 0));
}
.viewer-title { flex: 1; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: none;
  place-items: center;
  width: 52px; height: 52px;
  margin-top: -26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
}
.viewer-nav:hover { background: rgba(255, 255, 255, .24); }
.viewer-nav .icon { width: 30px; height: 30px; }
.viewer-prev { left: 20px; }
.viewer-next { right: 20px; }
.viewer.is-single .viewer-nav, .viewer.is-single .viewer-counter { display: none; }
.viewer-hint {
  position: absolute;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: 2;
  padding: 8px 14px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  text-align: center;
  transition: opacity .4s;
}
.viewer-hint.is-hidden { opacity: 0; }
@media (hover: hover) and (pointer: fine) {
  .viewer-nav { display: grid; }
}

/* Imatge pròpia d'una categoria (en lloc de la icona) */
.cat-img { display: block; object-fit: contain; border-radius: 8px; }
.banner .cat-img.banner-icon { position: relative; width: 72px; height: 72px; }
.banner-detail .cat-img.banner-icon { width: 88px; height: 88px; }
.filter-chip .cat-img { width: 20px; height: 20px; border-radius: 4px; }
