/* L2 Pearl — Server Features page
 *
 * A sidebar of categories on the left, panels of cards on the right. It
 * reuses the site's tokens (light parchment + bronze) rather than bringing
 * its own palette, so it sits next to the other pages instead of next to
 * whoever inspired the layout.
 */

/* The hero already gives the page its breathing room; a full section's worth
   of padding on top of it leaves a hole between the title and the first card. */
.features-section {
  padding-top: clamp(0.75rem, 2vw, 1.5rem);
}

.features-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}

/* --- sidebar -------------------------------------------------------------- */

.features-side {
  position: sticky;
  top: calc(var(--header-h) + 18px);
  /* A grid item defaults to min-width:auto, so on a phone — where the nav
     turns into a horizontally scrolling strip — its content would push the
     whole column, and the page, wider than the screen. */
  min-width: 0;
}

.features-nav {
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.features-nav-title {
  margin: 0.25rem 0 0.6rem;
  padding: 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fnav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.6rem;
  border-left: 2px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
}

.fnav-link + .fnav-link {
  margin-top: 2px;
}

.fnav-link:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.fnav-link.is-active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent-text);
}

.fnav-link svg {
  width: 17px;
  height: 17px;
  flex: none;
  opacity: 0.85;
}

/* --- panels --------------------------------------------------------------- */

.features-content {
  min-width: 0;
}

.fpanel {
  padding: clamp(1.15rem, 2.5vw, 1.85rem);
  margin-bottom: 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  /* No scroll-margin here: html already carries scroll-padding-top for the
     fixed header, and the two add up — an anchor would land a header and a
     half too low. The phone rule below adds just enough for the sticky
     category strip. */
}

.fpanel-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1.15rem;
  border-bottom: 1px solid var(--border);
}

.fpanel-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.fpanel-icon svg {
  width: 20px;
  height: 20px;
}

.fpanel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.6vw, 1.75rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.fgroup + .fgroup {
  margin-top: 1.4rem;
}

.fgroup-title {
  margin: 0 0 0.7rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-text);
}

/* --- rate cards ----------------------------------------------------------- */

.fcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.fcard {
  padding: 1rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  text-align: center;
  transition: transform var(--duration) var(--ease), border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.fcard:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-sm);
}

.fcard-icon {
  display: grid;
  place-items: center;
  height: 48px;
  margin-bottom: 0.5rem;
  color: var(--accent-text);
}

.fcard-icon img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.fcard-icon svg {
  width: 30px;
  height: 30px;
}

.fcard-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fcard-value {
  margin-top: 0.15rem;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}

.fcard-note {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

/* --- key / value rows ----------------------------------------------------- */

.frows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 0.6rem;
}

.frow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.frow-k {
  font-size: 0.91rem;
  color: var(--text-secondary);
}

.frow-v {
  font-size: 0.94rem;
  font-weight: 600;
  text-align: right;
  color: var(--text);
}

.frow-v .ok {
  color: var(--success);
}

.frow--wide {
  grid-column: 1 / -1;
}

/* --- feature tiles (icon + copy) ------------------------------------------ */

.ftiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.ftile {
  display: flex;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  transition: transform var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.ftile:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
}

.ftile-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.ftile-icon svg {
  width: 18px;
  height: 18px;
}

.ftile h4 {
  margin: 0 0 0.15rem;
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text);
}

.ftile p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* --- opening timeline ----------------------------------------------------- */

.ftime-intro {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.ftime {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* The rail runs between the first and last markers rather than the full
   height, so it does not stick out past either end. */
.ftime::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 1.15rem;
  bottom: 1.15rem;
  width: 1px;
  background: var(--border-strong);
}

.ftime li {
  position: relative;
  display: grid;
  grid-template-columns: 158px minmax(0, 1fr);
  gap: 1rem;
  padding: 0.7rem 0 0.7rem 1.6rem;
}

.ftime li + li {
  border-top: 1px solid var(--border);
}

.ftime li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.05rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border-strong);
}

.ftime li.is-major::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ftime-date {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.ftime li.is-major .ftime-date {
  color: var(--accent-text);
}

.ftime-what {
  font-size: 0.93rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.ftime-what strong {
  color: var(--text);
}

/* --- note box ------------------------------------------------------------- */

.fnote {
  display: flex;
  gap: 0.7rem;
  margin-top: 1.1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-accent);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.fnote svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 0.1rem;
  color: var(--accent-text);
}

.fnote strong {
  color: var(--text);
}

/* --- concept panel -------------------------------------------------------- */

.fconcept {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 1.5rem;
  align-items: start;
}

.fconcept p {
  margin: 0 0 0.85rem;
  font-size: 0.97rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.fconcept p:last-child {
  margin-bottom: 0;
}

.fconcept-art img {
  display: block;
  width: 100%;
  height: 260px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 960px) {
  .features-layout {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  /* The sidebar becomes a scrollable strip of chips that stays under the
     header, so the categories are still one tap away on a phone. */
  .features-side {
    position: sticky;
    top: calc(var(--header-h) - 12px);
    z-index: 5;
  }

  .features-nav {
    display: flex;
    gap: 0.35rem;
    padding: 0.45rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .features-nav::-webkit-scrollbar {
    display: none;
  }

  .features-nav-title {
    display: none;
  }

  .fnav-link {
    flex: none;
    white-space: nowrap;
    border-left: 0;
    border-bottom: 2px solid transparent;
    border-radius: var(--radius-sm);
  }

  .fnav-link.is-active {
    border-bottom-color: var(--accent);
  }

  .fnav-link svg {
    display: none;
  }

  /* Clear the strip itself, which sits below the header. html's
     scroll-padding-top already covers the header (108px), so this only has to
     add the strip: it ends at 134px, and 34 lands a panel at 142 — just under
     it, and close enough that the scroll-spy counts the panel as reached
     rather than leaving the previous chip lit. */
  .fpanel {
    scroll-margin-top: 34px;
  }

  .fconcept {
    grid-template-columns: 1fr;
  }

  .fconcept-art {
    order: -1;
  }

  .fconcept-art img {
    height: 180px;
  }
}

@media (max-width: 560px) {
  .fcards {
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  }

  .fcard-value {
    font-size: 1.45rem;
  }

  .frow {
    flex-direction: column;
    gap: 0.15rem;
  }

  .frow-v {
    text-align: left;
  }

  .ftime li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fcard,
  .ftile {
    transition: none;
  }

  .fcard:hover,
  .ftile:hover {
    transform: none;
  }
}
