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

:root {
  --bg: #1a1a1a;
  --surface: #222;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #d65d0e;
  --accent-dim: #92400e;
  --radius: 8px;
}

.light {
  --bg: #f5f5f0;
  --surface: #eaeae5;
  --border: #d4d4d0;
  --text: #1a1a1a;
  --text-muted: #888;
  --accent: #d65d0e;
  --accent-dim: #b84a0a;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

::selection {
  background: var(--accent);
  color: #fff;
}

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

/* === Layout === */
.page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 2rem 0;
}

/* === Tabs === */
.tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.tab-btn {
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
}

/* === Panels === */
.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.panel-title {
  font-size: 1.6rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1rem;
}

.accent {
  color: var(--accent);
}

/* === Links panel === */
.hero-name {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.hero-links {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: color 0.2s, transform 0.2s;
}

.social-username {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.4em;
}

/* === About panel === */
.about-text {
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto 1.75rem;
}

.about-text a {
  color: var(--accent);
}

/* === Tech Stack === */
.tech-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.tech-strip .icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.tech-strip svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  color: var(--text-muted);
}

.tech-dot {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
}

/* === GitHub Activity === */
#github-activity {
  display: flex;
  justify-content: center;
}

.gh-activity {
  font-size: 0.7rem;
  text-align: left;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.gh-activity--compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gh-activity-header {
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
}

.gh-activity-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gh-row {
  display: flex;
  align-items: center;
  gap: 1px;
}

.gh-day-label {
  width: 14px;
  font-size: 0.55rem;
  color: var(--text-muted);
  text-align: right;
  padding-right: 2px;
  flex-shrink: 0;
}

.gh-cell {
  width: 10px;
  height: 10px;
  border-radius: 1.5px;
  flex-shrink: 0;
}

.gh-lvl-0 { background: #222; }
.gh-lvl-1 { background: #92400e; }
.gh-lvl-2 { background: #b84a0a; }
.gh-lvl-3 { background: #d65d0e; }
.gh-lvl-4 { background: #f97316; }

.light .gh-lvl-0 { background: #ebedf0; }
.light .gh-lvl-1 { background: #fbbf8f; }
.light .gh-lvl-2 { background: #f0924a; }
.light .gh-lvl-3 { background: #d65d0e; }
.light .gh-lvl-4 { background: #92400e; }

.gh-months {
  display: flex;
  gap: 1px;
  margin-top: 3px;
  padding-left: 16px;
  overflow: hidden;
}

.gh-month-label {
  width: 10px;
  font-size: 0.55rem;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}

.gh-legend {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.6rem;
}

.gh-legend .gh-cell {
  width: 10px;
  height: 10px;
}

/* === Projects list === */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  max-width: 480px;
  margin: 0 auto;
  text-align: left;
}

.project-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.project-row:last-child {
  border-bottom: none;
}

.project-row .name {
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-link {
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.site-link--na {
  border-color: var(--border);
  color: var(--text-muted);
  cursor: default;
}

.loading {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* === Footer === */
.footer {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem 0 0.5rem;
}

.footer-pill {
  display: inline-block;
  padding: 0.6rem 0.6rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
}

.footer-btn {
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.footer-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  margin: 0 0.6rem;
  vertical-align: middle;
}

/* === Modal === */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  padding: 1.5rem;
  text-align: center;
}

.modal-box h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.modal-box p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.friends-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.friend-link {
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}

/* === Time modal === */
.time-box {
  max-width: 480px;
}

.modal-box .time-big {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.time-big svg {
  flex-shrink: 0;
  color: var(--text);
}

.time-big time {
  font-variant-numeric: tabular-nums;
}

.time-utc {
  color: var(--accent);
}

.modal-box .time-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0;
}

/* === Theme Toggle === */
.theme-toggle {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  font-size: 1.1rem;
  line-height: 1;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* === Hover states (skip on touch so taps don't leave a stuck highlight) === */
@media (hover: hover) and (pointer: fine) {
  .tab-btn:hover {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
  }

  .social-link:hover {
    color: var(--accent);
    transform: translateY(-2px);
  }

  .about-text a:hover {
    text-decoration: underline;
  }

  .tech-strip .icon-wrap:hover svg {
    color: var(--accent);
  }

  .project-row .name:hover {
    color: var(--accent);
  }

  .site-link:hover {
    background: var(--accent);
    color: #fff;
  }

  .footer-btn:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
  }

  .friend-link:hover {
    background: var(--accent);
    color: #fff;
  }

  .theme-toggle:hover {
    border-color: var(--accent-dim);
    color: var(--text);
  }
}

/* === Responsive === */
@media (max-width: 700px) {
  .page {
    padding: 1.25rem 1.5rem;
  }

  .hero-name {
    font-size: 2.4rem;
  }
}

@media (max-width: 540px) {
  .page {
    padding: 1rem;
  }

  .hero-name {
    font-size: 2.2rem;
  }

  .theme-toggle {
    bottom: 0.75rem;
    right: 0.75rem;
  }
}
