:root {
  --yale-blue: #00356b;
  --yale-blue-accent: #0f4d92;
  --bg: #f7f9fc;
  --text: #111827;
  --card-bg: #ffffff;
  --ring: rgba(15, 77, 146, 0.35);
  --right-pane: 880px;
  /* change me to widen/narrow the right pane */
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a {
  color: var(--yale-blue-accent);
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

/* Outer shell margins for BOTH panes */
.shell {
  max-width: calc(300px + 32px + var(--right-pane) + 80px);
  margin: 0 auto;
  padding: 24px 40px
}

.layout {
  display: flex;
  min-height: calc(100vh - 48px);
  align-items: stretch;
  flex-wrap: nowrap
}

.sidebar {
  width: 300px;
  background: var(--yale-blue);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  border-radius: 16px;
}

/* Desktop: profile contains avatar, name, tagline, contact, and tabs */
.profile {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Desktop: profile-info wrapper is transparent */
.profile-info {
  display: contents;
}

/* Desktop: tabs positioned right after contact links */
.tabs {
  margin: 24px 0 0 0;
  display: grid;
  gap: 10px;
}

.sidebar-footer {
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.8);
}

.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.25);
  display: block;
  margin: 4px 0 12px 0
}

.name {
  margin: 8px 0 4px 0;
  font-size: 24px;
  line-height: 1.2
}

.tagline {
  margin: 0 0 16px 0;
  color: rgba(255, 255, 255, 0.85)
}

.contact {
  list-style: none;
  margin: 0;
  padding: 0
}

.contact li {
  margin: 6px 0
}

.contact a {
  color: #fff;
  opacity: 0.95
}

.tab-btn {
  appearance: none;
  border: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 15px
}

.tab-btn[aria-selected="true"] {
  background: #fff;
  color: var(--yale-blue);
  font-weight: 600
}

.sidebar-footer {
  margin-top: 0;
  color: rgba(255, 255, 255, 0.8);
  order: 3; /* Position footer at the very bottom */
}

.content {
  flex: 1;
  padding-left: 32px;
  height: calc(100vh - 48px);
  display: flex
}

.content-inner {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  padding: 24px 24px 48px 24px;
  width: var(--right-pane);
  height: 100%;
  display: block;
  overflow: auto
}

/* Tab panels */
.tab-panel {
  display: none;
  height: 100%
}

.tab-panel.active {
  display: block;
  animation: fade .25s ease;
  height: 100%
}

/* Home layout: intro, photo, bottom cards; photo expands without causing scroll */
#home.active {
  display: grid;
  grid-template-rows: auto 1fr auto
}

.home-photo {
  min-height: 160px;
}

.home-photo img {
  width: 100%;
  height: 90%;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  display: block;
}

/* Cards triplet at bottom, no stretching */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
  align-content: start
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  transition: transform .2s ease, box-shadow .2s ease;
  outline: none;
  display: block;
}

.card:focus {
  box-shadow: 0 0 0 4px var(--ring)
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12)
}

.card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block
}

.card-title {
  padding: 12px 14px;
  font-weight: 600;
  border-top: 1px solid #eef2f7;
  text-align: center
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px)
  }

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

/* YouTube grid & hero image */
.video-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr))
}

.video-wrap {
  position: relative;
  padding-top: 56.25%;
  overflow: hidden;
  border-radius: 16px;
  background: #000
}

.video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0
}

.hero {
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08)
}

/* Fallback thumbnail card for non-embeddable videos */
.yt-thumb {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 16px;
  overflow: hidden;
  /* clip overlays to rounded corners */
}

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

/* Center play button */
.yt-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 28px;
  line-height: 1;
}

/* Title overlay (2-line clamp) */
.yt-title {
  position: absolute;
  top: 8px;
  left: 10px;
  /* top-left */
  z-index: 2;
  padding: 10px 12px;
  color: #fff;
  font-weight: 600;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0) 60%);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  /* clamp to 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yt-thumb:hover .yt-play {
  background: rgba(0, 0, 0, 0.75);
}

.yt-thumb:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

/* Apple Music embed - zoomed out to show more content without scroll */
.apple-music-wrap {
  position: relative;
  padding-top: 45%;
  /* Moderate height for container */
  overflow: hidden;
  border-radius: 16px;
  background: transparent;
}

.apple-music-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 125%;
  /* Scale up width to zoom out */
  height: 125%;
  /* Scale up height to zoom out */
  transform: scale(0.8);
  /* Scale down to fit, showing more content */
  transform-origin: top left;
  /* Scale from top-left corner */
  border: 0;
  border-radius: 16px;
}

/* Image grid for displaying images side by side */
.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 20px 0;
}

.image-item {
  display: flex;
  flex-direction: column;
}

.image-item img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  margin-bottom: 8px;
}

.image-item img:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.image-item img:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

.image-caption {
  font-size: 14px;
  color: var(--text);
  text-align: center;
  font-weight: 500;
  opacity: 0.8;
}

/* Video grid captions for music section */
.video-item {
  display: flex;
  flex-direction: column;
}

.video-caption {
  font-size: 14px;
  color: var(--text);
  text-align: center;
  font-weight: 500;
  margin-top: 8px;
  opacity: 0.8;
}

/* Mobile */
@media (max-width: 980px) {
  .shell {
    padding: 16px
  }

  .layout {
    flex-direction: column;
    min-height: auto
  }

  /* Mobile sidebar - two row structure */
  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    border-radius: 12px;
    margin-bottom: 16px;
    padding: 16px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* Mobile: Profile restructured for two-row layout */
  .profile {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* First row: Profile info in two columns */
  .profile-info {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: start;
  }

  /* Profile left column - avatar and name */
  .profile-left {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .avatar {
    width: 80px;
    height: 80px;
    margin: 0 0 8px 0;
  }

  .name {
    font-size: 18px;
    margin: 0 0 4px 0;
    text-align: center;
  }

  .tagline {
    font-size: 12px;
    margin: 0;
    text-align: center;
  }

  /* Profile right column - contact links */
  .contact {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .contact li {
    margin: 0;
  }

  .contact a {
    font-size: 14px;
  }

  /* Second row: Navigation tabs full width */
  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0;
    width: 100%;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 14px;
  }

  .content {
    padding-left: 0;
    height: auto;
    display: block;
    width: 100%; /* Match sidebar width */
  }

  .content-inner {
    height: auto;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    margin: 0; /* Remove any margin that might cause offset */
  }

  #home.active {
    min-height: auto;
    display: block
  }

  /* Single column layout for cards */
  .cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Single column for image and video grids */
  .image-grid {
    grid-template-columns: 1fr;
  }

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

  /* Ensure page starts at top */
  body {
    scroll-behavior: smooth;
  }

  .shell {
    display: flex;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .cards {
    grid-template-columns: 1fr
  }

  .image-grid {
    grid-template-columns: 1fr
  }
}