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

ul {
  list-style: none;
}

/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Layout (shared) */
  --gap: 10px;
  --r-card: 22px;
  --r-icon: 12px;
  --max-w: 480px;
  --glass-blur: 16px;

  /* Accent (shared) */
  --blue: #0a84ff;
  --purple: #bf5af2;
  --teal: #64d2ff;

  /* Brand colours (shared) */
  --c-instagram: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  --c-x: #000;
  --c-note: #41c9b4;
  --c-runtrip: #3AB483;
  --c-strava: #FC4C02;
  --c-youtube: #FF0000;
  --c-spotify: #1DB954;
}

/* ── Dark Theme ────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #050510;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-raised: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.10);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #48484a;
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --card-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --mesh-opacity: 1;
}

/* ── Light Theme ───────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f2f2f7;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-raised: rgba(0, 0, 0, 0.04);
  --border: rgba(0, 0, 0, 0.08);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --card-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  --card-inset: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --mesh-opacity: 0.5;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
html {
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 14px 48px;
  position: relative;
  overflow-x: hidden;
}

/* ── Animated Mesh Gradient Background ─────────────────────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(10, 132, 255, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 30%, rgba(191, 90, 242, 0.15) 0%, transparent 55%),
    radial-gradient(ellipse 55% 45% at 50% 85%, rgba(100, 210, 255, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 40% 50% at 10% 70%, rgba(255, 104, 53, 0.08) 0%, transparent 50%);
  animation: meshShift 12s ease-in-out infinite alternate;
  opacity: var(--mesh-opacity);
}

@keyframes meshShift {
  0% {
    transform: scale(1) translate(0, 0);
    opacity: 1;
  }

  33% {
    transform: scale(1.1) translate(2%, -3%);
    opacity: 0.9;
  }

  66% {
    transform: scale(1.05) translate(-2%, 2%);
    opacity: 1;
  }

  100% {
    transform: scale(1.15) translate(3%, -1%);
    opacity: 0.85;
  }
}

/* Noise texture overlay for premium feel */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ── Bento Grid ─────────────────────────────────────────────────────────── */
.bento {
  width: 100%;
  max-width: var(--max-w);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "profile   profile"
    "instagram x"
    "note      runtrip"
    "strava    youtube"
    "spotify   spotify"
    "teaser    teaser";
  gap: var(--gap);
}

/* ── Card base — glassmorphism ──────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--card-shadow), var(--card-inset);
  animation: cardEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.card:nth-child(1) {
  animation-delay: 0.0s;
}

.card:nth-child(2) {
  animation-delay: 0.08s;
}

.card:nth-child(3) {
  animation-delay: 0.14s;
}

.card:nth-child(4) {
  animation-delay: 0.20s;
}

.card:nth-child(5) {
  animation-delay: 0.26s;
}

.card:nth-child(6) {
  animation-delay: 0.32s;
}

.card:nth-child(7) {
  animation-delay: 0.38s;
}

.card:nth-child(8) {
  animation-delay: 0.44s;
}

.card:nth-child(9) {
  animation-delay: 0.50s;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.95);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* ── Profile ────────────────────────────────────────────────────────────── */
.card--profile {
  grid-area: profile;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 20px;
  background:
    radial-gradient(ellipse 60% 80% at 0% 0%, rgba(10, 132, 255, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 100% 100%, rgba(191, 90, 242, 0.08) 0%, transparent 50%),
    var(--surface);
}

/* .avatar styles moved below with .avatar-wrap */

.profile-info {
  min-width: 0;
  /* prevent text overflow blowout */
  display: flex;
  flex-direction: column;
  gap: 0;
}

.name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.name-roman {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-2);
  margin-left: 4px;
  letter-spacing: 0;
}

.tagline {
  font-size: 11px;
  color: var(--text-2);
  font-style: italic;
  margin-bottom: 7px;
}

.bio {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 11px;
}

.pbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 10px 3px 8px;
}

.pb__label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--blue);
}

.pb__time {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Link cards ─────────────────────────────────────────────────────────── */
.card--link {
  display: flex;
  flex-direction: column;
  padding: 16px 16px 18px;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.25s ease,
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.card--link:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.card--instagram:hover {
  box-shadow: 0 8px 32px rgba(225, 48, 108, 0.15), 0 0 0 1px rgba(225, 48, 108, 0.2);
}

.card--x:hover {
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.card--note:hover {
  box-shadow: 0 8px 32px rgba(65, 201, 180, 0.15), 0 0 0 1px rgba(65, 201, 180, 0.2);
}

.card--runtrip:hover {
  box-shadow: 0 8px 32px rgba(58, 180, 131, 0.15), 0 0 0 1px rgba(58, 180, 131, 0.2);
}

.card--strava:hover {
  box-shadow: 0 8px 32px rgba(252, 76, 2, 0.15), 0 0 0 1px rgba(252, 76, 2, 0.2);
}

.card--youtube:hover {
  box-shadow: 0 8px 32px rgba(255, 0, 0, 0.15), 0 0 0 1px rgba(255, 0, 0, 0.2);
}

.card--spotify:hover {
  box-shadow: 0 8px 32px rgba(29, 185, 84, 0.15), 0 0 0 1px rgba(29, 185, 84, 0.2);
}

.card--link:active {
  transform: scale(0.97);
}

.card--link:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Grid area assignment */
.card--instagram {
  grid-area: instagram;
}

.card--x {
  grid-area: x;
}

.card--note {
  grid-area: note;
}

.card--runtrip {
  grid-area: runtrip;
}

.card--strava {
  grid-area: strava;
}

.card--youtube {
  grid-area: youtube;
}

.card--spotify {
  grid-area: spotify;
}

.link-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

/* Brand icon badge */
.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.brand-icon svg {
  width: 20px;
  height: 20px;
}

.card--instagram .brand-icon {
  background: var(--c-instagram);
}

.card--x .brand-icon {
  background: var(--c-x);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.card--note .brand-icon {
  background: var(--c-note);
}

.card--runtrip .brand-icon {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.card--strava .brand-icon {
  background: var(--c-strava);
}

.card--youtube .brand-icon {
  background: var(--c-youtube);
}

.card--spotify .brand-icon {
  background: var(--c-spotify);
}

/* ── Brand-icon glow (dark mode) ─────────────────────────────────────── */
[data-theme="dark"] .card--instagram .brand-icon {
  box-shadow: 0 2px 12px rgba(225, 48, 108, 0.45), 0 4px 24px rgba(225, 48, 108, 0.18);
}

[data-theme="dark"] .card--x .brand-icon {
  box-shadow: 0 2px 12px rgba(255, 255, 255, 0.18), 0 4px 24px rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] .card--note .brand-icon {
  box-shadow: 0 2px 12px rgba(65, 201, 180, 0.45), 0 4px 24px rgba(65, 201, 180, 0.18);
}

[data-theme="dark"] .card--runtrip .brand-icon {
  box-shadow: 0 2px 12px rgba(58, 180, 131, 0.45), 0 4px 24px rgba(58, 180, 131, 0.18);
}

[data-theme="dark"] .card--strava .brand-icon {
  box-shadow: 0 2px 12px rgba(252, 76, 2, 0.45), 0 4px 24px rgba(252, 76, 2, 0.18);
}

[data-theme="dark"] .card--youtube .brand-icon {
  box-shadow: 0 2px 12px rgba(255, 0, 0, 0.45), 0 4px 24px rgba(255, 0, 0, 0.18);
}

[data-theme="dark"] .card--spotify .brand-icon {
  box-shadow: 0 2px 12px rgba(29, 185, 84, 0.45), 0 4px 24px rgba(29, 185, 84, 0.18);
}

/* ── Brand-icon glow (light mode — subtle) ───────────────────────────── */
[data-theme="light"] .card--instagram .brand-icon {
  box-shadow: 0 2px 10px rgba(225, 48, 108, 0.22);
}

[data-theme="light"] .card--note .brand-icon {
  box-shadow: 0 2px 10px rgba(65, 201, 180, 0.22);
}

[data-theme="light"] .card--runtrip .brand-icon {
  box-shadow: 0 2px 10px rgba(58, 180, 131, 0.22);
}

[data-theme="light"] .card--strava .brand-icon {
  box-shadow: 0 2px 10px rgba(252, 76, 2, 0.22);
}

[data-theme="light"] .card--youtube .brand-icon {
  box-shadow: 0 2px 10px rgba(255, 0, 0, 0.22);
}

[data-theme="light"] .card--spotify .brand-icon {
  box-shadow: 0 2px 10px rgba(29, 185, 84, 0.22);
}

.link-arrow {
  font-size: 14px;
  color: var(--text-3);
  line-height: 1;
}

.link-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}

.link-desc {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.55;
}

/* ── Teaser card ────────────────────────────────────────────────────────── */
.card--teaser {
  grid-area: teaser;
  padding: 26px 22px;
  background:
    radial-gradient(ellipse 55% 70% at 94% 6%, rgba(10, 132, 255, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 10% 90%, rgba(191, 90, 242, 0.10) 0%, transparent 50%),
    var(--surface);
  transition: box-shadow 0.3s ease;
}

.card--teaser:hover {
  box-shadow:
    0 8px 32px rgba(10, 132, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.teaser-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 132, 255, 0.12);
  border: 1px solid rgba(10, 132, 255, 0.22);
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  margin-bottom: 14px;
}

.teaser-badge__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.2;
  }
}

.teaser-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 9px;
}

.teaser-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.75;
  max-width: 290px;
}

.teaser-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 20px;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-3);
}

.dot--active {
  width: 14px;
  border-radius: 100px;
  background: var(--blue);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  margin-top: 22px;
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
}

.footer-credit {
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-3);
  opacity: 0.6;
}

/* ── Responsive: wider (≥ 600px) ────────────────────────────────────────── */
@media (min-width: 600px) {
  :root {
    --r-card: 26px;
  }

  .bento {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas:
      "profile   profile   profile"
      "instagram x         note"
      "runtrip   strava    youtube"
      "spotify   teaser    teaser";
  }
}

/* ── Responsive: very small (≤ 340px) ───────────────────────────────────── */
@media (max-width: 340px) {
  .card--profile {
    flex-direction: column;
  }

  .name {
    font-size: 18px;
    white-space: normal;
  }
}

/* ── Light theme overrides ─────────────────────────────────────────────── */
[data-theme="light"] .card--x .brand-icon {
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .card--link:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .avatar {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.12), rgba(191, 90, 242, 0.12));
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 0 20px rgba(10, 132, 255, 0.08);
}

[data-theme="light"] .pb {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] body::after {
  opacity: 0.015;
}

/* ── Shimmer sweep on link card hover ──────────────────────────────────── */
.card--link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.07) 50%,
    transparent 70%
  );
  transform: translateX(-160%);
  pointer-events: none;
}

.card--link:hover::before {
  animation: shimmerSweep 0.6s ease forwards;
}

@keyframes shimmerSweep {
  to {
    transform: translateX(160%);
  }
}

/* ── Brand icon micro-animation ─────────────────────────────────────────── */
.brand-icon {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card--link:hover .brand-icon {
  transform: scale(1.15) rotate(-6deg);
}

/* ── Link arrow travel ──────────────────────────────────────────────────── */
.link-arrow {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), color 0.25s ease;
}

.card--link:hover .link-arrow {
  transform: translate(3px, -3px);
  color: var(--text-2);
}

/* ── Avatar pulse ring ──────────────────────────────────────────────────── */
.avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 68px;
  height: 68px;
  border-radius: 50%;
}

.avatar-wrap::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(10, 132, 255, 0.5);
  animation: avatarRingPulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes avatarRingPulse {
  0%, 100% {
    opacity: 0.7;
    transform: scale(1);
  }
  55% {
    opacity: 0;
    transform: scale(1.22);
  }
}

.avatar {
  flex-shrink: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.2), rgba(191, 90, 242, 0.2));
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 20px rgba(10, 132, 255, 0.15);
}

/* ── Torch-light: mouse-position radial highlight ───────────────────────── */
.card--link {
  --mouse-x: 50%;
  --mouse-y: 50%;
}

.card--link:hover {
  background:
    radial-gradient(circle 90px at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.05), transparent 70%),
    var(--surface);
}

[data-theme="light"] .card--link:hover {
  background:
    radial-gradient(circle 90px at var(--mouse-x) var(--mouse-y), rgba(0, 0, 0, 0.03), transparent 70%),
    rgba(0, 0, 0, 0.02);
}

/* ── Theme Toggle ──────────────────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  z-index: 100;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.toggle-track {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 14px;
  border: 1px solid var(--border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--card-shadow);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.15s ease,
    border-radius 0.15s ease,
    background 0.3s ease,
    color 0.3s ease;
}

.toggle-icon {
  position: absolute;
  width: 12px;
  height: 12px;
  transition: opacity 0.2s ease;
}

/* Dark mode */
[data-theme="dark"] .toggle-track {
  background: rgba(8, 8, 28, 0.88);
}

[data-theme="dark"] .toggle-knob {
  transform: translateX(26px);
  background: rgba(60, 80, 200, 0.55);
  color: #b8ccff;
}

[data-theme="dark"] .icon-sun  { opacity: 0; }
[data-theme="dark"] .icon-moon { opacity: 1; }

/* Light mode */
[data-theme="light"] .toggle-track {
  background: rgba(255, 246, 210, 0.92);
  border-color: rgba(180, 120, 0, 0.18);
}

[data-theme="light"] .toggle-knob {
  transform: translateX(0);
  background: rgba(240, 165, 0, 0.92);
  color: #5a3300;
}

[data-theme="light"] .icon-sun  { opacity: 1; }
[data-theme="light"] .icon-moon { opacity: 0; }

/* Interaction */
.theme-toggle:hover .toggle-knob {
  filter: brightness(1.12);
}

.theme-toggle:active .toggle-knob {
  width: 24px;
  border-radius: 10px;
}

.theme-toggle:focus-visible .toggle-track {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}