/* ==========================================================================
   Jonathan Jiang — Personal Website
   Built to the design-system handoff. All tokens/specs sourced from
   jonathan-jiang-design-system.md
   ========================================================================== */

/* ---- Font ---------------------------------------------------------------- */
/* Monoweb Book is a commercial font (Lineto). Drop the licensed .woff2 into
   /fonts and it loads automatically; until then the monospace fallback is used. */
@font-face {
  font-family: 'Monoweb';
  src: url('../fonts/MonowebBook.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---- Color tokens -------------------------------------------------------- */
:root {
  --bg:         #ffffff;
  --text:       #000000;
  --muted:      #333333;
  --faint:      #888888;
  --border:     #e0e0e0;
  --row-border: #ebebeb;
  --tag-bg:     #f4f4f4;
  --img-bg:     #f0f0f0;
}

[data-theme="dark"] {
  --bg:         #111111;
  --text:       #ffffff;
  --muted:      #aaaaaa;
  --faint:      #888888;
  --border:     #2a2a2a;
  --row-border: #1e1e1e;
  --tag-bg:     #1a1a1a;
  --img-bg:     #1e1e1e;
}

/* ---- Reset / base -------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Monoweb', 'Courier New', Courier, monospace;
  font-weight: 400;
  font-size: 12px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: inherit; }

img { display: block; }

/* ---- Layout -------------------------------------------------------------- */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 2.5rem;
}

.section {
  padding: 2rem 0;
  border-bottom: 0.5px solid var(--border);
}
.section:last-child { border-bottom: none; }

.section-label {
  font-size: 10px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   Nav
   ========================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
  transition: background 0.2s ease, border-color 0.2s ease;
}

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

.nav-name {
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  color: var(--text);
}

.nav-right {
  display: flex;
  align-items: center;
}

.nav-tabs {
  display: flex;
  gap: 1.25rem;
}

.nav-tab {
  font-size: 11px;
  text-decoration: none;
  color: var(--text);
  padding-bottom: 2px;
  border-bottom: 0.5px solid transparent;
}
.nav-tab:hover { color: var(--muted); }
.nav-tab.active {
  border-bottom: 0.5px solid var(--text);
}

/* ---- Light/dark toggle --------------------------------------------------- */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 1.5rem;
  padding-left: 1.5rem;
  border-left: 0.5px solid var(--border);
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

.toggle-track {
  position: relative;
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: var(--tag-bg);
  border: 0.5px solid var(--border);
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 2.5px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}

[data-theme="dark"] .toggle-thumb {
  transform: translateX(12px);
  background: var(--text);
}

.toggle-label {
  font-size: 10px;
  color: var(--muted);
  min-width: 5ch;
  display: inline-block;
}

/* ==========================================================================
   Hero (home)
   ========================================================================== */
.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2.5rem 2.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  border-bottom: 0.5px solid var(--border);
}

.hero-text { flex: 1; }

.hero h1 {
  font-size: 24px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.3px;
  max-width: 500px;
  margin: 0 0 1.25rem;
}

.hero-meta {
  margin: 0;
  padding: 0;
  list-style: none;
}
.hero-meta li {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.hero-meta li::before { content: "\2192\00a0"; } /* "→ " */

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 0.5px solid var(--border);
  background: var(--img-bg);          /* placeholder — TODO: real photo */
  object-fit: cover;
  flex-shrink: 0;
}

/* ==========================================================================
   Entry rows (experience / recent work)
   ========================================================================== */
.entry {
  padding: 14px 0;
  border-bottom: 0.5px solid var(--row-border);
}
.entry:last-child { border-bottom: none; }

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.entry-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.entry-year {
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
}
.entry-sub {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}
.entry-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
}

/* ---- Tags ---------------------------------------------------------------- */
.tags { margin-top: 6px; }
.tag {
  font-size: 10px;
  color: var(--muted);
  background: var(--tag-bg);
  border-radius: 3px;
  padding: 1px 6px;
  margin: 3px 3px 0 0;
  display: inline-block;
}

/* ==========================================================================
   Project cards (work)
   ========================================================================== */
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  border: 0.5px solid var(--row-border);
  border-radius: 8px;
  overflow: hidden;
}

.card-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: var(--img-bg);          /* placeholder — TODO: real screenshot */
}

.card-body { padding: 12px; }

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.card-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ---- GitHub link --------------------------------------------------------- */
.gh-link {
  font-size: 10px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 0.5px solid var(--row-border);
  padding-bottom: 1px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.gh-link svg { width: 11px; height: 11px; }

/* ==========================================================================
   About
   ========================================================================== */
.about {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
.about-photo {
  width: 120px;
  height: 150px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--img-bg);          /* placeholder — TODO: real photo */
}
.about-copy { flex: 1; }
.about-copy p {
  margin: 0 0 1rem;
  line-height: 1.8;
}
.about-copy p:last-child { margin-bottom: 0; }

.facts {
  margin: 0;
  padding: 0;
  list-style: none;
}
.facts li {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
}

/* ==========================================================================
   Writing
   ========================================================================== */
.writing-empty {
  color: var(--muted);
  font-size: 12px;
}

.post-list { display: flex; flex-direction: column; }
.post-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 14px 0;
  border-bottom: 0.5px solid var(--row-border);
  text-decoration: none;
  color: var(--text);
}
.post-row:last-child { border-bottom: none; }
.post-title { font-size: 13px; }
.post-date { font-size: 11px; color: var(--faint); white-space: nowrap; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  border-top: 0.5px solid var(--border);
}
.footer-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-email {
  font-size: 11px;
  font-style: italic;
  color: var(--text);
  text-decoration: none;
}
.footer-icons {
  display: flex;
  gap: 14px;
}
.footer-icons a {
  color: var(--text);
  display: inline-flex;
  align-items: center;
}
.footer-icons svg { width: 15px; height: 15px; }
.footer-icons a:hover { color: var(--muted); }

/* ==========================================================================
   Responsive (mobile)
   ========================================================================== */
@media (max-width: 600px) {
  .container { padding: 0 1.25rem; }

  .nav-inner { padding: 1.25rem; }
  .nav-tabs { gap: 1rem; }
  .theme-toggle { margin-left: 1rem; padding-left: 1rem; }

  .hero {
    flex-direction: column;
    padding: 2.5rem 1.25rem 2rem;
  }

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

  .footer-inner { padding: 1.25rem; }
}

@media (max-width: 380px) {
  .toggle-label { display: none; }
}
