/* ==========================================================================
   Design Tokens & CSS Variables (Monochrome System)
   ========================================================================== */
:root {
  /* Typography */
  --font-sans: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.35s cubic-bezier(0.16, 1, 0.3, 1);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

/* Dark Mode Tokens (Default) */
[data-theme="dark"] {
  --bg-body: #09090b;
  --bg-surface: #121215;
  --bg-card: #18181b;
  --bg-card-hover: #222226;
  --bg-subtle: #27272a;

  --border-subtle: #27272a;
  --border-strong: #3f3f46;
  --border-focus: #71717a;

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;

  --accent-solid: #ffffff;
  --accent-invert: #000000;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.7);

  --grid-line: rgba(255, 255, 255, 0.035);
  --pulse-dot-bg: #22c55e;
  --avatar-border: #27272a;
}

/* Light Mode Tokens */
[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-subtle: #e2e8f0;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #64748b;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;

  --accent-solid: #0f172a;
  --accent-invert: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);

  --grid-line: rgba(0, 0, 0, 0.035);
  --pulse-dot-bg: #16a34a;
  --avatar-border: #e2e8f0;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* Subtle Geometric Grid */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 50% 25%, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 25%, black 40%, transparent 80%);
  z-index: 0;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  background-color: rgba(9, 9, 11, 0.75);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

[data-theme="light"] .site-header {
  background-color: rgba(248, 250, 252, 0.8);
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 26px;
  height: 26px;
  background-color: var(--accent-solid);
  color: var(--accent-invert);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.logo-text {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background-color: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background-color: var(--bg-card);
}

/* Theme Toggle Visibility */
[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}
[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}
[data-theme="light"] .theme-toggle .sun-icon {
  display: none;
}
[data-theme="light"] .theme-toggle .moon-icon {
  display: block;
}

/* ==========================================================================
   Main Container
   ========================================================================== */
.main-container {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Profile Hero Section
   ========================================================================== */
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.avatar-wrapper {
  position: relative;
  width: 112px;
  height: 112px;
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--avatar-border);
  box-shadow: var(--shadow-md);
  filter: grayscale(100%) contrast(105%);
  transition: filter var(--transition-normal), border-color var(--transition-normal);
}

.avatar-img:hover {
  filter: grayscale(0%);
}

.status-indicator {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  background-color: var(--pulse-dot-bg);
  border: 2.5px solid var(--bg-body);
  border-radius: var(--radius-full);
}

.profile-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--pulse-dot-bg);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.profile-title {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.profile-handle {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
}

.profile-reading {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
}

.profile-tagline {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.profile-bio {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 460px;
  line-height: 1.65;
  margin-top: 0.35rem;
}

/* ==========================================================================
   Links Section
   ========================================================================== */
.links-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  font-weight: 600;
  padding-left: 0.25rem;
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-spring);
  position: relative;
  overflow: hidden;
}

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

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.link-card:hover .card-icon {
  transform: scale(1.05);
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex-grow: 1;
}

.card-label {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.card-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.card-arrow {
  color: var(--text-tertiary);
  transition: transform var(--transition-spring), color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-card:hover .card-arrow {
  color: var(--text-primary);
  transform: translateX(3px);
}

/* ==========================================================================
   About & Focus Section
   ========================================================================== */
.about-section {
  display: flex;
  flex-direction: column;
}

.info-card {
  padding: 1.5rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.info-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.tag:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background-color: var(--bg-surface);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 1.25rem;
  background-color: var(--bg-body);
}

.footer-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.footer-domain {
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* ==========================================================================
   Modal & QR Code
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 340px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transform: scale(0.94);
  transition: transform var(--transition-spring);
}

.modal-backdrop.is-open .modal-window {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0 0.25rem;
  transition: color var(--transition-fast);
}

.close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.qr-canvas-box {
  width: 180px;
  height: 180px;
  background-color: #ffffff;
  padding: 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.qr-canvas-box svg {
  width: 100%;
  height: 100%;
}

.qr-url-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.primary-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background-color: var(--accent-solid);
  color: var(--accent-invert);
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.primary-btn:hover {
  opacity: 0.9;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: var(--accent-solid);
  color: var(--accent-invert);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-spring);
  z-index: 120;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 480px) {
  .main-container {
    padding-top: 2rem;
    gap: 2.25rem;
  }

  .profile-title {
    font-size: 1.85rem;
  }

  .avatar-wrapper {
    width: 96px;
    height: 96px;
  }

  .link-card {
    padding: 0.875rem 1rem;
    gap: 0.875rem;
  }

  .card-icon {
    width: 38px;
    height: 38px;
  }
}
