/* =========================================
   Base
   ========================================= */
/* Comments in English to avoid RTL editor issues */
body {
  direction: rtl;
  font-family: 'Heebo', sans-serif;
  position: relative;
  min-height: 100vh;
  background: #111;
  color: #ffd700;
  background-image: url('background_graph.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed; /* keep the background pinned to the viewport */
  overflow-x: hidden;
}

/* Subtle overlay for background darkness */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(17, 17, 17, 0.3);
  pointer-events: none;
}

.overlay-content { position: relative; z-index: 1; }

header h1 { display: none; }

header {
  background: none;
  padding: 20px;
  text-align: center;
}

/* =========================================
   Navigation
   ========================================= */
nav a {
  color: #ffd700;
  margin: 0 10px;
  text-decoration: none;
  font-weight: bold;
  background: #222;
  padding: 8px 18px;
  border-radius: 22px;
  transition: background 0.2s;
  display: inline-block;
}
nav a:hover { background: #444; }

.main-nav a.active { outline: 1px solid #ffd700; }

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.main-nav li { display: inline-block; }

/* =========================================
   Sections / Cards
   ========================================= */
section {
  max-width: 860px;
  margin: 48px auto;
  padding: 28px 32px;
  background: linear-gradient(180deg, #16120f 0%, #0e0b09 100%);
  border: 1px solid rgba(246, 194, 84, 0.35);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.4);
  line-height: 1.85;
}

/* Buttons */
.btn.btn-gold {
  display: inline-block;
  background: #ffd700;
  color: #111;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 10px;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.btn.btn-gold:hover { filter: brightness(1.05); }

/* CTA section on home */
.cta-contact { text-align: center; }

/* =========================================
   Forms
   ========================================= */
input, textarea, button {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 10px;
  border-radius: 7px;
  border: none;
}
button { background: #ffd700; color: #111; font-weight: bold; cursor: pointer; }

.contact-card {
  max-width: 720px;
  margin: 48px auto;
  background: #181818;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.contact-card textarea {
  resize: none;
  width: 100%;
  height: 180px;
  box-sizing: border-box;
  overflow: auto;
}
.contact-card input[type="text"],
.contact-card input[type="email"] {
  width: 100%;
  box-sizing: border-box;
}
.contact-card label {
  display: block;
  text-align: right;
  margin: 8px 0 6px;
}
.contact-card button { width: 100%; box-sizing: border-box; }

/* =========================================
   Footer
   ========================================= */
footer {
  background: rgba(0, 0, 0, 0.6);
  text-align: center;
  padding: 1.2rem 0;
  color: #f6c254;
  font-size: 0.9rem;
}

/* =========================================
   Desktop floating photo (desktop only)
   ========================================= */
.floating-photo {
  position: fixed;
  top: 0;
  right: 0;
  margin-right: -120px;
  width: 700px;
  height: 100vh;
  z-index: 8;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: none;
}
.floating-photo img {
  width: 95%;
  height: auto;
  max-height: 90vh;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: none;
  object-fit: contain;
}

/* =========================================
   Popup
   ========================================= */
.central-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(24, 24, 24, 0.96);
  border: 2px solid #ffd700;
  border-radius: 16px;
  box-shadow: 0 0 28px 4px #0009;
  color: #ffd700;
  max-width: 450px;
  width: 90vw;
  padding: 32px 22px 26px 22px;
  z-index: 10;
  text-align: center;
}
.central-box h2 { font-size: 1.4em; margin-bottom: 20px; font-weight: bold; }
.central-box ul { list-style: none; padding: 0; margin: 0; }
.central-box ul li { margin-bottom: 14px; font-size: 1.08em; }

.central-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(24, 24, 24, 0.98);
  border: 2px solid #ffd700;
  border-radius: 16px;
  box-shadow: 0 0 28px 6px #000a;
  color: #ffd700;
  max-width: 440px;
  width: 88vw;
  padding: 32px 22px 26px 22px;
  z-index: 99;
  text-align: center;
  display: none; /* Start hidden */
}
.central-popup ul {
  direction: rtl;
  text-align: right;
  list-style-position: inside;
  padding-right: 0;
  margin-right: 0;
}
.central-popup ul li {
  margin-bottom: 10px;
  font-size: 1em;
  color: #ffd700;
  font-weight: normal;
  padding-right: 0.3em;
}
.central-popup.active { display: block; animation: popIn 0.4s; }

.popup-title {
  margin-top: 12px;
  margin-bottom: 8px;
  font-size: 1.13em;
  color: #ffd700;
  font-weight: bold;
  text-align: right;
  display: block;
  width: 100%;
  direction: rtl;
}
.right-align { text-align: right; direction: rtl; }

@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, -60%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.central-popup .close-btn{
  position: absolute;
  top: 12px;
  right: 16px;
  width: auto;
  height: auto;
  padding: 0 10px;
  margin: 0;
  display: inline;
  background: none;
  border: none;
  color: #ffd700;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.6em;
  z-index: 101;
  transition: color 0.2s;
  line-height: 1;
}
.central-popup .close-btn:hover { color: #fff000; }

/* =========================================
   Articles (library + single)
   ========================================= */
.articles-container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.articles-intro { margin: 12px 0 24px; line-height: 1.8; opacity: 0.95; }

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.article-card {
  border: 1px solid rgba(246, 194, 84, 0.35);
  border-radius: 14px;
  padding: 16px;
  background: #111;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.45);
  border-color: rgba(255, 215, 0, 0.55);
}
.article-title { font-size: 1.08rem; margin: 0 0 .4rem; }
.article-meta  { font-size: .9rem; opacity: .85; margin-bottom: .65rem; }
.article-excerpt { font-size: .95rem; line-height: 1.7; margin: 0 0 .7rem; }
.article-link { color: #ffd700; text-decoration: underline; font-weight: 700; }
.article-link:hover { filter: brightness(1.08); }

.article-wrap {
  max-width: 820px;
  margin: 48px auto;
  padding: 28px 32px;
  background: linear-gradient(180deg, #16120f 0%, #0e0b09 100%);
  border: 1px solid rgba(246, 194, 84, 0.35);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.4);
}
.article-back { display: inline-block; margin: 6px 0 12px; text-decoration: underline; color: #ffd700; font-weight: 600; }
.article-meta { font-size: .92rem; opacity: .86; margin-bottom: 14px; }
.article-body p { line-height: 1.9; margin: 0 0 1rem; }
.article-body h2 { margin-top: 1.25rem; font-size: 1.2rem; }

/* =========================================
   Global Responsive
   ========================================= */
*,
*::before,
*::after { box-sizing: border-box; } /* safer sizing */

img, video { max-width: 100%; height: auto; display: block; }

/* Sections: reduce spacing on small phones */
@media (max-width: 600px) {
  section { margin: 28px auto; padding: 18px 16px; }
}
/* Navigation tweaks on phones */
@media (max-width: 600px) {
  .main-nav ul { flex-wrap: wrap; gap: 8px; }
  .main-nav a { padding: 8px 12px; font-weight: 600; font-size: 0.95rem; }
}
/* Avoid horizontal scrollbars on mobile */
@media (max-width: 900px) { body { overflow-x: hidden; } }
/* Popup readability on very small screens */
@media (max-width: 480px) {
  .central-popup { width: 92vw; padding: 22px 16px; }
  .central-popup ul li { font-size: 0.95em; }
}

/* =========================================
   Mobile/Tablet framed photo (single source of truth)
   ========================================= */
/* Hidden by default on desktop */
.mobile-photo { display: none; }

/* Up to 1080px (covers phones + tablets incl. iPad landscape):
   hide the desktop floating photo and show the framed mobile photo */
@media (max-width: 1080px) {
  .floating-photo { display: none !important; }

  .mobile-photo {
    display: block;
    margin: 18px auto;
    padding: 0;
    max-width: 92%;
    background: linear-gradient(180deg, #16120f 0%, #0e0b09 100%);
    border: 1px solid rgba(246, 194, 84, 0.35);
    border-radius: 16px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
    overflow: hidden; /* clean crop */
  }

  .mobile-photo img {
    width: 100%;
    /* fixed height is key so object-fit/object-position work */
    height: clamp(220px, 46vw, 420px);
    object-fit: cover;
    object-position: 10% 50%; /* default: slight push to the right */
    margin: 0;
    border-radius: 16px;
    display: block;
  }
}

/* Fine-tune phones (<=600px): a bit taller and slightly more to the right */
@media (max-width: 600px) {
  .mobile-photo img {
    height: clamp(200px, 58vw, 360px);
    object-position: 5% 50%;
  }
}

/* =========================================
   iPad / Tablets HARD OVERRIDE (put LAST in the file)
   Ensures shift works even if previous rules conflict.
   ========================================= */
@media (min-width: 700px) and (max-width: 1080px) {
  .floating-photo { display: none !important; }     /* force desktop version off */
  .mobile-photo { display: block !important; overflow: hidden !important; }

  .mobile-photo img {
    width: 110% !important;               /* slight zoom so shifting is visible */
    height: min(46vw, 420px) !important;  /* fixed height enables cropping */
    object-fit: cover !important;         /* fill the frame */
    object-position: 50% 50% !important;  /* neutral; we shift via transform */
    transform: translateX(-6%) !important;/* move image left so content appears right */
    margin: 0 !important;
    border-radius: 16px !important;
    display: block !important;
  }
}

/* Orientation fine-tuning */
@media (min-width: 1024px) and (max-width: 1080px) and (orientation: landscape) {
  .mobile-photo img { transform: translateX(5%) !important; }
}
@media (min-width: 768px) and (max-width: 834px) and (orientation: portrait) {
  .mobile-photo img { transform: translateX(5%) !important; }
}
/* Landscape phones tweak (e.g., Galaxy Note ~915×412) */
@media (max-height: 450px) and (min-width: 700px) and (max-width: 1080px) and (orientation: landscape) {
  .mobile-photo { overflow: hidden !important; }
  .mobile-photo img {
    /* keep enough height so cropping & shifting work */
    height: min(52vw, 420px) !important;
    object-fit: cover !important;
    object-position: 50% 50% !important;   /* neutral center */
    transform: translateX(5%) !important; /* nudge content to the right */
    width: 110% !important;                 /* tiny zoom so shift is visible */
  }
}
/* Sticky footer – minimal & safe */
html, body { height: 100%; }

body {
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }   /* main fills the space */
footer { flex-shrink: 0; } /* footer stays at the bottom */