/*
 * 刘安个人首页 · Swiss Grid
 * Visual language adapted directly from html-ppt / swiss-grid.
 * Content structure, responsive layout and interaction behavior are unchanged.
 */

:root {
  color-scheme: only light;
  --bg: #ffffff;
  --bg-soft: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #f4f4f4;
  --border: #111111;
  --border-strong: #111111;
  --text-1: #111111;
  --text-2: #444444;
  --text-3: #888888;
  --accent: #d6001c;
  --accent-2: #111111;
  --accent-3: #888888;
  --good: #0f8a2f;
  --warn: #d38a00;
  --bad: #d6001c;
  --radius: 0;
  --radius-sm: 0;
  --radius-lg: 0;
  --shadow: none;
  --shadow-lg: none;
  --font-sans: "Microsoft YaHei", "微软雅黑", sans-serif;
  --font-display: "Microsoft YaHei", "微软雅黑", sans-serif;
  --font-mono: "Microsoft YaHei", "微软雅黑", sans-serif;
  --page-max: 1440px;
  --gutter: 20px;
  --rail: 390px;
  --gap: 20px;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  min-width: 320px;
  background-color: var(--bg);
  background-image: linear-gradient(90deg, rgba(0, 0, 0, .035) 1px, transparent 1px);
  background-size: calc(100% / 12) 100%;
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 19.5px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  z-index: 1000;
  top: 0;
  right: 0;
  left: 0;
  height: 6px;
  background: var(--accent);
}

img, video, svg {
  display: block;
  max-width: 100%;
}

button, input, textarea, select {
  font: inherit;
}

.layout {
  display: block;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 26px var(--gutter) 0;
}

/* Profile rail */
.sidebar,
.sidebar.is-fixed {
  position: fixed;
  z-index: 20;
  top: 20px;
  left: max(calc((100vw - var(--page-max)) / 2 + var(--gutter) - 40px), 0px);
  width: var(--rail);
  padding: 16px 18px;
  border: 2px solid var(--border);
  border-top-width: 7px;
  background: var(--surface);
}

.sidebar-header {
  margin-bottom: 12px;
  padding: 0 0 9px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.sidebar-header::before {
  content: "■";
  margin-right: 10px;
  color: var(--accent);
}

.sidebar-photo {
  width: 100%;
  height: 510px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  object-fit: cover;
  object-position: center 23%;
}

.sidebar-name {
  margin-bottom: 10px;
  padding: 7px 0 8px;
  border-top: 4px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--font-display);
  font-size: 31.5px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: .26em;
  text-align: center;
}

.sidebar-role {
  margin-bottom: 2px;
  color: var(--text-1);
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: .02em;
  text-align: center;
  white-space: nowrap;
}

.sidebar-role::before {
  content: "/ ";
  color: var(--accent);
  font-weight: 900;
}

.sidebar-divider {
  height: 1px;
  margin: 12px 0;
  border: 0;
  background: var(--border);
}

.sidebar-info {
  list-style: none;
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.65;
}

.sidebar-info li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border-bottom: 1px solid #cccccc;
}

.sidebar-info li:last-child {
  border-bottom: 0;
}

.sidebar-info .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
}

.sidebar-info .icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.sidebar-info .label {
  margin-right: 4px;
  color: var(--text-1);
  font-weight: 800;
}

.sidebar-info .value {
  min-width: 0;
  flex: 1;
  color: var(--text-2);
  white-space: nowrap;
}

.sidebar-info .phone-item {
  align-items: flex-start;
}

.sidebar-info .phone-item .icon {
  margin-top: 4px;
}

.sidebar-info .phone-value {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  column-gap: 4px;
}

.phone-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

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

/* Main content */
.main,
.main.is-compensated {
  width: auto;
  min-width: 0;
  margin-left: calc(var(--rail) + var(--gap));
  padding-left: 0;
  border-left: 0;
}

.section {
  margin-bottom: 52px;
  background: var(--surface);
}

.section-head {
  position: relative;
  display: flex;
  min-height: 58px;
  align-items: center;
  margin-bottom: 22px;
  padding: 8px 0 8px 66px;
  border-top: 4px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.section-head::before {
  content: attr(data-section);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  width: 48px;
  height: 100%;
  place-items: center;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .04em;
}

.section-title {
  margin: 0;
  color: var(--text-1);
  font-family: var(--font-display);
  font-size: 27.5px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -.025em;
}

/* Experience */
.experience-grid,
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.entry {
  min-width: 0;
  padding: 18px 0 16px;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.entry-title {
  margin-bottom: 10px;
  color: var(--text-1);
  font-size: 20.5px;
  font-weight: 850;
  line-height: 1.55;
}

.entry-list,
.project-content,
.course-goals {
  list-style: none;
  padding-left: 0;
}

.entry-list li,
.project-content li,
.course-goals li {
  position: relative;
  padding-left: 20px;
  color: var(--text-2);
  font-size: 16px;
}

.entry-list li {
  line-height: 2.05;
}

.entry-list li::before,
.project-content li::before,
.course-goals li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 900;
}

/* Projects */
.project {
  min-width: 0;
  padding: 18px 0 16px;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.project-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #cccccc;
}

.project-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  padding: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  object-fit: contain;
}

.project-title {
  min-width: 0;
  flex: 1;
  color: var(--text-1);
  font-size: 19.5px;
  font-weight: 850;
  line-height: 1.45;
}

.project-no {
  display: block;
  width: fit-content;
  margin-bottom: 4px;
  padding: 2px 8px;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.project-customer {
  margin-bottom: 8px;
  padding: 4px 0 8px;
  border-bottom: 1px dashed #888888;
  color: var(--text-2);
  font-size: 16px;
  font-weight: 700;
}

.project-content li {
  line-height: 1.85;
}

/* Courses */
.course-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.course-card,
.course-card:last-child {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(290px, 330px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 0 40px;
  padding: 18px 0;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.course-title {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font-size: 17.5px;
  font-weight: 900;
  line-height: 1.5;
}

.course-info {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  color: var(--text-2);
  font-size: 16px;
}

.course-fact {
  padding: 7px 0;
}

.course-fact-label {
  display: block;
  width: fit-content;
  margin-bottom: 4px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.course-goals {
  margin-top: 5px;
}

.course-goals li {
  margin-bottom: 3px;
  line-height: 1.65;
}

.course-img {
  width: 100%;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: zoom-in;
  object-fit: contain;
  object-position: top;
  transition: opacity .2s ease;
}

.course-img:hover {
  opacity: .82;
}

/* Achievements */
.subsection-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 16px;
  padding: 8px 0;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-size: 20.5px;
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: -.015em;
}

.subsection-title::before {
  content: "■";
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.achievement-grid,
.achievement-grid.cols-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.ach-item {
  height: auto;
  min-width: 0;
  margin-bottom: 10px;
  padding: 0 0 14px;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.ach-media {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  cursor: zoom-in;
  object-fit: contain;
  object-position: center;
  transition: opacity .2s ease;
}

.ach-media:hover {
  opacity: .82;
}

.ach-item-multi {
  display: flex;
  gap: 6px;
}

.ach-item-multi .ach-media {
  width: calc(50% - 3px);
  min-width: 0;
  flex: 1;
}

.ach-title {
  margin-top: 0;
  padding: 10px 0 0;
  color: var(--text-1);
  font-size: 16.5px;
  font-weight: 850;
  line-height: 1.45;
  text-align: left;
}

.ach-no {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 7px;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: .04em;
}

/* Lightbox — existing interaction remains unchanged */
.lightbox {
  position: fixed;
  z-index: 9999;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 60px 34px;
  background: rgba(0, 0, 0, .92);
}

.lightbox.is-open {
  display: flex;
}

.lightbox-content {
  position: relative;
  display: flex;
  width: min(1180px, 94vw);
  height: min(820px, 86vh);
  align-items: center;
  justify-content: center;
}

#lightboxMedia {
  display: flex;
  max-width: 100%;
  max-height: 100%;
  align-items: center;
  justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  border: 1px solid #ffffff;
  background: #000000;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 22px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid #ffffff;
  background: #000000;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: #ffffff;
  color: #000000;
}

.lightbox-caption {
  position: absolute;
  right: 0;
  bottom: -34px;
  left: 0;
  color: #ffffff;
  font-size: 17.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-align: center;
}

[data-zoom]:focus-visible,
.lightbox-close:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

@media (max-width: 1120px) and (min-width: 901px) {
  :root {
    --gutter: 16px;
    --rail: 380px;
    --gap: 20px;
  }

  .sidebar,
  .sidebar.is-fixed {
    padding: 14px 16px;
  }

  .course-card,
  .course-card:last-child {
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  :root {
    --gutter: 18px;
  }

  .layout {
    padding-top: 18px;
  }

  .sidebar,
  .sidebar.is-fixed {
    position: static !important;
    top: auto;
    left: auto;
    width: 100%;
    margin-bottom: 24px;
  }

  .sidebar-photo {
    height: 420px;
    object-position: center 20%;
  }

  .main,
  .main.is-compensated {
    width: 100%;
    margin-left: 0;
  }

  .experience-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --gutter: 14px;
  }

  body {
    font-size: 17px;
  }

  .layout {
    padding-bottom: 42px;
  }

  .sidebar-photo {
    height: 360px;
  }

  .section {
    margin-bottom: 42px;
  }

  .section-head {
    min-height: 52px;
    padding-left: 60px;
  }

  .section-title {
    font-size: 23px;
  }

  .achievement-grid,
  .achievement-grid.cols-2 {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .ach-media {
    max-height: 420px;
  }
}

@media (max-width: 620px) {
  .course-card,
  .course-card:last-child {
    display: block;
    padding: 16px 0;
  }

  .course-title {
    margin-bottom: 10px;
  }

  .course-info {
    margin-bottom: 14px;
  }

  .sidebar-role,
  .sidebar-info .value {
    white-space: normal;
  }
}

@media (max-width: 360px) {
  :root {
    --gutter: 6px;
  }

  .sidebar-info {
    font-size: 15px;
    letter-spacing: -.04em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  body::before,
  .lightbox {
    display: none !important;
  }

  .sidebar,
  .sidebar.is-fixed {
    position: absolute;
  }

  .entry,
  .project,
  .course-card,
  .ach-item {
    break-inside: avoid;
  }
}
