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

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

.skip-link {
  background: var(--card);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  left: -9999px;
  padding: 12px 20px;
  position: absolute;
  text-decoration: none;
  top: 20px;
  z-index: 999;
}

.skip-link:focus { left: 20px; }

:root {
  --bg:                #f5f5f7;
  --card:              #ffffff;
  --text:              #1d1d1f;
  --secondary:         #6e6e73;
  --separator:         rgba(0, 0, 0, 0.1);
  --btn-bg:            #ffffff;
  --btn-text:          #1d1d1f;
  --btn-hover:         #e5e5ea;
  --card-fade:         rgba(255, 255, 255, 0.82);

  --pad: 60px;
  --gap:      12px;
  --radius:   20px;
  --sat:      env(safe-area-inset-top);
  --sab:      env(safe-area-inset-bottom);

  --wb:       #663BFF;
  --cof:      #CF2729;
  --unt:      #00853E;
  --rfs:      #1d1d1f;
  --rhhs:     #01A9EF;
  --cristina: #553C84;
  --beto:     #333333;
  --mochila:  #C23824;
  --palmagent:#007AFF;
  --lumon:    #05B4EE;
  --macrodata:#3685F0;
  --optics:   #02967F;
  --dish:     #162D59;
  --congress: #B31942;
  --badt:     #EB1470;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:                #000000;
    --card:              #1d1d1f;
    --text:              #f5f5f7;
    --separator:         rgba(255, 255, 255, 0.1);
    --btn-bg:            #1d1d1f;
    --btn-text:          #f5f5f7;
    --btn-hover:         #2d2d2f;
    --card-fade:         rgba(29, 29, 31, 0.82);
  }

  .li-logo-invert { filter: invert(1); }

  .flip-overlay span {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow:
      inset 0 1.5px 0 rgba(255, 255, 255, 0.45),
      inset 0 -1px 0 rgba(0, 0, 0, 0.2),
      0 6px 20px rgba(0, 0, 0, 0.35),
      0 1px 3px rgba(0, 0, 0, 0.2);
  }
}

.wb        { color: var(--wb); }
.cof       { color: var(--cof); }
.macadmins { background: linear-gradient(135deg, #5EBD3E 0%, #FFB900 23.66%, #F78200 35.33%, #E23838 49.99%, #973999 67.66%, #009CDF 79.22%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rfs       { color: var(--rfs); }
.rhhs      { color: var(--rhhs); }
.unt       { color: var(--unt); }
.cristina  { color: var(--cristina); }
.beto      { color: var(--beto); }
.mochila   { color: var(--mochila); }
.palmagent { color: var(--palmagent); }
.lumon     { color: var(--lumon); }
.macrodata { color: var(--macrodata); }
.optics    { color: var(--optics); }
.dish      { color: var(--dish); }
.congress  { color: var(--congress); }
.badt      { color: var(--badt); }

body {
  -webkit-font-smoothing: antialiased;
  align-items: flex-start;
  background: var(--bg);
  color: var(--text);
  display: flex;
  font-family: system-ui, sans-serif;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--pad) 20px;
  padding-bottom: max(var(--pad), calc(var(--pad) + var(--sab)));
  padding-top: max(var(--pad), calc(var(--pad) + var(--sat)));
}

.wrap {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-top: 84px;
  max-width: 50vw;
  position: relative;
  width: 100%;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
}

.card-front { padding: 36px; }

.flip-spacer { height: 48px; }

.card-profile {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 40px 32px;
  text-align: center;
}

.portrait {
  border-radius: 50%;
  display: block;
  height: 96px;
  object-fit: cover;
  object-position: top center;
  width: 96px;
}

.bio p {
  font-size: 17px;
  letter-spacing: -0.022em;
  line-height: 1.6;
  text-align: center;
  text-wrap: pretty;
}

.bio a { font-weight: 600; text-decoration: none; }
.bio a:hover { text-decoration: underline; }

.card h2 {
  color: var(--secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.card ul { list-style: none; }

.card ul li {
  border-bottom: 0.5px solid var(--separator);
  color: var(--text);
  font-size: 15px;
  letter-spacing: -0.016em;
  line-height: 1.45;
  padding: 16px 0;
}

.card ul li:first-child { padding-top: 0; }
.card ul li:last-child  { border-bottom: none; padding-bottom: 0; }

.card-front ul li { font-weight: 600; }

.card ul li a { font-weight: 600; text-decoration: none; }
.card ul li a:hover { text-decoration: underline; }

.now-playing {
  align-items: center;
  background: linear-gradient(180deg, #d2d2d2 0%, #b6b6b6 100%);
  bottom: calc(100% + var(--gap));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 1px 4px rgba(0,0,0,0.25);
  display: grid;
  gap: var(--gap);
  grid-template-columns: 52px 1fr;
  left: 0;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: absolute;
  right: 0;
  transform: translateY(var(--gap));
  transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.now-playing.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.now-playing img {
  aspect-ratio: 1;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  cursor: pointer;
  object-fit: cover;
  transition: border-radius 0.7s ease,
              box-shadow 0.7s ease,
              width 0.7s ease;
  width: 52px;
}

.now-playing img.hidden { display: none; }

.now-playing .meta {
  background: #d6ddb4;
  border-radius: 4px;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.2), 0 1px 0 rgba(255,255,255,0.5);
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
  padding: 8px 12px;
  position: relative;
  transition: height 0.7s ease;
}

.now-playing .meta::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.1) 50%, transparent 50%);
  border-radius: inherit;
  content: '';
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.now-playing .label {
  color: rgba(0,0,0,0.38);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.now-playing .title,
.now-playing .artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-playing .title  { color: #1a1a1a; font-size: 14px; font-weight: 700; }
.now-playing .artist { color: #3a3a3a; font-size: 12px; }

.fn {
  border-bottom: 1px dashed currentColor;
  cursor: help;
}

.fn:focus { outline: none; }

.fn-tip {
  background: var(--text);
  border-radius: 8px;
  color: var(--card);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  opacity: 0;
  padding: 6px 10px;
  pointer-events: none;
  position: fixed;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  z-index: 100;
}

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.card-flip {
  animation: fadein 1s ease 1.2s both;
  cursor: pointer;
  perspective: 1200px;
}

.card-flip-inner {
  display: grid;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-flip.flipped .card-flip-inner { transform: rotateY(180deg); }

.card-face {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  grid-area: 1 / 1;
  overflow: hidden;
  position: relative;
}

.card-back {
  display: flex;
  flex-direction: column;
  inset: 0;
  position: absolute;
  transform: rotateY(180deg);
}

.scroll-wrap {
  -ms-overflow-style: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.scroll-wrap::-webkit-scrollbar { display: none; }

.scroll-fade {
  background: linear-gradient(to top, var(--card-fade) 20%, transparent);
  border-radius: 0 0 var(--radius) var(--radius);
  bottom: 0;
  height: 72px;
  left: 0;
  position: absolute;
  right: 0;
}

.flip-overlay {
  -webkit-appearance: none;
  align-items: flex-end;
  appearance: none;
  background: linear-gradient(to top, var(--card-fade) 40%, transparent);
  border: none;
  border-radius: 0 0 var(--radius) var(--radius);
  bottom: 0;
  cursor: pointer;
  display: flex;
  font: inherit;
  justify-content: center;
  left: 0;
  opacity: 0;
  padding: 48px 20px 20px;
  position: absolute;
  right: 0;
  transition: opacity 0.2s ease;
  width: 100%;
}

.flip-overlay:hover,
.flip-overlay:focus-visible { opacity: 1; }

.flip-overlay span {
  -webkit-backdrop-filter: blur(28px) saturate(2.2) brightness(1.12);
  backdrop-filter: blur(28px) saturate(2.2) brightness(1.12);
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 100px;
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.82),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06),
    inset 1px 0 0 rgba(255, 255, 255, 0.35),
    inset -1px 0 0 rgba(255, 255, 255, 0.18),
    0 6px 20px rgba(0, 0, 0, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.08);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 6px 14px;
  position: relative;
}

.flip-overlay span::before {
  background: linear-gradient(165deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.1) 40%, transparent 65%);
  border-radius: inherit;
  content: '';
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.li-logo-item {
  align-items: center;
  display: flex;
  gap: 16px;
}

.li-logo {
  border-radius: 12px;
  flex-shrink: 0;
  height: 64px;
  overflow: hidden;
  width: 64px;
}

.li-logo-sm {
  border-radius: 6px;
  height: 32px;
  width: 32px;
}

.li-logo img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.card-links {
  animation: fadein 1s ease 2.2s both;
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(3, 1fr);
}

.card-btn {
  align-items: center;
  background: var(--btn-bg);
  border-radius: var(--radius);
  color: var(--btn-text);
  display: flex;
  font-size: 14px;
  font-weight: 600;
  justify-content: center;
  letter-spacing: -0.016em;
  padding: 18px 12px;
  text-decoration: none;
  transition: background 0.15s;
}

.card-btn:hover { background: var(--btn-hover); }

.card-btn.workbrew { background: var(--wb); color: #ffffff; }
.card-btn.workbrew:hover { background: #5530d4; }

.now-playing.expanded {
  align-items: center;
  grid-template-columns: auto 1fr;
}

.now-playing.expanded .meta {
  align-self: end;
}

.now-playing.expanded img {
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}


@media (prefers-reduced-motion: reduce) {
  .card-flip,
  .card-links        { animation: none; }
  .card-flip-inner,
  .now-playing,
  .now-playing img,
  .now-playing .meta { transition: none; }
}

@media (max-width: 768px) {
  body {
    padding: 32px 16px;
    padding-bottom: max(32px, calc(32px + var(--sab)));
    padding-top: max(32px, calc(32px + var(--sat)));
  }
  .wrap        { max-width: 90vw; }
  .card        { padding: 20px; }
  .card-front  { padding: 24px; }
  .card-profile { padding: 28px 20px; }
  .card-links  { grid-template-columns: 1fr; }
  .scroll-wrap { padding: 16px 0; }
  .flip-overlay { opacity: 1; }
  .flip-overlay span {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: none;
    border: none;
    box-shadow: none;
    color: var(--secondary);
    filter: none;
    font-weight: 500;
    opacity: 0.75;
  }
  .flip-overlay span::before { display: none; }
}
