:root {
  --profile-navy: #003f7d;
  --profile-navy-dark: #002c58;
  --profile-accent: #0b6fc2;
  --profile-text: #1d2b3e;
  --profile-muted: #536477;
  --profile-background: #f3f7fb;
  --profile-surface: #ffffff;
  --profile-border: #c8d8e8;
}

body.student-profile-page {
  margin: 0;
  color: var(--profile-text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 18px;
  line-height: 1.75;
  text-align: left;
  background: var(--profile-background) !important;
}

.student-profile-page #header {
  width: min(100%, 1200px);
  height: auto;
  margin: 0 auto;
  overflow: hidden;
  text-align: center;
  background: var(--profile-navy-dark);
  border: 0;
}

.student-profile-page #header a,
.student-profile-page #header img {
  display: block;
}

.student-profile-page #header img {
  width: 100%;
  height: auto;
  border: 0;
}

.student-profile-page #container {
  width: min(100%, 1200px);
  min-height: 0;
  margin: 0 auto;
  text-align: left;
  background: transparent;
  border: 0;
}

.department-profile {
  padding: 36px 32px 56px;
}

.profile-back {
  margin: -16px 0 12px;
}

.profile-back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--profile-navy);
  text-underline-offset: 4px;
}

.profile-hero,
.profile-section {
  background: var(--profile-surface);
  border: 1px solid var(--profile-border);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(18, 53, 88, 0.07);
}

.profile-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 22px 28px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--profile-navy-dark), var(--profile-navy));
  border: 0;
  box-shadow: 0 12px 28px rgba(0, 48, 93, 0.18);
}

.profile-hero__eyebrow,
.profile-section__heading > p {
  margin: 0 0 6px;
  color: var(--profile-accent);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.profile-hero__eyebrow {
  color: #cfe8ff;
}

.profile-hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
}

.profile-hero__description {
  max-width: 42rem;
  margin: 6px 0 0;
  color: #e5f1fc;
  font-size: 1.125rem;
  line-height: 1.75;
}

.profile-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 0;
  color: #dcecff;
  font-size: 1rem;
}

.profile-hero__meta a {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 14px;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.profile-hero__meta a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.25);
  border-color: #ffffff;
  transform: translateY(-1px);
}

.profile-section {
  padding: clamp(20px, 3vw, 28px);
}

.profile-section--study {
  margin-top: 24px;
}

.profile-section__heading {
  margin-bottom: 18px;
}

.profile-section__heading h2 {
  margin: 0;
  color: var(--profile-navy-dark);
  font-size: 1.5rem;
  font-weight: 700;
}

.profile-section__heading > span {
  display: block;
  margin-top: 6px;
  color: var(--profile-muted);
  font-size: 1rem;
}

.profile-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--profile-border);
  border-radius: 10px;
}

.profile-table {
  width: 100%;
  min-width: 840px;
  border-spacing: 0;
  border-collapse: collapse;
}

.profile-table th,
.profile-table td {
  padding: 16px 18px;
  color: var(--profile-text);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--profile-border);
}

.profile-table thead th {
  color: #ffffff;
  font-weight: 700;
  background: var(--profile-navy);
}

.profile-table tbody th {
  color: var(--profile-navy-dark);
  font-weight: 700;
  background: #eef5fc;
}

.profile-table tbody tr:nth-child(even) td {
  background: #fbfdff;
}

.profile-table tbody tr:last-child th,
.profile-table tbody tr:last-child td {
  border-bottom: 0;
}

.profile-enrollment {
  min-width: 260px;
  line-height: 1.8;
}

.profile-enrollment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-enrollment-list li {
  padding: 2px 8px;
  background: #eef5fc;
  border-radius: 4px;
}

.profile-enrollment-list strong {
  font-variant-numeric: tabular-nums;
}

.profile-content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.profile-section--staff,
.profile-section--feature,
.profile-section--career {
  grid-column: 1 / -1;
}

.profile-content-grid > .profile-section {
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-rich-text,
.profile-career-card p {
  margin: 0;
  color: var(--profile-text);
  line-height: 1.85;
}

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

.profile-career-card {
  padding: 18px;
  background: #f6faff;
  border: 1px solid #d7e5f2;
  border-radius: 10px;
}

.profile-career-card h3 {
  margin: 0 0 8px;
  color: var(--profile-navy);
  font-size: 1.125rem;
  font-weight: 700;
}

.profile-link-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.profile-link-list > div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #dbe6f0;
}

.profile-link-list > div:first-child {
  padding-top: 0;
}

.profile-link-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.profile-link-list dt {
  color: var(--profile-navy-dark);
  font-weight: 700;
}

.profile-link-list dd {
  min-width: 0;
  margin: 0;
}

.profile-link-list a {
  display: inline-block;
  min-height: 44px;
  color: #075caa;
  overflow-wrap: anywhere;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.profile-link-list a:hover {
  color: var(--profile-navy-dark);
}

.profile-empty {
  color: var(--profile-muted);
}

.profile-link-note {
  margin: 12px 0 0;
  color: var(--profile-muted);
  font-size: 1rem;
}

.profile-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 28px;
}

.profile-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 11px 18px;
  font-size: 1.0625rem;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  background: var(--profile-accent);
  border: 1px solid var(--profile-accent);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(11, 111, 194, 0.22);
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.profile-actions a:hover {
  color: #ffffff;
  background: #075b9f;
  border-color: #075b9f;
  box-shadow: 0 6px 14px rgba(11, 111, 194, 0.27);
  transform: translateY(-1px);
}

.student-profile-page a:focus-visible,
.student-profile-page .profile-skip-link:focus {
  outline: 3px solid rgba(11, 111, 194, 0.48);
  outline-offset: 3px;
}

.profile-hero__meta a:focus-visible {
  outline-color: #ffffff;
}

.profile-skip-link {
  position: absolute;
  z-index: 10;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  background: var(--profile-navy-dark);
  border-radius: 6px;
  transform: translateY(-160%);
}

.profile-skip-link:focus {
  transform: translateY(0);
}

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

.student-profile-page #footer {
  box-sizing: border-box;
  width: min(100%, 1200px);
  height: auto;
  min-height: 0;
  margin: 0 auto;
  padding: 20px 24px;
  color: #e5eef8;
  font-size: 1rem;
  line-height: 1.75;
  text-align: center;
  background: var(--profile-navy-dark);
  border: 0;
}

.student-profile-page #footer a {
  color: #ffffff;
}

.student-profile-page #footer img {
  vertical-align: text-bottom;
}

@media (max-width: 767px) {
  .student-profile-page #header,
  .student-profile-page #container,
  .student-profile-page #footer {
    width: 100%;
  }

  .department-profile {
    padding: 20px 16px 40px;
  }

  .profile-hero {
    padding: 18px 20px;
    border-radius: 12px;
  }

  .profile-content-grid,
  .profile-career-grid {
    grid-template-columns: 1fr;
  }

  .profile-section--feature,
  .profile-section--career,
  .profile-section--activity {
    grid-column: auto;
  }

  .profile-link-list > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .profile-actions a {
    width: 100%;
  }

  .student-profile-page #footer {
    padding: 18px 16px;
  }
}

@media print {
  body.student-profile-page {
    color: #000000;
    background: #ffffff !important;
  }

  .student-profile-page #header,
  .profile-hero {
    color: #000000;
    background: #ffffff;
    border-bottom: 2px solid #000000;
    box-shadow: none;
  }

  .profile-section {
    box-shadow: none;
  }

  .profile-actions,
  .profile-back,
  .profile-skip-link {
    display: none;
  }

  .profile-table-wrap {
    overflow: visible;
  }

  .profile-table {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-hero__meta a,
  .profile-actions a {
    transition: none;
  }
}
