*,
    *::before,
    *::after {
      box-sizing: border-box;
    }

    :root {
      --blue-dark: #1a2d4a;
      --blue-mid: #2c4a6e;
      --blue-accent: #3b6ea8;
      --blue-light: #e8f2f8;
      --gold: #c4a35a;
      --gold-light: #d4b87a;
      --bg-light: #f5f6f8;
      --bg-white: #ffffff;
      --text-dark: #1a2d4a;
      --text-muted: #5a6a7e;
      --text-light: #ffffff;
      --border: #e2e6ec;
      --container: 1100px;
    }

    body {
      margin: 0;
      font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
      color: var(--text-dark);
      line-height: 1.8;
      background: var(--bg-white);
    }

    html {
      scroll-behavior: smooth;
      scroll-padding-top: 76px;
    }

    img {
      max-width: 100%;
      height: auto;
      display: block;
    }

    a {
      color: inherit;
      text-decoration: none;
    }

    .container {
      max-width: var(--container);
      margin: 0 auto;
      padding: 0 1.5rem;
    }

    /* ── Header (تیره — مطابق طرح کتابخانه) ── */
    .site-header {
      position: sticky;
      top: 0;
      z-index: 100;
    }

    .site-header.library-header {
      background: var(--blue-dark);
      border-bottom: none;
    }

    .site-header.library-header .logo-mark {
      color: var(--gold);
    }

    .site-header.library-header .logo-text strong {
      color: var(--gold-light);
    }

    .site-header.library-header .logo-text span {
      color: rgba(255, 255, 255, 0.55);
    }

    .site-header.library-header .nav a {
      color: rgba(255, 255, 255, 0.88);
    }

    .site-header.library-header .nav a:hover {
      color: var(--gold);
    }

    .site-header.library-header .nav a.active {
      color: var(--gold);
      font-weight: 600;
    }

    .site-header.library-header .nav a.active::after {
      background: var(--gold);
    }

    .site-header.library-header .search-btn {
      color: rgba(255, 255, 255, 0.88);
    }

    .site-header.library-header .search-btn:hover {
      color: var(--gold);
    }

    .header-inner {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 1rem 0;
      gap: 1rem;
    }

    .header-right {
      display: flex;
      align-items: center;
      gap: 1.5rem;
      flex-wrap: wrap;
    }

    .logo {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .logo-mark {
      font-family: Georgia, "Times New Roman", serif;
      font-size: 1.75rem;
      font-weight: 700;
      color: var(--blue-dark);
      line-height: 1;
    }

    .logo-text strong {
      display: block;
      font-size: 0.88rem;
      font-weight: 700;
      color: var(--blue-dark);
    }

    .logo-text span {
      display: block;
      font-size: 0.68rem;
      color: var(--text-muted);
      margin-top: 0.15rem;
    }

    .nav {
      display: flex;
      align-items: center;
      gap: 0.15rem;
      flex-wrap: wrap;
    }

    .nav a {
      padding: 0.45rem 0.7rem;
      font-size: 0.8rem;
      font-weight: 500;
      color: var(--text-dark);
      position: relative;
      transition: color 0.2s;
    }

    .nav a:hover {
      color: var(--blue-accent);
    }

    .nav a.active {
      color: var(--blue-dark);
      font-weight: 600;
    }

    .nav a.active::after {
      content: "";
      position: absolute;
      bottom: 0;
      left: 0.7rem;
      right: 0.7rem;
      height: 2px;
      background: var(--blue-dark);
    }

    .search-btn {
      background: none;
      border: none;
      color: var(--text-dark);
      cursor: pointer;
      padding: 0.4rem;
      display: flex;
      align-items: center;
    }

    .search-btn:hover {
      color: var(--blue-accent);
    }

    .search-btn svg {
      width: 20px;
      height: 20px;
    }

    .menu-toggle {
      display: none;
      background: none;
      border: none;
      color: rgba(255, 255, 255, 0.88);
      cursor: pointer;
      padding: 0.4rem;
      align-items: center;
      justify-content: center;
    }

    .menu-toggle svg {
      width: 24px;
      height: 24px;
    }

    .menu-toggle:hover {
      color: var(--gold);
    }

    /* ── Hero ── */
    .hero-wrap {
      position: relative;
      min-height: 480px;
      overflow: hidden;
    }

    .hero-bg {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: 52% 40%;
      background: #e8e4dc;
      z-index: 0;
    }

    /* بدون سفید کردن تصویر — فقط محو لبه پایین */
    .hero-overlay {
      position: absolute;
      inset: 0;
      z-index: 1;
      pointer-events: none;
      background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 84%,
        rgba(255, 255, 255, 0.12) 94%,
        rgba(255, 255, 255, 0.42) 100%
      );
    }

    .hero-text-wrap {
      position: absolute;
      z-index: 2;
      top: 14%;
      left: calc(4% + 2cm);
      width: 34%;
      max-width: 400px;
      padding: 0 0.5rem;
    }

    .hero-text-zone {
      text-align: center;
    }

    .hero-text-zone h1 {
      font-size: 2.35rem;
      font-weight: 700;
      color: #1a2d4a;
      margin: 0 0 0.75rem;
      line-height: 1.35;
      text-align: center;
    }

    .hero-text-zone .subtitle {
      font-size: 0.92rem;
      font-weight: 500;
      color: #1a2d4a;
      margin: 0 0 1rem;
      line-height: 1.9;
      opacity: 0.82;
      text-align: center;
    }

    .hero-flourish {
      width: 48px;
      height: 20px;
      margin: 0 auto 1.15rem;
      color: var(--gold);
    }

    .hero-quote {
      font-size: 0.88rem;
      font-weight: 400;
      color: #1a2d4a;
      margin: 0;
      line-height: 1.95;
      opacity: 0.78;
      font-style: normal;
      text-align: center;
    }

    /* ── Tabs ── */
    .tabs-wrap {
      position: relative;
      z-index: 3;
      margin-top: -2.25rem;
      padding-bottom: 2.25rem;
    }

    .tabs {
      display: flex;
      align-items: center;
      justify-content: center;
      flex-wrap: wrap;
      gap: 0.35rem;
      background: var(--bg-white);
      border: 1px solid var(--border);
      border-radius: 999px;
      padding: 0.55rem 1.15rem;
      max-width: 700px;
      margin: 0 auto;
      box-shadow: 0 8px 28px rgba(26, 45, 74, 0.1);
    }

    .tabs a {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      padding: 0.5rem 1rem;
      font-size: 0.82rem;
      font-weight: 500;
      color: var(--text-muted);
      border-radius: 999px;
      transition: background 0.2s, color 0.2s;
    }

    .tabs a svg {
      width: 16px;
      height: 16px;
    }

    .tabs a:hover {
      color: var(--blue-dark);
    }

    .tabs a.active {
      background: var(--blue-dark);
      color: var(--text-light);
    }

    /* ── Section common ── */
    .section-block {
      padding: 2.5rem 0;
      scroll-margin-top: 76px;
    }

    .section-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 1.5rem;
      gap: 1rem;
    }

    .section-title-row {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .section-title-row h2 {
      font-size: 1.15rem;
      font-weight: 700;
      color: var(--blue-dark);
      margin: 0;
    }

    .leaf-icon {
      width: 20px;
      height: 20px;
      color: var(--gold);
    }

    .see-more {
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--blue-dark);
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      transition: color 0.2s;
    }

    .see-more:hover {
      color: var(--gold);
    }

  .see-more .arrow {
      color: var(--gold);
      font-size: 0.8rem;
    }

    /* ── Authored books ── */
    .authored-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1.25rem;
    }

    .book-card-lg {
      display: grid;
      grid-template-columns: 100px 1fr;
      gap: 1rem;
      padding: 1.25rem;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--bg-white);
      transition: box-shadow 0.2s;
    }

    .book-card-lg:hover {
      box-shadow: 0 6px 24px rgba(26, 45, 74, 0.08);
    }

    .book-cover {
      width: 100px;
      height: 130px;
      border-radius: 4px;
      overflow: hidden;
      background: #f3f5f8;
      box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.1);
      flex-shrink: 0;
    }

    .book-cover img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      object-position: center bottom;
    }

    .book-cover.placeholder {
      background: linear-gradient(145deg, var(--blue-mid), var(--blue-dark));
      display: flex;
      align-items: center;
      justify-content: center;
      color: rgba(255, 255, 255, 0.5);
      font-size: 0.7rem;
      text-align: center;
      padding: 0.5rem;
    }

    .book-info h3 {
      font-size: 0.92rem;
      font-weight: 700;
      color: var(--blue-dark);
      margin: 0 0 0.4rem;
      line-height: 1.45;
    }

    .book-info .desc {
      font-size: 0.78rem;
      color: var(--text-muted);
      margin: 0 0 1rem;
      line-height: 1.7;
    }

    .book-meta {
      display: flex;
      gap: 1rem;
      font-size: 0.72rem;
      color: var(--text-muted);
      margin-bottom: 0.75rem;
    }

    .book-meta span {
      display: flex;
      align-items: center;
      gap: 0.3rem;
    }

    .book-meta svg {
      width: 12px;
      height: 12px;
      color: var(--gold);
    }

    .book-link {
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--blue-dark);
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
    }

    .book-link:hover {
      color: var(--gold);
    }

    /* ── Recommended carousel ── */
    .carousel-wrap {
      position: relative;
    }

    .carousel-nav {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      width: 36px;
      height: 36px;
      border: 1px solid var(--border);
      border-radius: 50%;
      background: var(--bg-white);
      color: var(--blue-dark);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 2;
      transition: background 0.2s;
    }

    .carousel-nav:hover {
      background: var(--bg-light);
    }

    .carousel-nav.prev {
      right: -12px;
    }

    .carousel-nav.next {
      left: -12px;
    }

    .carousel-track {
      display: flex;
      gap: 1rem;
      overflow-x: auto;
      scroll-behavior: smooth;
      scrollbar-width: none;
      padding: 0.25rem 0;
    }

    .carousel-track::-webkit-scrollbar {
      display: none;
    }

    .book-card-sm {
      flex: 0 0 calc(25% - 0.75rem);
      min-width: 160px;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 1rem;
      text-align: center;
      background: var(--bg-white);
      transition: box-shadow 0.2s;
    }

    .book-card-sm:hover {
      box-shadow: 0 4px 16px rgba(26, 45, 74, 0.08);
    }

    .book-card-sm .book-cover {
      width: 96px;
      height: 128px;
      margin: 0 auto 0.75rem;
    }

    .book-card-sm h3 {
      font-size: 0.82rem;
      font-weight: 700;
      color: var(--blue-dark);
      margin: 0 0 0.25rem;
      line-height: 1.4;
    }

    .book-card-sm .author {
      font-size: 0.72rem;
      color: var(--text-muted);
      margin: 0 0 0.5rem;
    }

    .bookmark-icon {
      color: var(--gold);
      width: 16px;
      height: 16px;
      margin: 0 auto;
    }

    /* ── Study notes ── */
    .notes-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 1rem;
    }

    .note-card {
      display: flex;
      align-items: flex-start;
      gap: 0.75rem;
      padding: 1rem;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--bg-white);
      transition: box-shadow 0.2s;
    }

    .note-card:hover {
      box-shadow: 0 4px 16px rgba(26, 45, 74, 0.08);
    }

    .note-icon {
      width: 44px;
      height: 44px;
      border-radius: 50%;
      background: var(--blue-light);
      color: var(--blue-accent, #3b6ea8);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .note-icon svg {
      width: 22px;
      height: 22px;
    }

    .note-body h3 {
      font-size: 0.82rem;
      font-weight: 700;
      color: var(--blue-dark);
      margin: 0 0 0.4rem;
      line-height: 1.45;
    }

    .note-meta {
      font-size: 0.72rem;
      color: var(--text-muted);
    }

    /* ── Footer quote bar ── */
    .library-footer {
      position: relative;
      margin-top: 1rem;
      overflow: hidden;
      background: var(--blue-dark);
    }

    .library-footer-bg {
      width: 100%;
      height: auto;
      display: block;
      min-height: 150px;
      object-fit: cover;
      object-position: center;
    }

    .library-footer-inner {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1.25rem 1.5rem 1.25rem 22%;
      text-align: center;
    }

    .library-footer-quote {
      font-size: 1.05rem;
      color: var(--text-light);
      margin: 0;
      line-height: 1.95;
      max-width: 520px;
      font-weight: 400;
    }

    @media (max-width: 960px) {
      .header-inner {
        padding: 0.75rem 0;
        flex-wrap: wrap;
        gap: 0.5rem;
      }

      .header-right {
        flex: 1;
        gap: 0.75rem;
        flex-wrap: wrap;
        min-width: 0;
      }

      .header-right .nav {
        display: none;
        order: 3;
        width: 100%;
        flex-direction: column;
        background: var(--blue-dark);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 0.5rem 0 0.75rem;
        gap: 0;
        margin-top: 0.25rem;
      }

      .header-right .nav.is-open {
        display: flex;
      }

      .header-right .nav a {
        padding: 0.65rem 0.5rem;
        color: rgba(255, 255, 255, 0.9);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      }

      .header-right .nav a:last-child {
        border-bottom: none;
      }

      .header-right .nav a.active::after {
        display: none;
      }

      .header-right .nav a.active {
        color: var(--gold);
      }

      .site-header.library-header .header-inner {
        position: relative;
      }

      .site-header.library-header .search-btn,
      .site-header.library-header .menu-toggle {
        flex-shrink: 0;
      }

      .menu-toggle {
        display: flex;
      }

      .authored-grid {
        grid-template-columns: 1fr;
      }

      .book-card-sm {
        flex: 0 0 calc(50% - 0.5rem);
      }

      .notes-grid {
        grid-template-columns: repeat(2, 1fr);
      }

      .carousel-nav {
        display: none;
      }

      .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
      }
    }

    @media (max-width: 768px) {
      .library-footer-inner {
        padding: 1rem 1.25rem 1rem 18%;
      }

      .library-footer-quote {
        font-size: 0.9rem;
      }

      .hero-text-wrap {
        left: 50%;
        transform: translateX(-50%);
        width: min(92%, 380px);
        max-width: none;
        top: 10%;
      }

      .tabs-wrap {
        margin-top: -1.5rem;
        padding-bottom: 1.75rem;
      }

      .tabs-wrap .container {
        padding: 0 0.75rem;
      }

      .tabs {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        max-width: none;
        border-radius: 12px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
      }

      .tabs::-webkit-scrollbar {
        display: none;
      }

      .tabs a {
        flex-shrink: 0;
        white-space: nowrap;
      }
    }

    @media (max-width: 560px) {
      .container {
        padding: 0 1rem;
      }

      .logo-text span {
        display: none;
      }

      .notes-grid {
        grid-template-columns: 1fr;
      }

      .book-card-sm {
        flex: 0 0 72%;
        min-width: 140px;
      }

      .hero-wrap {
        min-height: 360px;
      }

      .hero-text-wrap {
        top: 8%;
        width: 92%;
      }

      .hero-text-zone h1 {
        font-size: 1.75rem;
      }

      .hero-text-zone .subtitle {
        font-size: 0.85rem;
        line-height: 1.75;
      }

      .hero-quote {
        font-size: 0.82rem;
      }

      .library-footer-inner {
        padding: 0.85rem 1rem;
      }

      .library-footer-quote {
        font-size: 0.82rem;
        line-height: 1.75;
      }

      .book-card-lg {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 0.85rem;
        padding: 1rem;
      }

      .book-cover {
        margin: 0 auto;
      }

      .book-meta {
        justify-content: center;
      }

      .book-link {
        justify-content: center;
      }

      .section-block {
        padding: 2rem 0;
      }

      .section-title-row h2 {
        font-size: 1rem;
      }
    }
