/* ═══════════════════════════════════════════════════════════════════
   Farshid Liquid Glass — macOS 27 / iOS 27
   ═══════════════════════════════════════════════════════════════════ */
@import url("./farshid-macos27.css");

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

/* ─── BASE GLASS ─────────────────────────────────────────────────── */
.liquid-glass,
.liquid-glass-item {
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  color: var(--text);
  transition:
    background   0.22s ease,
    box-shadow   0.22s ease,
    transform    0.18s ease,
    border-color 0.22s ease;
}

/* top-left shimmer — the iOS 27 signature */
.liquid-glass::before,
.liquid-glass-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.62) 0%,
    rgba(255, 255, 255, 0.00) 50%,
    rgba(200, 180, 255, 0.08) 100%
  );
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.liquid-glass:hover::before,
.liquid-glass-item:hover::before {
  opacity: 1;
}

.liquid-glass:hover,
.liquid-glass-item:hover {
  background: var(--glass-bg-hover);
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 14px 38px rgba(100, 80, 200, 0.14),
    0  1px 0   rgba(255, 255, 255, 1.00) inset;
}

.liquid-glass-item:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

/* ─── ACTIVE / SELECTED PILL ─────────────────────────────────────── */
.liquid-glass-item.active,
.liquid-glass-item[aria-current="page"],
.nav-list a.active,
.nav-list a[aria-current="page"] {
  background: var(--pill-active-bg);
  border-color: var(--pill-active-border);
  box-shadow: var(--pill-active-shadow);
  color: var(--farshid-blue);
  border-radius: 999px !important;
}

/* ─── NAVBAR — iOS 27 rounded rectangle ─────────────────────────── */
.nav-wrapper {
  position: sticky;
  top: 15px;
  z-index: 1000;
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
  padding: 0 1rem;
  overflow: visible;
}

.site-nav,
.site-nav.liquid-glass {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px;
  box-shadow:
    0 8px 30px rgba(100, 80, 200, 0.10),
    0 1px 0    rgba(255, 255, 255, 0.96) inset,
    0 -1px 0   rgba(180, 160, 220, 0.14) inset;
  overflow: visible;
}

@media (prefers-color-scheme: dark) {
  .site-nav.liquid-glass {
    background: rgba(30, 30, 34, 0.72);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow:
      0 8px 30px rgba(0, 0, 0, 0.35),
      0 1px 0    rgba(255, 255, 255, 0.08) inset;
  }
}

.nav-header {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  flex-direction: row;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
  align-items: center;
  justify-content: flex-start;
}

/* ─── NAV ITEMS — iOS 27 pill style ─────────────────────────────── */
.nav-brand,
.nav-list a,
.nav-list li > a,
.nav-toggle,
.nav-menu-btn,
.liquid-glass-item,
.moc-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 999px !important;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: rgba(255, 255, 255, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.50);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
}

.nav-brand:hover,
.nav-list a:hover,
.nav-list li > a:hover {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(255, 255, 255, 0.90);
  color: var(--farshid-blue);
  box-shadow:
    0 6px 24px rgba(10, 132, 255, 0.18),
    0 1px 0 rgba(255, 255, 255, 1.0) inset;
  transform: translateY(-1px);
}

/* ─── TOOLBAR ────────────────────────────────────────────────────── */
.toolbar.liquid-glass {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.80);
  border-radius: 26px;
  box-shadow:
    0 6px 24px rgba(100, 80, 200, 0.09),
    0 1px 0    rgba(255, 255, 255, 0.95) inset;
}

.bottom-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
}

/* ─── MAIN CONTENT PANEL ─────────────────────────────────────────── */
.site-main.liquid-glass {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  box-shadow: var(--glass-shadow-lg);
  max-width: 960px;
  margin: 2rem auto;
  padding: 2.5rem;
  color: #000000;
}

@media (prefers-color-scheme: dark) {
  .site-main.liquid-glass {
    background: rgba(28, 28, 30, 0.92);
    border-color: rgba(255, 255, 255, 0.10);
    color: #f5f5f7;
  }
}

/* ─── UNIFIED CONTENT TYPOGRAPHY (all pages, desktop + mobile) ──────── */
.site-main,
.site-main.liquid-glass,
.content-page .page-content,
.atlas-content {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.site-main h1,
.site-main h2,
.site-main h3,
.site-main h4,
.site-main h5,
.site-main h6 {
  line-height: 1.25;
  color: var(--text);
  font-weight: 700;
}

.site-main h1 { font-size: 1.75rem; }
.site-main h2 { font-size: 1.35rem; }
.site-main h3 { font-size: 1.15rem; }
.site-main h4 { font-size: 1.05rem; }
.site-main h5 { font-size: 1rem; }
.site-main h6 { font-size: 0.95rem; }

.site-main p,
.site-main li {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
}

.site-main a { color: var(--farshid-blue); text-decoration: none; }
.site-main a:hover { text-decoration: underline; }

/* Share-line blockquote (top of every page) — consistent card look */
.site-main blockquote {
  margin: 0.5rem 0 1.5rem;
  padding: 14px 18px;
  border-left: 4px solid var(--farshid-blue);
  border-radius: 12px;
  background: rgba(10, 132, 255, 0.08);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.site-main blockquote p { margin: 0; }

.site-main blockquote strong { color: var(--text); }

.site-main table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 1rem 0;
}

.site-main th,
.site-main td {
  padding: 8px 10px;
  border: 1px solid var(--glass-border-subtle);
  text-align: left;
}

.site-main th { background: rgba(10, 132, 255, 0.08); font-weight: 600; }

.site-main img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

/* Consistent share line in ALL layouts (incl. atlas/page) */
blockquote {
  border-left: 4px solid var(--farshid-blue);
  border-radius: 12px;
  background: rgba(10, 132, 255, 0.08);
  padding: 14px 18px;
  margin: 0.5rem 0 1.5rem;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

/* ─── NAV DROPDOWN — iOS 27 glass panel ──────────────────────────── */
.nav-list {
  position: relative;
}

.nav-list > li {
  position: relative;
}

.nav-sub {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  padding: 8px;
  margin: 0;
  list-style: none;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  box-shadow:
    0 16px 48px rgba(80, 60, 160, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.98) inset;
  z-index: 1000;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

@media (prefers-color-scheme: dark) {
  .nav-sub {
    background: rgba(44, 44, 50, 0.92);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow:
      0 16px 48px rgba(0, 0, 0, 0.48),
      0 1px 0 rgba(255, 255, 255, 0.08) inset;
  }
}

.has-children.open > .nav-sub {
  display: flex;
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-sub li {
  width: 100%;
}

.nav-sub li a {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.16s ease;
}

.nav-sub li a:hover {
  background: rgba(255, 255, 255, 0.60);
  border-color: rgba(255, 255, 255, 0.80);
  color: var(--farshid-blue);
  box-shadow: 0 4px 16px rgba(10, 132, 255, 0.12);
}

.nav-toggle {
  padding: 6px 10px;
  font-size: 10px;
  cursor: pointer;
}

/* ─── FOOTER ─────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* ─── PILL UTILITY ───────────────────────────────────────────────── */
.glass-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 999px !important;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.30);
  border: 1px solid rgba(255, 255, 255, 0.50);
  cursor: pointer;
  transition: all 0.18s ease;
}
.glass-pill:hover {
  background: rgba(255, 255, 255, 0.58);
  border-color: rgba(255, 255, 255, 0.85);
  color: var(--text);
}

/* ─── CODE ───────────────────────────────────────────────────────── */
code,pre{
  background: rgba(180, 170, 210, 0.14);
  border: 1px solid rgba(180, 160, 220, 0.22);
  border-radius: 10px;
  font-size: 0.9em;
}

@media (prefers-reduced-motion:reduce){
  .liquid-glass,.liquid-glass-item,#farshid-cursor{transition:none!important;animation:none!important}
}

/* ─── DESKTOP: hide menu button ─────────────────────────────────── */
@media (min-width: 769px) {
  .nav-menu-btn {
    display: none !important;
  }
}

/* ─── MOBILE NAV ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-menu-btn {
    display: block;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-list {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 8px;
    right: 8px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    box-shadow:
      0 20px 60px rgba(80, 60, 160, 0.22),
      0 1px 0 rgba(255, 255, 255, 0.95) inset;
    z-index: 1000;
    overflow: visible;
    animation: mobileNavIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  @keyframes mobileNavIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .nav-list li {
    width: 100%;
  }

  .nav-list > li + li {
    margin-top: 4px;
  }

  .nav-list a {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 14px;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .nav-list > li > a {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    padding: 14px 16px;
  }

  .nav-open > .nav-list {
    display: flex;
  }

  .nav-sub {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    min-width: 0;
    width: 100%;
    box-shadow: none;
    background: rgba(10, 132, 255, 0.06);
    border: 1px solid rgba(10, 132, 255, 0.1);
    border-radius: 16px;
    margin: 6px 0 8px;
    padding: 8px;
    opacity: 1;
    visibility: visible;
    transition: none;
    gap: 2px;
  }

  .nav-sub li a {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    min-height: 44px;
  }

  .nav-sub li a:active {
    background: rgba(10, 132, 255, 0.15);
    transform: scale(0.98);
  }

  .has-children.open > .nav-sub {
    display: flex;
    transform: none !important;
  }

  .has-children {
    flex-direction: column;
  }

  .has-children > a,
  .has-children > .nav-link {
    width: 100%;
    justify-content: space-between;
  }

  .nav-chevron {
    font-size: 12px;
    opacity: 0.5;
    transition: transform 0.2s ease;
  }

  .has-children.open > a > .nav-chevron,
  .has-children.open > .nav-link > .nav-chevron {
    transform: rotate(180deg);
  }

  @media (prefers-color-scheme: dark) {
    .nav-list {
      background: rgba(30, 30, 34, 0.96);
      border-color: rgba(255, 255, 255, 0.12);
      box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
    }

    .nav-list > li > a {
      background: rgba(255, 255, 255, 0.08);
      border-color: rgba(255, 255, 255, 0.1);
    }

    .nav-sub {
      background: rgba(10, 132, 255, 0.08);
      border-color: rgba(10, 132, 255, 0.12);
    }

    .nav-sub li a:active {
      background: rgba(10, 132, 255, 0.2);
    }
  }
}

.site-nav::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome/Safari */

/* ─── MOBILE FIRST: iPhone safe areas + touch targets ──────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-toolbar {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .site-footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 768px) {
  .site-main {
    padding: 12px 14px !important;
    font-size: 16px;
    line-height: 1.65;
  }

  .site-main h1 { font-size: 1.5rem; }
  .site-main h2 { font-size: 1.25rem; }
  .site-main h3 { font-size: 1.1rem; }
  .site-main h4 { font-size: 1rem; }

  .bottom-toolbar {
    display: flex;
    justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    gap: 2px;
  }

  .bottom-toolbar .liquid-glass-item {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 10px;
  }

  .site-footer {
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
    font-size: 0.78rem;
  }

  .site-footer p {
    margin: 4px 0;
  }
}

@media (min-width: 769px) {
  .site-main {
    padding: 24px 32px !important;
    max-width: 900px;
    margin: 0 auto;
  }
}

/* ─── 3-LEVEL NAV — Desktop dropdown nesting ──────────────────────── */
@media (min-width: 769px) {
  .nav-sub .nav-sub {
    position: absolute;
    top: 0;
    left: 100%;
    transform: none;
    margin-left: 8px;
    min-width: 200px;
  }

  .nav-sub li {
    position: relative;
  }

  .nav-sub li:hover > .nav-sub {
    display: flex;
  }

  .nav-sub .has-children > a::after {
    content: "▸";
    margin-left: auto;
    font-size: 10px;
    opacity: 0.5;
  }
}

/* ─── 3-LEVEL NAV — Mobile: accordion style ────────────────────────── */
@media (max-width: 768px) {
  .nav-depth-2 .nav-sub {
    background: rgba(10, 132, 255, 0.04) !important;
    border: 1px solid rgba(10, 132, 255, 0.08) !important;
    border-radius: 12px !important;
    margin: 4px 0 !important;
    padding: 4px 6px !important;
    gap: 1px !important;
  }

  .nav-depth-2 .nav-sub li a {
    padding: 10px 12px !important;
    font-size: 13px !important;
    min-height: 40px !important;
    border-radius: 10px !important;
  }

  .nav-depth-2 > a > .nav-chevron {
    font-size: 10px !important;
    opacity: 0.4 !important;
  }

  .nav-depth-3 {
    padding-left: 8px !important;
  }

  .nav-depth-3 > a {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: var(--text-muted) !important;
    background: transparent !important;
    border: none !important;
    min-height: 38px !important;
    padding: 8px 12px !important;
  }

  .nav-depth-3 > a:active {
    background: rgba(10, 132, 255, 0.12) !important;
    transform: scale(0.98) !important;
  }
}
