/* The DD Engine showcase (templates/dd-showcase.php): a dark, lamp-lit page that lets the game art lead.
   Logical properties throughout, so the same rules serve right-to-left and left-to-right languages. */

:root {
  --dd-ink: #0b0c12;
  --dd-night: #11131d;
  --dd-panel: #171a27;
  --dd-line: #2a2d3d;
  --dd-text: #f1e9da;
  --dd-muted: #a9a294;
  --dd-gold: #e9b45f;
  --dd-gold-deep: #c98a2e;
  --dd-ember: #db6a3d;
  --dd-radius: 18px;
  --dd-gutter: clamp(16px, 4vw, 48px);
  --dd-max: 1240px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body.dd-showcase {
  margin: 0; background: var(--dd-ink); color: var(--dd-text);
  font-family: var(--dd-font-body); font-size: 17px; line-height: 1.65;
  overflow-x: hidden;
}
/* A faint film grain over everything, like a painted scene under lamplight. */
body.dd-showcase::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: .06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.dd-showcase img { max-width: 100%; height: auto; display: block; }
.dd-showcase a { color: inherit; }
.dd-showcase h1, .dd-showcase h2, .dd-showcase h3, .dd-showcase h4 { font-family: var(--dd-font-head); font-weight: 700; line-height: 1.15; margin: 0; }
.dd-showcase :focus-visible { outline: 2px solid var(--dd-gold); outline-offset: 3px; border-radius: 6px; }

.dd-skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--dd-gold); color: #1a1206; border-radius: 10px; text-decoration: none; font-weight: 700; }
.dd-skip:focus { top: 12px; }

/* ---- Buttons and small parts ---- */
.dd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px;
  border-radius: 999px; border: 1px solid transparent; text-decoration: none; font-weight: 700; font-size: 17px; white-space: nowrap;
  background: linear-gradient(180deg, #f3c573, var(--dd-gold-deep)); color: #1d1206 !important;
  box-shadow: 0 10px 30px -10px rgba(233, 180, 95, .65), inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.dd-btn:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 16px 36px -12px rgba(233, 180, 95, .8), inset 0 1px 0 rgba(255, 255, 255, .45); }
.dd-btn svg { flex: none; }
.dd-btn-ghost { background: rgba(11, 12, 18, .45); color: var(--dd-text) !important; border-color: rgba(241, 233, 218, .35); box-shadow: none; backdrop-filter: blur(6px); }
.dd-btn-ghost:hover { background: rgba(241, 233, 218, .12); box-shadow: none; }
.dd-btn-small { min-height: 40px; padding: 0 18px; font-size: 15px; }
.dd-kicker { margin: 0 0 12px; color: var(--dd-gold); font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.dd-lang-ar .dd-kicker, .dd-lang-fa .dd-kicker, .dd-lang-ur .dd-kicker { letter-spacing: 0; font-size: 15px; }

/* ---- Top bar ---- */
.dd-top {
  position: fixed; inset-inline: 0; top: 0; z-index: 40; display: flex; align-items: center; gap: 18px;
  padding: 12px var(--dd-gutter); transition: background .3s ease, box-shadow .3s ease;
  background: linear-gradient(180deg, rgba(8, 9, 14, .75), rgba(8, 9, 14, 0));
}
.dd-top.is-solid { background: rgba(11, 12, 18, .92); backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--dd-line); }
.dd-brand img { width: 110px; height: auto; }
.dd-nav { display: flex; gap: 22px; margin-inline-end: auto; }
.dd-nav a { text-decoration: none; color: var(--dd-muted); font-weight: 500; font-size: 15px; }
.dd-nav a:hover { color: var(--dd-text); }

.dd-langpick { position: relative; }
.dd-langpick summary {
  list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; cursor: pointer;
  border: 1px solid rgba(241, 233, 218, .25); border-radius: 999px; font-size: 15px; color: var(--dd-text); background: rgba(11, 12, 18, .4);
}
.dd-langpick summary::-webkit-details-marker { display: none; }
.dd-langpick[open] summary { border-color: var(--dd-gold); }
.dd-langpick-list {
  position: absolute; inset-inline-end: 0; top: calc(100% + 10px); margin: 0; padding: 10px; list-style: none; z-index: 50;
  display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 2px; width: max-content; max-width: calc(100vw - 32px);
  max-height: 70vh; overflow: auto; background: #141623; border: 1px solid var(--dd-line); border-radius: 16px; box-shadow: 0 30px 60px -20px #000;
}
.dd-langpick-list a, .dd-lang-grid a { display: block; padding: 9px 12px; border-radius: 10px; text-decoration: none; font-size: 15px; color: var(--dd-muted); }
.dd-langpick-list a:hover, .dd-lang-grid a:hover { background: rgba(233, 180, 95, .12); color: var(--dd-text); }
.dd-langpick-list a[aria-current], .dd-lang-grid a[aria-current] { color: var(--dd-gold); background: rgba(233, 180, 95, .1); }
.dd-lang-grid a { text-align: center; }
.dd-langpick-list a { text-align: start; }

.dd-preview-flag { position: fixed; bottom: 14px; inset-inline-start: 14px; z-index: 45; margin: 0; padding: 6px 12px; border-radius: 999px; background: #7a2f2f; color: #fff; font-size: 13px; }
.dd-suggest {
  position: fixed; bottom: 16px; inset-inline-end: 16px; z-index: 45; display: flex; align-items: center; gap: 6px; margin: 0;
  padding: 6px 6px 6px 16px; border-radius: 999px; background: #1b1e2c; border: 1px solid var(--dd-gold); box-shadow: 0 20px 40px -20px #000;
}
.dd-suggest[hidden] { display: none; }
.dd-suggest a { color: var(--dd-gold); font-weight: 700; text-decoration: none; }
.dd-suggest button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--dd-muted); font-size: 22px; cursor: pointer; }

/* ---- Hero ---- */
.dd-hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; isolation: isolate; overflow: hidden; }
.dd-hero-art { position: absolute; inset: 0; z-index: -2; background: var(--dd-night); }
.dd-hero-slide { position: absolute; inset: 0; width: 100%; height: 100% !important; max-width: none !important; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity 1.6s ease, transform 9s ease-out; }
.dd-hero-slide.is-on { opacity: 1; transform: scale(1); }
.dd-hero-shade {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 90% at 50% 30%, transparent 30%, rgba(8, 9, 14, .55) 70%, rgba(8, 9, 14, .95) 100%),
    linear-gradient(180deg, rgba(8, 9, 14, .2) 0%, rgba(8, 9, 14, .1) 40%, rgba(11, 12, 18, .92) 85%, var(--dd-ink) 100%);
}
[dir="ltr"] .dd-hero-shade { background:
    linear-gradient(90deg, rgba(8, 9, 14, .78) 0%, rgba(8, 9, 14, .2) 55%, transparent 75%),
    linear-gradient(180deg, rgba(8, 9, 14, .2) 0%, rgba(8, 9, 14, .1) 40%, rgba(11, 12, 18, .92) 85%, var(--dd-ink) 100%); }
[dir="rtl"] .dd-hero-shade { background:
    linear-gradient(270deg, rgba(8, 9, 14, .78) 0%, rgba(8, 9, 14, .2) 55%, transparent 75%),
    linear-gradient(180deg, rgba(8, 9, 14, .2) 0%, rgba(8, 9, 14, .1) 40%, rgba(11, 12, 18, .92) 85%, var(--dd-ink) 100%); }
.dd-hero-inner {
  width: 100%; max-width: var(--dd-max); margin: 0 auto; padding: 120px var(--dd-gutter) 40px;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: end; gap: 40px;
}
.dd-hero h1 { font-size: clamp(44px, 7.4vw, 96px); letter-spacing: -.01em; text-shadow: 0 6px 40px rgba(0, 0, 0, .6); }
.dd-lang-ar .dd-hero h1, .dd-lang-fa .dd-hero h1, .dd-lang-ur .dd-hero h1 { line-height: 1.3; }
.dd-hero-sub { max-width: 34em; margin: 18px 0 30px; font-size: clamp(17px, 1.6vw, 20px); color: #ddd3c1; text-shadow: 0 2px 20px rgba(0, 0, 0, .7); }
.dd-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.dd-posters { position: relative; justify-self: end; width: min(100%, 380px); aspect-ratio: 4 / 5; }
[dir="rtl"] .dd-posters { justify-self: start; }
.dd-posters img {
  position: absolute; width: 58%; border-radius: 16px; border: 1px solid rgba(241, 233, 218, .25);
  box-shadow: 0 40px 80px -30px #000, 0 0 0 6px rgba(11, 12, 18, .35);
}
.dd-posters img:nth-child(1) { inset-inline-end: 0; bottom: 0; transform: rotate(4deg); z-index: 1; }
.dd-posters img:nth-child(2) { inset-inline-start: 0; bottom: 14%; transform: rotate(-6deg); }
[dir="rtl"] .dd-posters img:nth-child(1) { transform: rotate(-4deg); }
[dir="rtl"] .dd-posters img:nth-child(2) { transform: rotate(6deg); }

.dd-hero-games { list-style: none; margin: 0 auto; padding: 0 var(--dd-gutter) 36px; width: 100%; max-width: var(--dd-max); display: flex; gap: 14px; flex-wrap: wrap; }
.dd-hero-games a {
  display: flex; align-items: center; gap: 12px; padding: 8px 18px 8px 8px; text-decoration: none; border-radius: 14px;
  background: rgba(17, 19, 29, .7); border: 1px solid rgba(241, 233, 218, .14); backdrop-filter: blur(8px); transition: border-color .2s ease;
}
[dir="rtl"] .dd-hero-games a { padding: 8px 8px 8px 18px; }
.dd-hero-games a:hover { border-color: var(--dd-gold); }
.dd-hero-games img { width: 64px; height: 44px !important; object-fit: cover; border-radius: 9px; }
.dd-hero-games strong { display: block; font-size: 15px; }
.dd-hero-games small { display: block; font-size: 12px; color: var(--dd-muted); }

/* ---- Sections ---- */
.dd-games, .dd-how, .dd-langs { width: 100%; max-width: var(--dd-max); margin: 0 auto; padding: 90px var(--dd-gutter) 20px; }
.dd-section-head { margin-bottom: 40px; }
.dd-section-head h2 { font-size: clamp(34px, 4.6vw, 56px); }
.dd-section-head h2::after { content: ""; display: block; width: 64px; height: 3px; margin-top: 16px; background: linear-gradient(90deg, var(--dd-gold), transparent); border-radius: 3px; }
[dir="rtl"] .dd-section-head h2::after { background: linear-gradient(270deg, var(--dd-gold), transparent); }
.dd-section-head p { margin: 14px 0 0; color: var(--dd-muted); font-size: 18px; max-width: 40em; }

/* ---- A game ---- */
.dd-game {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0; margin-bottom: 72px;
  background: linear-gradient(180deg, var(--dd-panel), var(--dd-night)); border: 1px solid var(--dd-line); border-radius: 26px; overflow: hidden;
  box-shadow: 0 50px 100px -50px #000;
}
.dd-game-portrait { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
.dd-game-cover { position: relative; min-height: 420px; }
.dd-game-cover img { position: absolute; inset: 0; width: 100%; height: 100% !important; object-fit: cover; }
.dd-game-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 60%, var(--dd-panel)); }
[dir="rtl"] .dd-game-cover::after { background: linear-gradient(270deg, transparent 60%, var(--dd-panel)); }
.dd-game-body { padding: 44px 44px 36px; }
.dd-game-body h3 { font-size: clamp(36px, 4.4vw, 58px); color: #fff3dc; margin-bottom: 18px; }
.dd-chips { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.dd-chips li { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--dd-line); color: var(--dd-muted); font-size: 14px; }
.dd-chips li:first-child { color: var(--dd-gold); border-color: rgba(233, 180, 95, .45); }
.dd-game-desc { margin: 0 0 18px; color: #d8cfbf; }
.dd-note { margin: 0 0 22px; padding: 10px 14px; border-inline-start: 3px solid var(--dd-ember); background: rgba(219, 106, 61, .08); border-radius: 8px; font-size: 14px; color: #e8c6b5; }

.dd-cast { margin-top: 30px; }
.dd-cast h4, .dd-shots h4 { font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--dd-muted); font-family: var(--dd-font-body); margin-bottom: 14px; }
.dd-cast ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.dd-cast li { width: 96px; text-align: center; font-size: 13px; color: var(--dd-muted); }
.dd-cast img { width: 96px; height: 96px !important; object-fit: cover; object-position: center 20%; border-radius: 50%; background: #f3ead8; border: 2px solid rgba(233, 180, 95, .5); margin-bottom: 6px; }

.dd-shots { grid-column: 1 / -1; padding: 28px 0 32px; border-top: 1px solid var(--dd-line); }
.dd-shots h4 { padding: 0 44px; }
.dd-strip {
  list-style: none; margin: 0; padding: 0 44px 10px; display: grid; grid-auto-flow: column; gap: 14px; overflow-x: auto;
  scroll-snap-type: x mandatory; scroll-padding-inline: 44px; scrollbar-width: thin; scrollbar-color: var(--dd-line) transparent;
}
.dd-game-landscape .dd-strip { grid-auto-columns: minmax(260px, 30%); }
.dd-game-portrait .dd-strip { grid-auto-columns: minmax(170px, 17%); }
.dd-strip li { scroll-snap-align: start; }
.dd-strip a { display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--dd-line); position: relative; }
.dd-strip img { width: 100%; transition: transform .5s ease, filter .3s ease; filter: saturate(.92); }
.dd-strip a:hover img { transform: scale(1.05); filter: saturate(1.1); }
.dd-strip a::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 0 var(--dd-gold); transition: box-shadow .2s ease; border-radius: 14px; }
.dd-strip a:hover::after, .dd-strip a:focus-visible::after { box-shadow: inset 0 0 0 2px var(--dd-gold); }

/* ---- How it plays ---- */
.dd-features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.dd-features li { position: relative; min-height: 340px; border-radius: 20px; overflow: hidden; border: 1px solid var(--dd-line); display: flex; align-items: flex-end; isolation: isolate; }
.dd-features img { position: absolute; inset: 0; width: 100%; height: 100% !important; object-fit: cover; z-index: -2; transition: transform .8s ease; }
.dd-features li:hover img { transform: scale(1.06); }
.dd-features li::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(11, 12, 18, 0) 20%, rgba(11, 12, 18, .92) 75%); }
.dd-features div { padding: 22px; }
.dd-num { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-bottom: 12px; border-radius: 50%; border: 1px solid var(--dd-gold); color: var(--dd-gold); font-weight: 700; font-size: 15px; }
.dd-features h3 { font-size: 24px; margin-bottom: 8px; }
.dd-features p { margin: 0; color: #cfc6b6; font-size: 15px; }

/* ---- More to come: a wall of every screenshot ---- */
.dd-more { position: relative; margin-top: 90px; min-height: 520px; display: grid; place-items: center; overflow: hidden; isolation: isolate; }
.dd-mosaic { position: absolute; inset: -40px; z-index: -2; columns: 6 220px; column-gap: 10px; transform: rotate(-4deg) scale(1.1); opacity: .85; }
.dd-mosaic img { margin-bottom: 10px; border-radius: 10px; width: 100%; break-inside: avoid; }
.dd-more::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(42% 46% at 50% 50%, rgba(11, 12, 18, .9), rgba(11, 12, 18, .55) 70%, rgba(11, 12, 18, .35)), linear-gradient(180deg, var(--dd-ink), transparent 18%, transparent 82%, var(--dd-ink)); }
.dd-more-copy { text-align: center; padding: 60px var(--dd-gutter); max-width: 760px; }
.dd-more-copy h2 { font-size: clamp(34px, 5vw, 62px); color: #fff3dc; }
.dd-more-copy p { margin: 16px 0 0; color: var(--dd-muted); font-size: 19px; }

/* ---- Languages ---- */
.dd-lang-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.dd-lang-grid a { border: 1px solid var(--dd-line); padding: 14px 16px; font-size: 17px; }

/* ---- Footer ---- */
.dd-foot { max-width: var(--dd-max); margin: 80px auto 0; padding: 36px var(--dd-gutter) 48px; border-top: 1px solid var(--dd-line); display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; color: var(--dd-muted); font-size: 15px; }
.dd-foot p { margin: 0; }
.dd-made { color: var(--dd-gold); font-weight: 700; }
.dd-foot nav { display: flex; flex-wrap: wrap; gap: 18px; margin-inline-end: auto; }
.dd-foot a { text-decoration: none; }
.dd-foot a:hover { color: var(--dd-text); }

/* ---- Screenshot viewer ---- */
.dd-viewer { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(5, 6, 10, .96); color: var(--dd-text); }
.dd-viewer[open] { display: grid; place-items: center; }
.dd-viewer::backdrop { background: rgba(0, 0, 0, .8); }
.dd-viewer img { max-width: min(94vw, 1600px); max-height: 88vh; width: auto; height: auto; border-radius: 12px; box-shadow: 0 40px 100px -30px #000; }
.dd-viewer button { position: absolute; width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(241, 233, 218, .3); background: rgba(17, 19, 29, .8); color: var(--dd-text); font-size: 30px; line-height: 1; cursor: pointer; }
.dd-viewer button:hover { border-color: var(--dd-gold); color: var(--dd-gold); }
.dd-viewer-close { top: 16px; inset-inline-end: 16px; }
.dd-viewer-prev { inset-inline-start: 16px; top: calc(50% - 26px); }
.dd-viewer-next { inset-inline-end: 16px; top: calc(50% - 26px); }

/* ---- Smaller screens ---- */
@media (max-width: 1000px) {
  .dd-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dd-hero-inner { grid-template-columns: 1fr; }
  .dd-posters { display: none; }
}
@media (max-width: 820px) {
  .dd-nav { display: none; }
  .dd-langpick { margin-inline-start: auto; }
  .dd-game, .dd-game-portrait { grid-template-columns: 1fr; }
  .dd-game-cover { min-height: 0; aspect-ratio: 16 / 10; }
  .dd-game-portrait .dd-game-cover { aspect-ratio: 4 / 5; max-height: 70vh; }
  .dd-game-cover::after, [dir="rtl"] .dd-game-cover::after { background: linear-gradient(180deg, transparent 55%, var(--dd-panel)); }
  .dd-game-body { padding: 26px 22px 24px; }
  .dd-shots h4 { padding: 0 22px; }
  .dd-strip { padding: 0 22px 10px; scroll-padding-inline: 22px; }
  .dd-game-landscape .dd-strip { grid-auto-columns: 78%; }
  .dd-game-portrait .dd-strip { grid-auto-columns: 46%; }
  .dd-langpick-list { grid-template-columns: repeat(2, minmax(120px, 1fr)); position: fixed; top: 64px; inset-inline: 16px; width: auto; }
}
@media (max-width: 560px) {
  body.dd-showcase { font-size: 16px; }
  .dd-top { gap: 10px; }
  .dd-brand img { width: 88px; }
  .dd-top .dd-btn-small { display: none; }
  .dd-hero-inner { padding-top: 100px; }
  .dd-actions .dd-btn { flex: 1 1 100%; }
  .dd-hero-games li { flex: 1 1 100%; }
  .dd-features { grid-template-columns: 1fr; }
  .dd-features li { min-height: 260px; }
  .dd-games, .dd-how, .dd-langs { padding-top: 64px; }
  .dd-lang-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dd-viewer button.dd-viewer-prev, .dd-viewer button.dd-viewer-next { top: auto; bottom: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .dd-hero-slide, .dd-strip img, .dd-features img, .dd-btn { transition: none !important; }
}
