/*
Theme Name: YouLab Blog
Theme URI: /blog/
Author: YouLab
Description: Block theme for the YouLab blog. Same tokens, fonts and tone as the landing page (landing/app/tokens.css). Arabic first, right to left.
Version: 1.0.0
Requires at least: 6.5
Requires PHP: 8.0
Text Domain: youlab
*/

/* Logical properties only, so the same CSS works in RTL and LTR. */
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
:focus-visible { outline: 3px solid var(--wp--preset--color--blue); outline-offset: 3px; border-radius: 6px; }
.skip-link { position: absolute; inset-inline-start: 12px; inset-block-start: -64px; z-index: 100; background: #fff; color: var(--wp--preset--color--brand-700); padding: 12px 16px; border-radius: 12px; font-weight: 600; }
.skip-link:focus { inset-block-start: 12px; }

/* Header: sticky, like the landing bar */
.yl-header { position: sticky; inset-block-start: 0; z-index: 50; background: rgb(253 254 254 / .88); backdrop-filter: blur(14px); border-block-end: 1px solid var(--wp--preset--color--hairline); }
.yl-header__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1120px; margin-inline: auto; height: 64px; }
.yl-header__logo img { display: block; height: 28px; width: auto; }
.yl-nav { display: none; align-items: center; gap: 2px; }
.yl-nav a, .yl-header__actions a.yl-link { display: inline-flex; align-items: center; min-height: 40px; padding-inline: 14px; border-radius: 999px; font-size: 15px; font-weight: 500; color: var(--wp--preset--color--body); text-decoration: none; white-space: nowrap; }
.yl-nav a:hover, .yl-header__actions a.yl-link:hover { color: var(--wp--preset--color--navy); background: var(--wp--preset--color--stage); }
.yl-nav a[aria-current="page"] { color: var(--wp--preset--color--navy); background: var(--wp--preset--color--brand-50); font-weight: 600; }
.yl-header__actions { display: flex; align-items: center; gap: 6px; }
.yl-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding-inline: 20px; border-radius: 999px; background: var(--wp--preset--color--navy); color: #fff !important; font-weight: 600; font-size: 15px; text-decoration: none !important; transition: background .15s; white-space: nowrap; }
.yl-btn:hover { background: var(--wp--preset--color--navy-900); }
.yl-btn--ghost { background: #fff; color: var(--wp--preset--color--navy) !important; border: 1px solid var(--wp--preset--color--line); }
.yl-btn--ghost:hover { background: var(--wp--preset--color--stage); }
@media (min-width: 1024px) { .yl-header__bar { height: 72px; } .yl-header__logo img { height: 32px; } .yl-nav { display: flex; } }
@media (max-width: 639px) { .yl-header__actions a.yl-link { display: none; } }

/* Phone and tablet menu: a plain <details>, so it needs no JavaScript */
.yl-menu > summary { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; color: var(--wp--preset--color--navy); cursor: pointer; list-style: none; }
.yl-menu > summary::-webkit-details-marker { display: none; }
.yl-menu[open] > summary { background: var(--wp--preset--color--brand-50); }
.yl-menu__panel { position: absolute; inset-inline: 0; inset-block-start: 100%; display: flex; flex-direction: column; padding: 8px 20px 16px; background: #fff; border-block-end: 1px solid var(--wp--preset--color--hairline); box-shadow: 0 12px 24px rgb(14 42 107 / .08); }
.yl-menu__panel a { display: flex; align-items: center; min-height: 48px; font-size: 16px; color: var(--wp--preset--color--navy); text-decoration: none; }
.yl-menu__panel a[aria-current="page"] { font-weight: 600; }
@media (min-width: 1024px) { .yl-menu { display: none; } }
/* A blurred sticky bar costs repaints on every scroll, which phones feel most */
@media (max-width: 1023px) { .yl-header { background: #fdfefe; backdrop-filter: none; } }

/* Blog home hero */
.yl-hero { text-align: center; padding-block: 56px 32px; background: radial-gradient(60% 80% at 50% 0%, var(--wp--preset--color--brand-50), transparent 70%); }
.yl-hero h1 { margin: 0 0 12px; }
.yl-hero p { margin: 0 auto; max-width: 560px; color: var(--wp--preset--color--muted); }

/* Post cards */
.yl-card { height: 100%; display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid var(--wp--preset--color--hairline); border-radius: var(--wp--custom--radius--card); padding: 22px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.yl-card:hover { border-color: var(--wp--preset--color--brand-300); box-shadow: 0 10px 30px -14px rgb(14 42 107 / .25); transform: translateY(-2px); }
.yl-card .wp-block-post-title { font-size: 19px; line-height: 1.5; margin: 0; }
.yl-card .wp-block-post-title a { color: var(--wp--preset--color--navy); text-decoration: none; }
.yl-card .wp-block-post-excerpt { font-size: 15px; line-height: 1.8; color: var(--wp--preset--color--muted); margin: 0; flex: 1; }
.yl-card .wp-block-post-date, .yl-meta { font-size: 13px; color: var(--wp--preset--color--muted); }
.yl-cat a { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--wp--preset--color--brand-50); color: var(--wp--preset--color--brand-700); font-size: 13px; font-weight: 500; text-decoration: none; margin-inline-end: 6px; }

/* Pagination */
.wp-block-query-pagination { justify-content: center; gap: 8px; margin-block-start: 40px; }
.wp-block-query-pagination a, .wp-block-query-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding-inline: 14px; border-radius: 999px; border: 1px solid var(--wp--preset--color--line); text-decoration: none; background: #fff; color: var(--wp--preset--color--navy); font-weight: 500; }
.wp-block-query-pagination .page-numbers.current { background: var(--wp--preset--color--navy); color: #fff; border-color: var(--wp--preset--color--navy); }

/* Single post */
.yl-crumbs { font-size: 14px; color: var(--wp--preset--color--muted); margin-block-end: 8px; }
.yl-crumbs a { color: var(--wp--preset--color--muted); text-decoration: none; }
.yl-crumbs a:hover { color: var(--wp--preset--color--navy); text-decoration: underline; }
.wp-block-post-content { font-size: 18px; line-height: 1.95; overflow-wrap: break-word; }
.wp-block-post-content img { max-width: 100%; height: auto; border-radius: 16px; }
.wp-block-post-content table { width: 100%; border-collapse: collapse; font-size: 16px; display: block; overflow-x: auto; }
.wp-block-post-content th, .wp-block-post-content td { border: 1px solid var(--wp--preset--color--hairline); padding: 10px 14px; text-align: start; }
.wp-block-post-content th { background: var(--wp--preset--color--stage); color: var(--wp--preset--color--navy); }
.wp-block-post-content :where(h2, h3) { scroll-margin-block-start: 96px; }
.yl-disclaimer { margin-block: 24px 0; clear: both; background: var(--wp--preset--color--warm-50); border: 1px solid #ffe2b8; color: var(--wp--preset--color--warm-700); border-radius: 16px; padding: 14px 18px; font-size: 15px; line-height: 1.8; }

/* Call to action (replaces the old banner image) */
.yl-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; background: linear-gradient(135deg, var(--wp--preset--color--navy), var(--wp--preset--color--navy-900)); color: #fff; border-radius: 24px; padding: 28px 32px; margin-block: 32px; }
.yl-cta__text { flex: 1 1 320px; }
.yl-cta__title { font-family: var(--wp--preset--font-family--display); font-weight: 600; font-size: clamp(20px, 2.4vw, 26px); line-height: 1.5; margin: 0 0 6px; color: #fff; }
.yl-cta__sub { margin: 0; color: #b9c6e6; font-size: 16px; line-height: 1.8; }
.yl-cta .yl-btn { background: var(--wp--preset--color--brand-500); color: var(--wp--preset--color--navy) !important; }
.yl-cta .yl-btn:hover { background: var(--wp--preset--color--brand-300); }

/* Footer: mirrors the landing footer (white, hairline top border, 4-column grid, giant wordmark) */
.yl-footer { position: relative; overflow: hidden; background: #fff; border-block-start: 1px solid var(--wp--preset--color--hairline); margin-block-start: 72px; }
.yl-footer__inner { max-width: 1120px; margin-inline: auto; padding: 56px 20px 0; display: flex; flex-direction: column; gap: 48px; }
.yl-footer__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 24px; }
.yl-footer__brand { grid-column: span 2; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.yl-footer__logo img { display: block; height: 32px; width: auto; }
.yl-footer__tagline { margin: 0; max-width: 20rem; font-size: 15px; line-height: 24px; color: var(--wp--preset--color--body); }
.yl-footer__desc { margin: 0; max-width: 24rem; font-size: 14px; line-height: 22px; color: #657085; }
.yl-footer__mail { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; font-weight: 600; color: var(--wp--preset--color--brand-700); text-decoration: none; text-underline-offset: 4px; }
.yl-footer__mail:hover { text-decoration: underline; }
.yl-footer__col { display: flex; flex-direction: column; gap: 12px; }
.yl-footer__h { margin: 0; font-size: 14px; font-weight: 600; color: var(--wp--preset--color--navy); }
.yl-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.yl-footer li a { display: inline-flex; align-items: center; min-height: 44px; width: fit-content; font-size: 14px; color: var(--wp--preset--color--muted); text-decoration: none; text-underline-offset: 4px; }
.yl-footer li a:hover { color: var(--wp--preset--color--navy); text-decoration: underline; }
@media (min-width: 640px) { .yl-footer ul { gap: 0; } .yl-footer__col { gap: 8px; } .yl-footer li a { min-height: 36px; } }
.yl-footer__legal { display: flex; flex-direction: column; gap: 8px; border-block-start: 1px solid var(--wp--preset--color--hairline); padding-block-start: 24px; font-size: 13px; line-height: 20px; color: #657085; }
.yl-footer__legal p { margin: 0; }
.yl-footer__disc { max-width: 36rem; }
@media (min-width: 640px) { .yl-footer__legal { flex-direction: row; align-items: center; justify-content: space-between; } }
@media (min-width: 1024px) {
  .yl-footer__inner { padding-block-start: 80px; }
  .yl-footer__grid { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
  .yl-footer__brand { grid-column: span 1; }
}
.yl-footer__word { margin: 24px 0 -0.16em; text-align: center; user-select: none; font-family: var(--wp--preset--font-family--display); font-weight: 700; letter-spacing: -0.06em; line-height: .8; font-size: clamp(6rem, 24vw, 22rem); color: #e8eef2; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .yl-card { transition: none; } .yl-card:hover { transform: none; } }

/* SEO layer: chips, tags, related, dates */
.yl-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 1120px; margin: 0 auto 28px; padding-inline: 0; }
.yl-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding-inline: 18px; border-radius: 999px; border: 1px solid var(--wp--preset--color--line); background: #fff; color: var(--wp--preset--color--navy); font-weight: 500; font-size: 15px; text-decoration: none; }
.yl-chip:hover { border-color: var(--wp--preset--color--brand-300); background: var(--wp--preset--color--brand-50); }
.yl-chip.is-current { background: var(--wp--preset--color--navy); border-color: var(--wp--preset--color--navy); color: #fff; }
.yl-chip__n { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--wp--preset--color--stage); color: var(--wp--preset--color--muted); }
.yl-chip.is-current .yl-chip__n { background: rgb(255 255 255 / .18); color: #fff; }
.yl-dates { margin: 0; font-size: 14px; color: var(--wp--preset--color--muted); }
.yl-tags { margin-block: 32px 8px; }
.yl-tags__h { font-size: 16px !important; margin: 0 0 10px !important; }
.yl-tags ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.yl-tags a { display: inline-flex; align-items: center; min-height: 40px; padding-inline: 14px; border-radius: 999px; background: var(--wp--preset--color--stage); border: 1px solid var(--wp--preset--color--hairline); color: var(--wp--preset--color--body); font-size: 14px; text-decoration: none; }
.yl-tags a:hover { border-color: var(--wp--preset--color--brand-300); color: var(--wp--preset--color--navy); }
.yl-related { display: flow-root; margin-block: 48px 0; }
.yl-related h2 { margin-block: 0 16px !important; }
.yl-related__grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .yl-related__grid { grid-template-columns: repeat(3, 1fr); } }
.yl-hero .yl-crumbs, .yl-hero .rank-math-breadcrumb { margin-block-end: 12px; font-size: 14px; }
.yl-hero .wp-block-term-description { margin-block: 0 auto; max-width: 560px; color: var(--wp--preset--color--muted); }
