@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/manrope-variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page-background: #0b1220;
  --card-background: #111d2e;
  --text-primary: #e6edf3;
  --text-secondary: rgba(230, 237, 243, 0.88);
  --text-body: rgba(230, 237, 243, 0.78);
  --raised-background: color-mix(in srgb, var(--text-primary) 4%, var(--card-background));
  --accent: #38f9d7;
  --border: rgba(230, 237, 243, 0.12);
  --font-size-title: clamp(48px, 6vw, 72px);
  --font-size-heading: clamp(24px, 3vw, 32px);
  --font-size-body: 18px;
  --font-size-caption: 14px;
  font-family: "Manrope", "PingFang SC", "HarmonyOS Sans", "Source Han Sans SC", sans-serif;
  font-size: var(--font-size-body);
  line-height: 1.75;
  color: var(--text-body);
  background-color: var(--page-background);
}

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

body {
  margin: 0;
}

.page {
  padding-inline: 20px;
}

.container {
  max-width: 1040px;
  margin-inline: auto;
  text-align: left;
}

.hero {
  display: grid;
  gap: 16px;
  padding-block: 48px;
}

.hero h1,
.hero p {
  margin: 0;
}

.hero h1 {
  color: var(--accent);
  font-size: var(--font-size-title);
  font-weight: 700;
  line-height: 1.1;
}

.hero-identity {
  color: var(--text-secondary);
  font-size: var(--font-size-heading);
  font-weight: 600;
  line-height: 1.5;
}

.hero-tagline {
  font-size: var(--font-size-body);
  line-height: 1.75;
  color: var(--text-body);
}

.content-section {
  padding-block: 40px;
  border-top: 1px solid var(--border);
}

.content-section h2 {
  color: var(--text-primary);
  margin: 0 0 24px;
  font-size: var(--font-size-heading);
  font-weight: 700;
  line-height: 1.3;
}

.content-section h3 {
  color: var(--text-secondary);
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
}

.content-section p {
  margin: 0;
}

.experience-list {
  display: grid;
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.experience-item {
  display: grid;
  gap: 8px;
}

.experience-year {
  font-size: var(--font-size-caption);
  line-height: 1.5;
  color: var(--text-body);
}

.project-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.project-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: var(--card-background);
}

.project-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
}

.project-summary::-webkit-details-marker {
  display: none;
}

.project-summary::marker {
  content: "";
}

.project-summary-text {
  display: grid;
  gap: 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.project-title {
  color: var(--text-secondary);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

.project-excerpt {
  font-size: var(--font-size-caption);
  line-height: 1.6;
  color: var(--text-body);
}

.project-toggle {
  flex: 0 0 24px;
  font-size: 24px;
  line-height: 1.3;
  color: var(--accent);
}

.project-toggle::after {
  content: "+";
}

.project-card[open] > .project-summary > .project-toggle::after {
  content: "−";
}

.project-content {
  min-width: 0;
  margin-top: 16px;
}

.experience-projects {
  margin-top: 16px;
}

.experience-projects:not(:has(> .project-card)) {
  display: none;
}

#practice > .experience-list {
  gap: 32px;
}

.markdown-body {
  overflow-wrap: anywhere;
}

.markdown-body > * {
  margin: 0;
}

.content-section .markdown-body > * + * {
  margin-top: 12px;
}

.markdown-body :is(h4, h5, h6) {
  color: var(--text-secondary);
  font-size: var(--font-size-body);
  font-weight: 600;
  line-height: 1.5;
}

.markdown-body :is(ul, ol) {
  padding-left: 24px;
}

.markdown-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.markdown-body a {
  color: var(--accent);
}

.markdown-body blockquote {
  padding-left: 16px;
  border-left: 2px solid var(--border);
  color: var(--text-body);
}

.markdown-body pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 16px;
  background-color: var(--card-background);
  font-size: var(--font-size-caption);
}

.markdown-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.markdown-body :is(th, td) {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.markdown-body th {
  color: var(--text-secondary);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-caption);
  line-height: 1.5;
  color: var(--text-body);
}

.project-status {
  padding: 2px 8px;
  border: 1px solid var(--accent);
  border-radius: 4px;
}

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

.section-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 24px;
}

.content-section .section-heading h2 {
  margin: 0;
}

.gallery-entry,
.gallery-header a {
  color: var(--accent);
  font-size: 14px;
  text-underline-offset: 4px;
}

.photo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.photo-link {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  cursor: zoom-in;
}

.photo-link img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.photo-grid .photo-wide img,
.photo-grid .photo-portrait img {
  aspect-ratio: auto;
}

.gallery-page {
  max-width: 1280px;
  margin-inline: auto;
  padding: 48px 20px 64px;
}

.gallery-header {
  margin-bottom: 40px;
}

.gallery-header nav {
  margin-bottom: 32px;
}

.gallery-header h1 {
  color: var(--text-primary);
  margin: 0;
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1.3;
}

.gallery-grid,
.gallery-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.gallery-grid .photo-link img {
  aspect-ratio: auto;
  object-fit: contain;
}

.photo-viewer {
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  overflow: visible;
  background: var(--raised-background);
}

.photo-viewer::backdrop {
  background: rgba(11, 18, 32, 0.92);
}

html:has(.photo-viewer[open]) {
  overflow: hidden;
}

.photo-full {
  display: block;
  max-width: 92vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.photo-close {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 20px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  font: inherit;
  font-size: 28px;
  line-height: 1;
  color: var(--text-primary);
  background: var(--raised-background);
  cursor: pointer;
}

a:focus-visible,
summary:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .project-title {
    transition: color 160ms ease;
  }

  .project-summary:hover .project-title {
    color: var(--accent);
  }

  .contact-email {
    transition: color 160ms ease;
  }

  .contact-email:hover {
    color: var(--text-primary);
  }

  .project-card {
    transition: border-color 160ms ease;
  }

  .project-card:hover {
    border-color: var(--accent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-card,
  .contact-email,
  .project-title {
    transition: none;
  }
}

@media (min-width: 768px) {
  .project-card {
    padding: 20px;
  }

  .project-title {
    font-size: 22px;
  }

  #practice > .experience-list {
    gap: 40px;
  }

  .section-heading {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
  }

  .gallery-page {
    padding: 64px 40px 80px;
  }

  .gallery-grid {
    gap: 40px;
  }

  .gallery-row {
    grid-template-columns: var(--columns);
    align-items: start;
    gap: 20px;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-grid .photo-wide {
    grid-column: span 2;
  }

  .photo-grid .photo-portrait img {
    height: 100%;
  }

  .photo-grid .photo-portrait {
    grid-row: span 2;
  }

  .page {
    padding-inline: 40px;
  }

  .hero {
    padding-block: 80px;
  }

  .content-section {
    padding-block: 64px;
  }
}

@media (min-width: 1024px) {
  .photo-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .photo-grid .photo-link img {
    height: 100%;
    aspect-ratio: auto;
  }

  .photo-grid .photo-portrait {
    grid-column: 4;
    grid-row: 1 / span 2;
  }
}

/* 独立 Markdown 同步的长项目正文。 */
.synced-project .markdown-body,
.project-page .markdown-body {
  font-size: 18px;
  line-height: 1.85;
  color: var(--text-body);
}

.content-section .synced-project .markdown-body > h4,
.project-page .markdown-body > h2 {
  margin-top: 40px;
  margin-bottom: 24px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  font-size: clamp(26px, 3vw, 30px);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-secondary);
}

.synced-project .markdown-body img,
.project-page .markdown-body img {
  width: 520px;
  margin: 28px auto 16px;
}

.synced-project .markdown-body pre,
.project-page .markdown-body pre {
  font-size: 16px;
  line-height: 1.8;
}

.content-section .project-page-entry {
  margin: 0 0 24px;
  font-size: 14px;
}

.project-page-entry a,
.project-page nav a {
  color: var(--accent);
  text-underline-offset: 4px;
}

.project-page-entry a:focus-visible,
.project-page a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.project-page {
  max-width: 820px;
  margin-inline: auto;
  padding: 40px 24px 72px;
  overflow-wrap: anywhere;
}

.project-page nav {
  margin-bottom: 32px;
  font-size: 14px;
}

.project-page-header {
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.project-page h1 {
  color: var(--text-primary);
  margin: 0;
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1.35;
  font-weight: 700;
}

.project-page-header > * + * {
  margin-top: 16px;
}

.project-page .markdown-body > * + * {
  margin-top: 16px;
}

.project-page .markdown-body :is(h3, h4, h5, h6) {
  font-size: 22px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.error-page {
  max-width: 820px;
  margin-inline: auto;
  padding: 80px 24px;
  overflow-wrap: anywhere;
}

.error-page > * {
  margin: 0 0 24px;
}

.error-code {
  color: var(--accent);
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 700;
  line-height: 1.1;
}

.error-page h1 {
  font-size: var(--font-size-heading);
  line-height: 1.3;
}

.error-page a {
  color: var(--accent);
}
