/**
 * Page - Profile (KKAA-inspired Minimal Design)
 *
 * Features:
 * - Vertical writing mode for Japanese titles
 * - Minimal grid layout
 * - Intersection Observer scroll animations
 * - WCAG 2.2 AA Compliant
 *
 * @since 2.4.0 (V0 integration)
 */

/* ========================================
 * Profile Page Container
 * ======================================== */

.page-template-page-profile-php #main {
  padding-top: var(--header-height-desktop);
}

/* Tablet (768px-959px) */
@media (min-width: 768px) and (max-width: 959px) {
  .page-template-page-profile-php #main {
    padding-top: var(--header-height-tablet);
  }
}

/* Mobile (767px以下) */
@media (max-width: 767px) {
  .page-template-page-profile-php #main {
    padding-top: var(--header-height-mobile);
  }
}

/* ========================================
 * KKAA Section Base
 * ======================================== */

.ysa-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  margin-block: var(--spacing-3xl);
  border-top: 1px solid var(--ysa-border);
  padding-top: var(--spacing-2xl);
}

.ysa-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.ysa-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
 * Hero Section (with photo)
 * ======================================== */

.ysa-hero__title {
  margin-bottom: var(--spacing-lg);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--ysa-text);
}

.ysa-hero__layout {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2xl);
}

@media (min-width: 768px) {
  .ysa-hero__layout {
    flex-direction: row;
    gap: var(--spacing-3xl);
  }
}

.ysa-hero__photo {
  margin: 0;
  flex-shrink: 0;
}

.ysa-hero__photo img {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #f5f5f5;
}

.ysa-hero__content {
  flex: 1;
  display: flex;
  gap: var(--spacing-lg);
}

@media (min-width: 768px) {
  .ysa-hero__content {
    gap: var(--spacing-2xl);
  }
}

/* ========================================
 * Section Layout (without photo)
 * ======================================== */

.ysa-section__layout {
  display: flex;
  gap: var(--spacing-lg);
}

@media (min-width: 768px) {
  .ysa-section__layout {
    gap: var(--spacing-2xl);
  }
}

/* ========================================
 * Vertical Writing Mode Title
 * ======================================== */

.ysa-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.3em;
  font-weight: 400;
  font-size: clamp(0.875rem, 2vw, 1rem);
  color: var(--ysa-text-light);
  flex-shrink: 0;
  min-height: 200px;
}

/* Mobile hero: photo left, name right, career below */
@media (max-width: 640px) {
  .ysa-hero__layout {
    display: block;
  }

  .ysa-hero__photo {
    float: left;
    width: 40%;
    margin: 0 var(--spacing-md) var(--spacing-md) 0;
  }

  .ysa-hero__photo img {
    max-width: 100%;
    width: 100%;
    margin: 0;
  }

  .ysa-hero__content {
    display: block;
  }

  /* Hide 略歴 title on mobile */
  .ysa-hero .ysa-title {
    display: none;
  }

  /* Style CFS h6 name next to photo */
  .ysa-hero .ysa-content-inner h6 {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    margin: 0;
    padding-top: var(--spacing-xs);
  }

  /* Career dl: clear float, full width below */
  .ysa-hero .ysa-content-inner dl {
    clear: both;
  }
}

/* Horizontal mode for mobile */
@media (max-width: 640px) {
  .ysa-section__layout {
    flex-direction: column;
    gap: 0;
  }

  .ysa-title {
    writing-mode: horizontal-tb;
    text-orientation: initial;
    letter-spacing: 0.15em;
    min-height: auto;
    margin-bottom: var(--spacing-sm);
  }
}

/* ========================================
 * Content Inner
 * ======================================== */

.ysa-content-inner {
  flex: 1;
  min-width: 0;
}

/* ========================================
 * List Item (Grid Layout for dl)
 * ======================================== */

.ysa-content-inner dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
  margin-bottom: var(--spacing-lg);
}

.ysa-content-inner dt {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--ysa-text-light);
  white-space: nowrap;
  min-width: 100px;
}

.ysa-content-inner dd {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--ysa-text);
  margin: 0;
}

/* Mobile: Stack dt/dd */
@media (max-width: 640px) {
  .ysa-content-inner dl {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .ysa-content-inner dt {
    font-size: 0.8125rem;
    margin-top: 0.75rem;
  }

  .ysa-content-inner dt:first-child {
    margin-top: 0;
  }
}

/* ========================================
 * Office Grid (for office section)
 * ======================================== */

.ysa-content-inner .office-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem 1.5rem;
  font-size: 0.9375rem;
}

.ysa-content-inner .office-label {
  color: var(--ysa-text-light);
  white-space: nowrap;
}

.ysa-content-inner .office-value {
  color: var(--ysa-text);
}

.ysa-content-inner .office-value a {
  color: var(--ysa-text);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.ysa-content-inner .office-value a:hover {
  opacity: 0.6;
}

/* Mobile: Stack office grid */
@media (max-width: 640px) {
  .ysa-content-inner .office-grid {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .ysa-content-inner .office-label {
    margin-top: 0.75rem;
  }

  .ysa-content-inner .office-label:first-child {
    margin-top: 0;
  }
}

/* ========================================
 * Links & Focus States
 * ======================================== */

.ysa-content-inner a {
  color: var(--ysa-text);
  text-decoration: underline;
  text-decoration-color: var(--ysa-text-light);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s ease;
}

.ysa-content-inner a:hover {
  text-decoration-color: var(--ysa-text);
}

.ysa-content-inner a:focus-visible {
  outline: 2px solid var(--ysa-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ========================================
 * Reduced Motion Support
 * ======================================== */

@media (prefers-reduced-motion: reduce) {
  .ysa-section {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ========================================
 * Legacy Support (Custom Field Suite output)
 * ======================================== */

#profile_ja,
#profile_en,
#winning,
#office,
#publications {
  /* Reset any legacy float-based styles */
  float: none;
  clear: none;
}

#profile_ja dl,
#profile_en dl,
#winning dl,
#office dl,
#publications dl {
  /* Ensure grid layout applies */
  display: grid;
  grid-template-columns: auto 1fr;
}

/* Mobile: override legacy ID selector specificity */
@media (max-width: 640px) {
  #profile_ja dl,
  #profile_en dl,
  #winning dl,
  #office dl,
  #publications dl {
    grid-template-columns: 1fr;
  }
}

/* ========================================
 * Accessibility Enhancements
 * ======================================== */

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

/* Touch Target Size (WCAG 2.5.8) */
.ysa-content-inner a {
  min-height: 44px;
  display: inline-block;
  padding-block: var(--spacing-xs);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .ysa-title,
  .ysa-content-inner dt {
    font-weight: 600;
  }

  .ysa-section {
    border-top-width: 2px;
  }
}
