/*
Theme Name: James Im Portfolio
Theme URI: https://jamesim.com
Author: James Im
Description: Custom portfolio theme for James Im, Content Director
Version: 1.1.0
License: Private
Text Domain: james-im
*/

/* =====================================================
   CSS VARIABLES
   ===================================================== */
:root {
  --dark-box: #303030;
  --white: #ffffff;
  --black: #000000;
  --font-sfpro: 'SF Pro Display', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Inter', 'Helvetica Neue', sans-serif;
  --font-worksans: 'Work Sans', sans-serif;
  --font-jakarta: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-montserrat: 'Montserrat', 'Inter', sans-serif;
  --sidebar-width: 320px;
  --sidebar-ratio-w: 10;
  --sidebar-ratio-h: 7;
  --sidebar-padding: 24px;
}

/* =====================================================
   RESET & BASE
   ===================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  background: #ffffff;
  color: #000000;
  font-family: var(--font-sfpro);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* =====================================================
   HOMEPAGE — DESKTOP LAYOUT
   ===================================================== */

.site-homepage {
  position: relative;
  min-height: 100vh;
}

/* ── Hero wrap: natural 16:9 aspect ratio ── */
.homepage-hero-wrap {
  position: relative;
  width: 100%;
}

.homepage-hero {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #000;
  overflow: hidden;
}

.homepage-hero iframe,
.homepage-hero video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
  object-fit: cover;
}

/* ── Sidebar box — 10:7 ratio, vertically centred over hero ── */
.sidebar-box {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  /* 10:7 ratio: width = --sidebar-width, height = width * 7/10 */
  width: var(--sidebar-width);
  aspect-ratio: 10 / 7;
  background: var(--dark-box);
  padding: var(--sidebar-padding);
  z-index: 100;
  font-family: var(--font-worksans);
  font-weight: 300;
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: opacity 0.3s;
}

.sidebar-box.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.sidebar-box .site-name {
  font-size: 45px;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 300;
  line-height: 1;
}

.sidebar-box .site-title {
  font-size: 22px;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 16px;
  font-weight: 300;
}

.sidebar-box .sidebar-nav {
  list-style: none;
  margin-top: 16px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
}

.sidebar-box .sidebar-nav li {
  display: flex;
  align-items: center;
}

.sidebar-box .sidebar-nav li + li::before {
  content: "|";
  margin: 0 10px;
  opacity: 0.5;
  font-size: 16px;
}

.sidebar-box .sidebar-nav a {
  font-size: 16px;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.85;
  transition: opacity 0.2s;
  font-weight: 300;
}

.sidebar-box .sidebar-nav a:hover { opacity: 1; }

.sidebar-box .social-icons {
  display: flex;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 0;
}

.sidebar-box .social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transition: opacity 0.2s;
}

.sidebar-box .social-icons a:hover { opacity: 1; }

.sidebar-box .social-icons svg {
  width: 18px;
  height: 18px;
  fill: var(--white);
}

/* ── Sticky header strip (desktop) — hidden until sidebar scrolls off ── */
.sticky-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--dark-box);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 70px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.sticky-header.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.sticky-header__left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.sticky-header__name {
  font-family: var(--font-worksans);
  font-size: 24px;
  font-weight: 300;
  text-transform: uppercase;
  color: var(--white);
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.sticky-header__title {
  font-family: var(--font-worksans);
  font-size: 11px;
  font-weight: 300;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.1em;
}

.sticky-header__right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.sticky-header__icons {
  display: flex;
  gap: 16px;
  align-items: center;
}

.sticky-header__icons a {
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.sticky-header__icons a:hover { opacity: 1; }

.sticky-header__icons svg {
  width: 22px;
  height: 22px;
  fill: var(--white);
}

.sticky-header__nav {
  list-style: none;
  display: flex;
  gap: 28px;
}

.sticky-header__nav a {
  font-family: var(--font-worksans);
  font-size: 14px;
  font-weight: 300;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.08em;
  transition: color 0.2s;
}

.sticky-header__nav a:hover { color: var(--white); }

/* ── Mobile compact sticky bar — hidden on desktop ── */
.mobile-sticky-bar {
  display: none; /* shown in mobile media query */
}

/* ── Mobile scroll hint — hidden on desktop ── */
.mobile-scroll-hint {
  display: none; /* shown in mobile media query */
}

/* =====================================================
   HOMEPAGE — VIDEO CONTROLS
   ===================================================== */
.hero-controls {
  position: absolute;
  bottom: 40px;
  right: 24px;
  z-index: 20;
  display: flex;
  gap: 10px;
  align-items: center;
}

.hero-control-btn {
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
  backdrop-filter: blur(4px);
}

.hero-control-btn:hover {
  background: rgba(0,0,0,0.7);
  border-color: rgba(255,255,255,0.7);
}

.hero-control-btn svg {
  width: 16px;
  height: 16px;
  fill: #fff;
  pointer-events: none;
}

@media (max-width: 767px) {
  /* Hide homepage hero controls on mobile, but show project hero controls */
  .homepage-hero .hero-controls { display: flex; bottom: 12px; right: 12px; }
}

/* =====================================================
   HOMEPAGE — SCROLL HINT
   ===================================================== */
.hero-scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sfpro);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
  white-space: nowrap;
}

.hero-scroll-hint:hover { color: #fff; }

.hero-scroll-hint .scroll-arrow {
  display: flex;
  align-items: center;
  animation: bounceDown 1.8s ease-in-out infinite;
}

.hero-scroll-hint .scroll-arrow svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(4px); }
}

/* =====================================================
   HOMEPAGE — PROJECT GRID (DESKTOP)
   ===================================================== */
.projects-grid-section {
  width: 100%;
  padding: 0;
  margin-top: 20px;
  scroll-margin-top: 70px; /* clear sticky header */
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
}

@media (min-width: 1200px) {
  .projects-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.project-card {
  display: block;
  position: relative;
  cursor: pointer;
}

.project-card__image-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e8e8e8;
}

.project-card__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.project-card:hover .project-card__image-wrap img {
  transform: scale(1.03);
}

.project-card__info {
  padding: 12px 0 20px;
  text-align: center;
}

.project-card__title {
  font-family: var(--font-jakarta);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: #000000;
}

.project-card__desc {
  font-family: var(--font-montserrat);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0;
  color: #000000;
  line-height: 1.45;
  padding: 0 5%;
}

/* =====================================================
   HOMEPAGE — FOOTER
   ===================================================== */
.site-footer {
  padding: 40px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  background: #303030;
}

.site-footer .social-icons { display: flex; gap: 20px; }
.site-footer .social-icons a { opacity: 0.75; transition: opacity 0.2s; }
.site-footer .social-icons a:hover { opacity: 1; }
.site-footer .social-icons svg { fill: #ffffff; }
.site-footer .footer-icons svg { width: 30px; height: 30px; }

/* =====================================================
   PROJECT PAGE — SHARED STICKY HEADER
   ===================================================== */
.project-sticky-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--dark-box);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 70px;
}

.project-sticky-header__left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.project-sticky-header__name {
  font-family: var(--font-worksans);
  font-size: 24px;
  font-weight: 300;
  text-transform: uppercase;
  color: var(--white);
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.project-sticky-header__title {
  font-family: var(--font-worksans);
  font-size: 11px;
  font-weight: 300;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.1em;
}

.project-sticky-header__right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.project-sticky-header__icons {
  display: flex;
  gap: 16px;
  align-items: center;
}

.project-sticky-header__icons a {
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.project-sticky-header__icons a:hover { opacity: 1; }

.project-sticky-header__icons svg {
  width: 22px;
  height: 22px;
  fill: var(--white);
}

.project-sticky-header__nav {
  list-style: none;
  display: flex;
  gap: 28px;
}

.project-sticky-header__nav a {
  font-family: var(--font-worksans);
  font-size: 14px;
  font-weight: 300;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.08em;
  transition: color 0.2s;
}

.project-sticky-header__nav a:hover { color: var(--white); }

/* =====================================================
   PROJECT PAGE — DESKTOP LAYOUT
   ===================================================== */
.project-page {
  padding-top: 70px; /* clear the sticky header */
}

.project-hero {
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
}

/* YouTube embed — 16:9 */
.project-hero .video-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  overflow: hidden;
}

.project-hero .video-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}

/* Controls inside project hero video — same style as homepage */
.project-hero .hero-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 20;
}

/* Static image — 16:7 */
.project-hero .hero-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7;
  overflow: hidden;
}

.project-hero .hero-static-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

/* ── Project content — full width wrapper, text elements centred at 60% ── */
.project-content {
  max-width: 100%;
  margin: 0;
  padding: 40px 0 80px;
}

/* Non-text content (carousels, images, embeds) gets side margins */
.project-body {
  padding: 0 40px;
}

/* Text elements break out of body padding and centre at 60% of viewport */
.project-body h3,
.project-body p,
.project-body figcaption {
  padding: 0;
}

/* Text blocks centred at 60% */
.project-content .project-title,
.project-content .project-extended-desc,
.project-content .project-credits-toggle,
.project-body h3,
.project-body p,
.project-body figcaption {
  max-width: 60%;
  margin-left: auto;
  margin-right: auto;
}

.project-content .project-title {
  font-family: var(--font-jakarta);
  font-weight: 400;
  font-size: 40px;
  letter-spacing: 0;
  margin-bottom: 16px;
  color: #000000;
  line-height: 1.1;
  text-align: center;
}

.project-content .project-extended-desc {
  font-family: var(--font-montserrat);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.8;
  color: #000000;
  margin-bottom: 24px;
  text-align: center;
}

/* ── Credits ── */
.project-credits-toggle {
  margin-bottom: 32px;
  text-align: center;
}

.credits-btn {
  background: #E0E0E0;
  border: none;
  color: #000000;
  font-family: var(--font-montserrat);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.credits-btn:hover { background: #d0d0d0; }

.credits-btn .credits-prefix {
  font-size: 14px;
  line-height: 1;
  font-weight: 400;
}

.credits-panel {
  display: none;
  margin-top: 14px;
  font-family: var(--font-montserrat);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.8;
  color: #000000;
  text-align: center;
}

.credits-panel.is-open { display: block; }

/* ── Body content ── */
.project-body h2 {
  font-family: var(--font-jakarta);
  font-weight: 400;
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: 0;
  margin: 32px 0 16px;
  color: #000000;
  text-align: center;
}

.project-body h3 {
  font-family: var(--font-jakarta);
  font-weight: 500;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: 0;
  margin: 28px auto 18px;
  color: #000000;
  text-align: center;
}

.project-body p {
  font-family: var(--font-montserrat);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.8;
  color: #000000;
  margin: 0 auto 16px;
  text-align: center;
}
.project-body p + .wp-block-separator {
  margin-top: 30px; /* pull the separator up, adjust to taste */
}

.project-body img {
  width: 100%;
  height: auto;
  margin: 24px 0;
}

.project-body figure { margin: 24px 0; }

.project-body figcaption {
  font-size: 11px;
  color: rgba(0,0,0,0.45);
  margin: 8px auto 0;
  font-weight: 300;
  letter-spacing: 0.04em;
  text-align: center;
}

.project-body .wp-block-embed { margin: 32px 0; }

/* =====================================================
   MOBILE LAYOUT — HOMEPAGE  (max-width: 767px)
   ===================================================== */
@media (max-width: 767px) {

  /* Hide desktop sticky header on mobile */
  .sticky-header { display: none !important; }

  /* Hero: 16:9, full width */
  .homepage-hero {
    padding-top: 56.25%;
  }

  /* Sidebar box: full-width grey block ABOVE the hero on mobile */
  .sidebar-box {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    aspect-ratio: unset;
    padding: 24px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: flex-start;
  }

  .sidebar-box .site-name {
    font-size: 48px;
    margin-bottom: 4px;
  }

  .sidebar-box .site-title {
    font-size: 16px;
    margin-bottom: 16px;
  }

  .sidebar-box .social-icons {
    justify-content: center;
    gap: 18px;
    margin-bottom: 14px;
  }

  .sidebar-box .social-icons svg {
    width: 28px;
    height: 28px;
  }

  .sidebar-box .sidebar-nav {
    justify-content: center;
    margin-top: 0;
  }

  .sidebar-box .sidebar-nav li + li::before {
    margin: 0 12px;
  }

  /* Reorder: sidebar box comes first, then hero video */
  .homepage-hero-wrap {
    display: flex;
    flex-direction: column;
  }

  .sidebar-box { order: -1; }

  /* Compact mobile sticky bar */
  .mobile-sticky-bar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
    background: var(--dark-box);
    height: 70px;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }

  .mobile-sticky-bar.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-sticky-bar__left {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .mobile-sticky-bar__name {
    font-family: var(--font-worksans);
    font-size: 20px;
    font-weight: 300;
    text-transform: uppercase;
    color: var(--white);
    letter-spacing: 0.03em;
    line-height: 1.1;
  }

  .mobile-sticky-bar__title {
    font-family: var(--font-worksans);
    font-size: 10px;
    font-weight: 300;
    text-transform: uppercase;
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.1em;
  }

  .mobile-sticky-bar__nav {
    list-style: none;
    display: flex;
    gap: 20px;
  }

  .mobile-sticky-bar__nav a {
    font-family: var(--font-worksans);
    font-size: 13px;
    font-weight: 300;
    text-transform: uppercase;
    color: rgba(255,255,255,0.85);
    letter-spacing: 0.08em;
  }

  /* Scroll hint — hidden inside hero on mobile; shown as separate element below */
  .hero-scroll-hint {
    display: none !important;
  }

  /* Mobile scroll hint shown below video */
  .mobile-scroll-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 0 8px;
    font-family: var(--font-sfpro);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(0,0,0,0.55);
    cursor: pointer;
    user-select: none;
  }

  .mobile-scroll-hint .scroll-arrow {
    display: flex;
    align-items: center;
    animation: bounceDown 1.8s ease-in-out infinite;
  }

  .mobile-scroll-hint .scroll-arrow svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
  }

  /* Space between hero/hint section and project tiles */
  .projects-grid-section {
    margin-top: 24px;
    scroll-margin-top: 70px;
  }

  /* Mobile project tiles — stacked, with margin and spacing */
  .projects-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 16px;
    margin-bottom: 30px;
  }

  .project-card {
    display: block;
    width: 100%;
    margin-bottom: 40px; /* space between bottom of subhead and next image */
  }

  .project-card:last-child { margin-bottom: 0; }

  .project-card__image-wrap {
    aspect-ratio: 1 / 1;
    width: 100%;
    background: #e8e8e8;
  }

  .project-card__info {
    position: static;
    background: none;
    padding: 12px 0 0;
    text-align: center;
  }

  .project-card__title {
    font-family: var(--font-jakarta);
    font-weight: 500;
    font-size: 20px;
    color: #000;
    text-transform: uppercase;
    margin-bottom: 6px;
  }

  .project-card__desc {
    display: block;
    font-family: var(--font-montserrat);
    font-weight: 400;
    font-size: 13px;
    line-height: 1.4;
    color: #000;
  }

  .site-footer {
    padding: 24px;
  }
}

/* =====================================================
   MOBILE LAYOUT — PROJECT PAGE  (max-width: 767px)
   ===================================================== */
@media (max-width: 767px) {

  /* Project page uses the same compact sticky header */
  .project-sticky-header {
    height: 70px;
  }

  .project-sticky-header__icons {
    display: none; /* hide social icons on mobile project header to save space */
  }

  .project-page {
    padding-top: 70px;
  }

  .project-content {
    max-width: 100%;
    padding: 24px 20px 60px;
  }

  /* Reset project-body padding on mobile */
  .project-body {
    padding: 0;
  }

  /* Remove 60% constraint on text blocks for mobile — full width */
  .project-content .project-title,
  .project-content .project-extended-desc,
  .project-content .project-credits-toggle,
  .project-body h3,
  .project-body p,
  .project-body figcaption {
    max-width: 100%;
  }

  .project-content .project-title {
    font-size: 28px;
    text-align: center;
  }

  .project-content .project-extended-desc {
    font-size: 14px;
    text-align: center;
  }

  .project-body h2 + .section-image {
    width: 100% !important;
    margin-top: -15px;
  }
  
  .project-body h3 {
    font-size: 16px;
    text-align: center;
    margin: 20px auto 20px;
  }

  .project-body p {
    font-size: 14px;
    text-align: center;
  }

  .project-body figcaption {
    text-align: center;
  }
}

/* =====================================================
   ABOUT PAGE
   ===================================================== */
.about-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 100px 24px 80px;
}

.about-page .page-title {
  font-family: var(--font-sfpro);
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.5;
  margin-bottom: 48px;
}

.about-page .about-content {
  font-family: var(--font-sfpro);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.75;
  color: rgba(255,255,255,0.85);
}

.about-page .about-content p {
  margin-bottom: 24px;
}

.about-page .about-content p:last-child {
  margin-bottom: 0;
}

/* =====================================================
   UTILITY
   ===================================================== */
.screen-reader-text {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

body.no-scroll { overflow: hidden; }
