/*
Theme Name: SXDPM Portfolio
Theme URI: https://sxdpm.com
Author: Song Xudong
Description: An Apple-inspired portfolio theme with editable portfolio modules.
Version: 1.2.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
Text Domain: sxdpm-portfolio
*/

:root {
  color-scheme: light;
  --paper: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --soft: #fbfbfd;
  --accent: #0066cc;
  --header: rgba(251, 251, 253, 0.82);
  --mono: "SFMono-Regular", "SF Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.72;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--header);
  padding: 13px clamp(22px, 6vw, 88px);
  backdrop-filter: saturate(180%) blur(18px);
}

.wordmark {
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 18px;
}

.main-nav a {
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
  border-color: var(--accent);
  color: var(--accent);
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}

.menu-toggle span {
  display: block;
  height: 2px;
  margin: 5px 0;
  background: var(--ink);
}

.resume-page {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0 104px;
}

.module {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 64px;
  padding: 52px 0;
}

.hero-module {
  align-items: start;
  min-height: 58vh;
  padding-top: 0;
}

.module-label,
.section-label {
  position: sticky;
  top: 92px;
  align-self: start;
  font-weight: 700;
}

.module-label h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.06;
}

.module-label p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.42;
}

.section-label {
  display: grid;
  gap: 8px;
  border-left: 3px solid var(--accent);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.18;
  padding-left: 16px;
}

.section-label::after {
  color: var(--muted);
  content: attr(data-en);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
}

.module-content {
  max-width: 840px;
  color: #2b2b2f;
  font-size: 17px;
}

.english-title,
.meta,
.career-kicker,
.education-note {
  color: var(--muted);
  font-family: var(--mono);
}

.english-title {
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 500;
}

h2,
h3,
p,
ol {
  margin-top: 0;
}

h2 {
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.32;
}

h3 {
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.42;
}

p {
  margin-bottom: 13px;
}

.hero-copy h2 {
  max-width: 700px;
  color: var(--ink);
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 600;
  line-height: 1.36;
  margin-bottom: 16px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 30px;
}

.hero-tags span {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 9px 12px;
}

.contact-summary {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.contact-summary p {
  margin: 0 0 8px;
}

.contact-summary button {
  border-bottom: 1px solid var(--accent);
  color: var(--accent);
  font-family: inherit;
  padding: 0;
}

.detail-list,
.list-stack,
.project-stack,
.career-stack,
.skills-grid,
.glossary-grid,
.ai-focus-grid,
.contact-grid {
  display: grid;
  gap: 14px;
}

.detail-list {
  margin-top: 26px;
}

.detail-list article {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.detail-list strong {
  color: var(--ink);
  font-size: 16px;
}

.list-stack article,
.project-item,
.career-stack article,
.skills-grid article,
.glossary-grid article,
.ai-focus-grid article,
.contact-grid article {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px 22px;
}

.list-stack article:last-child,
.project-item:last-child,
.career-stack article:last-child,
.skills-grid article:last-of-type,
.glossary-grid article:last-child,
.ai-focus-grid article:last-child,
.contact-grid article:last-child {
  padding-bottom: 20px;
}

.ai-agent-block {
  display: grid;
  gap: 24px;
}

.ai-agent-intro {
  border: 1px solid rgba(0, 102, 204, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f5faff 100%);
  padding: 24px;
}

.ai-focus-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.architecture-panel {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
}

.architecture-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.architecture-flow article {
  position: relative;
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 18px;
}

.architecture-flow article:not(:last-child)::after {
  position: absolute;
  top: 50%;
  right: -11px;
  width: 10px;
  height: 1px;
  background: var(--accent);
  content: "";
}

.architecture-flow span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  margin-bottom: 14px;
}

.architecture-flow strong,
.contact-grid span {
  display: block;
  color: var(--ink);
  font-weight: 700;
}

.architecture-flow p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 8px 0 0;
}

.contact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
}

.contact-grid article {
  padding: 16px 18px;
}

.contact-grid span {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.contact-grid button {
  border-bottom: 1px solid var(--accent);
  color: var(--accent);
  padding: 0;
}

.contact-grid strong {
  color: var(--ink);
  font-weight: 600;
}

.meta {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 500;
}

ol {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
  padding-left: 0;
  list-style-position: inside;
}

li::marker {
  font-family: var(--mono);
}

.career-primary {
  border-color: rgba(0, 102, 204, 0.24) !important;
  background: #f5faff;
}

.career-kicker {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.education-note {
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.65;
  margin: 4px 0 0;
  padding-top: 18px;
}

.contact-module {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 54px;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.contact-actions button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 600;
  padding: 0 16px;
  transition: background 160ms ease, color 160ms ease;
}

.contact-actions button:hover {
  background: var(--accent);
  color: #fff;
}

.back-to-top,
.toast {
  position: fixed;
  z-index: 30;
}

.back-to-top {
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  font-family: var(--mono);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-2px);
}

.toast {
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: #fff;
  opacity: 0;
  padding: 10px 14px;
  border-radius: 8px;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 920px) {
  body {
    font-size: 16px;
  }

  .site-header {
    padding: 14px 18px;
  }

  .menu-toggle {
    display: block;
  }

  .main-nav {
    position: absolute;
    top: 62px;
    right: 18px;
    left: 18px;
    display: none;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.12);
    padding: 12px 14px;
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav a {
    padding: 6px 0;
  }

  .resume-page {
    width: min(100% - 28px, 1180px);
    padding-top: 44px;
  }

  .module {
    grid-template-columns: 1fr;
    gap: 18px;
    border-top: 1px solid var(--line);
    padding: 30px 0;
  }

  .hero-module {
    min-height: auto;
    border-top: 0;
    padding-top: 0;
  }

  .module-label,
  .section-label {
    position: static;
  }

  .section-label {
    border-left-width: 3px;
    font-size: 23px;
    padding-left: 14px;
  }

  .section-label::after {
    font-size: 12px;
  }

  .contact-summary {
    font-size: 16px;
  }

  .detail-list article {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .ai-focus-grid,
  .architecture-flow,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .architecture-flow article {
    min-height: auto;
  }

  .architecture-flow article:not(:last-child)::after {
    top: auto;
    right: auto;
    bottom: -13px;
    left: 28px;
    width: 1px;
    height: 12px;
  }

  h2 {
    font-size: 22px;
  }
}

@media (max-width: 560px) {
  .module-label h1 {
    font-size: 34px;
  }

  .module-label p {
    font-size: 20px;
  }

  .module-content {
    max-width: none;
  }

  ol {
    list-style-position: outside;
    padding-left: 22px;
  }

  .contact-actions button {
    width: 100%;
  }
}
