/* ==========================================================================
   ALI — Minimalist RTL Personal Landing Page
   Calm Porcelain (Light) & Deep Slate (Dark) · Pure CSS3 · Logical RTL
   ========================================================================== */

:root,
[data-theme="light"] {
  color-scheme: light;

  /* Surfaces */
  --bg-canvas: #f6f5f2;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-surface: #f4f3ef;

  /* Typography */
  --text-primary: #181b20;
  --text-secondary: #666d78;
  --text-muted: #78808c;

  /* Accent (Soothing Teal-Sage) */
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.08);
  --accent-ring: rgba(15, 118, 110, 0.22);

  /* Borders & Highlights */
  --border-subtle: rgba(24, 27, 32, 0.08);
  --border-hover: rgba(15, 118, 110, 0.28);
  --card-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.92);

  /* Elevation */
  --shadow-card:
    0 1px 2px rgba(24, 27, 32, 0.03),
    0 14px 36px -10px rgba(24, 27, 32, 0.065),
    0 24px 52px -18px rgba(15, 118, 110, 0.055);
  --shadow-btn: 0 1px 2px rgba(24, 27, 32, 0.03);
  --shadow-btn-hover:
    0 8px 22px -8px rgba(15, 118, 110, 0.16),
    0 2px 6px -2px rgba(24, 27, 32, 0.04);
  --shadow-avatar:
    0 10px 24px -8px rgba(24, 27, 32, 0.12),
    0 0 0 1px rgba(24, 27, 32, 0.04);

  /* Atmospheric Glow */
  --ambient-glow-1: rgba(15, 118, 110, 0.085);
  --ambient-glow-2: rgba(185, 160, 120, 0.08);

  /* Motion & Radii */
  --font-sans: "IBM Plex Sans Arabic", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-card: 1.75rem;
  --radius-pill: 9999px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 180ms;
  --dur-med: 280ms;
  --dur-theme: 300ms;
}

[data-theme="dark"] {
  color-scheme: dark;

  /* Surfaces */
  --bg-canvas: #0e1116;
  --bg-card: rgba(21, 26, 34, 0.84);
  --bg-surface: rgba(255, 255, 255, 0.04);

  /* Typography */
  --text-primary: #eef2f6;
  --text-secondary: #8f98a6;
  --text-muted: #768090;

  /* Accent (Soft Calm Teal) */
  --accent: #5eead4;
  --accent-soft: rgba(94, 234, 212, 0.11);
  --accent-ring: rgba(94, 234, 212, 0.24);

  /* Borders & Highlights */
  --border-subtle: rgba(238, 242, 246, 0.085);
  --border-hover: rgba(94, 234, 212, 0.32);
  --card-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  /* Elevation */
  --shadow-card:
    0 1px 2px rgba(0, 0, 0, 0.32),
    0 20px 48px -14px rgba(0, 0, 0, 0.54),
    0 0 0 1px rgba(255, 255, 255, 0.025);
  --shadow-btn: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-btn-hover:
    0 10px 26px -8px rgba(0, 0, 0, 0.5),
    0 0 22px -8px rgba(94, 234, 212, 0.16);
  --shadow-avatar:
    0 12px 28px -8px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(238, 242, 246, 0.08);

  /* Atmospheric Glow */
  --ambient-glow-1: rgba(94, 234, 212, 0.075);
  --ambient-glow-2: rgba(56, 112, 152, 0.085);
}

/* ==========================================================================
   Base Reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  min-block-size: 100vh;
  min-block-size: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip;
  transition:
    background-color var(--dur-theme) ease,
    color var(--dur-theme) ease;
}

img,
svg {
  display: block;
  max-inline-size: 100%;
}

/* Accessible focus outlines */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ==========================================================================
   Ambient Atmospheric Background
   ========================================================================== */

.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(
      620px circle at 50% 24%,
      var(--ambient-glow-1),
      transparent 68%
    ),
    radial-gradient(
      520px circle at 72% 78%,
      var(--ambient-glow-2),
      transparent 72%
    );
  transition: opacity var(--dur-theme) ease;
}

/* ==========================================================================
   Theme Toggle Button (Top Inline-End via CSS Logical Insets)
   ========================================================================== */

.theme-toggle {
  position: fixed;
  inset-block-start: clamp(1rem, 3vw, 1.5rem);
  inset-inline-end: clamp(1rem, 3vw, 1.5rem);
  z-index: 20;

  inline-size: 2.75rem;
  block-size: 2.75rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
  color: var(--text-secondary);
  box-shadow: var(--card-highlight), var(--shadow-btn);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;

  transition:
    transform var(--dur-med) var(--ease-out),
    background-color var(--dur-theme) ease,
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    box-shadow var(--dur-med) var(--ease-out);
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--border-hover);
  color: var(--accent);
  box-shadow: var(--card-highlight), var(--shadow-btn-hover);
}

.theme-toggle:active {
  transform: scale(0.94);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  inline-size: 1.2rem;
  block-size: 1.2rem;
  pointer-events: none;
  transition:
    opacity var(--dur-med) var(--ease-out),
    transform var(--dur-med) var(--ease-out);
}

/* Light Mode: show Moon icon (switch to dark) */
.theme-toggle .icon-moon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.theme-toggle .icon-sun {
  opacity: 0;
  transform: scale(0.55) rotate(-90deg);
}

/* Dark Mode: show Sun icon (switch to light) */
[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: scale(0.55) rotate(90deg);
}

[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* ==========================================================================
   Page Wrapper & Minimalist Profile Card
   ========================================================================== */

.page-wrapper {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  inline-size: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-block: clamp(4.5rem, 9vh, 5.75rem) clamp(1.25rem, 3vh, 2rem);
  padding-inline: clamp(1rem, 4vw, 1.5rem);
}

.profile-card {
  inline-size: 100%;
  max-inline-size: 25rem;
  padding-block: clamp(2.5rem, 7vw, 3.15rem);
  padding-inline: clamp(1.5rem, 5vw, 2.25rem);

  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--card-highlight), var(--shadow-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  animation: fadeUp 560ms var(--ease-out) both;
  transition:
    background-color var(--dur-theme) ease,
    border-color var(--dur-theme) ease,
    box-shadow var(--dur-theme) ease;
}

/* ==========================================================================
   Hero: Avatar, Name & Emoji Pill
   ========================================================================== */

.hero {
  inline-size: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.avatar-ring {
  inline-size: 8.5rem;
  block-size: 8.5rem;
  padding: 0.25rem;
  margin-block-end: 1.4rem;

  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: linear-gradient(145deg, var(--accent-ring), var(--border-subtle));
  box-shadow: var(--shadow-avatar);

  animation: fadeUp 520ms var(--ease-out) 70ms both;
  transition:
    transform var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out),
    background var(--dur-theme) ease;
}

.avatar-ring:hover {
  transform: translateY(-2px) scale(1.03);
}

.avatar-img {
  inline-size: 8rem;
  block-size: 8rem;
  padding: 0.85rem;
  border-radius: var(--radius-pill);
  object-fit: contain;
  object-position: center;
  background: radial-gradient(circle at 50% 40%, #1e2430 0%, #11151c 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: transform var(--dur-med) var(--ease-out);
}

.profile-name {
  margin-block: 0 1.05rem;
  margin-inline: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  color: var(--text-primary);

  animation: fadeUp 520ms var(--ease-out) 130ms both;
}

.name-en {
  font-size: clamp(1.7rem, 5vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  padding-inline-start: 0.14em;
  padding-block-start: 0;
  color: var(--text-primary);
  text-transform: uppercase;
}

.profile-bio {
  display: flex;
  justify-content: center;
  margin-block-end: 0;
  animation: fadeUp 520ms var(--ease-out) 190ms both;
}

.bio-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 3.4rem;
  block-size: 2.25rem;
  padding-inline: 1rem;

  border-radius: var(--radius-pill);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 1.15rem;
  line-height: 1;
  user-select: none;
  cursor: default;

  transition:
    transform var(--dur-med) var(--ease-spring),
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
}

.bio-pill:hover {
  transform: translateY(-2px) rotate(-6deg) scale(1.06);
  background-color: var(--accent-soft);
  border-color: var(--border-hover);
}

/* ==========================================================================
   Minimal Footer
   ========================================================================== */

.site-footer {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  inline-size: 100%;
  padding-block: 0.75rem 1.5rem;
  padding-inline: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
  animation: fadeUp 520ms var(--ease-out) 240ms both;
}

.footer-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  max-inline-size: 36ch;
  opacity: 0.9;
}

.footer-note-title,
.footer-note-desc {
  margin: 0;
  line-height: 1.55;
}

.footer-note-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.footer-note-desc {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.footer-text {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.75;
}

/* ==========================================================================
   Entrance Animation
   ========================================================================== */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Small Mobile Adjustments (<= 380px)
   ========================================================================== */

@media (max-width: 23.75rem) {
  .profile-card {
    border-radius: 1.5rem;
    padding-block: 2.2rem;
    padding-inline: 1.25rem;
  }

  .avatar-ring {
    inline-size: 7.5rem;
    block-size: 7.5rem;
  }

  .avatar-img {
    inline-size: 7rem;
    block-size: 7rem;
    padding: 0.75rem;
  }
}

/* ==========================================================================
   Reduced Motion Preference
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .theme-toggle:hover,
  .theme-toggle:active,
  .avatar-ring:hover,
  .bio-pill:hover {
    transform: none;
  }
}
