:root {
  --bg: #fdfdfc;
  --text: #1a1a1a;
  --muted: #777;
  --line: #e6e6e3;
  --link: #1a1a1a;
  --accent: #c2410c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110;
    --text: #e8e8e6;
    --muted: #8a8a87;
    --line: #2a2a28;
    --link: #e8e8e6;
    --accent: #fb923c;
  }
}

:root[data-theme="dark"] {
  --bg: #111110;
  --text: #e8e8e6;
  --muted: #8a8a87;
  --line: #2a2a28;
  --link: #e8e8e6;
  --accent: #fb923c;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 72px 16px 48px;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s, color 0.15s;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* header */
header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
}
.name {
  font-weight: 600;
  text-decoration: none;
  font-size: 16px;
}
nav { display: flex; gap: 16px; align-items: baseline; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); }

#theme {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
#theme:hover { color: var(--text); }

/* content */
.intro { margin: 0 0 36px; }

section { margin-bottom: 32px; }

h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}
h2::after { content: ":"; }

ul { list-style: none; margin: 0; padding: 0; }
li { display: flex; gap: 10px; margin-bottom: 10px; }
.arrow { color: var(--muted); flex-shrink: 0; }

.desc { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.note { color: var(--muted); font-size: 14px; }
.plain { margin: 0; }
.email { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* footer */
footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.links { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; }
.meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}
.ring a { color: var(--muted); text-decoration: none; }
.ring a:hover { color: var(--accent); }

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

/* current page in nav */
nav a[aria-current="page"] { color: var(--text); }

/* status line with live clock */
.status {
  margin: -24px 0 28px;
  font-size: 13px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* inline org logos */
.org img {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  vertical-align: -2px;
  margin-right: 5px;
}

/* arrow nudges on hover */
li .arrow { transition: transform 0.2s, color 0.2s; }
li:hover .arrow { transform: translateX(3px); color: var(--accent); }

/* writing list */
.posts li { gap: 16px; }
.posts time {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  flex-shrink: 0;
  padding-top: 1px;
}

/* gentle staggered fade-in on load */
main > * { animation: rise 0.5s ease-out both; }
main > *:nth-child(2) { animation-delay: 0.05s; }
main > *:nth-child(3) { animation-delay: 0.1s; }
main > *:nth-child(4) { animation-delay: 0.15s; }
main > *:nth-child(5) { animation-delay: 0.2s; }
main > *:nth-child(6) { animation-delay: 0.25s; }
main > *:nth-child(7) { animation-delay: 0.3s; }
main > *:nth-child(n+8) { animation-delay: 0.35s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* fun site stats */
.stats {
  margin: 0 0 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
}

/* ───────────── easter eggs ───────────── */

/* toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* writing post */
.post-title { font-size: 22px; font-weight: 600; line-height: 1.3; margin: 0 0 6px; }
.post-meta {
  margin: 0 0 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
}

/* ───────────── reading layout (blog posts) ───────────── */
.post main { max-width: 700px; }
.post .post-title { font-size: 30px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; margin: 8px 0 8px; }
.post .post-meta { font-size: 13px; margin-bottom: 40px; }

.prose { font-size: 17.5px; line-height: 1.75; }
.prose p { margin: 0 0 1.25em; }
.prose h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
  margin: 2em 0 0.6em;
}
.prose h2::after { content: none; }
.prose h3 { font-size: 18px; font-weight: 600; margin: 1.6em 0 0.5em; }
.prose ul, .prose ol { list-style: revert; padding-left: 1.4em; margin: 0 0 1.25em; }
.prose li { display: list-item; margin-bottom: 0.4em; }
.prose blockquote {
  margin: 1.5em 0;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--line);
  padding: 1px 5px;
  border-radius: 4px;
}
.prose pre {
  overflow-x: auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 1.5em;
}
.prose pre code { background: none; padding: 0; }
.prose img { max-width: 100%; height: auto; border-radius: 6px; display: block; margin: 1.5em auto; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.5em 0; }

/* nvidia-smi easter egg */
.smi-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.smi-link:hover { color: var(--accent); }

#smi {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  cursor: pointer;
  animation: rise 0.2s ease-out both;
}
#smi pre {
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 16px 18px;
  border-radius: 10px;
  background: #0c0c0c;
  color: #76b900;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* ───────────── mobile ───────────── */
@media (max-width: 600px) {
  body { font-size: 15px; }
  main { padding: 40px 16px 40px; }
  header { margin-bottom: 32px; }
  nav { gap: 14px; }
  .status { margin: -16px 0 24px; }
  .intro { margin-bottom: 28px; }
  section { margin-bottom: 28px; }
  li { gap: 8px; }
  footer { margin-top: 40px; }
  .meta { flex-direction: column; gap: 4px; }

  .post .post-title { font-size: 25px; }
  .post .post-meta { margin-bottom: 28px; }
  .prose { font-size: 17px; line-height: 1.7; }
  .prose pre { font-size: 13px; margin-left: -4px; margin-right: -4px; }

  #toast { bottom: max(16px, env(safe-area-inset-bottom)); font-size: 12px; text-align: center; }
}

/* smi card scales down to fit narrow phones instead of side-scrolling */
#smi pre { font-size: clamp(7px, 2.2vw, 12px); }
@media (max-width: 600px) { #smi { padding: 8px; } #smi pre { padding: 12px; } }
.stats span, .stats button { white-space: nowrap; }

/* bigger tap targets on touch screens */
@media (pointer: coarse) {
  #theme { padding: 6px; margin: -6px; }
  .dot { position: relative; }
  .dot::after { content: ""; position: absolute; inset: -12px; }
}

/* easter egg menu (click name on homepage) */
header { position: relative; z-index: 10; }
#eggs {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 15;
  width: min(300px, 100%);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  font-size: 13px;
  animation: rise 0.15s ease-out both;
}
#eggs[hidden] { display: none; }
.eggs-title { margin: 0 0 6px; font-weight: 600; }
#eggs ul { list-style: none; margin: 0; padding: 0; }
#eggs li { display: list-item; margin: 0 0 4px; color: var(--muted); }
#eggs kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--text);
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
