/**
 * سَرْد | SARD Studio — Interior Architecture & Haute Living
 * ملف المكونات المعمارية والعناصر التحريرية (Editorial Components & UI Kit)
 */

/* ==========================================================================
   1. الأزرار التحريرية الحادة (Architectural Buttons)
   ========================================================================== */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.875rem 2.25rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 500;
  color: var(--chapter-bg);
  background-color: var(--chapter-accent);
  border: none;
  border-radius: var(--radius-sharp);
  cursor: pointer;
  text-decoration: none;
  overflow: hidden;
  transition: color 400ms var(--ease-chromatic),
              background-color var(--duration-chapter) var(--ease-chromatic);
  z-index: 1;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: var(--chapter-text);
  transform: translateY(100%);
  transition: transform 400ms var(--ease-chromatic);
  z-index: -1;
}

.btn-primary:hover::before {
  transform: translateY(0);
}

.btn-primary:hover {
  color: var(--chapter-bg);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.875rem 2.25rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 500;
  color: var(--chapter-text);
  background-color: transparent;
  border: 1px solid var(--chapter-text);
  border-radius: var(--radius-sharp);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 300ms var(--ease-subtle),
              color 300ms var(--ease-subtle),
              border-color var(--duration-chapter) var(--ease-chromatic);
}

.btn-ghost:hover {
  background-color: var(--chapter-text);
  color: var(--chapter-bg);
}

/* ==========================================================================
   2. بطاقات الخدمات المعمارية (Service Cards)
   ========================================================================== */
.service-card {
  position: relative;
  background-color: transparent;
  border: 1px solid var(--chapter-border);
  border-radius: var(--radius-sharp);
  padding: clamp(1.75rem, 3.5vw, 3rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 300ms var(--ease-subtle),
              background-color 300ms var(--ease-subtle),
              transform 400ms var(--ease-chromatic);
}

.service-card:hover {
  border-color: var(--chapter-accent);
  background-color: rgba(255, 255, 255, 0.02);
}

.service-num {
  font-family: var(--font-editorial);
  font-size: 3rem;
  font-weight: 400;
  line-height: 1;
  color: var(--chapter-accent);
  margin-bottom: 1.5rem;
  user-select: none;
  transition: color var(--duration-chapter) var(--ease-chromatic);
}

.service-card h3 {
  margin-bottom: 1rem;
  color: var(--chapter-text);
}

.service-card p {
  color: var(--chapter-text-muted);
  margin-bottom: 1.75rem;
}

/* ==========================================================================
   3. بطاقات المشاريع التحريرية (Editorial Project Cards)
   ========================================================================== */
.project-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius-sharp);
  border: 1px solid var(--chapter-border);
  text-decoration: none;
  background-color: var(--chapter-bg);
  transition: border-color 400ms var(--ease-subtle);
}

.project-card.is-wide {
  aspect-ratio: 16 / 10;
}

.project-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: var(--img-filter);
  transition: transform 700ms var(--ease-chromatic),
              filter 400ms var(--ease-subtle);
  transform-origin: center center;
}

.project-card:hover img {
  transform: scale(1.04);
  filter: var(--img-filter-hover);
}

.project-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.35) 45%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  color: #F2EBDD; /* تباين دائم وموثوق فوق التدرج الداكن */
  z-index: 2;
}

.project-meta {
  font-family: var(--font-tech);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #D4A853;
  margin-bottom: 0.5rem;
}

.project-title {
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  font-weight: 600;
  line-height: 1.3;
  color: #FFFFFF;
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   4. الهالة الشعاعية التفاعلية للماوس (Radial Mouse Halo Follower)
   ========================================================================== */
.cursor-halo {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--cursor-halo-size);
  height: var(--cursor-halo-size);
  background: radial-gradient(circle, var(--chapter-accent) 0%, transparent 70%);
  opacity: 0.05;
  pointer-events: none;
  transform: translate3d(
    calc(var(--mouse-x, 50vw) - 350px),
    calc(var(--mouse-y, 50vh) - 350px),
    0
  );
  transition: transform 0.8s var(--ease-chromatic),
              background 600ms var(--ease-chromatic);
  z-index: 0;
  will-change: transform;
}

@media (max-width: 900px) {
  .cursor-halo {
    display: none;
  }
}

/* ==========================================================================
   5. الفوتر المعماري وشريط الـ Marquee المتحرك (Footer & Giant Marquee)
   ========================================================================== */
.site-footer {
  position: relative;
  overflow: hidden;
  padding-bottom: 4rem;
  border-top: 1px solid var(--chapter-border);
}

.footer-marquee {
  overflow: hidden;
  padding: 3rem 0;
  border-block: 1px solid var(--chapter-border);
  width: 100%;
  position: relative;
  user-select: none;
}

.marquee-track {
  display: flex;
  gap: 3rem;
  width: max-content;
  white-space: nowrap;
  animation: marquee-rtl 40s linear infinite;
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 600;
  color: var(--chapter-text);
  line-height: 1.1;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 3rem;
}

.marquee-separator {
  color: var(--chapter-accent);
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 0.8em;
}

/* TODO: verify marquee direction visually in browser — may need to flip to -50% → 0 */
@keyframes marquee-rtl {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track {
    animation: none;
  }
}

.footer-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
  padding: 4rem 0 2rem;
  border-bottom: 1px solid var(--chapter-border);
}

@media (max-width: 768px) {
  .footer-info {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.footer-info-col h4 {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  margin-bottom: 1.25rem;
  color: var(--chapter-text);
}

.footer-info-col p,
.footer-info-col a {
  color: var(--chapter-text-muted);
  display: block;
  margin-bottom: 0.5rem;
}

.footer-info-col a:hover {
  color: var(--chapter-accent);
}

/* العلامة المائية الشامخة في قاع الفوتر */
.footer-watermark {
  font-family: var(--font-editorial);
  font-size: clamp(8rem, 20vw, 20rem);
  font-weight: 400;
  color: var(--chapter-text);
  opacity: 0.04;
  line-height: 0.8;
  text-align: center;
  user-select: none;
  pointer-events: none;
  margin-top: 2rem;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   6. شريط الفلترة للأعمال (Portfolio Filter Bar)
   ========================================================================== */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  padding: 1.5rem 0;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.625rem 1.5rem;
  border: 1px solid var(--chapter-border);
  border-radius: var(--radius-sharp);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--chapter-text-muted);
  background-color: transparent;
  cursor: pointer;
  transition: all 300ms var(--ease-subtle);
}

.filter-btn:hover {
  border-color: var(--chapter-text);
  color: var(--chapter-text);
}

.filter-btn.is-active {
  background-color: var(--chapter-text);
  color: var(--chapter-bg);
  border-color: var(--chapter-text);
}

/* ==========================================================================
   7. القوائم المطوية والأسئلة الشائعة (Accordion Component)
   ========================================================================== */
.accordion-item {
  border-bottom: 1px solid var(--chapter-border);
}

.accordion-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.75rem 0;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--chapter-text);
  background: transparent;
  cursor: pointer;
  text-align: right;
  transition: color 300ms var(--ease-subtle);
}

.accordion-trigger:hover {
  color: var(--chapter-accent);
}

.accordion-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 400ms var(--ease-chromatic);
  font-family: var(--font-editorial);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--chapter-accent);
}

.accordion-item.is-open .accordion-icon {
  transform: rotate(45deg);
}

.accordion-content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 400ms var(--ease-chromatic);
}

.accordion-item.is-open .accordion-content {
  grid-template-rows: 1fr;
}

.accordion-content > div {
  overflow: hidden;
}

.accordion-body {
  padding-bottom: 1.75rem;
  color: var(--chapter-text-muted);
}

/* ==========================================================================
   8. حقول الإدخال والنماذج الفاخرة (Editorial Form Elements)
   ========================================================================== */
.form-group {
  margin-bottom: 2rem;
  width: 100%;
}

.form-group label {
  font-family: var(--font-tech);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--chapter-text-muted);
  display: block;
  margin-bottom: 0.75rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.875rem 1.25rem;
  background-color: transparent;
  border: 1px solid var(--chapter-border);
  color: var(--chapter-text);
  font-family: var(--font-body);
  font-size: 1rem;
  border-radius: var(--radius-sharp);
  transition: border-color 300ms var(--ease-subtle),
              background-color 300ms var(--ease-subtle);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--chapter-accent);
  background-color: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   9. حاسبة التكلفة التقديرية (Interactive Cost Estimator)
   ========================================================================== */
.cost-estimator {
  border: 1px solid var(--chapter-border);
  padding: clamp(2rem, 4vw, 3.5rem);
  border-radius: var(--radius-sharp);
  background-color: transparent;
}

.estimator-field {
  margin-bottom: 2.25rem;
}

.estimator-field label {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--chapter-text);
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.estimator-field input[type="range"] {
  width: 100%;
  height: 4px;
  background: var(--chapter-border);
  border-radius: 0;
  outline: none;
  accent-color: var(--chapter-accent);
  cursor: pointer;
}

.estimator-result {
  padding-top: 2rem;
  border-top: 1px solid var(--chapter-border);
  margin-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
}

.estimator-label {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--chapter-text);
}

.estimator-total {
  font-family: var(--font-editorial);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 600;
  color: var(--chapter-accent);
  line-height: 1;
}

/* ==========================================================================
   10. زر العودة للأعلى (Back to Top Architectural Button)
   ========================================================================== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 48px;
  height: 48px;
  background-color: var(--chapter-accent);
  color: var(--chapter-bg);
  border: none;
  border-radius: var(--radius-sharp);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 300ms var(--ease-subtle),
              transform 300ms var(--ease-chromatic),
              background-color var(--duration-chapter) var(--ease-chromatic);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background-color: var(--chapter-text);
  color: var(--chapter-bg);
}
