/* ============================================================
   Connect @ RSC Saudi East — base / structural styles
   Colour + surface tokens live in themes.css (per [data-theme]).
   ============================================================ */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }

/* ---------- decorative backdrop ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 15% 10%, var(--bg-glow-1), transparent 70%),
    radial-gradient(55% 45% at 90% 20%, var(--bg-glow-2), transparent 70%),
    radial-gradient(70% 60% at 50% 100%, var(--bg-glow-3), transparent 70%),
    var(--bg);
  perspective: 900px;
}

.blob {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 45% 55% 60% 40% / 50% 45% 55% 50%;
  filter: blur(60px);
  opacity: var(--blob-opacity, .55);
  will-change: transform;
  animation: drift 24s ease-in-out infinite alternate;
}
.blob--1 { top: -18vmax; left: -12vmax; background: var(--blob-1); }
.blob--2 { bottom: -22vmax; right: -14vmax; background: var(--blob-2); animation-duration: 30s; }
.blob--3 { top: 30%; left: 55%; background: var(--blob-3); animation-duration: 38s; }

@keyframes drift {
  from { transform: translate3d(0,0,0) scale(1) rotate(0deg); }
  to   { transform: translate3d(4vmax,-3vmax,0) scale(1.12) rotate(18deg); }
}

.shape {
  position: absolute;
  will-change: transform;
  transform-style: preserve-3d;
  opacity: var(--shape-opacity, .8);
}
.shape--ring {
  top: 14%; right: 8%;
  width: clamp(70px, 12vw, 150px); aspect-ratio: 1;
  border: 3px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 40px -6px var(--accent);
  animation: spin3d 18s linear infinite;
}
.shape--cube {
  bottom: 16%; left: 7%;
  width: clamp(46px, 7vw, 84px); aspect-ratio: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 14px;
  box-shadow: 0 20px 50px -12px var(--accent);
  animation: bob 9s ease-in-out infinite;
}
.shape--pill {
  top: 62%; right: 12%;
  width: clamp(60px, 9vw, 120px); height: clamp(24px, 3.4vw, 44px);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  animation: bob 11s ease-in-out infinite reverse;
}
@keyframes spin3d {
  from { transform: rotateX(50deg) rotateZ(0deg); }
  to   { transform: rotateX(50deg) rotateZ(360deg); }
}
@keyframes bob {
  0%,100% { transform: translateY(0) rotate(-6deg); }
  50%     { transform: translateY(-22px) rotate(6deg); }
}

/* ---------- layout ---------- */
.wrap {
  max-width: 560px;
  margin-inline: auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 5vw, 1.5rem) 3rem;
}

.masthead { display: flex; justify-content: center; margin-bottom: clamp(1.5rem, 6vw, 2.75rem); }
.logo { width: min(320px, 74vw); height: auto; }

.hero { text-align: center; margin-bottom: clamp(1.5rem, 6vw, 2.5rem); }
.kicker {
  display: inline-block;
  margin: 0 0 .9rem;
  padding: .35rem .8rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
}
.hero h1 {
  margin: 0 0 .6rem;
  font-family: var(--font-display, inherit);
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 1.05;
  letter-spacing: var(--display-tracking, -0.02em);
}
.lede { margin: 0 auto; max-width: 40ch; color: var(--text-dim); }

/* ---------- card ---------- */
.card-wrap { position: relative; transform-style: preserve-3d; }

.card {
  position: relative;
  padding: clamp(1.35rem, 5vw, 2.25rem);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(var(--surface-blur, 14px));
  -webkit-backdrop-filter: blur(var(--surface-blur, 14px));
  transform-style: preserve-3d;
  transition: transform .3s ease;
}
.card__sheen {
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 40%, var(--sheen, rgba(255,255,255,.12)) 50%, transparent 60%);
  opacity: 0; pointer-events: none;
  transition: opacity .4s ease;
}
.card:hover .card__sheen { opacity: 1; }

/* ---------- fields ---------- */
.field { margin-bottom: 1.1rem; }
.field > label {
  display: block;
  margin-bottom: .4rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

input[type="text"], input[type="tel"], select {
  width: 100%;
  padding: .8rem .9rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--field-bg);
  border: 1.5px solid var(--field-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  appearance: none;
}
input::placeholder { color: var(--text-faint); }
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

/* Native <select> popup: force a readable, opaque colour scheme so the option
   list isn't light-on-light on the dark theme. */
select {
  background-color: var(--select-bg);
  color: var(--select-text);
  color-scheme: var(--select-scheme, light);
}
select option,
select optgroup {
  background-color: var(--select-bg);
  color: var(--select-text);
}
select option:disabled { color: var(--text-faint); }

#cityOther:not([hidden]) { margin-top: .55rem; }

.select { position: relative; }
.select::after {
  content: "";
  position: absolute;
  right: 1rem; top: 50%;
  width: .5rem; height: .5rem;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.link-btn {
  margin-top: .45rem;
  padding: 0;
  background: none;
  border: none;
  font-size: .82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* checkbox */
.field--check { margin-top: 1.35rem; }
.check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .7rem;
  align-items: start;
  cursor: pointer;
  font-size: .92rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box {
  width: 1.4rem; height: 1.4rem;
  border: 2px solid var(--field-border);
  border-radius: 7px;
  background: var(--field-bg);
  display: grid; place-content: center;
  transition: background .15s ease, border-color .15s ease;
}
.check__box::after {
  content: "";
  width: .42rem; height: .8rem;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s ease;
}
.check input:checked + .check__box {
  background: var(--accent);
  border-color: var(--accent);
}
.check input:checked + .check__box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .check__box { box-shadow: 0 0 0 4px var(--focus-ring); }

/* ---------- errors ---------- */
.err {
  margin: .35rem 0 0;
  min-height: 0;
  font-size: .8rem;
  font-weight: 600;
  color: var(--err);
}
.err:empty { display: none; }
.err--form { margin-top: .9rem; text-align: center; }

.field.invalid input,
.field.invalid select,
.field.invalid .check__box { border-color: var(--err); }

/* ---------- submit ---------- */
.submit {
  position: relative;
  width: 100%;
  margin-top: 1.4rem;
  padding: .95rem 1rem;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--btn-text, #fff);
  background: var(--btn-bg, linear-gradient(120deg, var(--accent), var(--accent-2)));
  border: var(--btn-border, none);
  border-radius: var(--radius-sm);
  box-shadow: var(--btn-shadow, 0 14px 34px -12px var(--accent));
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
.submit:hover { transform: translateY(-2px); filter: brightness(1.05); }
.submit:active { transform: translateY(0); }
.submit[disabled] { opacity: .7; cursor: progress; }

.submit__spin {
  display: none;
  position: absolute;
  right: 1.1rem; top: 50%;
  width: 1.05rem; height: 1.05rem;
  margin-top: -.525rem;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.submit.loading .submit__spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- success panel ---------- */
.done { text-align: center; }
.done__check {
  width: 68px; height: 68px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--ok-bg, rgba(46,204,113,.16));
  display: grid; place-content: center;
}
.done__check svg { width: 40px; height: 40px; overflow: visible; }
.done__check path {
  fill: none;
  stroke: var(--ok, #2ecc71);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: draw .5s .1s ease forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.done h2 { margin: 0 0 .5rem; font-size: 1.4rem; font-family: var(--font-display, inherit); }
.done p { margin: 0 auto .4rem; max-width: 34ch; color: var(--text-dim); }
.done__hint { font-size: .82rem; }

.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-top: 1.2rem;
  padding: .85rem 1.4rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: #25d366;
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 30px -12px rgba(37,211,102,.9);
  transition: transform .12s ease, filter .2s ease;
}
.wa-btn:hover { transform: translateY(-2px); filter: brightness(1.04); }
.wa-btn__icon { width: 1.25rem; height: 1.25rem; fill: currentColor; }

/* ---------- footer ---------- */
.foot { margin-top: 2.5rem; text-align: center; font-size: .8rem; color: var(--text-faint); }

/* ---------- honeypot ---------- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- theme switcher (remove after selection) ---------- */
.theme-switch {
  position: fixed;
  left: 50%; bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  gap: .25rem;
  padding: .3rem;
  background: rgba(20,20,35,.72);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  z-index: 50;
}
.theme-switch button {
  padding: .45rem .85rem;
  font-size: .78rem;
  font-weight: 600;
  color: #fff;
  background: none;
  border: none;
  border-radius: 999px;
}
.theme-switch button[aria-pressed="true"] { background: var(--accent); }

/* ---------- scroll reveal (only when JS is running) ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); }
.js .reveal.in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }

/* ---------- motion / touch guards ---------- */
@media (hover: none) {
  .card__sheen { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .blob, .shape, .submit__spin, .done__check path { animation: none !important; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { scroll-behavior: auto !important; }
}
