:root {
  --navy: #0d1628;
  --blue: #0068ff;
  --blue-soft: #eaf2ff;
  --text: #162033;
  --muted: #9aa6b8;
  --line: #aeb7c4;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  height: 64px;
  background: var(--navy);
  color: var(--white);
  width: 100%;
}

.nav {
  width: 1068px;
  max-width: calc(100% - 48px);
  height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 38px;
  font-size: 13px;
  color: #d9e3f0;
}

.nav-links a {
  height: 100%;
  display: flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  padding-top: 3px;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.page {
  width: 1068px;
  max-width: calc(100% - 48px);
  margin: 0 auto;
}

.section-block {
  padding-top: 162px;
}

.intro {
  display: grid;
  grid-template-columns: 254px minmax(0, 615px);
  gap: 50px;
  align-items: center;
}

.portrait {
  width: 254px;
  height: 254px;
  display: block;
  border: 1px solid #8792a0;
  border-radius: 5px;
  object-fit: cover;
}

.intro-copy {
  padding-top: 2px;
}

.intro h1 {
  margin: 0 0 2px;
  color: #edf4ff;
  font-size: 54px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.intro h2 {
  margin: 0 0 24px;
  color: var(--blue);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
}

.intro p {
  width: 610px;
  max-width: 100%;
  margin: 0;
  color: #96a2b3;
  font-size: 15px;
  line-height: 1.9;
}

.section-title {
  margin: 0 0 52px;
  color: var(--blue-soft);
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
}

.work-card {
  width: 518px;
  overflow: hidden;
  border: 1px solid #1e2a3c;
  border-radius: 5px;
  background: var(--navy);
}

.work-image {
  position: relative;
  height: 258px;
  overflow: hidden;
  background: #f5f7fb;
}

.work-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.tags {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

.tags span {
  min-width: 54px;
  height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #1f2937;
  font-size: 12px;
}

.work-body {
  padding: 23px 24px 26px;
  color: var(--white);
}

.work-body h3 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 800;
}

.work-body p {
  margin: 0;
  color: #d7deea;
  font-size: 13px;
  line-height: 1.9;
}

.timeline {
  position: relative;
  margin-left: 12px;
  border-left: 1px solid var(--line);
  width: calc(100% - 12px);
}

.timeline-item {
  position: relative;
  min-height: 90px;
  padding-left: 34px;
}

.timeline-item.long {
  min-height: 168px;
}

.marker {
  position: absolute;
  left: -9px;
  top: 0;
  width: 18px;
  height: 18px;
  border: 4px solid var(--navy);
  border-radius: 50%;
  background: var(--blue);
}

.timeline-content {
  padding-top: 0;
  max-width: 940px;
}

.meta {
  margin: 0 0 6px;
  color: #aab4c2;
  font-size: 12px;
  line-height: 1.2;
}

.timeline h3 {
  margin: 0;
  color: var(--blue);
  font-size: 21px;
  line-height: 1.3;
  font-weight: 800;
}

.org {
  margin: 2px 0 0;
  color: var(--blue);
  font-size: 14px;
  line-height: 1.5;
}

.timeline p:not(.meta):not(.org),
.timeline li {
  color: #9aa6b8;
  font-size: 13px;
  line-height: 1.85;
}

.timeline ul {
  margin: 18px 0 0;
  padding-left: 17px;
}

.timeline li + li {
  margin-top: 7px;
}

#works {
  padding-top: 250px;
}

#education {
  padding-top: 264px;
}

#career {
  padding-top: 246px;
}

#projects {
  padding-top: 238px;
  padding-bottom: 256px;
}

.manage-link {
  position: fixed;
  right: 26px;
  bottom: 18px;
  z-index: 45;
  border: 0;
  background: transparent;
  color: #6f7b8d;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.78;
}

.manage-link:hover {
  color: var(--blue);
  opacity: 1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(13, 22, 40, 0.35);
  padding: 24px;
}

.modal.open {
  display: flex;
}

.modal-card {
  position: relative;
  width: min(360px, 100%);
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(13, 22, 40, 0.24);
  padding: 28px;
}

.modal-card h2 {
  margin: 0 0 22px;
  color: var(--navy);
  font-size: 22px;
}

.modal-close,
.drawer-header button {
  border: 0;
  background: transparent;
  color: #7c8796;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.modal-card label,
.admin-section label {
  display: grid;
  gap: 8px;
  color: #526073;
  font-size: 12px;
  font-weight: 700;
}

.modal-card label + label,
.admin-section label + label {
  margin-top: 14px;
}

.modal-card input,
.admin-section input,
.admin-section textarea {
  width: 100%;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 10px 11px;
}

.admin-section textarea {
  resize: vertical;
}

.modal-card input:focus,
.admin-section input:focus,
.admin-section textarea:focus {
  outline: 2px solid rgba(0, 104, 255, 0.18);
  border-color: var(--blue);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.login-error {
  min-height: 20px;
  margin: 10px 0 14px;
  color: #c0392b;
  font-size: 12px;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 70;
  width: min(460px, 100vw);
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #f8fafc;
  border-left: 1px solid #d8dee8;
  box-shadow: -24px 0 70px rgba(13, 22, 40, 0.18);
  transform: translateX(104%);
  transition: transform 180ms ease;
}

.admin-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid #d8dee8;
  background: #fff;
}

.drawer-header p {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.drawer-header h2 {
  margin: 0;
  color: var(--navy);
  font-size: 24px;
}

.drawer-body {
  overflow: auto;
  padding: 20px 24px 120px;
}

.admin-section {
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.admin-section + .admin-section {
  margin-top: 14px;
}

.admin-section h3 {
  margin: 0 0 16px;
  color: var(--navy);
  font-size: 16px;
}

.preview-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.preview-row img {
  width: 84px;
  height: 84px;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  object-fit: cover;
  background: #f3f6fa;
}

.file-button,
.import-button {
  position: relative;
  overflow: hidden;
}

.file-button input,
.import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #d8dee8;
  background: #fff;
}

.admin-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 0 12px;
  cursor: pointer;
}

.admin-button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.admin-button.danger {
  color: #c0392b;
}

@media (max-width: 760px) {
  .topbar,
  .nav {
    height: auto;
  }

  .nav {
    min-height: 64px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: 16px 0;
  }

  .nav-links {
    width: 100%;
    height: auto;
    flex-wrap: wrap;
    gap: 8px 18px;
    justify-content: flex-start;
  }

  .nav-links a {
    height: 30px;
    padding-top: 0;
  }

  .section-block,
  #works,
  #education,
  #career,
  #projects {
    padding-top: 90px;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .portrait {
    width: 210px;
    height: 210px;
  }

  .intro h1 {
    font-size: 42px;
  }

  .intro h2 {
    font-size: 24px;
  }

  .work-card {
    width: 100%;
  }

  .work-image {
    height: auto;
    aspect-ratio: 518 / 258;
  }

  .manage-link {
    right: 16px;
    bottom: 12px;
  }

  .drawer-actions {
    padding-bottom: 42px;
  }
}

@media (min-width: 761px) and (max-width: 1120px) {
  .nav,
  .page {
    width: calc(100% - 96px);
    max-width: 1068px;
  }

  .nav-links {
    gap: 24px;
  }

  .intro {
    grid-template-columns: 254px minmax(0, 1fr);
    gap: 50px;
  }

  .intro p {
    width: auto;
  }
}
