/* ====== LIQUID GLASS ====== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", system-ui, sans-serif;
}

:root {
  --bg-dark: #06080f;
  --status-height-fallback: 44px;
  --status-bg-dark: #0b1220;
}

body {
  min-height: 100vh;
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;

  background: #0f131a;

  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);

  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

@supports (min-height: 100dvh) {
  body {
    min-height: 100dvh;
  }
}

/* ====== BACKGROUND ====== */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(circle at center, #19202f 0%, #0c0f16 90%);
}

.blob {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.65;
  transform: translate3d(0,0,0);
  mix-blend-mode: screen;
}

.b1 { 
  background: radial-gradient(circle at 30% 30%, #83c6ff, #6fb8ff 60%, transparent 70%); 
  top: -10%; 
  left: -10%; 
}
.b2 { 
  background: radial-gradient(circle at 60% 40%, #ffacac, #ff9ab0 50%, transparent 65%); 
  right: -15%; 
  top: 10%; 
}
.b3 { 
  background: radial-gradient(circle at 40% 60%, #b8ffb6, #a6ffb0 40%, transparent 65%); 
  left: 20%; 
  bottom: -10%; 
}

@media (min-width: 481px) {
  .blob {
    opacity: 0.65;
  }
  
  .b1 { 
    background: radial-gradient(circle at 30% 30%, #83c6ff, #6fb8ff 60%, transparent 70%); 
  }
  .b2 { 
    background: radial-gradient(circle at 60% 40%, #ffacac, #ff9ab0 50%, transparent 65%); 
  }
  .b3 { 
    background: radial-gradient(circle at 40% 60%, #b8ffb6, #a6ffb0 40%, transparent 65%); 
  }
}

.grain {
  position: absolute;
  inset: 0;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><filter id="n"><feTurbulence baseFrequency="0.8" numOctaves="2" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity="0.02"/></svg>');
  mix-blend-mode: overlay;
}

/* ====== GLASS PANEL ====== */
.card {
  width: 360px;
  max-width: calc(100% - 48px);
  padding: 40px 32px;
  border-radius: 20px;
  backdrop-filter: blur(12px) saturate(145%);
  -webkit-backdrop-filter: blur(12px) saturate(145%);
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 50px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.02);
  text-align: center;
  transition: background 0.3s, border 0.3s, transform 0.25s;
}

.card:hover { transform: translateY(-6px) scale(1.01); }

/* ====== AVATAR ====== */
.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 0 auto;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-image: url("../icons/avatar.webp");
  background-color: rgba(0,0,0,0.1);
  border: 2px solid rgba(255, 255, 255, 0.12);
  background-clip: padding-box;
  box-shadow: 0 10px 30px rgba(2,6,23,0.7), 0 2px 10px rgba(255,255,255,0.04), inset 0 1px 0 rgba(255,255,255,0.02);
}

.card .avatar { display: none; }

body.home .card .avatar {
  display: block !important;
  background-image: url("../icons/avatar.webp") !important;
}

.avatar-link {
  display: inline-block;
  border-radius: 50%;
  margin: 0 auto 6px auto;
  transition: transform 320ms cubic-bezier(.2,.9,.25,1), box-shadow 320ms cubic-bezier(.2,.9,.25,1);
  will-change: transform;
}

.avatar-link:focus {
  outline: none;
}

.avatar-link:focus-visible {
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12);
  border-radius: 50%;
}

.avatar-link:hover .avatar,
.avatar-link:focus-within .avatar {
  transform: translateY(-12px) scale(1.12) rotate(-2deg);
  box-shadow: 0 28px 60px rgba(2,6,23,0.55);
}

@keyframes avatar-pop {
  0% { transform: translateY(14px) scale(0.92) rotate(0deg); opacity: 0; }
  60% { transform: translateY(-6px) scale(1.15) rotate(-3deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
}

.avatar {
  transform-origin: center center;
  transition: transform 320ms cubic-bezier(.2,.9,.25,1), box-shadow 320ms cubic-bezier(.2,.9,.25,1);
  animation: avatar-pop 640ms cubic-bezier(.22,.9,.25,1) both;
}

@media (prefers-reduced-motion: reduce) {
  .avatar-link, .avatar {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}

/* ====== TEXT ====== */
.card h1 {
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: #f0f4f8;
}

.lead {
  margin-top: 6px;
  font-size: 0.95rem;
  opacity: 0.8;
  color: #f0f4f8;
}

/* ====== BUTTONS ====== */
.actions {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 28px;
}

body.browse .actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 28px;
  justify-items: center;
  align-items: center;
  width: 100%;
}

body.browse .actions-grid a {
  display: block;
  width: 100%;
}

body.browse .actions-grid button {
  width: 100%;
  max-width: 280px;
  justify-content: center;
}

body.browse .back-home {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  width: 100%;
}

@media (max-width: 480px) {
  body.browse .actions-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.browse .actions-grid a {
    display: inline-block;
    width: auto;
  }

  body.browse .actions-grid button {
    max-width: 280px;
    justify-content: center;
  }

  .btn-primary,
  .btn-secondary {
    background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06)) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255,255,255,0.14) !important;
    backdrop-filter: blur(6px) saturate(120%) !important;
    -webkit-backdrop-filter: blur(6px) saturate(120%) !important;
    box-shadow: 0 4px 10px rgba(2,6,23,0.12);
  }

  .btn-primary:hover,
  .btn-secondary:hover {
    background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08)) !important;
  }
}

a { text-decoration: none; color: inherit; }

a:focus {
  outline: 3px solid rgba(99,102,241,0.25);
  outline-offset: 3px;
  border-radius: 6px;
}

button {
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: 0.25s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary,
.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover,
.btn-primary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.actions button {
  transition: transform 320ms cubic-bezier(.22,.9,.25,1), box-shadow 320ms cubic-bezier(.22,.9,.25,1), background 220ms;
}

.actions button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(16,24,40,0.12);
}

.actions button.clicked {
  animation: btn-pop 360ms cubic-bezier(.2,.9,.3,1);
}

@keyframes btn-pop {
  0% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-1px) scale(0.97); }
  60% { transform: translateY(-2px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

/* ====== PAGE / CONTENT ENTRANCE ANIMATIONS ====== */
@keyframes enter-up {
  0% { opacity: 0; transform: translateY(10px); }
 100% { opacity: 1; transform: translateY(0); }
}

.card .content h1 {
  opacity: 0;
  animation: enter-up 420ms cubic-bezier(.2,.9,.3,1) both;
  animation-delay: 60ms;
}
.card .content .lead {
  opacity: 0;
  animation: enter-up 420ms cubic-bezier(.2,.9,.3,1) both;
  animation-delay: 120ms;
}

.actions a:nth-child(1) button,
.actions-grid a:nth-child(1) button { opacity: 0; animation: enter-up 420ms cubic-bezier(.2,.9,.3,1) both; animation-delay: 180ms; }
.actions a:nth-child(2) button,
.actions-grid a:nth-child(2) button { opacity: 0; animation: enter-up 420ms cubic-bezier(.2,.9,.3,1) both; animation-delay: 240ms; }
.actions a:nth-child(3) button,
.actions-grid a:nth-child(3) button { opacity: 0; animation: enter-up 420ms cubic-bezier(.2,.9,.3,1) both; animation-delay: 300ms; }
.actions a:nth-child(4) button,
.actions-grid a:nth-child(4) button { opacity: 0; animation: enter-up 420ms cubic-bezier(.2,.9,.3,1) both; animation-delay: 360ms; }

.back-home button { opacity: 0; animation: enter-up 420ms cubic-bezier(.2,.9,.3,1) both; animation-delay: 420ms; }

@media (prefers-reduced-motion: reduce) {
  .card .content h1,
  .card .content .lead,
  .actions button,
  .actions-grid button,
  .back-home button {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ====== RESPONSIVE ====== */
@media (max-width:480px) {
  .card { padding: 28px 20px; }
  .avatar { width: 100px; height: 100px; }
}

@media (max-width:480px) {
  .home .card,
  .browse .card,
  .error .card {
    padding: 44px 20px;
  }
}

/* ====== LICENSE STYLES ====== */
.license-section {
  color: rgba(255,255,255,0.95);
  max-width: 100%;
  max-height: 220px;
  overflow: auto;
  padding: 16px;
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  -webkit-overflow-scrolling: touch;
}

.license-heading {
  font-size: 1.05rem;
  margin-top: 12px;
  margin-bottom: 6px;
  color: #f8fafc;
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(0,0,0,0.45);
}

.license-list {
  list-style: none;
  padding-left: 0;
  margin-top: 10px;
}

.license-list li { margin: 8px 0; }

.license-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background .18s ease;
}

.license-link:hover { background: rgba(255,255,255,0.08); }

.license-text {
  font-weight: 600;
  color: rgba(255,255,255,0.95);
}

.cc-icons {
  display: inline-flex;
  gap: 6px;
  margin-left: 8px;
  align-items: center;
}

.cc-icon {
  width: 22px;
  height: 22px;
  display: inline-block;
  vertical-align: middle;
}

.license-section p,
.license-section li,
.license-section .license-text {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.95);
}

.license-section pre {
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.5;
  color: inherit;
}

@media (max-width: 480px) {
  .license-section {
    max-height: 160px;
    padding: 12px;
  }
}

@media (max-width:480px) {
  .bg {
    background: radial-gradient(circle at center, #18252d 0%, #071014 90%);
  }

  .blob {
    opacity: 0.55;
  }

  .card {
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.008) 100%);
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 12px 50px rgba(0,0,0,0.68), inset 0 1px 0 rgba(255,255,255,0.02);
  }

  .card h1 {
    color: #ffffff;
    text-shadow: 0 1px 0 rgba(0,0,0,0.5);
    font-size: 2rem;
    line-height: 1.15;
  }

  .lead {
    color: rgba(255,255,255,0.96);
    opacity: 0.96;
    font-size: 1.02rem;
    line-height: 1.45;
  }

  .card, .card * {
    color: rgba(255,255,255,0.96);
  }

  a, .license-link {
    color: rgba(255,255,255,0.95);
  }

  .actions button, .btn-primary, .btn-secondary {
    color: #ffffff;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
  }

  .license-section p,
  .license-section li,
  .license-section .license-text,
  .gh-loading, .gh-message, .gh-error,
  .gh-card, .gh-description {
    color: rgba(255,255,255,0.95);
    line-height: 1.5;
    font-size: 1rem;
  }
}

@media (max-width:360px) {
  .actions { gap: 12px; }
  .actions button {
    padding: 14px 20px;
    font-size: 1rem;
    border-radius: 14px;
    background-clip: padding-box;
    box-shadow: 0 10px 24px rgba(2,6,23,0.44), 0 1px 0 rgba(255,255,255,0.02) inset;
    -webkit-tap-highlight-color: transparent;
  }

  .btn-primary {
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.20);
    color: #ffffff;
  }
  .btn-secondary {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.16);
    color: #ffffff;
  }
}

/* ====== GITHUB PROJECTS VIEWER ====== */
.gh-repo-container {
  margin-top: 18px;
  text-align: left;
}

.gh-loading,
.gh-message,
.gh-error {
  color: rgba(255,255,255,0.85);
  padding: 12px 10px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
  text-align: center;
}

.gh-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 12px;
}

.gh-grid, .gh-card {
  min-width: 0;
}

.gh-card {
  word-wrap: break-word;
  overflow: hidden;
}

.gh-description {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.gh-card {
  padding: 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.04);
  box-shadow: 0 8px 20px rgba(2,6,23,0.45);
  transition: transform 200ms ease, box-shadow 200ms ease;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.gh-card:hover { transform: translateY(-6px); box-shadow: 0 12px 30px rgba(2,6,23,0.55); }

.gh-card {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.gh-fork-badge {
  font-size: 0.65rem;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.95);
  padding: 4px 8px;
  border-radius: 999px;
  margin-left: 0;
  font-weight: 600;
  vertical-align: middle;
}

.gh-title { 
  margin: 0 0 6px 0; 
  font-size: 1rem; 
  font-weight: 700; 
  color: #f8fafc; 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
}
.gh-link { color: inherit; text-decoration: none; }
.gh-description { color: rgba(255,255,255,0.88); font-size: 0.95rem; margin: 8px 0 12px 0; min-height: 48px; line-height: 1.35; }

.gh-meta { display: flex; gap: 10px; align-items: center; font-size: 0.88rem; color: rgba(255,255,255,0.75); justify-content: flex-start; }
.gh-meta .gh-stars, .gh-meta .gh-forks { display: inline-flex; gap: 6px; align-items: center; }

@media (max-width: 1100px) {
  .gh-grid { grid-template-columns: repeat(2, 1fr); }
  body.projects .card { width: 720px; }
}

@media (min-width: 1000px) {
  body.projects .card,
  body.license .card {
    width: calc(100% - 160px);
    max-width: 1200px;
    padding: 48px 40px;
    text-align: left;
    margin: 0 auto;
  }

  body.projects .card .gh-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }

  .gh-repo-container { max-height: none; overflow: visible; }
  body.license .license-section { max-height: none; overflow: visible; }
}

@media (max-width: 720px) {
  .gh-grid { grid-template-columns: 1fr; gap: 10px; }
  .card { width: calc(100% - 32px); padding: 20px; }
  body.projects .card,
  body.license .card { width: min(360px, calc(100% - 32px)); padding: 20px; margin: 0 auto; text-align: center; }
  .gh-card { padding: 14px; }

  body.projects .gh-repo-container {
    box-shadow: none;
    background: transparent;
    padding-right: 4px;
  }

  body.projects .gh-card {
    box-shadow: none;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 12px 14px;
    display: block;
    color: inherit;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
    -webkit-tap-highlight-color: transparent;
  }

  body.projects .gh-meta { gap: 12px; margin-top: 10px; }
  body.projects .gh-meta .gh-stars,
  body.projects .gh-meta .gh-forks {
    background: rgba(255,255,255,0.10);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: none;
    min-height: 38px;
  }

  body.projects .gh-description { font-size: 0.98rem; color: rgba(255,255,255,0.92); }

  body.projects .gh-loading,
  body.projects .gh-message,
  body.projects .gh-error {
    box-shadow: none;
    border: 1px solid rgba(255,255,255,0.02);
    background: rgba(255,255,255,0.02);
  }

  body.projects .gh-card:hover,
  body.projects .gh-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(16,24,40,0.12);
    background: rgba(255,255,255,0.14);
    outline: none;
  }

  body.projects .gh-card .gh-title { color: #ffffff; font-weight: 700; font-size: 1.02rem; }

  body.projects .gh-fork-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 4px;
    margin-left: 0;
    background: rgba(255,255,255,0.10);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 999px;
    line-height: 1;
    vertical-align: middle;
  }
}

  @media (max-width: 480px) {
  .card { width: calc(100% - 24px); padding: 16px; }
  body.projects .card { width: calc(100% - 24px); padding: 16px; }
  .gh-grid { gap: 8px; }
  .gh-card { padding: 10px; min-height: auto; }
  .gh-description { font-size: 0.9rem; min-height: auto; }
  .gh-title { font-size: 0.98rem; }
}

.gh-repo-container {
  margin-top: 18px;
  text-align: left;
  max-height: 420px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 6px;
}

body.license .license-section {
  max-height: 420px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.gh-repo-container::-webkit-scrollbar,
body.license .license-section::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.gh-repo-container::-webkit-scrollbar-thumb,
body.license .license-section::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
}
.gh-repo-container::-webkit-scrollbar-track,
body.license .license-section::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 720px) {
  .gh-repo-container { max-height: min(360px, 60vh); }
  body.license .license-section { max-height: min(340px, 55vh); }
}

body.projects .card {
  width: 360px;
  max-width: calc(100% - 48px);
  padding: 40px 32px;
  margin: 0 auto;
  text-align: center;
}

body.projects .card .gh-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

body.projects .card .content h1,
body.projects .card .content .lead {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

body.projects .card .content .lead {
  display: block;
  max-width: 700px;
}

body.license .card {
  width: 360px;
  max-width: calc(100% - 48px);
  padding: 40px 32px;
  margin: 0 auto;
  text-align: center;
}

body.license .license-section {
  padding: 18px;
}

@media (max-width: 900px) {
  body.license .card { width: 720px; }
}

@media (max-width: 720px) {
  body.license .card { width: calc(100% - 40px); }
  body.license .license-section { padding: 12px; }
}

body.license .card .content h1,
body.license .card .content .lead {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

body.license .card .content .lead {
  max-width: 760px;
  display: block;
}

@media (min-width: 1000px) {
  body.projects .card,
  body.license .card {
    width: calc(100% - 160px);
    max-width: 1200px;
    padding: 48px 40px;
    margin: 0 auto;
    text-align: left;
  }

  body.projects .card .gh-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }

  .gh-repo-container { max-height: none; overflow: visible; }
  body.license .license-section { max-height: none; overflow: visible; }
}