/* ========= الألوان (من ملف التصميم) ========= */
:root,
[data-theme="night"] {
  --bg: #141312;
  --surface: #1E1C1A;
  --line: #2E2B28;
  --text: #EDE9E3;
  --muted: #A8A29A;
  --soft: #CFC9C1;
  --accent-text: #3CC2B4;
  --accent-fill: #3CC2B4;
  --on-accent: #141312;
  --scrim: rgba(20, 19, 18, .94);
  --chip: rgba(20, 19, 18, .72);
  color-scheme: dark;
}
[data-theme="day"] {
  --bg: #F3EFE6;
  --surface: #E6E0D4;
  --line: #CFC8BB;
  --text: #161514;
  --muted: #5E5952;
  --soft: #3A3632;
  --accent-text: #0B6E66;
  --accent-fill: #1FA396;
  --on-accent: #161514;
  --scrim: rgba(243, 239, 230, .95);
  --chip: rgba(20, 19, 18, .72);
  color-scheme: light;
}

/* ========= الأساس ========= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  transition: background .3s, color .3s;
}
a { color: inherit; }
a:hover { opacity: .8; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.accent { color: var(--accent-text); font-weight: 600; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 32px; }
.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: 16px; top: 16px; z-index: 10; background: var(--surface); padding: 8px 16px; }
h1, h2, h3, .brand { font-family: 'Reem Kufi', sans-serif; font-weight: 700; }

/* ========= الهيدر ========= */
.top {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 16px; padding: 24px 0; border-bottom: 1px solid var(--line);
}
.brand { font-size: 20px; text-decoration: none; }
.top-end { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.nav { display: flex; gap: 24px; font-size: 15px; }
.nav a { text-decoration: none; }
.mode {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
}
.mode:hover { border-color: var(--muted); }
[data-theme="night"] .i-moon, [data-theme="day"] .i-sun { display: none; }

/* ========= البداية ========= */
.hero { padding: 112px 0 96px; display: flex; flex-direction: column; gap: 28px; }
.eyebrow { font-size: 14px; color: var(--muted); letter-spacing: 1px; }
.hero .eyebrow { align-self: flex-start; }
.hero h1 { margin: 0; font-size: clamp(64px, 11vw, 148px); line-height: 1; letter-spacing: -1px; }
.bar { width: 120px; height: 6px; background: var(--accent-fill); }
.intro { margin: 0; font-size: 21px; line-height: 1.9; color: var(--soft); max-width: 680px; }
.cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 28px;
  text-decoration: none; border-radius: 2px; font-weight: 600;
}
.btn-fill { background: var(--accent-fill); color: var(--on-accent); }
.btn-line { border: 1px solid var(--line); font-weight: 400; }
.btn-line:hover { border-color: var(--muted); opacity: 1; }

/* ========= الشغل ========= */
.work { padding: 88px 0 40px; border-top: 1px solid var(--line); scroll-margin-top: 16px; }
.work-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end;
  gap: 20px; margin-bottom: 36px;
}
.work h2 { margin: 0; font-size: 48px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter {
  min-height: 44px; padding: 0 16px; font-family: inherit; font-size: 14px; cursor: pointer; border-radius: 2px;
  background: transparent; color: var(--soft); border: 1px solid var(--line);
}
.filter:hover { border-color: var(--muted); }
.filter[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); }
.empty { color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 32px 20px; }
.grid-sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px 12px; }

.card { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.card[hidden] { display: none; }
.card.is-wide { grid-column: span 2; }
.thumb {
  position: relative; display: block; width: 100%; padding: 0; cursor: pointer;
  aspect-ratio: 9 / 16; background: var(--surface); border: 1px solid var(--line); overflow: hidden;
  font: inherit; color: inherit;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.thumb:hover img { transform: scale(1.03); }
.play {
  position: absolute; inset-inline-start: 12px; bottom: 12px;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--chip); color: #EDE9E3;
}
.thumb:hover .play { background: var(--accent-fill); color: var(--on-accent); }
.dur {
  position: absolute; inset-inline-end: 10px; top: 10px;
  font-size: 12px; padding: 2px 8px; border-radius: 2px;
  background: var(--chip); color: #EDE9E3; direction: ltr;
}
.c-title { font-size: 16px; font-weight: 500; line-height: 1.5; }
.c-client { font-size: 13px; color: var(--muted); }
.c-text { display: flex; flex-direction: column; gap: 2px; }
.roles { display: flex; flex-wrap: wrap; gap: 6px; }
.role {
  font-size: 12px; padding: 4px 10px; border: 1px solid var(--accent-text);
  color: var(--accent-text); border-radius: 2px;
}

/* ========= HT Studio ========= */
.studio {
  margin-top: 72px; padding: 64px 40px; background: var(--surface);
  display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; scroll-margin-top: 16px;
}
.studio-text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 16px; }
.studio h3 { margin: 0; font-size: 40px; }
.studio-text p { margin: 0; font-size: 17px; line-height: 1.8; color: var(--soft); }
.studio .grid-sm { flex: 999 1 560px; min-width: 0; }
.studio .card { gap: 8px; }
.studio .thumb { background: var(--bg); border: 0; border-bottom: 4px solid var(--accent-fill); }
.studio .c-title { font-size: 14px; font-weight: 400; }
.studio .c-client { font-size: 12px; }
.studio .play { width: 36px; height: 36px; inset-inline-start: 8px; bottom: 8px; }

/* ========= تواصل ========= */
.contact { padding: 96px 0 72px; display: flex; flex-direction: column; gap: 20px; scroll-margin-top: 16px; }
.contact h2 { margin: 0; font-size: clamp(40px, 6vw, 72px); }
.links { display: flex; flex-wrap: wrap; gap: 32px; font-size: 18px; }
.links a { text-decoration: none; }

/* ========= المشغل ========= */
.player {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: transparent; color: var(--text);
}
.player::backdrop { background: var(--scrim); }
.player-inner {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px 16px;
}
.p-stage { display: flex; align-items: center; gap: 16px; min-height: 0; flex: 0 1 auto; max-width: 100%; }
.p-stage video {
  display: block; max-height: calc(100dvh - 190px); max-width: min(100%, 1100px);
  background: #000; border: 1px solid var(--line);
}
.p-close, .p-nav {
  width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
}
.p-close:hover, .p-nav:hover { border-color: var(--muted); }
.p-nav:disabled { opacity: .3; cursor: default; }
.p-close { position: absolute; top: 16px; inset-inline-end: 16px; }
.p-meta { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.p-title { font-size: 18px; font-weight: 500; }
.p-client { font-size: 13px; color: var(--muted); }
.p-client:empty { display: none; }
.p-meta .roles { justify-content: center; margin-top: 4px; }
body.locked { overflow: hidden; }

.noscript { text-align: center; padding: 24px; }

/* ========= الموبايل ========= */
@media (max-width: 720px) {
  .wrap { padding: 0 20px; }
  .hero { padding: 72px 0 64px; gap: 22px; }
  .intro { font-size: 18px; }
  .work { padding-top: 64px; }
  .work h2 { font-size: 40px; }
  .filter { padding: 0 12px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
  .grid-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c-title { font-size: 15px; }
  .studio { margin-inline: -20px; padding: 48px 20px; gap: 32px; }
  .studio h3 { font-size: 34px; }
  .contact { padding: 72px 0 56px; }
  .links { gap: 20px; flex-direction: column; }
  .p-nav { display: none; }
  .p-stage video { max-height: calc(100dvh - 170px); }
  .player-inner { padding: 64px 12px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
