/* ResoShare feature atlas — page-specific composition and responsive rules. */

.features-page {
  --feature-sidebar-width: clamp(228px, 19vw, 276px);
  --feature-content-pad: clamp(1.35rem, 3.4vw, 3.75rem);
  --mobile-sidebar-height: 76px;
  --atlas-micro-type: 0.625rem;
  --atlas-small-type: 0.75rem;
  --atlas-copy-type: 0.875rem;
  --atlas-title-type: 1.25rem;
  background: var(--paper);
}

.features-page .site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.feature-atlas {
  display: grid;
  grid-template-columns: var(--feature-sidebar-width) minmax(0, 1fr);
  align-items: start;
  border-inline: 1px solid var(--line);
}

.feature-sidebar {
  position: sticky;
  z-index: 80;
  top: 72px;
  height: calc(100svh - 72px);
  min-height: 540px;
  display: flex;
  flex-direction: column;
  background: var(--paper-bright);
  overflow: hidden;
}

.feature-sidebar-head {
  display: grid;
  gap: 0.45rem;
  padding: 1.5rem 1.25rem 1.35rem;
  border-bottom: 1px solid var(--line-strong);
}

.feature-sidebar-head strong {
  font-family: var(--display);
  font-size: var(--atlas-title-type);
  letter-spacing: -0.035em;
  line-height: 1;
}

.feature-sidebar-head span {
  max-width: 22ch;
  color: var(--ink-soft);
  font-size: var(--atlas-small-type);
  line-height: 1.4;
}

.feature-sidebar-nav {
  display: grid;
}

.feature-sidebar-nav a {
  position: relative;
  min-height: 92px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  transition:
    background-color 180ms var(--ease-out),
    color 180ms var(--ease-out);
}

.feature-sidebar-nav a::after {
  content: "";
  position: absolute;
  right: 1.25rem;
  bottom: -1px;
  left: 1.25rem;
  height: 1px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 240ms var(--ease-out);
}

.feature-sidebar-nav a:hover,
.feature-sidebar-nav a.is-active {
  background: var(--brand-wash);
}

.feature-sidebar-nav a.is-active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.feature-sidebar-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--brand-dark);
  transition:
    background-color 180ms var(--ease-out),
    border-color 180ms var(--ease-out);
}

.feature-sidebar-nav a.is-active .feature-sidebar-icon {
  border-color: var(--brand-light);
  background: var(--paper-bright);
}

.feature-sidebar-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
}

.feature-sidebar-nav a > span:last-child {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.feature-sidebar-nav strong {
  font-size: var(--atlas-small-type);
  font-weight: 600;
  line-height: 1.2;
}

.sidebar-label-short {
  display: none;
}

.feature-sidebar-nav small {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: var(--atlas-micro-type);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feature-sidebar-foot {
  display: grid;
  gap: 0.75rem;
  margin-top: auto;
  padding: 1.25rem;
  border-top: 1px solid var(--line-strong);
}

.feature-sidebar-foot > span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--brand-dark);
  font-size: var(--atlas-micro-type);
  font-weight: 600;
}

.feature-sidebar-foot > span::before {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--brand);
}

.feature-sidebar-foot a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--mono);
  font-size: var(--atlas-micro-type);
}

.feature-sidebar-foot a svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  transition: transform 180ms var(--ease-out);
}

.feature-sidebar-foot a:hover svg {
  transform: translateX(3px);
}

.feature-atlas-content {
  min-width: 0;
  border-left: 1px solid var(--line);
}

.feature-page-hero {
  min-height: min(720px, calc(100svh - 72px));
  display: grid;
  grid-template-columns: minmax(400px, 1fr) minmax(440px, 1.05fr);
  align-items: center;
  gap: clamp(2rem, 3.5vw, 4.5rem);
  padding: clamp(3.75rem, 7vw, 7rem) var(--feature-content-pad);
  border-bottom: 1px solid var(--line-strong);
}

.feature-page-hero-copy {
  min-width: 0;
  max-width: 660px;
}

.feature-page-hero h1 {
  max-width: 100%;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3.2rem, 4.6vw, 4.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.91;
  text-wrap: balance;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.feature-page-hero h1 span {
  color: var(--brand);
}

.feature-page-hero-copy > p {
  max-width: 57ch;
  margin: clamp(1.6rem, 3vw, 2.5rem) 0 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.25vw, 1.16rem);
}

.feature-page-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.feature-page-hero-actions .button svg,
.feature-page-close .button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.capability-loop {
  position: relative;
  align-self: stretch;
  min-height: 480px;
  display: grid;
  align-content: center;
  padding: clamp(1.5rem, 3vw, 2.6rem);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--paper-bright);
  overflow: hidden;
}

.capability-loop::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 10%;
  left: 10%;
  height: 1px;
  background: var(--brand-light);
  transform-origin: left;
}

.capability-loop::after {
  content: "";
  position: absolute;
  top: calc(50% - 6px);
  right: calc(10% - 1px);
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--brand);
  border-right: 1px solid var(--brand);
  transform: rotate(45deg);
}

.capability-loop ol {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.capability-loop li {
  min-width: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.65rem;
  text-align: center;
}

.capability-loop li > span {
  width: clamp(54px, 5vw, 70px);
  height: clamp(54px, 5vw, 70px);
  display: grid;
  place-items: center;
  border: 1px solid var(--brand-light);
  border-radius: 50%;
  background: var(--paper-bright);
  color: var(--brand-dark);
}

.capability-loop li:nth-child(2) > span {
  background: var(--brand);
  color: var(--white);
}

.capability-loop li > span svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
}

.capability-loop strong {
  font-size: var(--atlas-small-type);
  line-height: 1.2;
}

.capability-loop small {
  max-width: 16ch;
  color: var(--ink-soft);
  font-size: var(--atlas-micro-type);
  line-height: 1.35;
}

.capability-loop > p {
  position: absolute;
  right: 1.5rem;
  bottom: 1.25rem;
  left: 1.5rem;
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: var(--atlas-micro-type);
  text-align: center;
}

.features-page.has-feature-motion:not(.is-feature-ready) .capability-loop::before {
  transform: scaleX(0);
}

.features-page.has-feature-motion .capability-loop::before {
  transition: transform 900ms var(--ease-out) 120ms;
}

.features-page.has-feature-motion:not(.is-feature-ready) .capability-loop li {
  transform: translateY(10px);
  opacity: 0.7;
}

.features-page.has-feature-motion .capability-loop li {
  transition:
    transform 620ms var(--ease-out),
    opacity 620ms var(--ease-out);
}

.features-page.has-feature-motion .capability-loop li:nth-child(2) {
  transition-delay: 90ms;
}

.features-page.has-feature-motion .capability-loop li:nth-child(3) {
  transition-delay: 180ms;
}

.features-page.has-feature-motion .capability-loop li:nth-child(4) {
  transition-delay: 270ms;
}

.feature-chapter {
  --chapter-accent: var(--brand);
  --chapter-wash: var(--brand-wash);
  scroll-margin-top: 96px;
  padding: clamp(4.75rem, 7vw, 7.5rem) var(--feature-content-pad);
  border-bottom: 1px solid var(--line-strong);
}

.feature-chapter--insights {
  --chapter-accent: #9f5c14;
  --chapter-wash: #efe0c9;
  background: var(--paper-bright);
}

.feature-chapter--client {
  --chapter-accent: #55785b;
  --chapter-wash: #dfe9df;
  background: var(--paper-muted);
}

.feature-chapter--control {
  --chapter-accent: #713f37;
  --chapter-wash: #ead8d2;
  background: var(--paper-bright);
}

.feature-chapter-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: start;
  gap: 1.25rem;
  margin-bottom: clamp(2.5rem, 4vw, 4rem);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line-strong);
}

.feature-chapter-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--chapter-wash);
  color: var(--chapter-accent);
}

.feature-chapter-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.feature-chapter-head > div {
  min-width: 0;
}

.feature-chapter-head h2 {
  max-width: 100%;
  max-width: 17ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.3rem, 4vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: auto;
}

.feature-chapter-head p {
  max-width: 68ch;
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
}

.feature-chapter-count {
  align-self: end;
  padding-bottom: 0.2rem;
  color: var(--chapter-accent);
  font-family: var(--mono);
  font-size: var(--atlas-micro-type);
  white-space: nowrap;
}

.feature-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.85rem, 1.4vw, 1.25rem);
}

.feature-detail-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--paper-bright);
  overflow: hidden;
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}

.feature-detail-card:hover {
  border-color: var(--chapter-accent);
  box-shadow: 0 14px 34px rgba(33, 23, 19, 0.09);
  transform: translateY(-2px);
}

.feature-detail-card--lead {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(300px, 0.95fr);
}

.feature-detail-card--wide {
  grid-column: span 2;
  display: grid;
  grid-template-columns: minmax(250px, 0.92fr) minmax(260px, 1.08fr);
}

.feature-media-slot {
  position: relative;
  aspect-ratio: 4 / 3;
  min-width: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.55rem;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: var(--chapter-wash);
  color: var(--chapter-accent);
  overflow: hidden;
}

.feature-detail-card--lead .feature-media-slot,
.feature-detail-card--wide .feature-media-slot {
  border-right: 1px solid var(--line);
  border-bottom: 0;
}

.feature-media-slot::before,
.feature-media-slot::after {
  content: "";
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--chapter-accent) 28%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--paper-bright) 76%, transparent);
}

.feature-media-slot::before {
  width: 66%;
  height: 54%;
  transform: translate(-8%, -7%);
}

.feature-media-slot::after {
  width: 42%;
  height: 32%;
  transform: translate(30%, 38%);
}

.feature-media-slot > * {
  position: relative;
  z-index: 1;
}

.feature-media-slot > svg {
  width: clamp(34px, 4vw, 52px);
  height: clamp(34px, 4vw, 52px);
  padding: 0.65rem;
  border: 1px solid color-mix(in srgb, var(--chapter-accent) 45%, transparent);
  border-radius: 7px;
  background: var(--paper-bright);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
}

.feature-media-slot > span {
  color: var(--ink);
  font-size: var(--atlas-small-type);
  font-weight: 600;
}

.feature-media-slot > small {
  color: color-mix(in srgb, var(--chapter-accent) 76%, var(--ink));
  font-family: var(--mono);
  font-size: var(--atlas-micro-type);
}

.feature-detail-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: clamp(1.25rem, 2vw, 1.8rem);
}

.feature-detail-copy h3 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.25rem, 1.75vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
  text-wrap: balance;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.feature-detail-card--lead .feature-detail-copy h3 {
  max-width: 16ch;
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.feature-detail-copy > p:not(.feature-benefit) {
  max-width: 68ch;
  margin: 0.9rem 0 0;
  color: var(--ink-soft);
  font-size: var(--atlas-copy-type);
  line-height: 1.55;
}

.feature-detail-card--lead .feature-detail-copy > p:not(.feature-benefit) {
  font-size: 0.96rem;
}

.feature-benefit {
  display: grid;
  gap: 0.35rem;
  margin: auto 0 0;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.feature-detail-copy > p:not(.feature-benefit) + .feature-benefit {
  margin-top: clamp(1.2rem, 2vw, 1.8rem);
}

.feature-benefit span {
  color: var(--chapter-accent);
  font-family: var(--mono);
  font-size: var(--atlas-micro-type);
  text-transform: uppercase;
}

.feature-benefit strong {
  max-width: 58ch;
  font-size: var(--atlas-small-type);
  font-weight: 600;
  line-height: 1.45;
}

.feature-page-close {
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 7rem);
  padding: clamp(4rem, 7vw, 7rem) var(--feature-content-pad);
  background: var(--graphite);
  color: var(--white);
}

.feature-page-close h2 {
  max-width: 15ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.4rem, 4.4vw, 4.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.94;
  text-wrap: balance;
}

.feature-page-close p {
  max-width: 60ch;
  margin: 1.4rem 0 0;
  color: var(--paper-muted);
}

.feature-page-close-actions {
  display: grid;
  gap: 0.75rem;
}

.feature-page-close .coming-soon-note {
  color: var(--white);
  border-color: var(--graphite-line);
}

.feature-page-close .button-inverse {
  justify-content: space-between;
}

@media (max-width: 1280px) {
  .feature-page-hero {
    grid-template-columns: minmax(360px, 0.95fr) minmax(400px, 1.05fr);
    gap: 2rem;
  }

  .feature-page-hero h1 {
    font-size: clamp(3rem, 4.8vw, 4.2rem);
  }

  .capability-loop {
    min-height: 430px;
  }

  .feature-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feature-detail-card--lead {
    grid-column: 1 / -1;
  }

  .feature-detail-card--wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1040px) {
  .features-page {
    --feature-sidebar-width: 220px;
  }

  .feature-page-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-block: 4.5rem;
  }

  .capability-loop {
    min-height: 380px;
  }

  .feature-chapter-head {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .feature-chapter-count {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 940px) {
  .features-page {
    padding-top: 64px;
  }

  .features-page .site-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
  }

  .feature-atlas {
    display: block;
    border-inline: 0;
  }

  .feature-sidebar {
    position: fixed;
    top: 64px;
    right: 12px;
    left: 12px;
    width: auto;
    height: var(--mobile-sidebar-height);
    min-height: 0;
    border-inline: 1px solid var(--line);
    border-bottom: 1px solid var(--line-strong);
  }

  .feature-sidebar-head,
  .feature-sidebar-foot {
    display: none;
  }

  .feature-sidebar-nav {
    height: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .feature-sidebar-nav a {
    min-height: 0;
    height: 100%;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 0.55rem;
    padding: 0.7rem;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .feature-sidebar-nav a:last-child {
    border-right: 0;
  }

  .feature-sidebar-nav a::after {
    right: 0.7rem;
    left: 0.7rem;
  }

  .feature-sidebar-icon {
    width: 30px;
    height: 30px;
  }

  .feature-sidebar-icon svg {
    width: 16px;
    height: 16px;
  }

  .feature-sidebar-nav strong {
    font-size: var(--atlas-small-type);
  }

  .feature-sidebar-nav small {
    font-size: var(--atlas-micro-type);
  }

  .feature-atlas-content {
    padding-top: var(--mobile-sidebar-height);
    border-left: 0;
  }

  .feature-page-hero,
  .feature-chapter,
  .feature-page-close {
    border-inline: 1px solid var(--line);
  }

  .feature-chapter {
    scroll-margin-top: 156px;
  }

  .feature-page-close {
    grid-template-columns: 1fr;
    min-height: 480px;
  }
}

@media (max-width: 720px) {
  .features-page {
    --mobile-sidebar-height: 68px;
  }

  .sidebar-label-long {
    display: none;
  }

  .sidebar-label-short {
    display: inline;
  }

  .feature-sidebar-nav a {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.25rem;
    text-align: center;
  }

  .feature-sidebar-nav a > span:last-child {
    display: block;
  }

  .feature-sidebar-nav small {
    display: none;
  }

  .feature-page-hero {
    gap: 2.75rem;
    padding-block: 3.75rem;
  }

  .feature-page-hero h1 {
    font-size: clamp(2.55rem, 10.4vw, 3.35rem);
  }

  .feature-page-hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .feature-page-hero-actions .button {
    width: 100%;
  }

  .capability-loop {
    min-height: 510px;
    padding: 1.25rem;
  }

  .capability-loop::before {
    top: 14%;
    right: 50%;
    bottom: 18%;
    left: auto;
    width: 1px;
    height: auto;
    transform-origin: top;
  }

  .features-page.has-feature-motion:not(.is-feature-ready) .capability-loop::before {
    transform: scaleY(0);
  }

  .capability-loop::after {
    top: auto;
    right: calc(50% - 5px);
    bottom: calc(18% - 1px);
    transform: rotate(135deg);
  }

  .capability-loop ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.4rem 1rem;
  }

  .capability-loop small {
    max-width: 19ch;
  }

  .feature-chapter-head {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 1rem;
  }

  .feature-chapter-icon {
    width: 44px;
    height: 44px;
  }

  .feature-chapter-head h2 {
    font-size: clamp(2rem, 8.7vw, 2.75rem);
  }

  .feature-card-grid {
    grid-template-columns: 1fr;
  }

  .feature-detail-card--lead,
  .feature-detail-card--wide {
    grid-column: auto;
    display: flex;
    flex-direction: column;
  }

  .feature-detail-card--lead .feature-media-slot,
  .feature-detail-card--wide .feature-media-slot {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .feature-detail-card--lead .feature-detail-copy h3 {
    font-size: clamp(1.65rem, 7vw, 2.2rem);
  }
}

@media (max-width: 520px) {
  .feature-sidebar {
    right: 8px;
    left: 8px;
  }

  .feature-page-hero,
  .feature-chapter,
  .feature-page-close {
    padding-inline: 1rem;
  }

  .feature-page-hero {
    padding-top: 3rem;
  }

  .feature-page-hero h1 {
    font-size: clamp(2.35rem, 9.7vw, 2.75rem);
  }

  .capability-loop {
    min-height: 480px;
  }

  .capability-loop li > span {
    width: 50px;
    height: 50px;
  }

  .capability-loop strong {
    font-size: 0.75rem;
  }

  .capability-loop small {
    font-size: var(--atlas-micro-type);
  }

  .feature-chapter {
    padding-block: 4.5rem;
  }

  .feature-chapter-head {
    grid-template-columns: 1fr;
  }

  .feature-chapter-icon {
    width: 46px;
    height: 46px;
  }

  .feature-chapter-count {
    grid-column: 1;
  }

  .feature-detail-copy {
    padding: 1.2rem;
  }

  .feature-detail-copy h3 {
    font-size: var(--atlas-title-type);
  }

  .feature-detail-copy > p:not(.feature-benefit),
  .feature-detail-card--lead .feature-detail-copy > p:not(.feature-benefit) {
    font-size: var(--atlas-copy-type);
  }

  .feature-page-close {
    min-height: 500px;
  }

  .feature-page-close h2 {
    font-size: clamp(2.35rem, 10.5vw, 3rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .features-page.has-feature-motion:not(.is-feature-ready) .capability-loop::before,
  .features-page.has-feature-motion:not(.is-feature-ready) .capability-loop li {
    transform: none;
    opacity: 1;
  }

  .features-page.has-feature-motion .capability-loop::before,
  .features-page.has-feature-motion .capability-loop li,
  .feature-detail-card,
  .feature-sidebar-nav a,
  .feature-sidebar-nav a::after {
    transition: none;
  }
}
