/* ============================================================
   AladdinMiles — Premium Aviation Editorial Gallery
   Luxury interactive travel-magazine space (light, editorial)
   ============================================================ */

:root {
  --red: #FE0000;          /* vivid brand red */
  --red-deep: #BE2C1C;
  --blue: #003CA1;         /* deep aviation blue */
  --blue-vivid: #0076FC;
  --gold: #C9A227;
  --ink: #0A1230;          /* deep night navy as text ink */
  --paper: #F4F6F9;        /* premium light grey */
  --cream: #FAF7F2;
  --serif: var(--font-playfair), "Times New Roman", Georgia, serif;
  --sans: var(--font-inter), "Segoe UI", system-ui, sans-serif;
  --arabic: var(--font-tajawal), "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, #ffffff 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 50% 115%, #e8ecf3 0%, transparent 55%),
    linear-gradient(180deg, #fbfcfe 0%, var(--paper) 45%, #eef1f6 100%);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body { opacity: 0; transition: opacity 1.1s ease; }
body.ready { opacity: 1; }

/* ---------- 3D stage ---------- */

#stage {
  position: fixed;
  inset: 0;
  perspective: 1100px;
  perspective-origin: 50% 50%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#stage.dragging { cursor: grabbing; }

#cylinder {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-style: preserve-3d;
}

.card3d {
  position: absolute;
  left: 0;
  top: 0;
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
}

.card3d .frame {
  position: relative;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(10, 18, 48, 0.08);
  box-shadow:
    0 34px 70px rgba(10, 18, 48, 0.16),
    0 8px 22px rgba(10, 18, 48, 0.08);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
}
.card3d:hover .frame {
  transform: scale(1.035) translateY(-3px);
  box-shadow:
    0 48px 95px rgba(10, 18, 48, 0.22),
    0 12px 30px rgba(10, 18, 48, 0.1);
}

.card3d canvas,
.card3d .frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card3d .meta {
  margin-top: 11px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(10, 18, 48, 0.78);
  text-transform: uppercase;
  white-space: nowrap;
}
.card3d .meta .title { margin-right: 2px; }
.card3d .meta .pill {
  border: 1px solid rgba(10, 18, 48, 0.22);
  border-radius: 999px;
  padding: 2px 8px 3px;
  font-size: 8px;
  font-weight: 600;
  color: rgba(10, 18, 48, 0.55);
  background: rgba(255, 255, 255, 0.65);
}
.card3d .meta .year { color: rgba(10, 18, 48, 0.4); margin-left: 2px; }

.card3d.filtered-out { pointer-events: none; }

/* ---------- atmosphere ---------- */

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    /* cinematic aviation glow on the horizon */
    radial-gradient(ellipse 70% 26% at 50% 58%, rgba(0, 118, 252, 0.07), transparent 70%),
    radial-gradient(ellipse 50% 18% at 50% 55%, rgba(201, 162, 39, 0.06), transparent 70%),
    /* light haze at the edges — atmospheric depth */
    radial-gradient(ellipse 120% 92% at 50% 50%, transparent 52%, rgba(244, 246, 249, 0.88) 100%),
    linear-gradient(to bottom, rgba(251, 252, 254, 0.95), transparent 14%, transparent 84%, rgba(234, 238, 245, 0.95));
}

/* ---------- chrome / UI ---------- */

.chrome { position: fixed; z-index: 20; }

#logo {
  top: 26px;
  left: 32px;
  width: 124px;
  cursor: pointer;
}
#logo img { width: 100%; height: auto; display: block; filter: drop-shadow(0 3px 10px rgba(10,18,48,0.12)); }

#sound {
  top: 36px;
  left: 50%;
  transform: translateX(-160%);
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
}
#sound .dots {
  display: inline-grid;
  grid-template-columns: repeat(5, 3px);
  gap: 2px;
}
#sound .dots i {
  width: 3px; height: 3px;
  background: rgba(10, 18, 48, 0.55);
  border-radius: 50%;
}
#sound.on { color: var(--red); }
#sound.on .dots i { background: var(--red); }

#mission {
  top: 34px;
  left: 56.5%;
  width: 225px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(10, 18, 48, 0.72);
}

#clocks {
  top: 34px;
  right: 225px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.7;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
  color: var(--ink);
}
#clocks .row { display: flex; gap: 8px; align-items: baseline; }
#clocks .dot { font-size: 7px; color: var(--red); }
#clocks .time { color: rgba(10, 18, 48, 0.5); }

#letstalk {
  top: 28px;
  right: 32px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 15px 28px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(254, 0, 0, 0.28);
  transition: transform 0.2s ease, background 0.2s ease;
}
#letstalk:hover { transform: scale(1.05); background: var(--red-deep); }

/* nav pills */
#nav {
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(10, 18, 48, 0.08);
  border-radius: 999px;
  padding: 5px;
  gap: 2px;
  box-shadow: 0 14px 38px rgba(10, 18, 48, 0.12);
}
#nav button {
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  padding: 11px 24px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
#nav button.active,
#nav button:hover { background: var(--ink); color: #fff; }

/* bottom-left view + customize */
#corner-tools {
  bottom: 28px;
  left: 32px;
  display: flex;
  gap: 8px;
}
.round-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(10, 18, 48, 0.1);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(10, 18, 48, 0.1);
  transition: background 0.2s ease, color 0.2s ease;
}
.round-btn:hover { background: var(--ink); color: #fff; }

/* filter */
#filter-wrap { bottom: 28px; right: 32px; }
#filter-btn {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(10, 18, 48, 0.1);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  border-radius: 999px;
  padding: 14px 26px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(10, 18, 48, 0.1);
  transition: background 0.2s ease, color 0.2s ease;
}
#filter-btn:hover, #filter-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

#filter-menu {
  position: absolute;
  bottom: 58px;
  right: 0;
  display: none;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(10, 18, 48, 0.1);
  border-radius: 16px;
  padding: 10px;
  max-height: 50vh;
  overflow: auto;
  min-width: 175px;
  box-shadow: 0 22px 55px rgba(10, 18, 48, 0.18);
}
#filter-menu.open { display: flex; }
#filter-menu button {
  background: none;
  border: 1px solid rgba(10, 18, 48, 0.16);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  padding: 8px 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
#filter-menu button:hover { background: rgba(10, 18, 48, 0.07); }
#filter-menu button.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------- detail overlay — magazine article ---------- */

#detail {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  background: linear-gradient(180deg, #fdfdfb 0%, var(--cream) 100%);
  overflow-y: auto;
}
#detail.open { display: block; animation: fadeIn 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

#detail .inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 120px 32px 150px;
}
#detail .hero {
  width: 100%;
  aspect-ratio: 16 / 8;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 40px;
  border: 1px solid rgba(10, 18, 48, 0.08);
  box-shadow: 0 44px 90px rgba(10, 18, 48, 0.18);
}
#detail .hero canvas, #detail .hero img {
  width: 100%; height: 100%; display: block; object-fit: cover;
}
/* Procedural poster cards (no photo): show the FULL composition like the wall
   thumbnail — just larger and centered. Contain (not cover), on a premium white
   frame. Photo cards keep cover (rules above) and are unaffected. */
#detail .hero.art {
  aspect-ratio: auto;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 3.2vw, 44px);
}
#detail .hero.art canvas, #detail .hero.art img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(10, 18, 48, 0.16);
}
@media (max-width: 700px) {
  #detail .hero.art { padding: 16px; }
  #detail .hero.art canvas, #detail .hero.art img { max-height: 56vh; }
}
#detail .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 22px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(10, 18, 48, 0.5);
}
#detail .meta-row .pill {
  border: 1px solid rgba(10, 18, 48, 0.2);
  border-radius: 999px;
  padding: 4px 13px;
}
#detail h1 {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.06;
  margin-bottom: 6px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
#detail .ar-title {
  font-family: var(--arabic);
  font-weight: 800;
  font-size: clamp(20px, 3vw, 30px);
  color: var(--blue);
  margin-bottom: 14px;
  direction: rtl;
  text-align: left;
}
#detail .blurb {
  color: var(--red);
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 36px;
}
#detail .body {
  font-size: 16px;
  line-height: 1.85;
  color: rgba(10, 18, 48, 0.88);
}
#detail .body p { margin-bottom: 20px; }
#detail .body ul { margin: 0 0 20px 22px; }
#detail .body li { margin-bottom: 9px; }
#detail .body a { color: var(--blue); }
#detail .body strong { color: var(--ink); }
#detail .body .btn-link {
  display: inline-block;
  border: 1.5px solid var(--red);
  color: var(--red);
  border-radius: 999px;
  padding: 12px 24px;
  margin: 6px 10px 6px 0;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}
#detail .body .btn-link:hover { background: var(--red); color: #fff; }

#detail-back {
  position: fixed;
  top: 28px;
  left: 32px;
  z-index: 45;
}
#detail-next {
  position: fixed;
  bottom: 28px;
  right: 32px;
  z-index: 45;
}
.ghost-btn {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(10, 18, 48, 0.14);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  padding: 13px 26px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(10, 18, 48, 0.12);
  transition: background 0.2s ease, color 0.2s ease;
}
.ghost-btn:hover { background: var(--ink); color: #fff; }

/* ---------- list view — magazine index ---------- */

#listview {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  background: linear-gradient(180deg, #fdfdfb, var(--paper));
  overflow-y: auto;
  padding: 130px 7vw 150px;
}
#listview.open { display: block; animation: fadeIn 0.3s ease; }
#listview .row {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 20px 8px;
  border-bottom: 1px solid rgba(10, 18, 48, 0.12);
  cursor: pointer;
  transition: padding-left 0.22s ease, background 0.22s ease;
}
#listview .row:hover { padding-left: 26px; background: rgba(255, 255, 255, 0.7); }
#listview .row .t {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(22px, 3.6vw, 40px);
  color: var(--ink);
}
#listview .row:hover .t { color: var(--red); }
#listview .row .tags {
  font-size: 9.5px;
  font-weight: 600;
  color: rgba(10, 18, 48, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
#listview .row .y { margin-left: auto; font-size: 11px; color: rgba(10, 18, 48, 0.35); }

/* ---------- customize panel ---------- */

#editor {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  z-index: 60;
  background: rgba(253, 253, 251, 0.98);
  backdrop-filter: blur(16px);
  border-left: 1px solid rgba(10, 18, 48, 0.1);
  box-shadow: -24px 0 60px rgba(10, 18, 48, 0.12);
  transform: translateX(105%);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  color: var(--ink);
}
#editor.open { transform: translateX(0); }
#editor header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(10, 18, 48, 0.1);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
#editor .scroll { flex: 1; overflow-y: auto; padding: 18px 22px 32px; }
#editor label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(10, 18, 48, 0.5);
  margin: 16px 0 6px;
}
#editor input, #editor select, #editor textarea {
  width: 100%;
  background: #fff;
  border: 1px solid rgba(10, 18, 48, 0.16);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  padding: 10px 12px;
}
#editor textarea { min-height: 130px; resize: vertical; }
#editor .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#editor .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 22px;
  border-top: 1px solid rgba(10, 18, 48, 0.1);
}
#editor .actions button {
  flex: 1;
  min-width: 110px;
  border: none;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
#editor .actions .save { background: var(--red); color: #fff; }
#editor .actions .ghost { background: rgba(10, 18, 48, 0.08); color: var(--ink); }
#editor .hint {
  font-size: 10.5px;
  line-height: 1.6;
  color: rgba(10, 18, 48, 0.45);
  margin-top: 14px;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  #mission { display: none; }
  #clocks { right: auto; left: 110px; top: 30px; font-size: 9px; }
  #letstalk { padding: 12px 18px; font-size: 12px; top: 30px; }
  #sound { display: none; }
}
@media (max-width: 560px) {
  #filter-wrap { display: none; }
  #corner-tools { bottom: 92px; }
  #logo { width: 96px; }
  #clocks { left: 104px; }
  #detail .inner { padding: 95px 20px 130px; }
}
