/* ─── Reset ─────────────────────────────────────────────────────────────── */

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

/* ─── Base ──────────────────────────────────────────────────────────────── */

:root {
  --font: "ui-monospace", "SFMono-Regular", "SF Mono", "Cascadia Mono",
          "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace",
          "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New",
          monospace;
  --fg:       #111111;
  --bg:       #ffffff;
  --muted:    #666666;
  --link:     #111111;
  --link-hover: #000000;
  --border:   #e0e0e0;
  --max-width: 850px;
  --font-size: 18px;
  --line-height: 1.75;
}

[data-theme="dark"] {
  --fg:       #e0e0e0;
  --bg:       #1a1a1a;
  --muted:    #999999;
  --link:     #e0e0e0;
  --link-hover: #ffffff;
  --border:   #333333;
}

html {
  font-size: var(--font-size);
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: var(--font);
  line-height: var(--line-height);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  -webkit-font-smoothing: antialiased;
}

/* ─── Links ─────────────────────────────────────────────────────────────── */

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--fg);
}

/* ─── Header / Nav ──────────────────────────────────────────────────────── */

header {
  margin-bottom: 3rem;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-left > a {
  font-weight: bold;
  font-size: 1rem;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-left > a:hover {
  text-decoration: underline;
  text-decoration-color: var(--fg);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--fg);
}

[data-theme="dark"] .icon-sun { display: inline; filter: invert(1); }
[data-theme="dark"] .icon-moon { display: none; }
:root:not([data-theme="dark"]) .icon-sun { display: none; }
:root:not([data-theme="dark"]) .icon-moon { display: inline; }

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--fg);
}

/* ─── Main content ──────────────────────────────────────────────────────── */

main {
  min-height: 60vh;
}

/* ─── About section ─────────────────────────────────────────────────────── */

.about {
  margin-bottom: 3rem;
}

.about .bio p {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.7;
}

.about .bio .asapp-link {
  color: #7ef4f4;
  text-decoration-color: #7ef4f4;
}

.about .bio .asapp-link:hover {
  color: #7ef4f4;
  text-decoration-color: #7ef4f4;
}

.quote {
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--border);
  font-style: italic;
}

.quote p {
  margin: 0;
  font-size: 1rem;
  color: var(--fg);
}

.quote cite {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: normal;
}

/* ─── Timeline section ──────────────────────────────────────────────────── */

.timeline-wrapper {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: 3rem;
  margin-bottom: 3rem;
  padding: 4rem 0;
  background: linear-gradient(180deg, transparent 0%, rgba(126, 244, 244, 0.03) 50%, transparent 100%);
  overflow-x: auto;
  overflow-y: visible;
}

.timeline-container {
  position: relative;
  min-width: 100%;
  padding: 0 2rem;
  height: 180px;
}

.timeline-line {
  position: absolute;
  top: 50%;
  left: 2rem;
  right: 2rem;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #7ef4f4 10%, #7ef4f4 90%, transparent 100%);
  transform: translateY(-50%);
}

.timeline-items {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: max-content;
  gap: 1.5rem;
  padding: 0 1rem;
  height: 100%;
  position: relative;
}

.timeline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  top: 50%;
  min-width: 90px;
}

/* Position items along the timeline */
.timeline-item:nth-child(1) { left: 1%; }
.timeline-item:nth-child(2) { left: 9%; }
.timeline-item:nth-child(3) { left: 17%; }
.timeline-item:nth-child(4) { left: 24%; }
.timeline-item:nth-child(5) { left: 32%; }
.timeline-item:nth-child(6) { left: 39%; }
.timeline-item:nth-child(7) { left: 47%; }
.timeline-item:nth-child(8) { left: 54%; }
.timeline-item:nth-child(9) { left: 62%; }
.timeline-item:nth-child(10) { left: 69%; }
.timeline-item:nth-child(11) { left: 77%; }
.timeline-item:nth-child(12) { left: 84%; }
.timeline-item:nth-child(13) { left: 92%; }

/* Above items - dot on line, content above */
.timeline-item.above {
  flex-direction: column;
  transform: translateY(-50%);
}

.timeline-item.above .timeline-content {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
}

/* Below items - dot on line, content below */
.timeline-item.below {
  flex-direction: column;
  transform: translateY(-50%);
}

.timeline-item.below .timeline-content {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
}

.timeline-dot {
  width: 10px;
  height: 10px;
  background: #7ef4f4;
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px #7ef4f4;
  z-index: 2;
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.2s);
}

.timeline-item:nth-child(1) .timeline-dot { --i: 0; }
.timeline-item:nth-child(2) .timeline-dot { --i: 1; }
.timeline-item:nth-child(3) .timeline-dot { --i: 2; }
.timeline-item:nth-child(4) .timeline-dot { --i: 3; }
.timeline-item:nth-child(5) .timeline-dot { --i: 4; }
.timeline-item:nth-child(6) .timeline-dot { --i: 5; }
.timeline-item:nth-child(7) .timeline-dot { --i: 6; }
.timeline-item:nth-child(8) .timeline-dot { --i: 7; }
.timeline-item:nth-child(9) .timeline-dot { --i: 8; }
.timeline-item:nth-child(10) .timeline-dot { --i: 9; }
.timeline-item:nth-child(11) .timeline-dot { --i: 10; }
.timeline-item:nth-child(12) .timeline-dot { --i: 11; }
.timeline-item:nth-child(13) .timeline-dot { --i: 12; }

.timeline-dot.active {
  width: 12px;
  height: 12px;
  animation: pulse-active 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px #7ef4f4, 0 0 6px rgba(126, 244, 244, 0.4);
  }
  50% {
    box-shadow: 0 0 0 2px #7ef4f4, 0 0 12px rgba(126, 244, 244, 0.8);
  }
}

@keyframes pulse-active {
  0%, 100% {
    box-shadow: 0 0 0 2px #7ef4f4, 0 0 10px rgba(126, 244, 244, 0.6);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 3px #7ef4f4, 0 0 18px rgba(126, 244, 244, 1);
    transform: scale(1.15);
  }
}

.timeline-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

/* Arrow pointing down from content (for above items) */
.timeline-item.above .timeline-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--border);
}

.timeline-item.below .timeline-content::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--border);
}

.timeline-year {
  font-size: 0.6rem;
  color: #7ef4f4;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.timeline-label {
  font-size: 0.55rem;
  color: var(--muted);
  margin-top: 0.15rem;
  white-space: nowrap;
}

.timeline-item:hover .timeline-dot {
  animation: none;
  box-shadow: 0 0 0 3px #7ef4f4, 0 0 16px rgba(126, 244, 244, 1);
  transform: scale(1.3);
}

.timeline-item:hover .timeline-content {
  border-color: #7ef4f4;
  box-shadow: 0 2px 12px rgba(126, 244, 244, 0.3);
}

.timeline-item:hover .timeline-label {
  color: var(--fg);
}

/* Timeline scrollbar */
.timeline-wrapper::-webkit-scrollbar {
  height: 4px;
}

.timeline-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.timeline-wrapper::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.timeline-wrapper {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ─── Spotlight section ─────────────────────────────────────────────────── */

.spotlight-section {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.spotlight-heading {
  font-size: 1.5rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7ef4f4;
  margin-bottom: 1.25rem;
}

.nav-spotlight {
  color: #7ef4f4 !important;
  font-weight: bold;
}

.spotlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.spotlight-tile {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.spotlight-tile:hover {
  border-color: var(--fg);
  transform: translateY(-2px);
}

.tile-date {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.tile-date.ongoing {
  color: #7ef4f4;
  font-weight: bold;
}

.tile-title {
  font-size: 1rem;
  font-weight: bold;
  color: var(--fg);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.tile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.tile-tag {
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.tile-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ─── Posts section ─────────────────────────────────────────────────────── */

.posts-section {
  margin-top: 2rem;
}

/* ─── Intro section ─────────────────────────────────────────────────────── */

.intro {
  margin-bottom: 3rem;
}

.intro p {
  color: var(--muted);
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

/* ─── Section headings ──────────────────────────────────────────────────── */

h2 {
  font-size: 0.75rem;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* ─── Post list ─────────────────────────────────────────────────────────── */

.post-list {
  list-style: none;
}

.post-list li {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list li:first-child {
  border-top: 1px solid var(--border);
}

.post-date {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 7.5rem;
}

.post-list a {
  font-size: 0.9rem;
  text-decoration: none;
}

.post-list a:hover {
  text-decoration: underline;
  text-decoration-color: var(--fg);
}

/* ─── Post page ─────────────────────────────────────────────────────────── */

.post-header {
  margin-bottom: 2.5rem;
}

.post-header h1 {
  font-size: 1.25rem;
  font-weight: bold;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.post-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

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

.tag {
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0 0.35rem;
}

/* ─── Post body typography ──────────────────────────────────────────────── */

.post-body {
  font-size: 0.9rem;
}

.post-body p {
  margin-bottom: 1.25rem;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: -0.01em;
}

.post-body h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: normal;
}

.post-body ul,
.post-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.post-body li {
  margin-bottom: 0.35rem;
}

.post-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  color: var(--muted);
  margin: 1.5rem 0;
  font-style: italic;
}

.post-body code {
  font-family: var(--font);
  font-size: 0.85em;
  background: #f5f5f5;
  padding: 0.1em 0.3em;
  border-radius: 2px;
}

.post-body pre {
  background: #f5f5f5;
  padding: 1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.82rem;
  line-height: 1.6;
  border-left: 2px solid var(--border);
}

.post-body pre code {
  background: none;
  padding: 0;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem 0;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 1.5rem 0;
}

.post-body th,
.post-body td {
  text-align: left;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
}

.post-body th {
  background: #f5f5f5;
  font-weight: bold;
}

/* ─── Post navigation ───────────────────────────────────────────────────── */

.post-nav {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.post-nav a {
  color: var(--muted);
  text-decoration: none;
}

.post-nav a:hover {
  color: var(--fg);
}

/* ─── Comments ──────────────────────────────────────────────────────────── */

.comments {
  margin-top: 3rem;
}

.comments h3 {
  font-size: 0.75rem;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* ─── Search ────────────────────────────────────────────────────────────── */

.search-page h2 {
  margin-bottom: 1rem;
}

#search-input {
  font-family: var(--font);
  font-size: 0.9rem;
  width: 100%;
  padding: 0.5rem 0;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  background: transparent;
  color: var(--fg);
  margin-bottom: 1.5rem;
}

#search-input:focus {
  border-bottom-color: var(--fg);
}

#search-empty {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ─── Footer ────────────────────────────────────────────────────────────── */

footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

footer p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  font-size: 0.8rem;
  color: #7ef4f4;
  text-decoration: none;
}

.social-links a:hover {
  color: #7ef4f4;
  text-decoration: underline;
  text-decoration-color: #7ef4f4;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  body {
    padding: 1.5rem 1rem 3rem;
  }

  .post-list li {
    flex-direction: column;
    gap: 0.15rem;
  }

  .post-date {
    font-size: 0.75rem;
    min-width: unset;
  }
}

/* ─── Profile Picture & About Header ───────────────────────────────────── */

.about-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.profile-pic {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  filter: grayscale(100%);
  transition: filter 0.3s ease;
}

.profile-pic:hover {
  filter: grayscale(0%);
}

.about-intro h1 {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.about-intro .tagline {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* ─── Photos Page ───────────────────────────────────────────────────────── */

.photos-page h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.photos-intro {
  color: var(--muted);
  margin-bottom: 2rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.photo-item {
  margin: 0;
}

.photo-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 4px;
  filter: grayscale(100%);
  transition: filter 0.3s ease;
}

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

.photo-item figcaption {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.no-photos {
  grid-column: 1 / -1;
  color: var(--muted);
  font-style: italic;
}

.no-photos code {
  background: var(--border);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.85em;
}

/* ─── Contact Page ──────────────────────────────────────────────────────── */

.contact-page h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.contact-intro {
  color: var(--muted);
  margin-bottom: 2rem;
}

.contact-form {
  max-width: 500px;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--fg);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.submit-btn {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.75rem 1.5rem;
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.submit-btn:hover {
  opacity: 0.85;
}

.contact-alt {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ─── Stats Page ────────────────────────────────────────────────────────── */

.stats-page h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.stats-intro {
  color: var(--muted);
  margin-bottom: 2rem;
}

.stats-summary {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.chart-container {
  margin-bottom: 2.5rem;
}

.chart-container h2 {
  margin-bottom: 1rem;
}

.chart-container canvas {
  max-height: 300px;
}

.tags-breakdown h2 {
  margin-bottom: 1rem;
}

.tag-list {
  list-style: none;
}

.tag-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.tag-list li:first-child {
  border-top: 1px solid var(--border);
}

.tag-name {
  font-weight: 500;
}

.tag-count {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ─── Responsive for new pages ──────────────────────────────────────────── */

@media (max-width: 600px) {
  .about-header {
    flex-direction: column;
    text-align: center;
  }
  
  .profile-pic {
    width: 100px;
    height: 100px;
  }
  
  .photo-grid {
    grid-template-columns: 1fr;
  }
}
