/* ============================================================
   Digital business card - shared structure
   Brand tokens (--brand, --bg, --panel ...) come from the
   brand stylesheet loaded after this file.
   ============================================================ */

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 5vw, 48px) clamp(14px, 4vw, 40px);
  padding-top: max(clamp(16px, 5vw, 48px), env(safe-area-inset-top));
  padding-bottom: max(clamp(16px, 5vw, 48px), env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--txt);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }

a { color: inherit; text-decoration: none; }

/* ---------- background ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg > * {
  position: absolute;
  inset: 0;
}

/* ---------- card shell ---------- */

.card {
  position: relative;
  width: 100%;
  max-width: 468px;
  padding: clamp(26px, 7vw, 38px) clamp(20px, 5.5vw, 34px) clamp(22px, 6vw, 32px);
  border: 1px solid var(--hair);
  border-radius: 26px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
  box-shadow:
    0 1px 0 0 var(--sheen) inset,
    0 30px 70px -30px rgba(0, 0, 0, .9);
  animation: card-in .7s cubic-bezier(.22, 1, .36, 1) both;
}

/* staggered entrance for the blocks inside the card */
.card > * { animation: block-in .6s cubic-bezier(.22, 1, .36, 1) both; }
.card > *:nth-child(1) { animation-delay: .10s; }
.card > *:nth-child(2) { animation-delay: .20s; }
.card > *:nth-child(3) { animation-delay: .28s; }
.card > *:nth-child(4) { animation-delay: .36s; }
.card > *:nth-child(5) { animation-delay: .44s; }
.card > *:nth-child(6) { animation-delay: .52s; }
.card > *:nth-child(7) { animation-delay: .60s; }

/* ---------- language switcher ----------
   Positioned out of flow so it never disturbs the entrance stagger
   or the vertical rhythm of the card. */

.langs {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  z-index: 2;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--tile);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: block-in .5s cubic-bezier(.22, 1, .36, 1) both .55s;
}

.langs button {
  min-width: 34px;
  min-height: 28px;
  padding: 4px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.langs button[aria-pressed="true"] {
  background: var(--brand);
  color: #fff;
}

@media (hover: hover) and (pointer: fine) {
  .langs button:not([aria-pressed="true"]):hover { color: var(--txt); }
}

/* the switcher sits above the logo, so give the logo room to clear it */
.card { padding-top: clamp(52px, 11vw, 62px); }

/* ---------- logo ---------- */

.brandmark {
  display: flex;
  justify-content: center;
  margin: 0 0 clamp(20px, 5vw, 26px);
}

.brandmark svg,
.brandmark img {
  width: var(--logo-w, clamp(160px, 48vw, 208px));
  height: auto;
  display: block;
  animation: logo-in .9s cubic-bezier(.22, 1, .36, 1) both .05s;
}

/* ---------- portrait ---------- */

.portrait {
  display: flex;
  justify-content: center;
  margin: 0 0 clamp(16px, 4vw, 20px);
}

.portrait img {
  width: clamp(104px, 30vw, 128px);
  height: clamp(104px, 30vw, 128px);
  border-radius: 50%;
  object-fit: cover;
  /* the ring is drawn with box-shadow so it never affects layout size */
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--brand),
    0 12px 28px -12px rgba(0, 0, 0, .85);
  background: var(--tile);
  animation: portrait-in .8s cubic-bezier(.22, 1, .36, 1) both .18s;
}

@keyframes portrait-in {
  from { opacity: 0; transform: scale(.86); }
  to   { opacity: 1; transform: none; }
}

/* ---------- identity ---------- */

.identity { text-align: center; }

.identity .rule {
  width: 46px;
  height: 3px;
  margin: 0 auto clamp(16px, 4vw, 20px);
  border-radius: 2px;
  background: var(--brand);
  animation: rule-in .8s cubic-bezier(.22, 1, .36, 1) both .3s;
}

.name {
  margin: 0;
  font-size: clamp(24px, 6.6vw, 34px);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  overflow-wrap: break-word;
}

.role {
  margin: 10px 0 0;
  font-size: clamp(10.5px, 3vw, 12.5px);
  font-weight: 300;
  letter-spacing: .17em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--muted);
}

.company {
  margin: 14px 0 0;
  font-size: clamp(9.5px, 2.6vw, 11px);
  font-weight: 600;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--brand-soft, var(--brand));
}

/* ---------- quick actions ---------- */

.quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 10px;
  margin: clamp(22px, 6vw, 30px) 0 0;
}

.quick a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 74px;
  padding: 12px 6px;
  border: 1px solid var(--hair);
  border-radius: 16px;
  background: var(--tile);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.quick a svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--brand);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick span {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- detail rows ---------- */

.details {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.details a {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 12px 14px;
  border: 1px solid var(--hair);
  border-radius: 16px;
  background: var(--tile);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.details .ico {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--badge);
  box-shadow: var(--badge-glow, none);
}

.details .ico svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.details .txt { min-width: 0; }

.details .k {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}

.details .v {
  display: block;
  margin-top: 3px;
  font-size: clamp(13px, 3.6vw, 14.5px);
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* ---------- save contact ---------- */

.save {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  margin: clamp(18px, 5vw, 24px) 0 0;
  padding: 16px 18px;
  border: 0;
  border-radius: 16px;
  background: var(--cta);
  color: #fff;
  font: inherit;
  font-size: clamp(12px, 3.4vw, 13.5px);
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--cta-glow);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.save svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- footer ---------- */

.foot {
  margin: clamp(18px, 5vw, 22px) 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
  text-align: center;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}

.foot a { color: var(--brand-soft, var(--brand)); }

/* ---------- interaction ---------- */

@media (hover: hover) and (pointer: fine) {
  .quick a:hover,
  .details a:hover {
    transform: translateY(-2px);
    background: var(--tile-hover);
    border-color: var(--hair-hover);
  }
  .save:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
  }
}

.quick a:active,
.details a:active { transform: scale(.98); }
.save:active { transform: scale(.985); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

/* ---------- motion ---------- */

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

@keyframes block-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

@keyframes logo-in {
  from { opacity: 0; transform: translateY(-8px) scale(.9); }
  to   { opacity: 1; transform: none; }
}

@keyframes rule-in {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- larger screens ---------- */

@media (min-width: 768px) {
  .card { max-width: 500px; border-radius: 30px; }
}

@media (min-width: 1024px) {
  .card { max-width: 520px; }
  .details a { min-height: 64px; }
}

/* ============================================================
   Arabic / right-to-left
   ============================================================ */

[dir="rtl"] body {
  font-family: "Cairo", "Noto Sans Arabic", system-ui, sans-serif;
}

/* Arabic has no capital forms, and letterspacing breaks its joined
   script, so undo both wherever they were applied for Latin. */
[dir="rtl"] .name,
[dir="rtl"] .role,
[dir="rtl"] .company,
[dir="rtl"] .quick span,
[dir="rtl"] .details .k,
[dir="rtl"] .save {
  text-transform: none;
  letter-spacing: 0;
}

[dir="rtl"] .name { font-weight: 700; line-height: 1.25; }
[dir="rtl"] .role { font-weight: 400; font-size: clamp(12px, 3.4vw, 14px); }
[dir="rtl"] .company { font-weight: 600; }
[dir="rtl"] .quick span { font-size: 10.5px; }
[dir="rtl"] .details .k { font-size: 10px; }
[dir="rtl"] .save { font-weight: 700; }

/* Contact values stay left-to-right even inside an RTL page: a phone
   number or email reversed by the bidi algorithm is unreadable. They
   still align to the right edge, which is the RTL reading start. */
[dir="rtl"] .details .txt { text-align: right; }

.details .v {
  direction: ltr;
  text-align: inherit;
}

[dir="rtl"] .foot a {
  direction: ltr;
  display: inline-block;
}

/* Cairo applies to everything in Arabic mode, including the company
   and footer lines. */
[dir="rtl"] .company,
[dir="rtl"] .foot,
[dir="rtl"] .langs button,
[dir="rtl"] .save,
[dir="rtl"] .quick span,
[dir="rtl"] .details .k,
[dir="rtl"] .details .v {
  font-family: "Cairo", "Noto Sans Arabic", system-ui, sans-serif;
}

/* Arabic names need a little more line height than the tight Latin
   setting, and no negative tracking. */
[dir="rtl"] .name {
  letter-spacing: 0;
  line-height: 1.3;
}
