/* Appily Fiftythree — Desk Codex policy UI */

.af-policy {
  --afpl-ink: var(--ts-ink, #15202B);
  --afpl-paper: #fff;
  --afpl-mist: var(--ts-paper, #F3F5F8);
  --afpl-copper: var(--ts-wine, #B85C38);
  --afpl-teal: var(--ts-grove, #2A6F7A);
  --afpl-line: var(--ts-line, #CDD4DE);
  --afpl-muted: var(--ts-muted, #5E6B7A);
  --afpl-ease: var(--ease-out, cubic-bezier(.22, 1, .36, 1));
}

@keyframes afpl-rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes afpl-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: .35; }
}
@keyframes afpl-spin {
  to { transform: rotate(360deg); }
}

.afpl-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #E8C4B4;
}
.afpl-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7DCFB6;
  animation: afpl-pulse 1.8s ease-out infinite;
}
.afpl-lede {
  margin: 0;
  max-width: 46ch;
  color: rgba(244, 247, 250, .72);
  font-size: 15px;
  line-height: 1.65;
}

/* Hero */
.afpl-hero {
  position: relative;
  overflow: hidden;
  padding: 48px 0 56px;
  color: #F4F7FA;
  background: linear-gradient(125deg, #15202B 0%, #1B2430 48%, #1A4A52 100%);
}
.afpl-hero-mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 48% 55% at 88% 20%, rgba(184, 92, 56, .3), transparent 55%),
    radial-gradient(ellipse 36% 40% at 8% 90%, rgba(42, 111, 122, .22), transparent 50%),
    repeating-linear-gradient(-16deg, transparent 0 28px, rgba(255,255,255,.03) 28px 29px);
  pointer-events: none;
}
.afpl-seal {
  position: absolute;
  right: 8%;
  top: 50%;
  width: min(180px, 28vw);
  aspect-ratio: 1;
  transform: translateY(-50%);
  pointer-events: none;
}
.afpl-seal-ring {
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(232, 196, 180, .35);
  border-radius: 50%;
  animation: afpl-spin 26s linear infinite;
}
.afpl-seal-core {
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--afpl-copper), #9A4528);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .08em;
  box-shadow: 0 14px 32px rgba(184, 92, 56, .4);
}
.afpl-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.35fr .75fr;
  gap: 28px;
  align-items: end;
  animation: afpl-rise .65s var(--afpl-ease) both;
}
.afpl-hero-copy h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -.03em;
}
.afpl-hero-copy h1 em {
  font-style: italic;
  font-weight: 500;
  color: #F0D2C4;
}
.afpl-hero-meta {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
}
.afpl-hero-meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.afpl-hero-meta span {
  color: rgba(244, 247, 250, .5);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: 10px;
}
.afpl-hero-meta strong {
  text-align: right;
  font-weight: 600;
  color: #F4F7FA;
}

/* Chapter rail */
.afpl-chapters {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 245, 248, .94);
  border-bottom: 1px solid var(--afpl-line);
  backdrop-filter: blur(10px);
}
.afpl-chapters-inner {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.afpl-chapter {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--afpl-muted);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.afpl-chapter span {
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--afpl-copper);
}
.afpl-chapter:hover {
  color: var(--afpl-ink);
  background: rgba(255, 255, 255, .55);
}
.afpl-chapter.is-active {
  color: var(--afpl-ink);
  border-bottom-color: var(--afpl-copper);
  background: #fff;
}

/* Stage */
.afpl-stage {
  padding: 28px 0 80px;
  background:
    radial-gradient(ellipse 40% 30% at 0% 0%, rgba(42, 111, 122, .07), transparent 50%),
    linear-gradient(180deg, var(--afpl-mist) 0%, #F7F9FB 100%);
}
.afpl-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: start;
}

.afpl-folio {
  background: var(--afpl-paper);
  border: 1px solid var(--afpl-line);
  padding: clamp(24px, 3.5vw, 40px);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);
  box-shadow: 0 24px 50px -40px rgba(21, 32, 43, .4);
  animation: afpl-rise .7s var(--afpl-ease) .08s both;
  position: relative;
  overflow: hidden;
}
.afpl-folio::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--afpl-copper), var(--afpl-teal));
}

.afpl-folio-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}
.afpl-folio-tag {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--afpl-copper);
}
.afpl-folio h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--afpl-ink);
  line-height: 1.15;
  max-width: 20ch;
}
.afpl-folio-code {
  flex-shrink: 0;
  padding: 10px 12px;
  border: 1px solid var(--afpl-line);
  background: var(--afpl-mist);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--afpl-teal);
}
.afpl-updated {
  margin: 0 0 28px;
  font-size: 13px;
  color: var(--afpl-muted);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--afpl-line);
}

/* Prose */
.afpl-body h2 {
  margin: 32px 0 12px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--afpl-ink);
  letter-spacing: -.01em;
  padding-left: 14px;
  border-left: 3px solid var(--afpl-copper);
  line-height: 1.35;
}
.afpl-body h3 {
  margin: 22px 0 10px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--afpl-ink);
}
.afpl-body p,
.afpl-body li {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--afpl-muted);
}
.afpl-body ul {
  margin: 10px 0 18px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.afpl-body ul li {
  margin: 0;
  padding: 12px 14px;
  background: var(--afpl-mist);
  border-left: 3px solid var(--afpl-teal);
}
.afpl-body strong { color: var(--afpl-ink); font-weight: 700; }
.afpl-body a {
  color: var(--afpl-teal);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.afpl-body a:hover { color: var(--afpl-copper); }

.afpl-body .highlight-box {
  padding: 18px 20px;
  margin: 18px 0;
  background: linear-gradient(160deg, rgba(42, 111, 122, .08), rgba(184, 92, 56, .06));
  border: 1px solid var(--afpl-line);
}
.afpl-body .highlight-box p { margin-bottom: 0; }
.afpl-body .highlight-box ul {
  margin: 0;
  gap: 6px;
}
.afpl-body .highlight-box ul li {
  background: transparent;
  border-left-color: var(--afpl-copper);
  padding: 6px 0 6px 12px;
}

.afpl-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
}
.afpl-body th,
.afpl-body td {
  border: 1px solid var(--afpl-line);
  padding: 12px 14px;
  text-align: left;
  color: var(--afpl-muted);
}
.afpl-body th {
  background: var(--afpl-mist);
  color: var(--afpl-ink);
  font-weight: 700;
}

.afpl-body .contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 24px;
}
.afpl-body .contact-card {
  padding: 14px 16px;
  border: 1px solid var(--afpl-line);
  background: var(--afpl-mist);
}
.afpl-body .contact-card dt {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--afpl-copper);
  margin-bottom: 6px;
  font-weight: 700;
}
.afpl-body .contact-card dd {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--afpl-ink);
  word-break: break-word;
  line-height: 1.45;
}

/* Side rail */
.afpl-rail {
  display: grid;
  gap: 12px;
  animation: afpl-rise .7s var(--afpl-ease) .16s both;
  position: sticky;
  top: 72px;
}
.afpl-rail-card {
  padding: 18px;
  background: var(--afpl-paper);
  border: 1px solid var(--afpl-line);
  display: grid;
  gap: 8px;
}
.afpl-rail-dark {
  background: linear-gradient(160deg, #15202B 0%, #1B2C36 55%, #1A4A52 100%);
  color: #F4F7FA;
  border-color: transparent;
}
.afpl-rail-tag {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--afpl-copper);
}
.afpl-rail-dark .afpl-rail-tag { color: #E8C4B4; }
.afpl-rail-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}
.afpl-rail-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--afpl-muted);
}
.afpl-rail-dark p { color: rgba(244, 247, 250, .68); }
.afpl-rail-card a {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--afpl-teal);
}
.afpl-rail-dark a { color: #E8C4B4; }
.afpl-rail-card a:hover { color: var(--afpl-copper); }
.afpl-rail-dark a:hover { color: #fff; }
.afpl-rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}
.afpl-rail-list a {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--afpl-line);
  color: var(--afpl-ink);
  font-size: 13px;
  font-weight: 500;
  margin: 0;
}
.afpl-rail-list a:first-child { border-top: 0; }
.afpl-rail-list a span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--afpl-muted);
}
.afpl-rail-list a.is-active { color: var(--afpl-copper); }
.afpl-rail-list a:hover { color: var(--afpl-copper); }

/* Responsive */
@media (max-width: 980px) {
  .afpl-hero-grid { grid-template-columns: 1fr; }
  .afpl-seal { opacity: .28; right: -4%; }
  .afpl-board { grid-template-columns: 1fr; }
  .afpl-rail { position: static; grid-template-columns: 1fr 1fr; }
  .afpl-folio { clip-path: none; }
}

@media (max-width: 640px) {
  .afpl-hero { padding: 40px 0 48px; }
  .afpl-seal { display: none; }
  .afpl-folio { padding: 22px 18px 26px; }
  .afpl-folio-head { flex-direction: column; }
  .afpl-rail { grid-template-columns: 1fr; }
  .afpl-body .contact-grid { grid-template-columns: 1fr; }
  .afpl-body table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .afpl-body th,
  .afpl-body td { white-space: nowrap; }
  .afpl-chapter span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .afpl-seal-ring,
  .afpl-pulse,
  .afpl-hero-grid,
  .afpl-folio,
  .afpl-rail {
    animation: none !important;
  }
}
