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

/* Remove iOS tap flash; eliminate 300ms delay on tappable elements */
a, button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* === Dark theme (default) === */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --accent-1: #FF6600;
  --accent-2: #AAFF00;
  --bg: #0B0B0F;
  --surface: rgba(255, 255, 255, 0.07);
  --surface-hover: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(255, 102, 0, 0.38);
  --text-1: #F2F2F0;
  --text-2: #88888C;
  --glow-1: rgba(255, 102, 0, 0.14);
  --glow-2: rgba(170, 255, 0, 0.11);
  --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.18);
  --card-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.22);
  --icon-hover-bg: rgba(255, 102, 0, 0.12);
  --icon-hover-border: rgba(255, 102, 0, 0.22);
  --spotlight: rgba(255, 255, 255, 0.055);
  --gradient: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
}

/* === Light theme === */
[data-theme="light"] {
  color-scheme: light;
  --accent-1: #2563EB;
  --accent-2: #38BDF8;
  --bg: #EFF2FF;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-hover: rgba(255, 255, 255, 0.88);
  --border: rgba(0, 0, 0, 0.08);
  --border-accent: rgba(37, 99, 235, 0.30);
  --text-1: #0D1117;
  --text-2: #6B7080;
  --glow-1: rgba(37, 99, 235, 0.11);
  --glow-2: rgba(56, 189, 248, 0.09);
  --card-shadow: 0 2px 16px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --icon-hover-bg: rgba(37, 99, 235, 0.10);
  --icon-hover-border: rgba(37, 99, 235, 0.22);
  --spotlight: rgba(37, 99, 235, 0.05);
  --gradient: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
}

/* === Layout tokens (theme-agnostic) === */
:root {
  --radius: 18px;
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

/* === Base === */
/* html background fills window.outerHeight (full screen incl. behind Liquid Glass bars) on iOS 26 */
html {
  height: 100%;
  height: -webkit-fill-available;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  transition: background-color 0.35s ease;
}

body {
  background: transparent;
  color: var(--text-1);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  transition: color 0.35s ease;
}

/* === Language toggle button === */
.lang-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 68px);
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.2s ease,
    background-color 0.35s ease,
    border-color 0.35s ease,
    transform 0.25s var(--ease-spring),
    box-shadow 0.2s ease;
  opacity: 0;
  animation: fadeIn 0.4s var(--ease-spring) 0.9s both;
}

.lang-toggle:hover {
  color: var(--text-1);
  background: var(--surface-hover);
  border-color: var(--border-accent);
  transform: scale(1.1);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent-1) 18%, transparent);
}

.lang-toggle:active {
  transform: scale(0.95);
}

.lang-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

/* === Theme toggle button === */
.theme-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 16px);
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.2s ease,
    background-color 0.35s ease,
    border-color 0.35s ease,
    transform 0.25s var(--ease-spring),
    box-shadow 0.2s ease;
  opacity: 0;
  animation: fadeIn 0.4s var(--ease-spring) 0.9s both;
}

.theme-toggle:hover {
  color: var(--text-1);
  background: var(--surface-hover);
  border-color: var(--border-accent);
  transform: scale(1.1);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent-1) 18%, transparent);
}

.theme-toggle:active {
  transform: scale(0.95);
}

[data-theme="light"] .theme-toggle {
  color: var(--text-1);
}

/* Icon visibility: default/dark → sun shown; light → moon shown */
.icon-moon                  { display: none; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: none; }

/* === Ambient glow === */
.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  transition: opacity 0.35s ease;
}

.glow::before,
.glow::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}

.glow::before {
  width: 700px;
  height: 700px;
  top: -280px;
  left: -180px;
  background: radial-gradient(ellipse at center, var(--glow-1) 0%, transparent 65%);
  filter: blur(2px);
  transition: background 0.35s ease;
}

.glow::after {
  width: 600px;
  height: 600px;
  bottom: -200px;
  right: -160px;
  background: radial-gradient(ellipse at center, var(--glow-2) 0%, transparent 65%);
  filter: blur(2px);
  transition: background 0.35s ease;
}

/* === Layout === */
/* padding-top: content starts just below the status bar so it scrolls behind Liquid Glass bars.
   padding-bottom: large enough that the last item can scroll clear of the bottom bar. */
.container {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding-top: max(24px, calc(env(safe-area-inset-top, 0px) + 16px));
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-bottom: max(64px, calc(env(safe-area-inset-bottom, 0px) + 40px));
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* === Profile === */
.profile {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  width: 100%;
  margin-bottom: 44px;
  opacity: 0;
  animation: profileIn 0.5s var(--ease-spring) 0.05s both;
}

/* Modern square frame — gradient border, squircle radius */
.avatar-frame {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  background: var(--gradient);
  padding: 2.5px;
  flex-shrink: 0;
  display: flex;
  box-shadow:
    0 0 20px color-mix(in srgb, var(--accent-1) 20%, transparent),
    0 0 48px color-mix(in srgb, var(--accent-2) 8%, transparent);
  transition: box-shadow 0.35s ease;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 15.5px;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.profile-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--text-1);
  transition: color 0.35s ease;
}

.bio {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.6;
  transition: color 0.35s ease;
}

/* === Links === */
.links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 40px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  text-decoration: none;
  color: var(--text-1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition:
    transform 0.28s var(--ease-spring),
    background-color 0.35s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    color 0.35s ease;
  opacity: 0;
  animation: fadeUp 0.4s var(--ease-spring) both;
}

.link-card[data-i="0"] { animation-delay: 0.18s; }
.link-card[data-i="1"] { animation-delay: 0.24s; }
.link-card[data-i="2"] { animation-delay: 0.30s; }
.link-card[data-i="3"] { animation-delay: 0.36s; }
.link-card[data-i="4"] { animation-delay: 0.42s; }

/* Mouse spotlight */
.link-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    180px circle at var(--mx, 50%) var(--my, 50%),
    var(--spotlight),
    transparent 80%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: inherit;
}

/* Gradient left accent bar */
.link-card::after {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.link-card:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
  border-color: var(--border-accent);
  box-shadow: var(--card-shadow-hover);
}

.link-card:hover::before { opacity: 1; }
.link-card:hover::after  { opacity: 1; }
.link-card:active        { transform: translateY(0); }

/* Icon pill — supports emoji text or <img> */
.lc-icon {
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.link-card:hover .lc-icon {
  background: var(--icon-hover-bg);
  border-color: var(--icon-hover-border);
}

/* Logo image inside icon — contained with padding (for brand logos) */
.lc-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 4px;
}

/* Full-bleed image variant — add class="lc-icon lc-icon--photo" */
.lc-icon--photo {
  padding: 0;
  border-color: transparent;
}

.lc-icon--photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* === Hero card — full-bleed image with text overlay === */
/* Usage: add class="link-card link-card--hero" and put an <img class="hero-img"> inside */
.link-card--hero {
  padding: 0;
  min-height: 132px;
  align-items: flex-end;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: #111; /* fallback while image loads */
}

.link-card--hero .hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease-spring);
}

.link-card--hero:hover .hero-img {
  transform: scale(1.04);
}

/* Gradient scrim — ensures text is always legible over any photo */
.link-card--hero .hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.18) 55%,
    transparent 100%
  );
}

.link-card--hero .lc-text {
  position: relative;
  z-index: 1;
  padding: 16px 20px;
  gap: 3px;
}

.link-card--hero .lc-label {
  color: #fff;
}

.link-card--hero .lc-sub {
  color: rgba(255, 255, 255, 0.7);
}

.link-card--hero .lc-arrow {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.6);
  margin-right: 20px;
  margin-bottom: 18px;
  align-self: flex-end;
}

.link-card--hero:hover .lc-arrow {
  color: #fff;
  transform: translateX(4px);
}

/* Text block */
.lc-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lc-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
  transition: color 0.35s ease;
}

.lc-sub {
  font-size: 0.75rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.35s ease;
}

/* Arrow */
.lc-arrow {
  flex-shrink: 0;
  color: var(--text-2);
  transition:
    color 0.2s ease,
    transform 0.28s var(--ease-spring);
}

.link-card:hover .lc-arrow {
  color: var(--accent-1);
  transform: translateX(4px);
}

/* === Social icons === */
.socials {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: fadeUp 0.4s var(--ease-spring) 0.52s both;
}

.social-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  transition:
    color 0.2s ease,
    background-color 0.35s ease,
    border-color 0.2s ease,
    transform 0.25s var(--ease-spring);
}

.social-icon:hover {
  color: var(--accent-1);
  background: var(--surface-hover);
  border-color: var(--border-accent);
  transform: translateY(-3px);
}

/* === Legal footer links === */
.legal-links {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  opacity: 0;
  animation: fadeUp 0.4s var(--ease-spring) 0.60s both;
}

.legal-links a {
  font-size: 0.75rem;
  color: var(--text-2);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.legal-links a:hover { color: var(--text-1); }

.legal-links span {
  font-size: 0.75rem;
  color: var(--text-2);
  opacity: 0.4;
}

/* === Legal pages (imprint / privacy) === */
.legal-page {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding-top: max(40px, calc(env(safe-area-inset-top, 0px) + 24px));
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  padding-bottom: max(80px, calc(env(safe-area-inset-bottom, 0px) + 48px));
}

.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--accent-1);
  text-decoration: none;
  margin-bottom: 48px;
  transition: gap 0.2s ease, color 0.2s ease;
}
.legal-back:hover { gap: 10px; }

.legal-page h1 {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--text-1);
  margin-bottom: 6px;
  transition: color 0.35s ease;
}

.legal-updated {
  font-size: 0.75rem;
  color: var(--text-2);
  margin-bottom: 40px;
  transition: color 0.35s ease;
}

.legal-page h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
  margin-top: 36px;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  transition: color 0.35s ease;
}

.legal-page p,
.legal-page li {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 12px;
  transition: color 0.35s ease;
}

.legal-page ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.legal-page a {
  color: var(--accent-1);
  text-decoration: none;
}
.legal-page a:hover { text-decoration: underline; }

.legal-placeholder {
  background: color-mix(in srgb, var(--accent-1) 8%, transparent);
  border: 1px dashed color-mix(in srgb, var(--accent-1) 30%, transparent);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.8rem;
  color: var(--accent-1);
  font-style: italic;
}

/* === Focus visible (keyboard nav / accessibility) === */
:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 3px;
}

/* Override outline to follow element shape */
.link-card:focus-visible {
  outline-offset: 2px;
  border-radius: var(--radius);
}

.social-icon:focus-visible,
.theme-toggle:focus-visible {
  outline-offset: 2px;
  border-radius: 50%;
}

.legal-back:focus-visible,
.legal-links a:focus-visible,
.legal-page a:focus-visible {
  border-radius: 3px;
}

/* === Keyframes === */
@keyframes profileIn {
  from { opacity: 0; transform: translateY(-14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)     scale(1);    }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0);    }
}

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

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* === Mobile === */
@media (max-width: 480px) {
  .container {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }

  .name {
    font-size: 1.3rem;
  }

  .avatar-frame {
    width: 70px;
    height: 70px;
    border-radius: 15px;
  }

  .avatar {
    border-radius: 12.5px;
  }
}
