/* Home uses the existing shell slots and one page scroller. */
body[data-page="home"] {
  --home-feed-width: 620px;
  --home-resume-width: 330px;
  --home-column-gap: 24px;
}

@media (min-width: 1101px) {
  body[data-page="home"]:not(.endgame-public) {
    --home-inset: max(12px, (100% - var(--rail) - var(--home-feed-width) - var(--home-resume-width) - 2 * var(--home-column-gap)) / 2);
  }

  html[data-theme] body[data-page="home"]:not(.endgame-public) #desktop-rail {
    left: var(--home-inset);
  }

  html[data-theme] body[data-page="home"]:not(.endgame-public) #main {
    padding-inline: calc(var(--home-inset) + var(--rail)) var(--home-inset);
  }
}

.social-layout-home .home-composer-slot,
.social-layout-home [data-continuous-feed] {
  min-width: 0;
}

.social-layout-home .home-composer-initial {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
}

.social-layout-home .home-composer-slot:has(.home-composer-avatar) .home-composer-initial {
  display: none;
}

.social-layout-home [data-continuous-feed] > article figure.post-media-source {
  margin-inline: 0;
}

.social-layout-home .cl-post-card__reactions > summary {
  display: grid;
  place-items: center;
}

.social-layout-home .home-resume {
  min-width: 0;
  margin: 0;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius, 12px);
  box-shadow: none;
}

.social-layout-home .home-resume:not(:has([data-home-reading], [data-home-conversation], [role="status"], [role="alert"])),
.social-layout-home .home-resume > section:not(:has([data-home-reading], [data-home-conversation], [role="status"], [role="alert"])),
.social-layout-home .home-resume :is([data-home-reading], [data-home-conversation]):not(:first-child) {
  display: none;
}

.social-layout-home .home-resume > h2 {
  margin: 0;
  font: 650 16px/1.35 var(--font-ui, system-ui);
}

.social-layout-home .home-resume > section {
  margin: 8px 0 0;
}

.social-layout-home .home-resume .section-head {
  align-items: center;
  margin-bottom: 4px;
}

.social-layout-home .home-resume .section-head h2 {
  font-weight: 600;
}

.social-layout-home .home-resume .section-head p {
  display: none;
}

.social-layout-home .home-resume :is(.home-reading-cards, .social-resume-list) {
  grid-template-columns: minmax(0, 1fr);
}

.social-layout-home .home-resume :is(.home-reading-card, .social-resume) {
  min-height: 44px;
  background: transparent;
}

.social-layout-home .home-resume :is(.home-reading-card, .social-resume) .grow {
  min-width: 0;
  overflow-wrap: anywhere;
}

.social-layout-home .home-resume :is(.home-reading-card, .social-resume):hover {
  background: var(--accent-soft, var(--bg2));
}

/* These route-scoped values supersede older !important concept geometry. */
@layer castlori-home-layout {
  html[data-theme] body[data-page="home"] #main > .social-layout-home {
    box-sizing: border-box;
    max-width: calc(var(--home-feed-width) + var(--home-resume-width) + 2 * var(--home-column-gap)) !important;
    padding: 16px 0 32px var(--home-column-gap) !important;
  }

  .social-layout-home .social-home-grid {
    grid-template-columns: minmax(0, var(--home-feed-width)) minmax(220px, var(--home-resume-width)) !important;
    align-items: start;
    gap: var(--home-column-gap) !important;
  }

  .social-layout-home .social-home-feed:not([data-art134-state]) {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  .social-layout-home .social-home-sidebar > .home-resume {
    padding: 14px !important;
  }

  .social-layout-home .home-resume > section {
    padding: 8px 0 0 !important;
    border: 0 !important;
    border-top: 1px solid var(--line) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .social-layout-home .home-resume .section-head {
    display: flex !important;
    justify-content: space-between;
    gap: 8px !important;
    padding: 0 !important;
  }

  .social-layout-home .home-resume .section-head > * {
    margin-block: 0 !important;
  }

  .social-layout-home .home-resume .section-head h2 {
    margin: 0 !important;
    font-size: 13px !important;
  }

  .social-layout-home .home-resume :is(.home-reading-card, .social-resume) {
    padding: 4px 0 !important;
    border: 0 !important;
  }

  .social-layout-home .home-composer-slot :is(.social-status-entry, .home-composer) {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 10px !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 0 12px !important;
    padding: 4px 10px !important;
  }

  .social-layout-home .home-composer-slot .social-status-entry > .btn {
    flex: 1 1 0%;
    min-width: 0;
    width: auto !important;
  }

  .social-layout-home .home-composer-slot .home-composer-row,
  .social-layout-home .home-composer-slot .home-composer-prompt {
    min-width: 0;
    width: 100%;
    height: auto !important;
  }

  .social-layout-home .home-composer-slot .home-composer-prompt {
    min-height: 44px !important;
    border: 0 !important;
    background: transparent !important;
  }

  /* The native composer dialog still offers the supported post modes. */
  .social-layout-home .home-composer-slot .home-composer-tools {
    display: none !important;
  }

  .social-layout-home [data-continuous-feed] > article[data-post-id] {
    max-width: none;
    width: 100%;
    margin: 0 !important;
    padding: 14px !important;
    gap: 6px !important;
  }

  .social-layout-home [data-castlori-post-card="home"] > [data-post-card-actions] {
    margin-top: 0 !important;
    overflow: visible !important;
  }

  .social-layout-home :is([data-castlori-post-card="home"], [data-castlori-post-card="home"] > .cl-post-card__content) > .card-copy {
    margin-block: 0 !important;
  }

  .social-layout-home [data-castlori-post-card="home"] > .cl-post-card__header > .identity {
    padding-block: 0 !important;
  }

  .social-layout-home .cl-post-card__reactions > summary,
  .social-layout-home .cl-post-card__reactions > summary:not(:focus-visible) {
    position: static !important;
    width: 32px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    overflow: visible !important;
    clip-path: none !important;
  }

  .social-layout-home [data-continuous-feed] {
    gap: 12px;
  }

  @media (max-width: 1100px) {
    html[data-theme] body[data-page="home"] #main > .social-layout-home {
      max-width: calc(var(--home-feed-width) + 24px) !important;
      padding: 12px 12px 24px !important;
    }

    .social-layout-home .social-home-grid {
      grid-template-columns: minmax(0, 1fr) !important;
    }

    .social-layout-home .social-home-sidebar {
      display: none !important;
    }

    /* Keep the focused link visible until the resize handler moves its card. */
    .social-layout-home .social-home-sidebar:has(> .home-resume) {
      display: block !important;
    }

    .social-layout-home .social-home-sidebar > :not(.home-resume) {
      display: none !important;
    }
  }

  @media (max-width: 767px) {
    .social-layout-home [data-continuous-feed] > article[data-post-id] {
      padding: 12px !important;
    }

    .social-layout-home .cl-post-card__actions,
    .social-layout-home .cl-post-card__primary {
      flex-wrap: wrap !important;
      overflow: visible !important;
    }

    .social-layout-home .cl-post-card__reactions > summary,
    .social-layout-home .cl-post-card__overflow > summary {
      min-width: 44px !important;
      min-height: 44px !important;
    }
  }
}

/* Approved Home match: compact feed, quiet rails, and one continuation surface. */
body[data-page="home"] {
  --home-match-backdrop: #08132b;
  --home-match-surface: #141f3d;
  --home-match-quiet: #101d36;
  --home-match-line: #2b3960;
}
html[data-theme="light"] body[data-page="home"] {
  --home-match-backdrop: #f7f3fc;
  --home-match-surface: #f1ecfa;
  --home-match-quiet: #f4f0fc;
  --home-match-line: #dfd5ef;
}
html[data-theme] body[data-page="home"] #main {
  background-color: var(--home-match-backdrop);
}
@layer castlori-home-layout {
  .social-layout-home [aria-label="Feed category"] {
    justify-content: flex-start !important;
    gap: 6px !important;
  }
  .social-layout-home [aria-label="Feed category"] > :is(button,a) {
    flex: 0 1 auto !important;
    min-height: 44px !important;
    padding-inline: clamp(8px,1.5vw,20px) !important;
    font-size: 14px !important;
  }
  .social-layout-home .home-composer-slot :is(.social-status-entry, .home-composer),
  .social-layout-home .home-resume {
    background: var(--home-match-quiet) !important;
    border-color: var(--home-match-line) !important;
  }
  .social-layout-home [data-continuous-feed] > article[data-post-id] {
    gap: 4px !important;
    background: var(--home-match-surface) !important;
    border-color: var(--home-match-line) !important;
  }
  .social-layout-home [data-castlori-post-card="home"] .cl-post-card__header .identity .grow {
    display: flex !important;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 3px 8px !important;
  }
  .social-layout-home [data-castlori-post-card="home"] > [data-post-card-actions] {
    border-top: 0 !important;
    padding-block: 0 !important;
  }
  .social-layout-home [data-castlori-post-card="home"] :is(.cl-post-card__primary,.cl-post-card__actions) {
    justify-content: space-between;
  }
  .social-layout-home .home-resume > h2 {
    font: 700 16px/1.3 var(--font-ui,system-ui) !important;
  }
  .social-layout-home .home-resume > section {
    margin: 4px 0 0 !important;
    padding: 3px 0 0 !important;
  }
  .social-layout-home .home-resume > section:has([data-home-reading],[data-home-conversation]) .section-head {
    min-height: 0 !important;
    height: auto !important;
    margin: 2px 0 !important;
  }
  .social-layout-home .home-resume :is(.home-reading-card,.social-resume) {
    padding: 5px 2px !important;
    border-radius: 6px;
    gap: 9px !important;
  }
  .social-layout-home .home-resume .home-reading-card progress {
    max-width: 100%;
    height: 2px;
  }
  .social-layout-home .social-home-sidebar > .concept-side-scene {
    display: none !important;
  }
}



/* Match the shared Home card's four native actions to one even row. */
@layer castlori-home-layout {
  .social-layout-home [data-castlori-post-card="home"] > [data-post-card-actions] {
    display: block !important;
  }
  .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary:has(> .cl-post-card__like):has(> [data-post-card-comments-toggle]):has(> [data-social-share]):has(> :is([data-social-save],[data-home-post-save-sign-in])) {
    display: grid !important;
    grid-template-columns: repeat(4,minmax(0,1fr));
    align-items: stretch;
    gap: 2px !important;
    width: 100%;
  }
  .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary :is(.cl-post-card__action, .cl-post-card__like) {
    min-width: 0 !important;
    justify-content: center;
  }
  .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary .cl-post-card__action {
    min-height: 44px !important;
    padding-inline: 3px !important;
    border-color: transparent !important;
    background: transparent !important;
  }
  .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary .cl-post-card__action:hover {
    background: var(--accent-soft) !important;
  }
  .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary .cl-post-card__reactions > summary {
    width: 22px !important;
  }
}



/* Home shell alignment, scoped so other surfaces keep their own design. */
html[data-theme] body[data-page="home"] .shell > .topbar {
  background: var(--home-match-backdrop);
  border-color: var(--home-match-line);
}
@media (min-width:1101px) {
  html[data-theme] body[data-page="home"]:not(.endgame-public) .shell > .topbar {
    padding-inline: max(24px,var(--home-inset,24px));
  }
  html[data-theme] body[data-page="home"] .shell > .topbar > #global-search {
    width: clamp(220px,20vw,290px) !important; max-width: 290px !important; min-width: 0 !important; flex: 0 1 clamp(220px,20vw,290px) !important;
    min-height: 34px !important;
    height: 34px !important;
    background: var(--home-match-quiet);
    border-color: var(--home-match-line);
  }
}
@layer castlori-home-layout {
  .social-layout-home [data-castlori-post-card="home"] :is([data-social-share],[data-post-card-comments-toggle]) [data-post-card-word] {
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip-path: none !important;
  }
  @media (max-width:380px) {
    .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary .cl-post-card__action {
      font-size: 10px !important;
      gap: 2px !important;
      padding-inline: 1px !important;
    }
    .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary .cl-post-card__action > svg {
      width: 13px !important;
      height: 13px !important;
    }
  }
}



@layer castlori-home-layout {
  .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary .cl-post-card__action {
    align-self: stretch;
    white-space: nowrap;
  }
  @media (max-width:767px) {
    .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary .cl-post-card__action {
      font-size: 10px !important;
      line-height: 1.15 !important;
    }
    .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary .cl-post-card__action > svg {
      flex: 0 0 13px;
      width: 13px !important;
      height: 13px !important;
    }
  }
}

/* Two resume rows use the existing catalog images and retain both destinations. */
@layer castlori-home-layout {
  .social-layout-home .home-resume > section:has([data-home-reading],[data-home-conversation]) {
    position: relative;
    margin-block: 4px 0 !important;
    padding-block: 2px !important;
  }
  .social-layout-home .home-resume > section:has([data-home-reading],[data-home-conversation]) .section-head {
    margin: 0 !important;
    padding: 0 !important;
    justify-content: flex-end !important;
    min-height: 0 !important;
  }
  .social-layout-home .home-resume > section:has([data-home-reading],[data-home-conversation]) .section-head h2 {
    position: absolute !important;
    inline-size: 1px !important;
    block-size: 1px !important;
    clip-path: inset(50%);
    overflow: hidden;
  }
  .social-layout-home .home-resume > section:has([data-home-reading],[data-home-conversation]) .section-head > a {
    padding: 0 3px !important;
    min-height: 23px !important;
    font: 600 11px/1.25 var(--font-ui,system-ui) !important;
  }
  .social-layout-home .home-resume :is(.home-reading-card,.social-resume) {
    min-height: 44px !important;
    padding: 1px 2px !important;
    border: 0 !important;
    border-radius: 6px !important;
    background: transparent !important;
    align-items: center;
  }
  .social-layout-home .home-resume :is(.home-reading-card > img,.home-reading-icon,.social-resume-icon) {
    inline-size: 56px !important;
    block-size: 38px !important;
    flex: 0 0 56px !important;
    object-fit: cover;
    border-radius: 7px !important;
  }
  .social-layout-home .home-resume .social-resume-portrait {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    border-radius: inherit;
  }
  .social-layout-home .home-resume :is(.home-reading-card,.social-resume) .grow {
    font-size: 13px;
    line-height: 1.2;
  }
  .social-layout-home .home-resume .home-reading-card progress { margin-block: 3px 0; }
  .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary [data-post-card-label] {
    overflow: visible !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    white-space: nowrap !important;
  }
  .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary [data-post-card-count] {
    display: inline-block !important;
    white-space: nowrap !important;
  }
}



@layer castlori-home-layout {
  .social-layout-home :is(.social-home-sidebar,[data-continuous-feed]) > .home-resume {
    padding: 10px !important;
  }
  .social-layout-home .home-resume > #home-resume-title {
    margin-block: 0 2px !important;
  }
}


@layer castlori-home-layout {
  @media (max-width:380px) {
    .social-layout-home .home-resume :is(.home-reading-card,.social-resume) .grow > :is(strong,.row-sub,time) {
      display: block;
      max-inline-size: 100%;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
    .social-layout-home .home-resume :is(.home-reading-card,.social-resume) .grow {
      flex: 1 1 0;
    }
  }
}


@layer castlori-home-layout {
  .social-layout-home [data-home-landscape] > a > img.post-media {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
  }
  .social-layout-home .home-photo-open-caption {
    position: absolute !important;
    inline-size: 1px !important;
    block-size: 1px !important;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

@layer castlori-home-layout {
  .social-layout-home .social-home-sidebar > .concept-home-people-quote { display: none !important; }
  .social-layout-home .concept-home-secondary > summary { min-block-size: 44px; align-content: center; cursor: pointer; }
  .social-layout-home .concept-home-secondary > [data-home-people-secondary] { margin-block: 4px 8px; }
}
 
@layer castlori-home-layout {
  .social-layout-home .social-home-sidebar > .concept-home-secondary:not([open]) {
    padding: 0 12px !important;
    min-block-size: 0 !important;
  }
}
@layer castlori-home-layout {
  .social-layout-home .home-quiet-people-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
  .social-layout-home .home-quiet-people-heading > h2 { margin: 0; }
}
@layer castlori-home-layout {
  .social-layout-home .home-resume { position: relative; }
  .social-layout-home .home-resume:has(> .home-resume-options) > #home-resume-title { min-height: 32px; padding-inline-end: 44px; align-content: center; }
  .social-layout-home .home-resume-options { position: absolute; inset-block-start: 2px; inset-inline-end: 4px; z-index: 2; }
  .social-layout-home .home-resume-options > summary { display: grid; place-items: center; min-width: 44px; min-height: 44px; cursor: pointer; list-style: none; }
  .social-layout-home .home-resume-options > summary::-webkit-details-marker { display: none; }
  .social-layout-home .home-resume-options > nav { position: absolute; inset-inline-end: 0; min-inline-size: 11rem; padding: 4px; border: 1px solid var(--line, CanvasText); border-radius: 9px; background: var(--panel, Canvas); }
  .social-layout-home .home-resume-options > nav > a { display: flex; align-items: center; padding: 0 10px; min-block-size: 44px; white-space: nowrap; }
  .social-layout-home .home-resume:has(> .home-resume-options) > section:has([data-home-reading],[data-home-conversation]) .section-head { min-block-size: 0 !important; block-size: 0 !important; }
}

@layer castlori-home-layout {
  .social-layout-home [data-castlori-post-card="home"] { --home-byline-inset: 54px; }
  .social-layout-home [data-castlori-post-card="home"] > .cl-post-card__header { position: relative; min-width: 0; }
  .social-layout-home [data-castlori-post-card="home"] > .cl-post-card__header > .identity {
    min-height: 28px !important;
    min-width: 0;
    padding-inline-start: var(--home-byline-inset) !important;
  }
  .social-layout-home [data-castlori-post-card="home"] > .cl-post-card__header .identity > .visual-identity-link:first-child {
    position: absolute;
    inset: 0 auto auto 0;
    inset-inline-start: 0;
    inset-inline-end: auto;
    z-index: 1;
  }
  .social-layout-home [data-castlori-post-card="home"] > .cl-post-card__header .identity .grow {
    margin: 0 !important;
    min-width: 0;
    line-height: 1.2 !important;
  }
  .social-layout-home [data-castlori-post-card="home"] > .cl-post-card__header .identity .grow strong {
    font: 650 15px/1.25 var(--font-ui, system-ui) !important;
  }
  .social-layout-home :is([data-castlori-post-card="home"], [data-castlori-post-card="home"] > .cl-post-card__content) > .card-copy {
    padding-inline-start: var(--home-byline-inset);
    min-height: 19px;
    line-height: 1.45 !important;
  }
  .social-layout-home [data-castlori-post-card="home"] > [data-post-card-actions] { min-height: 44px !important; }
  .social-layout-home [data-castlori-post-card="home"] .cl-post-card__primary > :is(.cl-post-card__like,button) {
    margin-block: 0 !important;
    transform: none !important;
  }
  .social-layout-home .home-resume-options > summary { border-radius: 8px; }
  @media (max-width: 767px) {
    .social-layout-home [data-castlori-post-card="home"] { --home-byline-inset: 51px; }
    .social-layout-home [data-castlori-post-card="home"] > .cl-post-card__header .identity .grow strong { font-size: 14px !important; }
    .social-layout-home :is([data-castlori-post-card="home"], [data-castlori-post-card="home"] > .cl-post-card__content) > .card-copy { font-size: 14px !important; }
  }
}

@media (min-width:1101px) {
  html[data-theme] body[data-page="home"]:not(.endgame-public) { --rail: 192px !important; }
  html[data-theme] body[data-page="home"]:not(.endgame-public) #desktop-rail { width: var(--rail) !important; min-width: 0 !important; }
  html[data-theme] body[data-page="home"] .topbar > .logo { font-size:28px !important; line-height:1.2; }
  html[data-theme] body[data-page="home"] .topbar > .logo > .brand-symbol { inline-size:32px !important; block-size:32px !important; }
  .social-layout-home .social-home-sidebar > .home-resume { order:-1; }
}
@media (max-width:767px) {
  html[data-theme] body[data-page="home"]:has(#bottom > [data-home-concept-bottom]) .topbar .visual-profile-button,
  html[data-theme] body[data-page="home"]:has(#bottom > [data-home-concept-bottom]) .topbar .logo::after { display:none !important; }
}

