/* ===========================
   Variables
   =========================== */

:root {
  --bg: #ffffff;
  --bg-subtle: #f5f5f4;
  --bg-hover: #eeeeec;
  --text: #1c1917;
  --text-muted: #78716c;
  --text-faint: #a8a29e;
  --border: #e7e5e4;
  --link: #1c1917;
  --accent: #d97706;
  --tag-bg: #f5f5f4;
  --tag-text: #57534e;
  --code-bg: #f5f5f4;
}

[data-theme="dark"] {
  --bg: #111110;
  --bg-subtle: #1c1b1a;
  --bg-hover: #262523;
  --text: #e8e5e1;
  --text-muted: #a8a29e;
  --text-faint: #6b6560;
  --border: #2a2825;
  --link: #e8e5e1;
  --accent: #f59e0b;
  --tag-bg: #1c1b1a;
  --tag-text: #a8a29e;
  --code-bg: #1c1b1a;
}

/* ===========================
   Reset & Base
   =========================== */

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

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

body {
  font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===========================
   Layout
   =========================== */

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===========================
   Header
   =========================== */

.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
  transition: background-color 0.2s ease;
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 56px;
}

.site-logo {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.site-nav a {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--bg-hover);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--text);
  font-weight: 500;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background-color 0.15s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-hover);
}

[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: none;  }
[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="dark"]  .icon-moon { display: none;  }

/* ===========================
   Home
   =========================== */

.home {
  padding: 32px 0 64px;
}

.home-hero {
  margin-bottom: 16px;
}

.home-name {
  display: none;
}

.home-role {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.home-intro {
  margin-bottom: 40px;
}

.home-recent {
  margin-bottom: 40px;
}

.home-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.home-all-posts {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: 12px;
}

.home-all-posts:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home-photo-wrap {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
  cursor: default;
  animation: photoIn 1.1s cubic-bezier(0.23, 1, 0.32, 1) 0.1s both;
}

@keyframes photoIn {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

.home-photo-color {
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 420px;
  object-fit: cover;
  object-position: center 70%;
  display: block;
}

.home-photo-bw {
  position: absolute;
  inset: 0;
  background-image: url('/assets/images/profile.png');
  background-size: cover;
  background-position: center 70%;
  filter: grayscale(100%);
}


.home-bio {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-muted);
  max-width: 540px;
}

.home-bio a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Section grid */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.section-card {
  display: block;
  padding: 24px 28px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s;
}

.section-card:hover {
  background: var(--bg-subtle);
  text-decoration: none;
}

.section-card strong {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.section-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===========================
   List pages (Writing, Projects, About, Now, Books, Movies)
   =========================== */

.list-page {
  padding: 32px 0 64px;
}

.list-heading {
  margin-bottom: 28px;
}

.list-meta {
  font-size: 0.8125rem;
  color: var(--text-faint);
  margin-top: 4px;
}

.list-heading h1,
.list-heading h1 * {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.post-list-title {
  font-size: 0.9375rem;
  color: var(--text);
  text-decoration: none;
  flex: 1;
}

.post-list-title:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-list-date {
  font-size: 0.8125rem;
  color: var(--text-faint);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.post-year-group {
  margin-bottom: 28px;
}

.post-year {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}

/* ===========================
   Blog post
   =========================== */

.post {
  padding: 32px 0 64px;
}

.post-header {
  margin-bottom: 24px;
}

.post-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.post-title {
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin-bottom: 8px;
}

.post-subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}

.tag {
  font-size: 0.75rem;
  color: var(--text-faint);
  white-space: nowrap;
  font-weight: 400;
}

.tag + .tag::before {
  content: '·';
  padding: 0 5px;
  color: var(--border);
}

.tag--live {
  background: none;
  color: #16a34a;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tag--live::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  position: relative;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
  animation: livering 2.5s ease-out infinite;
}

@keyframes livering {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.tag--building {
  background: none;
  color: #92400e;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

[data-theme="dark"] .tag--live  { color: #4ade80; }
[data-theme="dark"] .tag--live::before { background: #4ade80; }
[data-theme="dark"] .tag--building { color: #fcd34d; }

.post-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.back-link {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.back-link:hover {
  color: var(--text);
}

/* ===========================
   Prose
   =========================== */

.prose {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--text);
}

.prose h2,
.prose h3,
.prose h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-top: 1.75em;
  margin-bottom: 0.5em;
}

.prose hr + h2,
.prose hr + h3,
.prose hr + h4 {
  margin-top: 0.5em;
}

.prose h2 { font-size: 1.2rem; }
.prose h3 { font-size: 1rem; }

.prose p { margin-bottom: 1.25em; }
.prose p:last-child { margin-bottom: 0; }

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

.prose a:hover { text-decoration-color: var(--text); }

.prose strong { font-weight: 600; }
.prose em { font-style: italic; }

.prose ul,
.prose ol {
  padding-left: 1.5em;
  margin-bottom: 1.25em;
}

.prose li { margin-bottom: 0.4em; }

.prose blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1.25em;
  margin: 1.5em 0;
  color: var(--text-muted);
  font-style: italic;
}

.prose code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.prose pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
  margin: 1.5em 0;
}

.prose pre code { background: none; padding: 0; }

.prose img {
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 2em 0;
}

.prose figure {
  margin: 2em 0;
}

.prose figure img {
  margin: 0;
  display: block;
}

.prose figcaption {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 6px;
  font-style: normal;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5em 0;
}


/* Projects list */
.project-list {
  display: flex;
  flex-direction: column;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.project-card:first-child {
  border-top: 1px solid var(--border);
}

.project-card:hover .project-card-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
}

.project-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===========================
   Footer
   =========================== */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: auto;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

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

.footer-links a:hover { color: var(--text); }

@keyframes vibe-gradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes vibe-spin {
  to { transform: rotate(360deg); }
}

.vibe-star {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  animation: vibe-spin 10s linear infinite;
}

.footer-copy {
  font-size: 0.8125rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.footer-copy span {
  background: linear-gradient(90deg, #d97706, #f59e0b, #ea580c, #d97706);
  background-size: 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: vibe-gradient 4s ease infinite;
  position: relative;
}

.footer-copy span::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, #d97706, #f59e0b, #ea580c, #d97706);
  background-size: 300%;
  animation: vibe-gradient 4s ease infinite;
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 640px) {
  .site-header .container { gap: 16px; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 4px 6px; font-size: 0.8125rem; }

  .section-grid { grid-template-columns: 1fr; }

  .post-title { font-size: 1.375rem; }

  .post-list-item {
    flex-direction: column;
    gap: 2px;
  }

  .post-list-date { font-size: 0.75rem; }

  .site-footer .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
