/* ============================================================
   CodeShift Studio — style.css
   A quiet, typographic one-pager. Edit the variables to re-theme.
   ============================================================ */

:root {
  /* Neutrals, warmed very slightly so nothing reads as flat grey. */
  --bg: #101113;
  --surface: #17181c;
  --surface-raised: #1d1f24;
  --border: #26282e;
  --border-soft: #202227;

  --text: #ececed;
  --text-dim: #b9bbc1;
  --muted: #8b8e96;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;

  --max-width: 760px;

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  /* Arabic falls through to a system face that actually has the glyphs. */
  --font-ar: "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", Arial, sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

/* ---------- Base ---------- */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

section {
  scroll-margin-top: 24px;
}

/* Arabic: swap the face and drop the tight Latin tracking, which breaks the
   joined letterforms. */
:root:lang(ar) body {
  font-family: var(--font-ar);
}

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

/* ============================================================
   Language toggle
   Centred at the top, with its own band of space so it never sits on the
   logo or content. Being a normal flow element, it pushes the hero down
   instead of overlapping it. `position: relative` + auto margins keep it
   centred in both LTR and RTL without physical offsets.
   ============================================================ */
.lang {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 24px 24px 0;
}

.lang__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid #34373e;
  border-radius: 999px;
  /* A soft raised surface so it reads as a control at a glance, while
     staying well below the text in contrast. */
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  transition:
    color 150ms var(--ease),
    border-color 150ms var(--ease),
    background-color 150ms var(--ease);
}

.lang__btn:hover {
  color: var(--text);
  background: var(--surface-raised);
  border-color: #44474f;
}

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

/* ============================================================
   1. Studio logo
   ============================================================ */
.hero {
  display: flex;
  justify-content: center;
  padding: 32px 24px 72px;
}

.hero__logo {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  overflow: hidden;
  /* The emblem already carries its own white ring, so no extra border —
     that would read as a second, doubled ring. */
  background: #0c0d0f;
}

.hero__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   Shared section furniture
   ============================================================ */
.section {
  padding: 8px 0 72px;
}

.section__head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}

.section__title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* A hairline that fades out — a rule, not a wall. `to left` so it fades away
   from the heading on both LTR and RTL. */
.section__rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(
    to left,
    var(--border) 0%,
    var(--border-soft) 45%,
    transparent 100%
  );
}

/* ============================================================
   2. About
   ============================================================ */
.lead {
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
  line-height: 1.55;
  letter-spacing: -0.011em;
  color: var(--text);
  text-wrap: pretty;
}

.lead__name {
  color: #ffffff;
  font-weight: 600;
  white-space: nowrap;
}

.body-text {
  margin-top: 18px;
  max-width: 54ch;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-dim);
  text-wrap: pretty;
}

/* ============================================================
   3. Games
   ============================================================ */
.games {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  /* On phones the card fills the column, but never stretches edge to edge. */
  max-width: 300px;
}

.game {
  position: relative;
  display: block;
  width: 100%;
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition:
    border-color 180ms var(--ease),
    background-color 180ms var(--ease),
    box-shadow 180ms var(--ease),
    transform 180ms var(--ease);
}

.game:hover {
  border-color: #3a3d45;
  background: var(--surface-raised);
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -28px rgba(0, 0, 0, 1);
}

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

/* --- image area --- */
.game__media {
  position: relative;
  display: block;
  /* 3:4 frame — shorter than the artwork's own 0.56 ratio, so `cover` trims
     only the sides and keeps the full height: wordmark and car stay in shot. */
  aspect-ratio: 3 / 4;
  background: var(--surface-raised);
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
}

.game__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms var(--ease);
}

.game:hover .game__media img {
  transform: scale(1.025);
}

/* Neat placeholder if no art is supplied or it fails to load:
   the game title in a quiet type-panel, no gradient, no icon. */
.game__media.is-empty,
.modal__media.is-empty {
  display: grid;
  place-items: center;
  background: #141519;
}

.game__media.is-empty img,
.modal__media.is-empty img {
  display: none;
}

.game__media.is-empty::after,
.modal__media.is-empty::after {
  content: attr(data-fallback);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6d7078;
}

/* --- card text --- */
.game__body {
  display: block;
  padding: 16px 18px 18px;
}

.game__title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}

/* Clamped to three lines: the full description makes the text block far
   taller than the art at phone width. Reuses the existing copy and keeps the
   card compact without a ragged one-word last line. */
.game__desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  margin-top: 4px;
  max-width: 46ch;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
  transition: color 180ms var(--ease);
}

.game:hover .game__desc {
  color: var(--text-dim);
}

.game__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  /* Keep each tag on one line so a wrapping row breaks at tag boundaries. */
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--text-dim);
  background: #23252b;
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* --- arrow affordance --- */
.game__arrow {
  position: absolute;
  top: 16px;
  /* inset-inline-end keeps it in the card's top corner in either direction. */
  inset-inline-end: 16px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(16, 17, 19, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  transition:
    background-color 180ms var(--ease),
    transform 180ms var(--ease);
}

.game__arrow svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game:hover .game__arrow {
  background: rgba(255, 255, 255, 0.14);
  transform: translateX(2px);
}

/* Mirror the nudge in RTL so it still points "into" the card. */
[dir="rtl"] .game:hover .game__arrow {
  transform: translateX(-2px);
}

[dir="rtl"] .game__arrow svg {
  transform: scaleX(-1);
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  padding: 0 0 48px;
}

.footer .wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.footer__logo {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  flex: none;
}

/* The copyright line: one uninterrupted run, so the name and the language
   switch never wrap apart on narrow screens. */
.footer__copy {
  min-width: 0;
  text-wrap: nowrap;
  letter-spacing: 0.005em;
}

@media (max-width: 420px) {
  .footer__copy {
    font-size: 0.75rem;
    letter-spacing: 0;
  }
}

/* ============================================================
   Modal
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.modal.is-open {
  display: flex;
  animation: fade-in 160ms var(--ease);
}

.modal__backdrop {
  position: fixed;
  inset: 0;
  /* Solid enough that the page behind reads as dismissed, not as a
     second layer competing with the dialog. */
  background: rgba(8, 9, 10, 0.84);
  backdrop-filter: blur(2px);
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface-raised);
  border: 1px solid #30333a;
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 1);
  animation: rise 200ms var(--ease);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.modal__close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(16, 17, 19, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  transition: background-color 150ms var(--ease);
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.modal__close:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.modal__close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.9;
  stroke-linecap: round;
}

.modal__media {
  position: relative;
  /* A short banner keeps the details and the download button above the fold
     on a laptop. The framing sits low so the car and road stay in shot. */
  aspect-ratio: 2 / 1;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
}

.modal__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 74%;
}



.modal__body {
  padding: 20px 24px 22px;
}

.modal__title {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.modal__meta {
  margin-top: 4px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal__text {
  margin-top: 14px;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-dim);
  text-wrap: pretty;
}

.modal__list {
  list-style: none;
  margin-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.modal__list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-soft);
}

.modal__list li span:first-child {
  color: var(--muted);
}

.modal__list li span:last-child {
  color: var(--text);
}

.modal__actions {
  margin-top: 18px;
}

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #101113;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 150ms var(--ease);
}

.btn:hover {
  background: #ffffff;
}

.btn__note {
  font-size: 0.75rem;
  font-weight: 500;
  color: #55585f;
}

.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn[aria-disabled="true"]:hover {
  background: var(--text);
}

/* ---------- Body lock ---------- */
body.modal-open {
  overflow: hidden;
}

/* Arabic needs a touch more leading and no negative tracking. */
[lang="ar"] .lead { letter-spacing: 0; line-height: 1.75; }
[lang="ar"] .body-text { line-height: 1.9; }
[lang="ar"] .game__desc { line-height: 1.7; }
[lang="ar"] .modal__text { line-height: 1.85; }
[lang="ar"] .game__title,
[lang="ar"] .modal__title { letter-spacing: 0; }
[lang="ar"] .tag,
[lang="ar"] .section__title,
[lang="ar"] .modal__meta {
  /* Uppercase + wide tracking is a Latin device; neither applies in Arabic. */
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.75rem;
}

/* Arabic interface weight — Arabic sits lighter than Latin at the same size. */
:lang(ar) .modal__title,
:lang(ar) .game__title {
  font-weight: 650;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 720px) {
  /* The toggle now occupies the top band, so the hero only needs a gap
     between the two rather than a full header's worth of padding. */
  .lang {
    padding-top: 32px;
  }

  .hero {
    padding: 40px 24px 88px;
  }

  .hero__logo {
    width: 192px;
    height: 192px;
  }

  .section {
    padding: 8px 0 88px;
  }

  /* Portrait card: constrained so it reads as a single game, not a banner. */
  .games {
    grid-template-columns: minmax(0, 280px);
  }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .game:hover {
    transform: none;
  }

  .game:hover .game__media img {
    transform: none;
  }
}
