/* =========================================================
   ADVALMA — Simple editorial
   Palette: warm paper, deep teal, ink
   Type: Instrument Serif (display) · Geist (body) · Geist Mono (label)
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:root {
  --paper:     #f1ede5;
  --paper-2:   #ebe6dc;
  --paper-3:   #e3ddd0;
  --ink:       #19181a;
  --ink-soft:  #5b554c;
  --ink-mute:  #8a8378;

  --teal:      #0d4754;
  --teal-deep: #093641;
  --teal-glow: #146477;

  --line:      rgba(25,24,26,0.12);
  --line-soft: rgba(25,24,26,0.06);

  --transition: 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);

  --font-sans:    'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif:   'Instrument Serif', Georgia, serif;
  --font-mono:    'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-arabic:  'Noto Naskh Arabic', 'Amiri', 'Geist', system-ui, sans-serif;
}

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body[dir="rtl"] { font-family: var(--font-arabic); }

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }

::selection { background: var(--teal); color: var(--paper); }

/* ===== LAYOUT ===== */
.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 2rem;
}
@media (max-width: 720px) {
  .container { padding: 0 1.25rem; }
}

/* ===== TYPE ===== */
.display {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 1.0;
}
h1.display { font-size: clamp(3rem, 8.5vw, 7.5rem); }
h2.display { font-size: clamp(2.3rem, 5vw, 4.2rem); }
.display em { font-style: italic; color: var(--teal); }

.section-tag {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 1.25rem;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1.5rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn svg { width: 16px; height: 16px; transition: transform var(--transition); }
.btn:hover svg { transform: translateX(4px); }
[dir="rtl"] .btn svg { transform: scaleX(-1); }
[dir="rtl"] .btn:hover svg { transform: translateX(-4px) scaleX(-1); }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--teal); }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); background: var(--paper-2); }

.btn-block { width: 100%; justify-content: center; padding-top: 1.05rem; padding-bottom: 1.05rem; }

/* ===== HEADER / NAV ===== */
#header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(241,237,229,0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  transition: border-color var(--transition);
}
#header.scrolled { border-color: var(--line); }

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 72px;
}

.logo { display: flex; align-items: center; flex-shrink: 0; }
.logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 2.25rem;
  margin-left: auto;
}
.nav-links a {
  display: inline-block;
  font-size: 0.95rem;
  color: var(--ink);
  position: relative;
  padding: 0.25rem 0;
  transition: color var(--transition);
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 1px;
  background: var(--teal);
  transition: width var(--transition);
}
.nav-links a:hover { color: var(--teal); }
.nav-links a:hover::after { width: 100%; }

.nav-right { display: flex; align-items: center; gap: 0.75rem; }

/* lang dropdown */
.lang-dropdown { position: relative; }
.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--ink);
  transition: all var(--transition);
  background: rgba(255,255,255,0.4);
}
.lang-trigger:hover { border-color: var(--ink); }
.lang-trigger svg { width: 12px; height: 12px; transition: transform var(--transition); }
.lang-dropdown.open .lang-trigger svg { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem;
  box-shadow: 0 12px 32px rgba(25,24,26,0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all var(--transition);
}
[dir="rtl"] .lang-menu { right: auto; left: 0; }
.lang-dropdown.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.lang-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 0.92rem;
  color: var(--ink);
  transition: background var(--transition), color var(--transition);
}
[dir="rtl"] .lang-opt { text-align: right; }
.lang-opt:hover { background: var(--paper-2); }
.lang-opt.active { color: var(--teal); background: var(--paper-2); }

/* hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.hamburger span {
  display: block; margin: 0 auto;
  width: 14px; height: 1px;
  background: var(--ink);
  transition: all var(--transition);
}
.hamburger.open span:nth-child(1) { transform: translateY(3px) rotate(45deg); }
.hamburger.open span:nth-child(2) { transform: translateY(-3px) rotate(-45deg); }

/* ===== SECTIONS COMMON ===== */
section { padding: clamp(5rem, 9vw, 8rem) 0; }

.section-head {
  max-width: 760px;
  margin: 0 auto 4rem;
  text-align: center;
}
.section-head h2 { margin-bottom: 1.5rem; text-wrap: balance; }
.section-sub {
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 52ch;
  margin: 0 auto;
  text-wrap: pretty;
}

/* ===== HERO ===== */
#hero {
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(3.5rem, 8vw, 6rem);
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  max-width: 900px;
  margin: 0 auto;
}
.hero-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.4);
  margin-bottom: 2rem;
}
#hero h1 {
  margin-bottom: 1.75rem;
  text-wrap: balance;
}
.hero-sub {
  color: var(--ink-soft);
  font-size: 1.1rem;
  max-width: 52ch;
  margin: 0 auto 2.5rem;
  text-wrap: pretty;
}
.hero-cta {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== SERVICES ===== */
#services { background: var(--paper); }

.svc-list {
  display: flex;
  flex-direction: column;
  max-width: 1000px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
}
.svc-row {
  padding: 2rem 0.5rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.svc-row.visible { opacity: 1; transform: translateY(0); }

.svc-body h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
  color: var(--ink);
}
.svc-body p {
  color: var(--ink-soft);
  font-size: 0.98rem;
  max-width: 60ch;
}

/* hover only on real pointer devices — avoids sticky hover on touch */
@media (hover: hover) {
  .svc-row { transition: opacity 0.6s ease, transform 0.6s ease, background 0.35s ease; }
  .svc-row:hover { background: var(--paper-2); }
  .svc-row:hover .svc-body h3 { color: var(--teal); }
}

/* ===== ABOUT ===== */
#about {
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.about-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 5rem;
  align-items: start;
}

.about-text .section-tag { margin-bottom: 1.25rem; text-align: left; }
[dir="rtl"] .about-text .section-tag { text-align: right; }
.about-text h2 { margin-bottom: 2rem; text-wrap: balance; }
.about-copy {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 2.5rem;
  max-width: 52ch;
}
.about-copy p {
  color: var(--ink-soft);
  font-size: 1.02rem;
  text-wrap: pretty;
}

.about-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 2.5rem;
  border-top: 1px solid var(--line);
}
.about-list li {
  padding: 0.9rem 0 0.9rem 1.6rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.98rem;
  color: var(--ink);
  position: relative;
}
.about-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  background: var(--teal);
  border-radius: 50%;
}
[dir="rtl"] .about-list li { padding-left: 0; padding-right: 1.6rem; }
[dir="rtl"] .about-list li::before { left: auto; right: 0; }

.about-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.stat-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 1.75rem 0;
  border-top: 1px solid var(--line);
  align-items: center;
}
.about-stats .stat-card:last-child { border-bottom: 1px solid var(--line); }
.stat-card .stat-val {
  grid-column: 2;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(3.5rem, 6vw, 5.5rem);
  line-height: 0.9;
  color: var(--teal);
  letter-spacing: -0.02em;
  text-align: right;
}
.stat-card .stat-val i {
  font-style: italic;
  font-size: 0.55em;
  color: var(--ink-soft);
}
.stat-card .stat-arrow {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: clamp(4.5rem, 7vw, 6.5rem);
  line-height: 1;
}
[dir="rtl"] .stat-card .stat-arrow { transform: scaleX(-1); display: inline-block; }
.stat-card .stat-cap {
  grid-column: 1;
  font-style: normal;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  line-height: 1.15;
  color: var(--ink);
}
[dir="rtl"] .stat-card .stat-val { text-align: left; }

/* ===== CONTACT ===== */
#contact { background: var(--paper); }
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4.5rem;
  align-items: start;
}
.contact-head .section-tag { text-align: left; margin-bottom: 1.25rem; }
[dir="rtl"] .contact-head .section-tag { text-align: right; }
.contact-head h2 { margin-bottom: 1.5rem; text-wrap: balance; }
.contact-head .section-sub { margin: 0 0 2rem 0; max-width: 42ch; text-align: left; }
[dir="rtl"] .contact-head .section-sub { text-align: right; }

.contact-mail {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-style: italic;
}
.contact-mail a {
  color: var(--teal);
  border-bottom: 1px solid var(--teal);
  padding-bottom: 2px;
  transition: opacity var(--transition);
}
.contact-mail a:hover { opacity: 0.7; }

/* form */
.contact-form {
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 2rem;
  border-radius: 4px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.form-group:first-child { padding-top: 0.2rem; }
.form-group label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: transparent;
  border: none;
  color: var(--ink);
  padding: 0.4rem 0;
  font-size: 1.05rem;
  font-family: var(--font-sans);
  outline: none;
  width: 100%;
}
.form-group textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23191920' stroke-width='1.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.2rem center;
  padding-right: 1.8rem;
  cursor: pointer;
}
[dir="rtl"] .form-group select { background-position: left 0.2rem center; padding-right: 0; padding-left: 1.8rem; }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--ink-mute); }
.form-group:focus-within { border-bottom-color: var(--teal); }
.form-group:focus-within label { color: var(--teal); }
.form-group select option { background: var(--paper); color: var(--ink); }

.contact-form .btn-block { margin-top: 1.5rem; }
.form-success {
  display: none;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(13,71,84,0.08);
  border: 1px solid rgba(13,71,84,0.2);
  color: var(--teal-deep);
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
}

/* ===== FOOTER ===== */
footer {
  background: var(--ink);
  color: var(--paper);
  padding: 3rem 0 2.5rem;
}
.footer-copy { padding: 0 1rem; }
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}
.footer-logo .logo-img {
  height: 56px;
  /* invert dark teal logo to light for dark footer */
  filter: brightness(0) invert(1);
  opacity: 0.95;
}
.footer-mail a {
  color: var(--paper);
  border-bottom: 1px solid rgba(241,237,229,0.4);
  padding-bottom: 1px;
  font-size: 0.95rem;
  transition: border-color var(--transition), color var(--transition);
}
.footer-mail a:hover { border-color: var(--teal-glow); color: var(--teal-glow); }
.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(241,237,229,0.45);
  margin-top: 0.5rem;
}

/* ===== BACK TO TOP ===== */
.back-top {
  position: fixed;
  bottom: 1.75rem; right: 1.75rem;
  width: 44px; height: 44px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  opacity: 0; pointer-events: none;
  transition: all var(--transition);
  z-index: 500;
}
.back-top.visible { opacity: 1; pointer-events: auto; }
.back-top:hover { background: var(--teal); transform: translateY(-3px); }
[dir="rtl"] .back-top { right: auto; left: 1.75rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 3rem; }
}

@media (max-width: 720px) {
  .hamburger { display: flex; }
  .nav { height: 64px; gap: 0.75rem; }
  .logo-img { height: 42px; }
  /* On mobile: logo on left, hamburger before lang so lang sits at the far right */
  .nav-right { order: 0; margin-left: auto; flex-direction: row-reverse; }
  [dir="rtl"] .nav-right { flex-direction: row; margin-left: 0; margin-right: auto; }
  .nav-links {
    position: fixed;
    top: 64px; left: 0; right: 0;
    background: var(--paper);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0 1.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    border-bottom: 1px solid var(--line);
  }
  .nav-links.open { max-height: 280px; padding: 0.75rem 1.25rem 1.25rem; }
  .nav-links li { width: 100%; border-bottom: 1px solid var(--line-soft); }
  .nav-links li:last-child { border-bottom: none; }
  .nav-links a { display: block; padding: 0.9rem 0; font-size: 1.05rem; width: 100%; }

  .hero-cta { justify-content: center; }
  .contact-form { padding: 1.5rem; }
}

@media (max-width: 480px) {
  .lang-trigger { padding: 0.45rem 0.7rem; font-size: 0.72rem; }
  .footer-logo .logo-img { height: 48px; }
  /* keep back-to-top from covering footer text */
  .back-top { bottom: 1rem; right: 1rem; width: 38px; height: 38px; }
  [dir="rtl"] .back-top { right: auto; left: 1rem; }
  footer { padding-bottom: 3.75rem; }
  .footer-copy { font-size: 0.65rem; }
}
