/* ==========================================================================
   Home — single-page personal portfolio with CV-style work history.
   ========================================================================== */

@layer pages {
  .home {
    --home-max-width: 42rem;
    --home-section-gap: var(--space-8);

    max-inline-size: var(--home-max-width);
    margin-inline: auto;
    padding-block: var(--space-12) var(--space-16);
    padding-inline: var(--space-6);
  }

  .home > section + section {
    border-block-start: 1px solid var(--border-subtle);
    margin-block-start: var(--home-section-gap);
    padding-block-start: var(--home-section-gap);
  }

  .home h2 {
    font-size: var(--text-small);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-ink-tertiary);
    margin-block-end: var(--space-5);
  }

  /* --------------------------------------------------------------------------
     Identity — headshot + name + role + location + social links.
     CV-style: image on the left, identity column on the right (desktop).
     -------------------------------------------------------------------------- */
  .identity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-5);
  }

  @media (min-width: 36rem) {
    .identity {
      flex-direction: row;
      align-items: center;
      gap: var(--space-6);
    }
  }

  .identity-headshot {
    --identity-headshot-size: 8rem;
    --identity-headshot-fade: 700ms;

    position: relative;
    inline-size: var(--identity-headshot-size);
    block-size: var(--identity-headshot-size);
    flex-shrink: 0;
    border-radius: var(--radius-md);
  }

  .identity-headshot-image {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    image-rendering: pixelated;
    border-radius: inherit;
    display: block;
    opacity: 0;
    transition: opacity var(--identity-headshot-fade) ease;
  }

  .identity-headshot-image--active {
    opacity: 1;
  }

  @media (prefers-reduced-motion: reduce) {
    .identity-headshot-image {
      transition: none;
    }
  }

  .identity-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }

  .identity-name {
    font-size: var(--text-xx-large);
    line-height: var(--line-height-tight);
    letter-spacing: -0.02em;
  }

  .identity-role {
    color: var(--color-ink-secondary);
    font-size: var(--text-medium);
  }

  .identity-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-ink-tertiary);
    font-family: var(--font-family-mono);
    font-size: var(--text-small);
    margin-block-start: var(--space-1);
  }

  .identity-meta-divider {
    color: var(--color-ink-lighter, var(--border-default));
  }

  .identity-links {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .identity-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 1.5rem;
    block-size: 1.5rem;
    color: var(--color-ink-tertiary);
    text-decoration: none;
    transition: color var(--transition-fast);
  }

  .identity-link svg {
    inline-size: 1rem;
    block-size: 1rem;
  }

  @media (any-hover: hover) {
    .identity-link:hover {
      color: var(--color-ink-primary);
    }
  }

  /* --------------------------------------------------------------------------
     Services — what I do.
     -------------------------------------------------------------------------- */
  .services-intro {
    color: var(--color-ink-secondary);
    line-height: var(--line-height-relaxed);
    margin-block-end: var(--space-4);
  }

  .services-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    list-style: none;
    padding: 0;
  }

  .services-item {
    color: var(--color-ink-secondary);
    line-height: var(--line-height-relaxed);
  }

  .services-label {
    color: var(--color-ink-primary);
    font-weight: var(--font-weight-semibold);
  }

  /* --------------------------------------------------------------------------
     Work — CV-style experience list.
     -------------------------------------------------------------------------- */
  .work-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }

  .work-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
  }

  .work-company {
    font-size: var(--text-medium);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
  }

  .work-dates {
    color: var(--color-ink-tertiary);
    font-family: var(--font-family-mono);
    font-size: var(--text-small);
    white-space: nowrap;
  }

  .work-role {
    color: var(--color-ink-secondary);
    font-size: var(--text-small);
    margin-block-start: var(--space-1);
  }

  .work-body {
    color: var(--color-ink-secondary);
    line-height: var(--line-height-relaxed);
    margin-block-start: var(--space-2);
  }

  /* --------------------------------------------------------------------------
     Projects — curated open-source work.
     -------------------------------------------------------------------------- */
  .projects-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }

  .projects-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
  }

  .projects-name {
    font-size: var(--text-medium);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
  }

  .projects-name a {
    color: inherit;
    text-decoration: none;
  }

  .projects-org {
    color: var(--color-ink-tertiary);
    font-weight: var(--font-weight-normal);
  }

  @media (any-hover: hover) {
    .projects-name a:hover {
      color: var(--color-link);
    }

    .projects-name a:hover .projects-org {
      color: var(--color-link);
    }
  }

  .projects-language {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-ink-tertiary);
    font-family: var(--font-family-mono);
    font-size: var(--text-small);
    white-space: nowrap;
  }

  .projects-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 1rem;
    block-size: 1rem;
  }

  .projects-icon svg {
    inline-size: 100%;
    block-size: 100%;
  }

  .projects-body {
    color: var(--color-ink-secondary);
    line-height: var(--line-height-relaxed);
    margin-block-start: var(--space-2);
  }

  /* --------------------------------------------------------------------------
     Speaking — talks given. Item layout mirrors .work-item: header row
     (event + meta) above, talk title (linked) below.
     -------------------------------------------------------------------------- */
  .speaking-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .speaking-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }

  .speaking-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
  }

  .speaking-event {
    color: var(--color-ink-primary);
    font-weight: var(--font-weight-semibold);
  }

  .speaking-meta {
    color: var(--color-ink-tertiary);
    font-family: var(--font-family-mono);
    font-size: var(--text-small);
    white-space: nowrap;
  }

  .speaking-title {
    color: var(--color-ink-secondary);
    font-size: var(--text-small);
    line-height: var(--line-height-relaxed);
  }
}
