/* ==========================================================================
   STYLE.CSS: THE MAMLUK CODEX DESIGN SYSTEM
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Cairo:wght@300;400;600;700&family=Cinzel:wght@400;600;700;900&family=Inter:wght@400;500;600&family=Noto+Sans+Arabic:wght@400;500;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Plus+Jakarta+Sans:wght@400;500;600&display=swap');

/* --------------------------------------------------------------------------
   1. MASTER SYSTEM VARIABLES
   -------------------------------------------------------------------------- */
:root {
  /* --- DARK THEME: "THE OBSIDIAN SULTANATE" (DEFAULT) --- */
  --bg-primary: #0F0F11;
  --bg-secondary: #1A1412; /* Deep Sepia / Aged Stone */
  --accent-gold: #C5A059;  /* Antique Hammered Gold */
  --accent-sienna: #8C5642; /* Bronzed Sienna */
  --accent-red: #A62B2B;    /* Crimson Seal Ink */
  --text-primary: #E6E8EA;  /* Warm Off-white */
  --text-secondary: #A9B2BC; /* Muted stone grey */
  --border-color: rgba(197, 160, 89, 0.25);
  --border-glow: rgba(197, 160, 89, 0.4);
  --shadow-color: rgba(0, 0, 0, 0.7);
  --abl-light: #2C2624;
  --abl-dark: #1A1412;
  
  /* Layout Fonts */
  --font-header: 'Cinzel', serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  --transition-slow: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  --transition-smooth: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme {
  /* --- LIGHT THEME: "THE ALABASTER COURT" --- */
  --bg-primary: #F0EAE1; /* Sepia Alabaster Parchment */
  --bg-secondary: #EADFC9; /* Aged Light Sepia Paper */
  --accent-gold: #8C5642;  /* Bronzed Sienna */
  --accent-sienna: #2C2523; /* Deep Earth-Brown */
  --accent-red: #8A1F1F;
  --text-primary: #1A1110;  /* Rich Ink Black */
  --text-secondary: #4D423E; /* Dark Sepia Ink */
  --border-color: rgba(140, 86, 66, 0.3);
  --border-glow: rgba(140, 86, 66, 0.5);
  --shadow-color: rgba(44, 37, 35, 0.15);
  --abl-light: #EADFC9;
  --abl-dark: #D1C4A5;
}

/* --- ARABIC TYPOGRAPHY CONFIGURATION --- */
body[dir="rtl"] {
  --font-header: 'Amiri', serif;
  --font-body: 'Cairo', sans-serif;
}

/* --------------------------------------------------------------------------
   2. INITIALIZATION & LAYOUT CONFIGURATION
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  transition: var(--transition-smooth);
  cursor: none; /* Hide standard cursor for pen-nib trail */
  overflow-x: hidden;
  position: relative;
}

/* Repeating Mamluk Geometric Star Background Pattern Layer */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M40 0 L45 25 L70 20 L55 40 L70 60 L45 55 L40 80 L35 55 L10 60 L25 40 L10 20 L35 25 Z' fill='%23C5A059' fill-rule='evenodd'/%3E%3Cpath d='M0 40 L25 45 L20 70 L40 55 L60 70 L55 45 L80 40 L55 35 L60 10 L40 25 L20 10 L25 35 Z' fill='%23C5A059' fill-rule='evenodd' opacity='0.7'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* CUSTOM PEN NIB CURSOR & CANVAS TRAIL */
#cursor-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99999;
}

#custom-cursor-nib {
  position: fixed;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 100000;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.2s, height 0.2s;
}

#custom-cursor-nib svg {
  width: 100%;
  height: 100%;
  fill: var(--accent-gold);
  filter: drop-shadow(0 2px 4px var(--shadow-color));
}

body:active #custom-cursor-nib {
  transform: translate(-50%, -50%) scale(0.85) rotate(-15deg);
}

/* Custom Webkit scrollbar matching the codex scrolls */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-sienna);
  border: 2px solid var(--bg-primary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

/* --------------------------------------------------------------------------
   3. FIXED HEADER & LANTERN SWITCHER
   -------------------------------------------------------------------------- */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;
  background: rgba(15, 15, 17, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border-color);
  z-index: 1000;
  transition: var(--transition-smooth);
}

body.light-theme header {
  background: rgba(240, 234, 225, 0.95);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 30px;
}

.logo-stamp {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--accent-gold);
  letter-spacing: 1px;
}

.logo-icon-svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: var(--accent-gold);
  stroke-width: 2.5;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 25px;
}

.nav-links a {
  font-family: var(--font-header);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
  padding: 8px 0;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--accent-gold);
  transition: var(--transition-smooth);
  transform: translateX(-50%);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-gold);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Controls Grid (Languages & Lantern Theme Toggle) */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.control-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1rem;
  padding: 8px 12px;
  cursor: none;
  transition: var(--transition-fast);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.control-btn:hover {
  background-color: rgba(197, 160, 89, 0.1);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* Stylized Hanging Lantern Theme Toggle */
.lantern-toggle {
  position: relative;
  width: 40px;
  height: 50px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 5px;
  cursor: none;
}

.lantern-toggle .lantern-chain {
  position: absolute;
  top: -15px;
  left: 50%;
  width: 2px;
  height: 25px;
  background: var(--accent-gold);
  transform: translateX(-50%);
}

.lantern-toggle .lantern-body {
  width: 24px;
  height: 30px;
  border: 2px solid var(--accent-gold);
  border-radius: 6px 6px 12px 12px;
  background: rgba(197, 160, 89, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 10px rgba(197, 160, 89, 0);
  transition: var(--transition-smooth);
}

.lantern-toggle .lantern-flame {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  width: 100%;
  height: 100%;
  transition: var(--transition-smooth);
}

/* Light mode styling for the lantern */
body.light-theme .lantern-body {
  box-shadow: 0 0 8px rgba(255, 165, 0, 0.3);
  background: rgba(197, 160, 89, 0.1);
}

body.light-theme .lantern-flame {
  color: #FFA500;
  filter: drop-shadow(0 0 3px #FFA500);
}

/* When dark mode (flame burns bright gold) */
body.dark-theme .lantern-body {
  box-shadow: 0 0 12px var(--border-glow);
  background: rgba(197, 160, 89, 0.4);
}

body.dark-theme .lantern-flame {
  color: #FFD700;
  filter: drop-shadow(0 0 6px #FFD700);
}

/* Hamburger mobile button */
#hamburger-btn {
  display: none;
  font-size: 1.5rem;
  color: var(--accent-gold);
}

/* --------------------------------------------------------------------------
   4. SCROLL SNAPPING CONTAINER SECTIONS
   -------------------------------------------------------------------------- */
section {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 100px 30px 40px 30px;
  box-sizing: border-box;
}

.section-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* Heavy Section Title Header decoration */
.section-header {
  text-align: center;
  margin-bottom: 50px;
}

.section-header h2 {
  font-family: var(--font-header);
  font-size: 2.8rem;
  color: var(--accent-gold);
  margin-bottom: 10px;
  position: relative;
  display: inline-block;
}

.section-header h2::before,
.section-header h2::after {
  content: "♦";
  color: var(--accent-sienna);
  margin: 0 15px;
  font-size: 1.5rem;
}

.section-header p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-style: italic;
  max-width: 600px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   5. SPLASH SCREEN & HOME PORTAL
   -------------------------------------------------------------------------- */
/* Splash always uses Obsidian cinematic palette (independent of light/dark theme) */
#splash-screen {
  --splash-bg: #050507;
  --splash-gate: #09090b;
  --splash-gold: #C5A059;
  --splash-gold-soft: rgba(197, 160, 89, 0.85);
  --splash-gold-glow: rgba(197, 160, 89, 0.4);
  --splash-gold-border: rgba(197, 160, 89, 0.05);
  direction: ltr !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--splash-bg);
  color: var(--splash-gold);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 1s ease, visibility 1s ease;
}

.splash-gate {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
}

.gate-wing {
  width: 50%;
  height: 100%;
  background: var(--splash-gate);
  position: relative;
  transition: transform 1.2s cubic-bezier(0.76, 0, 0.24, 1);
  display: flex;
  align-items: center;
  border: 1px solid var(--splash-gold-border);
}

.gate-wing.left {
  justify-content: flex-end;
  transform-origin: left;
}

.gate-wing.right {
  justify-content: flex-start;
  transform-origin: right;
}

.gate-decal {
  position: absolute;
  top: 50%;
  width: 180px;
  height: 360px;
  transform: translateY(-50%);
  opacity: 0.15;
}

.left .gate-decal {
  right: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 200'%3E%3Cpath d='M100 0 A100 100 0 0 0 0 100 A100 100 0 0 0 100 200 Z' fill='none' stroke='%23C5A059' stroke-width='2'/%3E%3C/svg%3E") no-repeat right;
}

.right .gate-decal {
  left: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 200'%3E%3Cpath d='M0 0 A100 100 0 0 1 100 100 A100 100 0 0 1 0 200 Z' fill='none' stroke='%23C5A059' stroke-width='2'/%3E%3C/svg%3E") no-repeat left;
}

.splash-content {
  position: relative;
  z-index: 10002;
  text-align: center;
  max-width: 80%;
}

.splash-logo-container {
  margin-bottom: 30px;
}

.splash-logo-svg {
  width: 120px;
  height: 120px;
  fill: none;
  color: var(--splash-gold);
  stroke: var(--splash-gold);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 15px var(--splash-gold-glow));
}

#splash-screen .splash-logo-core {
  fill: var(--splash-bg);
}

.splash-title-text {
  font-family: var(--font-header);
  font-size: 2.2rem;
  color: var(--splash-gold);
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition-slow);
}

.splash-title-text.reveal {
  opacity: 1;
  transform: translateY(0);
}

.splash-quote-text {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--splash-gold-soft);
  margin-top: 1.25rem;
  opacity: 0;
  transform: translateY(16px);
  transition: var(--transition-slow);
  transition-delay: 0.15s;
}

.splash-quote-text.reveal {
  opacity: 1;
  transform: translateY(0);
}

#page-turn-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-secondary);
  z-index: 9999;
  transform: skewX(-15deg) translateX(110%);
  transform-origin: right top;
  box-shadow: -15px 0 50px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  transition: none;
}

#page-turn-overlay.page-turn-active {
  display: block;
}

/* HOME SECTION - The Audience Hall */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 50px;
  min-height: 70vh;
}

.home-portrait-wrapper {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

body[dir="rtl"] .home-portrait-wrapper {
  justify-content: flex-start;
}

.home-archway-frame {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 520px;
  margin: 0 auto;
  border-radius: 120px 120px 0 0;
  border: 4px solid var(--accent-gold);
  padding: 12px;
  box-shadow: 0 20px 40px var(--shadow-color);
  background: var(--bg-secondary);
}

.home-archway-inner {
  width: 100%;
  height: 100%;
  border-radius: 110px 110px 0 0;
  border: 1px dashed var(--accent-gold);
  overflow: hidden;
  position: relative;
  background: #09090b;
}

.home-portrait-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--accent-gold);
}

.home-portrait-img {
  position: relative;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent-gold);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  opacity: 0.95;
  filter: sepia(0.15) contrast(1.1) brightness(0.95);
  transition: var(--transition-slow);
  z-index: 2;
}

.home-portrait-placeholder:hover .home-portrait-img {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 15px 30px var(--border-glow);
  filter: sepia(0) contrast(1.15) brightness(1.05);
}

.astrolabe-wrapper {
  width: 440px;
  height: 440px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  z-index: 1;
  pointer-events: none;
  transition: transform var(--transition-slow);
}

.astrolabe-spin {
  width: 100%;
  height: 100%;
  opacity: 0.35;
  transition: opacity var(--transition-slow);
}

.home-portrait-placeholder:hover .astrolabe-wrapper {
  transform: translate(-50%, -50%) scale(1.05);
}

.home-portrait-placeholder:hover .astrolabe-spin {
  opacity: 0.6;
}

.home-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.home-info h1 {
  font-family: var(--font-header);
  font-size: 4rem;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 10px;
}

.home-info .subtitle {
  font-family: var(--font-header);
  font-size: 1.8rem;
  color: var(--accent-gold);
  margin-bottom: 25px;
  letter-spacing: 1px;
}

.home-info .tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 550px;
  line-height: 1.7;
}

.home-actions {
  display: flex;
  gap: 25px;
}

/* ROYAL SEALS STAMP BUTTONS */
.royal-seal-btn {
  position: relative;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 1px;
  color: var(--text-primary);
  border: 2px solid var(--accent-gold);
  padding: 14px 28px;
  background: none;
  cursor: none;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.royal-seal-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  background: var(--accent-red);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.6s ease;
  z-index: -1;
  opacity: 0.85;
}

.royal-seal-btn:hover {
  border-color: var(--accent-red);
  color: #FFFFFF;
  box-shadow: 0 0 20px rgba(166, 43, 43, 0.4);
}

.royal-seal-btn:hover::before {
  transform: translate(-50%, -50%) scale(1);
}

/* --------------------------------------------------------------------------
   6. THE CHRONICLER / ABOUT MANUSCRIPT
   -------------------------------------------------------------------------- */
.chronicle-parchment {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-gold);
  border-radius: 12px;
  padding: 50px;
  box-shadow: 0 15px 30px var(--shadow-color);
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

/* Distress borders on parchment scroll */
.chronicle-parchment::before,
.chronicle-parchment::after {
  content: "";
  position: absolute;
  border: 1px dashed var(--border-color);
}
.chronicle-parchment::before {
  top: 10px; bottom: 10px; left: 10px; right: 10px;
}

.chronicle-content {
  position: relative;
  z-index: 2;
}

.chronicle-title {
  font-family: var(--font-header);
  font-size: 2.2rem;
  color: var(--accent-gold);
  text-align: left;
  margin-bottom: 25px;
  font-weight: 700;
}

body[dir="rtl"] .chronicle-title {
  text-align: right;
}

.chronicle-text p {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  line-height: 1.8;
  margin-bottom: 25px;
  color: var(--text-primary);
  text-align: justify;
}

body[dir="rtl"] .chronicle-text p {
  font-family: 'Amiri', serif;
  font-size: 1.45rem;
  line-height: 2.3;
}

/* Initial dropcap letter style */
.chronicle-text p::first-letter {
  font-family: var(--font-header);
  font-size: 3.5rem;
  float: left;
  margin-right: 12px;
  line-height: 1;
  color: var(--accent-gold);
  font-weight: 900;
}

body[dir="rtl"] .chronicle-text p::first-letter {
  float: right;
  margin-left: 12px;
  margin-right: 0;
}

/* --------------------------------------------------------------------------
   7. EDUCATION TIMELINE: THE ABLAQ STRIPES
   -------------------------------------------------------------------------- */
.timeline-container {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 0;
}

/* Ablaq Striped Stone Pattern vertical timeline pillar */
.timeline-container::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 24px;
  margin-left: -12px;
  background: repeating-linear-gradient(
    0deg,
    var(--abl-dark) 0px,
    var(--abl-dark) 20px,
    var(--abl-light) 20px,
    var(--abl-light) 40px
  );
  border-left: 2px solid var(--accent-gold);
  border-right: 2px solid var(--accent-gold);
  box-shadow: 0 5px 15px var(--shadow-color);
}

body[dir="rtl"] .timeline-container::before {
  left: 50%;
  margin-left: -12px;
}

.timeline-item {
  position: relative;
  width: 50%;
  padding: 20px 40px;
  box-sizing: border-box;
}

.timeline-item.left {
  left: 0;
  text-align: right;
}

.timeline-item.right {
  left: 50%;
  text-align: left;
}

/* Architectural Heraldry Shields as Nodes */
.timeline-badge {
  position: absolute;
  top: 25px;
  width: 32px;
  height: 42px;
  background-color: var(--accent-gold);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  border: 1px solid var(--bg-secondary);
  z-index: 10;
  box-shadow: 0 3px 6px rgba(0,0,0,0.5);
}

.timeline-item.left .timeline-badge {
  right: -16px;
}

.timeline-item.right .timeline-badge {
  left: -16px;
}

.timeline-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 25px;
  position: relative;
  box-shadow: 0 10px 20px var(--shadow-color);
  border-radius: 4px;
}

.timeline-panel h3 {
  font-family: var(--font-header);
  color: var(--accent-gold);
  font-size: 1.35rem;
  margin-bottom: 8px;
}

.timeline-panel .school {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-sienna);
  margin-bottom: 12px;
}

.timeline-panel p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   8. PROJECTS / THE DIGITAL CONQUEST MAPS
   -------------------------------------------------------------------------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.project-map-card {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-gold);
  border-radius: 8px;
  padding: 30px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 15px 30px var(--shadow-color);
  transition: var(--transition-smooth);
}

/* Corner ornament borders */
.project-map-card::before {
  content: "";
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border: 1px dashed var(--border-color);
  pointer-events: none;
}

.project-map-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px var(--border-glow);
}

.project-map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.project-icon {
  font-size: 1.8rem;
  color: var(--accent-gold);
}

.project-title {
  font-family: var(--font-header);
  font-size: 1.6rem;
  color: var(--text-primary);
}

.project-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 25px;
  min-height: 75px;
}

.project-actions {
  display: flex;
  gap: 15px;
}

.project-btn {
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  padding: 8px 16px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: none;
  background: none;
}

.project-btn:hover {
  background-color: var(--accent-gold);
  color: #FFFFFF;
}

/* FULL PAGE OVERLAY PANEL */
.project-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 15, 17, 0.98);
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  padding: 40px;
}

.project-overlay.active {
  opacity: 1;
  visibility: visible;
}

.overlay-scroll {
  background: var(--bg-secondary);
  border: 3px solid var(--accent-gold);
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  padding: 50px;
  position: relative;
  box-shadow: 0 25px 50px rgba(0,0,0,0.8);
  max-height: 85vh;
  overflow-y: auto;
}

.overlay-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: none;
  transition: var(--transition-fast);
}

.overlay-close-btn:hover {
  background: var(--accent-gold);
  color: #FFF;
}

/* --------------------------------------------------------------------------
   9. SKILLS / INTERACTIVE CODEX GRID
   -------------------------------------------------------------------------- */
.skills-codex-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.skill-stone-tile {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  padding: 30px 20px;
  text-align: center;
  position: relative;
  box-shadow: 0 8px 16px var(--shadow-color);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  overflow: hidden;
}

.skill-stone-tile svg,
.skill-stone-tile i {
  width: 50px;
  height: 50px;
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
  fill: var(--accent-gold);
  transition: var(--transition-smooth);
}

.skill-name {
  font-family: var(--font-header);
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 700;
  transition: var(--transition-smooth);
}

/* Golden Pulse Hover Effect */
.skill-stone-tile:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px var(--border-glow);
  transform: translateY(-5px);
}

.skill-stone-tile:hover svg,
.skill-stone-tile:hover i {
  transform: scale(1.1);
  filter: drop-shadow(0 0 8px var(--border-glow));
}

.skill-stone-tile:hover .skill-name {
  color: var(--accent-gold);
}

/* --------------------------------------------------------------------------
   10. SERVICES / SULTAN'S COURT DECREES
   -------------------------------------------------------------------------- */
.services-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
}

.service-decree-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: 5px solid var(--accent-gold);
  border-radius: 6px;
  padding: 40px 30px;
  box-shadow: 0 10px 25px var(--shadow-color);
  position: relative;
  transition: var(--transition-smooth);
}

.service-decree-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px var(--border-glow);
  border-color: var(--accent-gold);
}

.service-icon {
  font-size: 2.2rem;
  color: var(--accent-gold);
  margin-bottom: 20px;
  display: inline-block;
}

.service-decree-card h3 {
  font-family: var(--font-header);
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 15px;
}

.service-decree-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   11. FEEDBACK / TESTIMONIAL PARCHMENT SCROLL
   -------------------------------------------------------------------------- */
.scroll-roll-wrapper {
  position: relative;
  width: 100%;
  max-width: 950px;
  margin: 0 auto;
  padding: 20px 0;
  display: flex;
  align-items: center;
}

.scroll-wooden-spindle {
  width: 14px;
  height: 480px;
  background: linear-gradient(90deg, #5c3b24, #8b5a2b, #5c3b24);
  border: 2px solid var(--accent-gold);
  border-radius: 6px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  box-shadow: 2px 2px 10px rgba(0,0,0,0.6);
}

.scroll-wooden-spindle::before,
.scroll-wooden-spindle::after {
  content: "";
  position: absolute;
  left: -5px;
  width: 24px;
  height: 24px;
  background: var(--accent-gold);
  border-radius: 50%;
  border: 2px solid #5c3b24;
}
.scroll-wooden-spindle::before { top: -20px; }
.scroll-wooden-spindle::after { bottom: -20px; }

.scroll-wooden-spindle.left-spindle { left: -10px; }
.scroll-wooden-spindle.right-spindle { right: -10px; }

.scroll-view-viewport {
  width: 100%;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 3px double var(--accent-gold);
  box-shadow: 0 15px 30px var(--shadow-color);
  padding: 50px;
  height: 380px;
}

.scroll-slide-track {
  display: flex;
  width: 300%; /* Dynamic size based on slide items */
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.testimonial-parchment {
  width: 33.333%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 80px;
  box-sizing: border-box;
  text-align: center;
}

.testimonial-quote {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.35rem;
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: 25px;
  position: relative;
}

body[dir="rtl"] .testimonial-quote {
  font-family: 'Amiri', serif;
  font-size: 1.55rem;
}

.testimonial-scribe {
  font-family: var(--font-header);
  color: var(--accent-gold);
}

.testimonial-scribe .scribe-name {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
}

.testimonial-scribe .scribe-role {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.slider-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 25px;
}

.slider-dot-btn {
  width: 12px;
  height: 12px;
  border: 1px solid var(--accent-gold);
  background: none;
  border-radius: 50%;
  cursor: none;
  transition: var(--transition-fast);
}

.slider-dot-btn.active {
  background: var(--accent-gold);
  transform: scale(1.2);
}

/* --------------------------------------------------------------------------
   12. CONTACT / FINAL ENVOY AUDIENCE
   -------------------------------------------------------------------------- */
.contact-hall-box {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-gold);
  border-radius: 12px;
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 40px;
  text-align: center;
  box-shadow: 0 20px 40px var(--shadow-color);
  position: relative;
}

.contact-hall-box::before {
  content: "";
  position: absolute;
  top: 12px; left: 12px; right: 12px; bottom: 12px;
  border: 1px dashed var(--border-color);
}

.contact-hall-box p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 600px;
  margin: 0 auto 40px auto;
}

.royal-stamps-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 30px;
}

/* Circle Stamp Link button */
.royal-channel-stamp {
  width: 85px;
  height: 85px;
  border: 3px solid var(--accent-gold);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
  font-size: 1.8rem;
  background: none;
  cursor: none;
  box-shadow: 0 5px 15px rgba(0,0,0,0.4);
  position: relative;
  transition: var(--transition-smooth);
}

.royal-channel-stamp span {
  font-family: var(--font-header);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 4px;
}

.royal-channel-stamp:hover {
  background-color: var(--accent-red);
  border-color: var(--accent-red);
  color: #FFFFFF;
  transform: rotate(10deg) scale(1.1);
  box-shadow: 0 0 20px rgba(166, 43, 43, 0.5);
}

/* --------------------------------------------------------------------------
   13. FOOTER
   -------------------------------------------------------------------------- */
footer {
  text-align: center;
  padding: 30px;
  border-top: 1px solid var(--border-color);
  font-family: var(--font-header);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   14. RESPONSIVENESS AND MOBILE ADAPTATION
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .home-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }
  .home-archway-frame {
    height: 440px;
    max-width: 340px;
  }
  .home-info h1 {
    font-size: 3rem;
  }
  .home-actions {
    justify-content: center;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .skills-codex-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .services-container {
    grid-template-columns: 1fr;
  }
  .timeline-container::before {
    left: 40px;
  }
  .timeline-item {
    width: 100%;
    padding-left: 80px;
    padding-right: 20px;
    text-align: left !important;
  }
  .timeline-item.left {
    left: 0;
  }
  .timeline-item.right {
    left: 0;
  }
  .timeline-item.left .timeline-badge,
  .timeline-item.right .timeline-badge {
    left: 24px;
    right: auto;
  }
}

@media (max-width: 768px) {
  header {
    height: 70px;
  }
  #hamburger-btn {
    display: block;
  }
  .nav-links {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background: var(--bg-primary);
    flex-direction: column;
    justify-content: center;
    gap: 30px;
    padding: 40px;
    transform: translateY(-120%);
    transition: var(--transition-slow);
    border-bottom: 2px solid var(--border-color);
  }
  .nav-links.active {
    transform: translateY(0);
  }
  .skills-codex-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .scroll-wooden-spindle {
    display: none;
  }
  .scroll-view-viewport {
    padding: 30px;
    height: auto;
  }
  .testimonial-parchment {
    padding: 0 10px;
  }
  .testimonial-quote {
    font-size: 1.15rem;
  }
}

/* --- RTL TIMELINE OVERRIDES (PILLARS OF WISDOM) --- */
body[dir="rtl"] .timeline-item.left {
  left: auto;
  right: 0;
  text-align: left;
}
body[dir="rtl"] .timeline-item.right {
  left: auto;
  right: 50%;
  text-align: right;
}
body[dir="rtl"] .timeline-item.left .timeline-badge {
  right: auto;
  left: -16px;
}
body[dir="rtl"] .timeline-item.right .timeline-badge {
  left: auto;
  right: -16px;
}

@media (max-width: 992px) {
  body[dir="rtl"] .timeline-container::before {
    left: auto;
    right: 40px;
  }
  body[dir="rtl"] .timeline-item {
    left: 0 !important;
    right: auto !important;
    padding-right: 80px;
    padding-left: 20px;
    text-align: right !important;
  }
  body[dir="rtl"] .timeline-item.left .timeline-badge,
  body[dir="rtl"] .timeline-item.right .timeline-badge {
    right: 24px;
    left: auto;
  }
  .home-portrait-img {
    width: 220px;
    height: 220px;
  }
  .astrolabe-wrapper {
    width: 320px;
    height: 320px;
  }
}

/* Testimonial Arrow Buttons styling */
.scroll-arrow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  background: var(--bg-secondary);
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: none;
  z-index: 20;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.scroll-arrow-btn:hover {
  background: var(--accent-gold);
  color: var(--bg-primary);
  box-shadow: 0 0 15px var(--border-glow);
  transform: translateY(-50%) scale(1.12);
}

.scroll-arrow-btn.prev-btn {
  left: 20px;
}

.scroll-arrow-btn.next-btn {
  right: 20px;
}

@media (max-width: 768px) {
  .scroll-arrow-btn {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  .scroll-arrow-btn.prev-btn {
    left: -5px;
  }
  .scroll-arrow-btn.next-btn {
    right: -5px;
  }
  #page-turn-overlay {
    transform: skewX(-4deg) translateX(130%);
  }
}

/* Symmetrical desktop shift for the hero image */
@media (min-width: 993px) {
  .home-archway-frame {
    transform: translateX(35px);
    transition: transform var(--transition-smooth);
  }
  
  body[dir="rtl"] .home-archway-frame {
    transform: translateX(-35px);
  }
}

@media (max-width: 576px) {
  .home-actions {
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
  }
  
  .home-actions .royal-seal-btn {
    width: 100%;
    max-width: 280px;
    text-align: center;
    box-sizing: border-box;
    padding: 12px 16px;
    font-size: 0.95rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
