/* QaydLab | قيد لاب — brand tokens */
:root {
  --ink: #1D2A33;
  --ink-2: #4A5A66;
  --blue: #3B8FD0;
  --deep: #2A72AD;
  --sky: #8CC3EA;
  --mint: #3FB48C;
  --fog: #F3F8FB;
  --paper: #FFFDF7;
  --line: #DCE7EF;
  --yellow: #FFE45C;
  --yt: #E62117;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(29, 42, 51, .06), 0 12px 32px -12px rgba(29, 42, 51, .18);
  --font: "Readex Pro", system-ui, "Segoe UI", Tahoma, sans-serif;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='90'%3E%3Cpath d='M8 34a37 37 0 0 1 74 0z' fill='%233B8FD0'/%3E%3Cpath d='M98 15a37 37 0 0 0 74 0z' fill='%238CC3EA'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--fog);
  line-height: 1.75;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }

.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55em;
  padding: .8em 1.4em; border-radius: 999px;
  font: 600 1rem/1.2 var(--font); text-decoration: none;
  border: 2px solid transparent; transition: transform .2s, box-shadow .2s, background .2s;
}
.btn svg { width: 1.3em; height: 1.3em; fill: currentColor; }
.btn:hover { transform: translateY(-2px); }
.btn--yt { background: var(--yt); color: #fff; box-shadow: 0 8px 20px -8px rgba(230, 33, 23, .55); }
.btn--ghost { border-color: var(--ink); color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: #fff; }
.btn--sm { padding: .55em 1.05em; font-size: .92rem; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(243, 248, 251, .82);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.top.is-scrolled { border-bottom-color: var(--line); }
.top__in { display: flex; align-items: center; gap: 24px; height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__mark { width: 40px; height: 40px; flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__en { font-size: 1.25rem; font-weight: 400; color: var(--blue); letter-spacing: -.01em; }
.brand__en b { color: var(--ink); font-weight: 700; }
.brand__ar { font-size: .9rem; color: var(--blue); }
.brand__ar b { color: var(--ink); font-weight: 700; }
.nav { display: flex; gap: 6px; margin-inline-start: auto; }
.nav a { text-decoration: none; padding: .45em .9em; border-radius: 999px; font-weight: 500; color: var(--ink-2); transition: background .2s, color .2s; }
.nav a:hover { background: #fff; color: var(--ink); }

/* ---------- pattern ---------- */
.pattern { position: absolute; pointer-events: none; background-image: var(--pattern); }
.pattern--hero {
  inset-block: 0; inset-inline-end: 0; width: 46%;
  background-size: 120px 60px; opacity: .9;
  -webkit-mask-image: linear-gradient(to left, #000 0%, rgba(0,0,0,.55) 45%, transparent 100%);
          mask-image: linear-gradient(to left, #000 0%, rgba(0,0,0,.55) 45%, transparent 100%);
}

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(48px, 8vw, 104px) 0 clamp(56px, 8vw, 112px); }
.hero__in { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: clamp(32px, 6vw, 80px); }
.eyebrow { font-size: .8rem; letter-spacing: .22em; color: var(--ink-2); font-weight: 500; margin-bottom: 18px; text-align: right; }
.eyebrow i { color: var(--mint); font-style: normal; margin: 0 .4em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 4.6rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.hl {
  position: relative; display: inline-block; z-index: 0;
  background: linear-gradient(transparent 52%, var(--yellow) 52%, var(--yellow) 90%, transparent 90%);
  padding-inline: .08em;
}
.hl::after {
  content: ""; position: absolute; inset-inline: 0; bottom: -.12em; height: .16em;
  border-block: 3px solid var(--blue); border-radius: 2px;
  transform: scaleX(0); transform-origin: right; animation: draw .9s .5s cubic-bezier(.6,0,.2,1) forwards;
}
@keyframes draw { to { transform: scaleX(1); } }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.22rem); color: var(--ink-2); margin-top: 22px; max-width: 34em; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* journal-entry card */
.entry {
  position: relative; margin: 0;
  background:
    linear-gradient(to left, transparent calc(100% - 46px), #F4B9C2 calc(100% - 46px), #F4B9C2 calc(100% - 44px), transparent calc(100% - 44px)),
    repeating-linear-gradient(to bottom, var(--paper) 0 35px, #E3EDF4 35px 36px);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 26px 30px 30px 64px;
  transform: rotate(-2deg);
  border: 1px solid #E9EEF2;
}
.entry__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.term { font-weight: 600; font-size: .85rem; color: var(--deep); border: 2px solid var(--blue); border-radius: 999px; padding: .15em .8em; background: #fff; }
.entry__no { color: var(--ink-2); font-size: .9rem; }
.entry__no b { color: var(--ink); }
.entry__tbl { width: 100%; border-collapse: collapse; font-size: 1.05rem; }
.entry__tbl th { font-weight: 500; font-size: .8rem; color: var(--ink-2); text-align: right; padding: 4px 6px; border-bottom: 2px solid var(--ink); }
.entry__tbl th:not(:first-child), .entry__tbl td:not(:first-child) { text-align: center; width: 24%; }
.entry__tbl td { padding: 9px 6px; font-weight: 600; }
.entry__tbl td.to { padding-inline-start: 2.2em; color: var(--deep); }
.entry__tbl td.num { color: var(--ink); }
.entry__tbl tbody tr:last-child td { border-bottom: 2px double var(--ink); }
.entry__memo { margin-top: 14px; color: var(--ink-2); font-size: .95rem; }
.entry__memo span { font-weight: 600; color: var(--ink); }
.stamp {
  position: absolute; inset-inline-start: 18px; bottom: -18px;
  font-weight: 700; color: var(--mint); font-size: 1.05rem;
  border: 3px solid var(--mint); border-radius: 10px; padding: .1em .7em;
  background: rgba(255, 255, 255, .9);
  transform: rotate(-8deg) scale(1.6); opacity: 0;
  animation: stamp .45s 1.4s cubic-bezier(.2, 1.6, .4, 1) forwards;
}
@keyframes stamp { to { transform: rotate(-8deg) scale(1); opacity: 1; } }

/* ---------- sections ---------- */
.sec { padding: clamp(56px, 8vw, 96px) 0; }
.sec--paper { background: #fff; border-block: 1px solid var(--line); }
.sec__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 32px; }
.kicker { font-size: .8rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--blue); margin-bottom: 4px; text-align: right; }
.link { color: var(--deep); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* shorts grid */
.shorts { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.short {
  position: relative; display: block; border-radius: 16px; overflow: hidden;
  aspect-ratio: 9 / 16; background: #dde8f0; box-shadow: var(--shadow);
  text-decoration: none; transition: transform .25s, box-shadow .25s;
}
.short img { width: 100%; height: 100%; object-fit: cover; }
.short::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(29, 42, 51, .55), transparent 40%);
  opacity: 0; transition: opacity .25s;
}
.short__play {
  position: absolute; z-index: 1; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%; background: rgba(255, 255, 255, .92); display: grid; place-items: center;
  opacity: 0; transform: scale(.8); transition: opacity .25s, transform .25s;
}
.short__play svg { width: 22px; height: 22px; fill: var(--yt); margin-left: 4px; }
.short__media { display: contents; }
.short:hover { transform: translateY(-6px); box-shadow: 0 20px 40px -16px rgba(29, 42, 51, .4); }
.short:hover::after, .short:focus-visible::after { opacity: 1; }
.short:hover .short__play, .short:focus-visible .short__play,
.ep:hover .short__play, .ep:focus-visible .short__play { opacity: 1; transform: scale(1); }

/* long episodes */
.sec--tight { padding-top: 0; }
.longs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.ep { display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.ep__media {
  position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden;
  background: #dde8f0; box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s;
}
.ep__media img { width: 100%; height: 100%; object-fit: cover; }
.ep:hover .ep__media { transform: translateY(-4px); box-shadow: 0 20px 40px -16px rgba(29, 42, 51, .4); }
.ep__title { font-weight: 600; line-height: 1.5; }
@media (max-width: 820px) { .longs { grid-template-columns: 1fr; } }
.short__new {
  position: absolute; z-index: 1; top: 10px; inset-inline-start: 10px;
  background: var(--mint); color: #fff; font-size: .75rem; font-weight: 600; padding: .15em .7em; border-radius: 999px;
}

/* in-page player */
.no-scroll { overflow: hidden; }
.player {
  padding: 0; border: 0; background: transparent; max-width: none; max-height: none;
  width: 100%; height: 100%; color: #fff;
}
.player::backdrop { background: rgba(16, 24, 30, .88); backdrop-filter: blur(6px); }
.player[open] { display: grid; place-items: center; }
.player__box {
  display: grid; gap: 10px;
  /* frame + close row (44) + info bar (~64) + gaps must fit the screen height */
  width: min(420px, 100vw - 32px, (100dvh - 150px) * 9 / 16);
}
.player--wide .player__box { width: min(1000px, 100vw - 32px, (100dvh - 150px) * 16 / 9); }
.player--wide .player__frame { aspect-ratio: 16 / 9; }
.player__btn[hidden] { display: none; }
.player__top { display: flex; justify-content: flex-start; }
.player__frame { width: 100%; aspect-ratio: 9 / 16; border-radius: 18px; overflow: hidden; background: #000; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7); }
.player__frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.player__bar { display: flex; align-items: center; gap: 10px; }
.player__info { flex: 1; min-width: 0; text-align: center; }
.player__title { font-weight: 600; font-size: .95rem; line-height: 1.45; }
.player__yt { color: var(--sky); font-size: .82rem; font-weight: 500; }
.player__btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; font: 600 1.5rem/1 var(--font);
  display: grid; place-items: center; transition: background .2s;
}
.player__btn:hover { background: rgba(255, 255, 255, .28); }
.player__top .player__btn { font-size: 1.05rem; }

/* series */
.series { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  position: relative; overflow: hidden; background: var(--fog); border-radius: var(--radius);
  padding: 26px 24px 24px; border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 5px; background: var(--accent); }
.card--construction { --accent: var(--blue); }
.card--basics { --accent: var(--mint); }
.card--ai { --accent: var(--ink); }
.card__tag { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.card__tag b { font-size: 1.05rem; font-weight: 700; color: var(--accent); }
.card--ai .card__tag b { color: var(--deep); }
.card__tag small { font-size: .82rem; color: var(--ink-2); }
.card p { color: var(--ink-2); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: auto 0 0; padding: 6px 0 0; }
.chips li { font-size: .78rem; font-weight: 500; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .2em .75em; }

.soon {
  margin-top: 20px; display: flex; gap: 18px; align-items: flex-start;
  background: var(--ink); color: #fff; border-radius: var(--radius); padding: 24px 26px;
  position: relative; overflow: hidden;
}
.soon::after {
  content: ""; position: absolute; inset-block: 0; inset-inline-end: 0; width: 220px;
  background-image: var(--pattern); background-size: 90px 45px; opacity: .25;
  -webkit-mask-image: linear-gradient(to left, #000, transparent); mask-image: linear-gradient(to left, #000, transparent);
}
.soon > * { position: relative; z-index: 1; }
.soon p { color: #C9D6E0; margin-top: 4px; max-width: 46em; }
.soon__badge { flex: none; background: var(--mint); color: #fff; font-weight: 700; font-size: .85rem; padding: .25em .9em; border-radius: 999px; margin-top: 2px; }

/* about */
.about { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(32px, 6vw, 72px); align-items: start; }
.about .lead { margin-top: 14px; }
.why { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.why li { display: flex; gap: 16px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.why__n {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 1.2rem; color: #fff; background: var(--blue);
}
.why li:nth-child(2) .why__n { background: var(--mint); }
.why li:nth-child(3) .why__n { background: var(--ink); }
.why p { color: var(--ink-2); margin-top: 2px; }

/* follow */
.follow { position: relative; overflow: hidden; background: var(--ink); color: #fff; padding: clamp(64px, 9vw, 110px) 0; text-align: center; }
.pattern--dark {
  inset: 0; background-size: 120px 60px; opacity: .14;
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 30%, #000 75%);
          mask-image: radial-gradient(ellipse at center, transparent 30%, #000 75%);
}
.follow__in { position: relative; }
.follow p { color: #C9D6E0; margin-top: 10px; font-size: 1.1rem; }
.social { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.social__a {
  display: inline-flex; align-items: center; gap: .6em; text-decoration: none;
  padding: .75em 1.4em; border-radius: 999px; font-weight: 600;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18);
  transition: background .2s, transform .2s;
}
.social__a svg { width: 1.3em; height: 1.3em; fill: currentColor; }
.social__a:hover { background: rgba(255, 255, 255, .16); transform: translateY(-2px); }
.social__a--yt { background: var(--yt); border-color: var(--yt); }
.social__a--yt:hover { background: #c81c13; }

/* footer */
.foot { background: #fff; border-top: 1px solid var(--line); padding: 36px 0; }
.foot__in { display: grid; gap: 14px; }
.foot__brand { display: flex; align-items: center; gap: 12px; }
.foot__brand p { color: var(--ink-2); font-size: .95rem; }
.foot__note { color: var(--ink-2); font-size: .85rem; }
.foot__copy { color: var(--ink-2); font-size: .78rem; letter-spacing: .08em; text-align: right; }

/* reveal on scroll */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .entry.reveal { transform: translateY(18px) rotate(-2deg); }
.js .reveal.is-in { opacity: 1; transform: none; }
.js .entry.reveal.is-in { transform: rotate(-2deg); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .shorts { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 200px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; margin-inline: -16px; padding-inline: 16px; scrollbar-width: thin; }
  .short { scroll-snap-align: start; }
  .series { grid-template-columns: 1fr 1fr; }
  .card--ai { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .nav { display: none; }
  .top__in { justify-content: space-between; }
  .hero__in, .about { grid-template-columns: 1fr; }
  .pattern--hero {
    width: 100%; opacity: .6;
    -webkit-mask-image: linear-gradient(to top, #000 0, rgba(0,0,0,.5) 22%, transparent 42%);
            mask-image: linear-gradient(to top, #000 0, rgba(0,0,0,.5) 22%, transparent 42%);
  }
  .eyebrow { font-size: .68rem; letter-spacing: .14em; }
  .entry { max-width: 440px; justify-self: center; width: 100%; }
}
@media (max-width: 560px) {
  .series { grid-template-columns: 1fr; }
  .card--ai { grid-column: auto; }
  .shorts { grid-auto-columns: 160px; }
  .entry { padding: 22px 18px 26px 52px; }
  .entry__tbl { font-size: .95rem; }
  .soon { flex-direction: column; }
  .hero__cta .btn { flex: 1 1 100%; justify-content: center; }
}
