  :root {
    --bg: #f7f4ef;
    --ink: #4a342e;
    --muted: #6b514b;
    --hairline: #e1dad1;
    --max: 980px;
    --radius: 12px;
  }

  * {
    box-sizing: border-box;
  }

  html {
    scroll-behavior: smooth;
  }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: ui-serif, "Iowan Old Style", Palatino, Georgia, "Times New Roman", serif;
    line-height: 1.7;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  :focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
  }

  header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--bg) 92%, white 8%);
    border-bottom: 1px solid var(--hairline);
    backdrop-filter: blur(6px);
    transition: transform 0.3s ease;
  }

  header.hide {
    transform: translateY(-100%);
  }

  .wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 18px;
  }

  .topbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }

  .brand {
    font-family: "Noto Nastaliq Urdu", serif;
    letter-spacing: 0.02em;
    opacity: 0.95;
    font-weight: 600;
    font-size: 2.05rem;
    white-space: nowrap;
  }

  .toplink {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--muted);
  }

  main .wrap {
    padding-top: 38px;
    padding-bottom: 72px;
  }

  .article {
    max-width: 100%;
    margin: 0;
  }

  .article-header,
  .article-body {
    max-width: 88ch;
    margin-left: auto;
    margin-right: auto;
  }

  .article-header {
    margin-bottom: 30px;
  }

  .article-kicker {
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    margin-bottom: 10px;
  }

  .article-title {
    font-size: clamp(2.1rem, 4vw, 3.1rem);
    letter-spacing: -0.03em;
    line-height: 1.12;
    margin: 0 0 14px;
    font-weight: 650;
  }

  .article-dek {
    color: var(--muted);
    font-size: 1.12rem;
    line-height: 1.6;
    margin: 0 0 18px;
  }

  .article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    color: var(--muted);
    font-size: 0.92rem;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--hairline);
  }

  .article-meta strong {
    color: var(--ink);
    font-weight: 650;
  }

  .article-body p {
    margin: 0 0 22px;
    font-size: 1.05rem;
    line-height: 1.78;
  }

  .article-body p:first-of-type::first-letter {
    float: left;
    font-size: 2.6rem;
    line-height: 0.95;
    padding-right: 8px;
    padding-top: 2px;
    font-weight: 650;
    color: var(--ink);
  }

  .article-note {
    border-left: 2px solid var(--hairline);
    padding-left: 14px;
    color: var(--muted);
    margin: 18px 0 22px;
  }

  .article-rule {
    border-top: 1px solid var(--ink);
    margin: 0px 0;
  }
  
  .home-rule {
  border-top: 1px solid var(--hairline);
  margin: 40px 0;
}

  /* Full-width article image */
  .article-image {
    max-width: 88ch;
    margin: 28px auto;
    display: block;
  }

  .article-image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--hairline);
  }

  .article-image figcaption {
    font-size: 0.88rem;
    color: var(--muted);
    margin-top: 10px;
    text-align: center;
    font-style: italic;
  }

  /* Marginal image (optional) */
  .article-media {
    float: right;
    width: 96px;
    max-width: 96px;
    margin: 4px 0 10px 18px;
  }

  .article-media img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid var(--hairline);
    opacity: 0.92;
  }

  .media-caption {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 6px;
    text-align: right;
  }

  /* Audio bar */
  .audio-bar {
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 6px auto 22px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px 16px;
    background: transparent;
    max-width: 88ch;
  }

  .audio-left .audio-title {
    font-weight: 650;
    letter-spacing: -0.01em;
  }

  .audio-left .audio-sub {
    color: var(--muted);
    font-size: 0.92rem;
    margin-top: 2px;
  }

  .audio-controls {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .audio-ctl {
    border: 1px solid var(--hairline);
    background: transparent;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    transition: transform 0.1s ease;
  }

  .audio-ctl:hover {
    background: color-mix(in srgb, var(--hairline) 30%, transparent);
  }

  .audio-ctl:active {
    transform: translateY(1px);
  }

  .audio-progress {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .audio-progress input[type="range"] {
    width: 100%;
  }

  .audio-time {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.85rem;
  }
  /* ===== Floating TOC (right side) ===== */
  .article-layout{
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 28px;
    align-items: start;
  }

  /* Keeps your existing max-width article text */
  .article-main{
    min-width: 0;
  }

  /* Sticky sidebar */
  .toc{
    position: sticky;
    top: 92px; /* header height + breathing room */
    align-self: start;
    max-height: calc(100vh - 120px);
  }

  .toc-inner{
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: var(--bg);
    padding: 14px 14px 10px;
    overflow: auto;
  }

  .toc-title{
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--muted);
    margin: 2px 0 10px;
  }

  #tocNav a{
    display: block;
    padding: 6px 8px;
    border-radius: 8px;
    color: var(--muted);
    font-size: .92rem;
    line-height: 1.35;
    transition: background .15s ease, color .15s ease, transform .15s ease;
  }

  #tocNav a:hover{
    background: rgba(74,52,46,0.06);
    color: var(--ink);
    transform: translateX(1px);
  }

  #tocNav a.active{
    background: rgba(74,52,46,0.10);
    color: var(--ink);
    font-weight: 650;
  }

  /* indent h3 */
  #tocNav a[data-level="3"]{
    padding-left: 18px;
    font-size: .88rem;
  }

  /* Hide TOC on smaller screens (we can replace with dropdown later) */
  @media (max-width: 980px){
    .article-layout{
      grid-template-columns: 1fr;
    }
    .toc{
      display: none;
    }
  }

    footer {
      color: var(--muted);
      margin-top: 60px;
    }

    footer .wrap {
      padding-top: 40px;
      padding-bottom: 40px;
    }

    .footer-content {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 20px;
      align-items: start;
    }

    .footer-info {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .footer-brand {
      font-family: "Noto Nastaliq Urdu", serif;
      font-size: 1.3rem;
      font-weight: 600;
      color: var(--ink);
      margin-bottom: 0px;
      opacity: 0.9;
    }

    .footer-tagline {
      font-size: .95rem;
      color: var(--muted);
      max-width: 42ch;
      line-height: 1.6;
      font-style: italic;
    }


    @media (max-width: 760px) {
      .footer-content {
        grid-template-columns: 1fr;
        gap: 28px;
      }

      .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
      }
    }
        .connections-icons {
      display: flex;
      align-items: center;
      gap: 14px;
      margin-top: 14px;
    }

    .connections-icons a {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border-radius: 8px;
      transition: transform .15s ease, opacity .15s ease;
    }

    .connections-icons img {
      width: 25px;
      height: 25px;
      object-fit: contain;
      opacity: 0.85;
    }

    .connections-icons a:hover img {
      opacity: 1;
    }

    .connections-icons a:hover {
      transform: translateY(-1px);
    }

    .connections-icons a:focus-visible {
      outline: 1px solid var(--ink);
      outline-offset: 3px;
    }

  /* Responsive */
  @media (max-width: 720px) {
    .audio-bar {
      grid-template-columns: 1fr;
    }

    .audio-controls {
      justify-content: flex-start;
    }

    .article-media {
      float: none;
      width: 84px;
      max-width: 84px;
      margin: 14px auto;
      text-align: center;
    }

    .media-caption {
      text-align: center;
    }
  }
