/*
  JobPage Pro UI
  第一阶段只重构界面布局：Dashboard 双栏、Apple 风格、PC 优先。
*/

/* ========== Design Tokens ========== */
:root {
  --page-max-width: 1840px;
  --sidebar-width: 425px;
  --bg: #f8f8f5;
  --card: #ffffff;
  --text: #242424;
  --muted: #70736d;
  --soft: #94978f;
  --line: rgba(46, 49, 43, 0.08);
  --hover: #eef3f2;
  --brand: #8fa391;
  --brand-dark: #5f735f;
  --shadow: 0 18px 60px rgba(57, 61, 53, 0.045);
  --shadow-hover: 0 32px 76px rgba(57, 61, 53, 0.085);
  --float-shadow: 0 34px 90px rgba(57, 61, 53, 0.1);
  --radius: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 420ms;
  --float-ease: cubic-bezier(0.18, 0.9, 0.22, 1.08);
}

/* ========== Base ========== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "SF Pro Text",
    "Helvetica Neue",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  animation: pageFadeIn var(--duration) var(--ease) both;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.modal-open {
  overflow: hidden;
}

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

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ========== App Layout ========== */
.app-shell {
  width: min(98vw, var(--page-max-width));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-size: 25px;
  font-weight: 760;
  letter-spacing: 0;
}

.brand-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.theme-button,
.preview-button,
.download-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 720;
  transition:
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    background-color var(--duration) var(--ease);
}

.theme-button {
  width: 48px;
  min-height: 48px;
  background: transparent;
  font-size: 27px;
}

.preview-button {
  min-height: 48px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.download-button {
  min-height: 48px;
  padding: 0 32px;
  background: var(--text);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.theme-button:hover,
.preview-button:hover,
.download-button:hover {
  transform: translateY(-1px);
  background-color: var(--hover);
  box-shadow: var(--shadow-hover);
}

.download-button:hover {
  background-color: var(--brand-dark);
  color: #ffffff;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* ========== Sidebar ========== */
.profile-panel {
  min-height: auto;
  overflow: visible;
  padding: 32px;
  background: linear-gradient(145deg, #ffffff 0%, #f3f3ef 100%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition:
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.avatar-frame {
  position: relative;
  width: 330px;
  height: 330px;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: 0 auto 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 45% 28%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 36%),
    linear-gradient(145deg, #e7e8ec, #d2d5dc);
  box-shadow:
    0 28px 70px rgba(57, 61, 53, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transform: translateY(0);
  transition:
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.profile-panel:hover .avatar-frame {
  transform: translateY(-4px);
  box-shadow:
    0 38px 90px rgba(57, 61, 53, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.profile-headline {
  margin-bottom: 36px;
}

.profile-headline h1 {
  margin: 0 0 8px;
  font-size: 42px;
  line-height: 1.1;
  font-weight: 780;
  letter-spacing: 0;
}

.profile-headline p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 560;
}

.side-card {
  padding: 24px;
  margin-top: 20px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  box-shadow: var(--shadow);
  transition:
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.side-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.about-card {
  background: #f2f3ef;
}

.strengths-card {
  background: #ffffff;
}

.side-card h2,
.contact-block h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 760;
}

.card-icon {
  width: 24px;
  color: var(--text);
  font-size: 20px;
}

.about-card p {
  max-width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 520;
}

.strengths-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.strengths-card li {
  position: relative;
  padding-left: 36px;
  color: var(--text);
  font-size: 15px;
  font-weight: 560;
}

.strengths-card li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--brand);
  color: var(--brand-dark);
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
}

.contact-block {
  margin-top: 32px;
  padding: 0 12px;
  background: transparent;
}

.contact-list {
  display: grid;
  gap: 10px;
}

.contact-item {
  display: grid;
  grid-template-columns: 28px 48px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  color: var(--text);
  font-size: 15px;
}

.contact-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: var(--shadow);
}

.contact-label {
  font-weight: 680;
}

.contact-value {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ========== Main Content ========== */
.content-panel {
  min-height: auto;
  overflow: visible;
  padding: 32px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition:
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.content-header h2 {
  margin: 0 0 24px;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 780;
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.category-tab {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 17px;
  font-weight: 760;
  white-space: nowrap;
  transition:
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    background-color var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

.category-tab:hover {
  transform: translateY(-2px);
  background: var(--hover);
  border-color: rgba(143, 163, 145, 0.28);
  box-shadow: var(--shadow-hover);
}

.category-tab.is-active {
  background: var(--brand);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    var(--shadow-hover);
}

.tab-icon {
  color: currentColor;
  opacity: 0.78;
}

.tab-count {
  min-width: 28px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(46, 49, 43, 0.06);
  color: inherit;
  font-size: 14px;
  font-weight: 760;
}

.category-tab.is-active .tab-count {
  background: rgba(255, 255, 255, 0.14);
}

.works-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 16px;
}

.works-heading h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 780;
}

.view-all-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  font-weight: 760;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px 24px;
  perspective: 1200px;
}

.video-card {
  --rotate-x: 0deg;
  --rotate-y: 0deg;
  min-width: 0;
  background: transparent;
  text-align: left;
  transform: perspective(1000px) translateY(0) rotateX(var(--rotate-x)) rotateY(var(--rotate-y));
  transform-style: preserve-3d;
  will-change: transform, filter;
  transition:
    transform 620ms var(--float-ease),
    filter 620ms var(--ease);
}

.video-card:hover {
  transform: perspective(1200px) translateY(-5px) rotateX(var(--rotate-x)) rotateY(var(--rotate-y));
  filter: drop-shadow(0 24px 44px rgba(57, 61, 53, 0.1));
}

.video-thumb {
  position: relative;
  aspect-ratio: 1.24 / 1;
  overflow: hidden;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)),
    #dde2df;
  box-shadow: 0 14px 34px rgba(57, 61, 53, 0.06);
  transform: translateZ(0);
  transition:
    box-shadow 620ms var(--ease),
    filter 620ms var(--ease);
}

.video-card:hover .video-thumb {
  box-shadow: var(--float-shadow);
  filter: saturate(1.04) contrast(1.02);
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(36, 36, 36, 0.4);
  font-size: 42px;
  font-weight: 780;
}

.play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.78);
  transform: translate(-50%, -50%);
  border: 1.5px solid rgba(255, 255, 255, 0.48);
  box-shadow:
    0 8px 24px rgba(20, 22, 20, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px) saturate(112%);
  opacity: 0.68;
  transition:
    opacity 520ms var(--ease),
    transform 620ms var(--float-ease),
    background-color 520ms var(--ease),
    border-color 520ms var(--ease),
    box-shadow 520ms var(--ease);
}

.video-card:hover .play-badge {
  opacity: 0.9;
  transform: translate(-50%, -54%) scale(1.04);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow:
    0 14px 34px rgba(20, 22, 20, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.video-meta {
  padding-top: 10px;
}

.video-meta h4 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.28;
  font-weight: 800;
}

.video-meta p {
  margin: 0;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.empty-note {
  grid-column: 1 / -1;
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(143, 163, 145, 0.34);
  outline-offset: 4px;
}

/* ========== Video Modal ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: overlayFadeIn var(--duration) var(--ease) both;
}

.modal.is-closing {
  animation: overlayFadeOut var(--duration) var(--ease) both;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
}

.modal-card {
  position: relative;
  width: min(960px, 90vw);
  overflow: hidden;
  background: #111111;
  border-radius: 24px;
  box-shadow: 0 28px 56px rgba(0, 0, 0, 0.22);
  animation: videoPlayerZoomIn var(--duration) var(--ease) both;
}

.modal.is-closing .modal-card {
  animation: videoPlayerZoomOut var(--duration) var(--ease) both;
}

.icon-button {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.48);
  color: #ffffff;
  font-size: 28px;
  transition:
    transform var(--duration) var(--ease),
    background-color var(--duration) var(--ease);
}

.icon-button:hover {
  transform: scale(1.08);
  background: rgba(0, 0, 0, 0.68);
}

.modal-player-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000000;
}

.modal-video {
  width: 100%;
  height: 100%;
  background: #111111;
  object-fit: contain;
}

.modal-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.modal-empty[hidden] {
  display: none;
}

.modal-info {
  padding: 24px 28px 28px;
  background: #111111;
}

.modal-info h3 {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 20px;
  line-height: 1.28;
  font-weight: 760;
}

.modal-info p {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 500;
}

/* ========== PDF Modal ========== */
.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: overlayFadeIn var(--duration) var(--ease) both;
}

.pdf-modal[hidden] {
  display: none;
}

.pdf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.pdf-viewer-card {
  position: relative;
  width: min(900px, 90vw);
  height: 90vh;
  overflow: hidden;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.24);
  animation: playerZoomIn var(--duration) var(--ease) both;
}

.pdf-close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.48);
  color: #ffffff;
  font-size: 28px;
  transition:
    transform var(--duration) var(--ease),
    background-color var(--duration) var(--ease);
}

.pdf-close-button:hover {
  transform: scale(1.08);
  background: rgba(0, 0, 0, 0.68);
}

.pdf-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes overlayFadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes playerZoomIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes playerZoomOut {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.96);
  }
}

@keyframes videoPlayerZoomIn {
  from {
    opacity: 0;
    transform: translateY(-6vh) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(-6vh) scale(1);
  }
}

@keyframes videoPlayerZoomOut {
  from {
    opacity: 1;
    transform: translateY(-6vh) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-6vh) scale(0.96);
  }
}

/* ========== Responsive ========== */
@media (max-width: 1180px) {
  .category-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .video-grid {
    grid-template-rows: none;
  }
}

@media (max-width: 980px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .avatar-frame {
    width: 220px;
    height: 220px;
  }

  .profile-panel {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .content-panel {
    height: auto;
    min-height: auto;
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 32px, var(--page-max-width));
    padding-top: 16px;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .preview-button,
  .download-button {
    flex: 1 1 150px;
  }

  .profile-panel,
  .content-panel {
    padding: 24px;
  }

  .category-tabs,
  .video-grid {
    grid-template-columns: 1fr;
  }

  .video-thumb {
    aspect-ratio: 16 / 9;
    flex: none;
  }

  .category-tabs {
    gap: 16px;
    margin-bottom: 32px;
  }

  .works-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
