/* Tajwal Links, public page.
   Every themeable value is a CSS variable printed by designCss() in
   app/design.php; every enum option is a class on <body> from
   designBodyClasses(). This file never hard-codes a theme color. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body.lt {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg-color);
  color: var(--bio-color);
  font-family: var(--body-font);
  -webkit-font-smoothing: antialiased;
}

.icon { width: 20px; height: 20px; flex: none; display: block; }
[dir="rtl"] .lt-flip { transform: scaleX(-1); }

/* ---------------------------------------------------------------- Layout */

.lt-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.lt-page {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 8px var(--content-padding) 28px;
  overflow: hidden;
}

.lt-page > :not(.lt-bg) {
  width: 100%;
  max-width: calc(var(--content-width) - 2 * var(--content-padding));
  margin-inline: auto;
}

.lt-bg { position: absolute; inset: 0; z-index: -1; background: var(--page-bg); }
.bg-image .lt-bg { background: var(--page-bg-color); overflow: hidden; }
.bg-image .lt-bg::before {
  content: "";
  position: absolute;
  inset: calc(var(--bg-blur) * -2);
  background: var(--bg-image) center / cover no-repeat;
  filter: blur(var(--bg-blur));
}
.bg-image .lt-bg::after { content: ""; position: absolute; inset: 0; background: var(--bg-overlay); }

/* Desktop: Linktree's centered column on a darker outer color. */
@media (min-width: 768px) {
  body.lt.outer-column { background: var(--outer-bg); }
  .outer-column .lt-page { max-width: var(--content-width); }
  .outer-column.column-shadow .lt-page { box-shadow: 0 0 48px rgba(0, 0, 0, .22); }
}

/* ---------------------------------------------------------------- Top bar */

.lt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
}
.lt-top-group { display: flex; align-items: center; gap: 6px; }

.lt-top-btn {
  height: 40px;
  min-width: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: var(--top-btn-radius);
  background: var(--top-btn-bg);
  color: var(--top-btn-text);
  font: 500 14px/1 var(--body-font);
  text-decoration: none;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform .15s ease;
}
.lt-top-btn:hover { transform: scale(1.05); }
.lt-top-btn .icon { width: 18px; height: 18px; }
.lt-top-logo { width: 40px; padding: 0; }
.lt-top-logo img { width: 24px; height: 24px; object-fit: contain; }
.lt-top-text { padding: 0 12px; }

/* ---------------------------------------------------------------- Profile */

.lt-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 40px;
}

.lt-avatar {
  display: block;
  width: var(--avatar-size);
  height: var(--avatar-size);
  object-fit: cover;
  border: var(--avatar-border);
  margin-bottom: 18px;
}
.avatar-plain .lt-avatar { object-fit: contain; }
.avatar-circle .lt-avatar { border-radius: 50%; }
.avatar-rounded .lt-avatar { border-radius: 24%; }

.lt-title {
  margin: 0;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--title-font);
  font-size: var(--title-size);
  font-weight: var(--title-weight);
  line-height: 1.25;
  color: var(--title-color);
}
.lt-verified { width: .9em; height: .9em; color: var(--verified-color); }

.lt-bio {
  margin: 8px 0 0;
  max-width: 20em;
  font-size: var(--bio-size);
  line-height: 1.6;
  color: var(--bio-color);
}

.lt-socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--social-gap);
  margin-top: 20px;
}
.lt-links + .lt-socials { margin-top: 32px; }

.lt-social {
  display: inline-flex;
  color: var(--social-color);
  border-radius: 50%;
  transition: transform .15s ease;
}
.lt-social:hover { transform: scale(1.12); }
.lt-social .icon { width: var(--social-size); height: var(--social-size); }
.social-filled .lt-social { background: var(--social-bg); padding: calc(var(--social-size) * .38); }
.social-outline .lt-social { border: 2px solid var(--social-bg); padding: calc(var(--social-size) * .34); }
.social-filled .lt-social .icon,
.social-outline .lt-social .icon { width: calc(var(--social-size) * .8); height: calc(var(--social-size) * .8); }

/* ---------------------------------------------------------------- Links */

.lt-links {
  display: flex;
  flex-direction: column;
  gap: var(--btn-gap);
  margin-top: 36px;
}

.lt-item { position: relative; display: flex; transition: transform .15s ease; }

.lt-btn {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-height);
  padding: 10px 52px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: var(--btn-border);
  border-radius: var(--btn-radius);
  box-shadow: var(--btn-shadow);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  text-transform: var(--btn-transform);
  text-align: center;
  text-decoration: none;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow .15s ease, filter .15s ease;
}
.align-start .lt-btn { justify-content: flex-start; text-align: start; padding-inline-start: 20px; }
.align-start .has-thumb .lt-btn { padding-inline-start: 68px; }

.lt-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.lt-label-sub { font-size: .82em; font-weight: 400; opacity: .75; text-transform: none; }

.lt-thumb {
  position: absolute;
  inset-inline-start: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: min(48px, calc(var(--btn-height) - 18px));
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lt-thumb .icon { width: 62%; height: 62%; }
.thumb-rounded .lt-thumb { border-radius: 10px; }
.thumb-circle .lt-thumb { border-radius: 50%; }

.lt-more {
  position: absolute;
  inset-inline-end: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--btn-text);
  opacity: .55;
  cursor: pointer;
}
.lt-more:hover, .lt-more:focus-visible { opacity: 1; background: color-mix(in srgb, var(--btn-text) 10%, transparent); }
.lt-more .icon { width: 16px; height: 16px; }

/* Fill styles, shared by buttons and cards */
.btn-outline .lt-btn, .btn-outline .lt-card { background: transparent; }
.btn-glass .lt-btn, .btn-glass .lt-card {
  background: color-mix(in srgb, var(--btn-bg) 22%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Hover. "Press" is Linktree's hard-shadow move: the button slides onto its
   own shadow. With no shadow there is nothing to slide onto, so it shrinks. */
.hover-press .lt-item:hover, .hover-press .lt-item:active { transform: translate(var(--btn-shadow-x), var(--btn-shadow-y)); }
.hover-press .lt-item:hover .lt-btn, .hover-press .lt-item:active .lt-btn { box-shadow: none; }
.hover-press.shadow-none .lt-item:hover, .hover-press.shadow-none .lt-item:active { transform: scale(.98); }
.hover-lift .lt-item:hover { transform: translateY(-3px); }
.hover-grow .lt-item:hover { transform: scale(1.03); }
.hover-glow .lt-item:hover .lt-btn { box-shadow: 0 0 0 2px var(--btn-border-color), 0 0 26px var(--btn-shadow-color); }
.lt-btn:focus-visible { outline: 3px solid var(--btn-text); outline-offset: 3px; }

/* Highlight a single link */
.hl-pulse { animation: lt-pulse 1.8s ease-in-out infinite; }
.hl-shake { animation: lt-shake 3.2s ease-in-out infinite; }
.hl-glow { animation: lt-glow 2s ease-in-out infinite; }

/* ---------------------------------------------------------------- Headers, text */

.lt-header {
  margin: 12px 0 0;
  text-align: center;
  font-family: var(--title-font);
  font-size: calc(var(--btn-font-size) + 2px);
  font-weight: 700;
  color: var(--section-color);
}

.lt-text { text-align: center; color: var(--section-color); }
.lt-text h3 { margin: 0 0 6px; font-family: var(--title-font); font-size: calc(var(--btn-font-size) + 1px); }
.lt-text p { margin: 0; font-size: var(--bio-size); line-height: 1.65; opacity: .9; }

/* ---------------------------------------------------------------- Cards */

.lt-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: var(--btn-border);
  border-radius: var(--card-radius);
  box-shadow: var(--btn-shadow);
}
.lt-card-title { font-size: var(--btn-font-size); font-weight: 600; text-align: center; text-transform: var(--btn-transform); }
.lt-card-sub { font-size: .85em; text-align: center; opacity: .75; }

.lt-embed-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: min(var(--card-radius), 14px);
  background: rgba(0, 0, 0, .08);
}
.lt-embed-frame.is-map { aspect-ratio: 4 / 3; }
.lt-embed-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.lt-card-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}
.lt-card-action:hover { background: color-mix(in srgb, var(--btn-text) 8%, transparent); }

.lt-app-head { display: flex; align-items: center; justify-content: center; gap: 12px; }
.lt-app-head .lt-thumb { position: static; transform: none; width: 48px; }
.lt-app-head .lt-card-title, .lt-app-head .lt-card-sub { text-align: start; }

.lt-stores { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.lt-store {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--btn-text);
  color: var(--btn-bg);
  border-radius: min(var(--card-radius), 14px);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  transition: transform .15s ease;
}
.btn-outline .lt-store, .btn-glass .lt-store { color: var(--page-bg-color); }
.lt-store:hover { transform: translateY(-2px); }
.lt-store .icon { width: 24px; height: 24px; }
.lt-store small { display: block; font-size: 10px; font-weight: 500; opacity: .85; margin-bottom: 2px; }
.lt-store.is-suggested { outline: 3px solid color-mix(in srgb, var(--btn-text) 35%, transparent); outline-offset: 2px; }

/* ---------------------------------------------------------------- Forms */

.lt-form { position: relative; }
.lt-form input, .lt-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid color-mix(in srgb, var(--btn-text) 25%, transparent);
  border-radius: min(var(--card-radius), 12px);
  background: color-mix(in srgb, var(--btn-text) 4%, transparent);
  color: var(--btn-text);
  font: inherit;
  font-size: 16px; /* below 16px iOS zooms the page on focus */
  resize: vertical;
}
.lt-form input::placeholder, .lt-form textarea::placeholder { color: color-mix(in srgb, var(--btn-text) 55%, transparent); }
.lt-form input:focus, .lt-form textarea:focus { outline: none; border-color: var(--btn-text); }
.lt-form .is-invalid { border-color: #D93B30; }
.lt-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.lt-form-submit {
  min-height: 48px;
  border: 0;
  border-radius: min(var(--btn-radius), 999px);
  background: var(--btn-text);
  color: var(--btn-bg);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn-outline .lt-form-submit, .btn-glass .lt-form-submit { color: var(--page-bg-color); }
.lt-form-submit:disabled { opacity: .6; cursor: default; }
.lt-form-status { margin: 0; text-align: center; font-size: 14px; font-weight: 600; }
.lt-form-status:empty { display: none; }
.lt-form.is-done > :not(.lt-form-status):not(.lt-card-title) { display: none; }
.lt-form.is-done .lt-form-status { font-size: 15px; padding: 8px 0; }

/* ---------------------------------------------------------------- Footer */

.lt-footer {
  margin-top: auto;
  padding-top: 48px;
  display: flex;
  justify-content: center;
}
.lt-footer-pill {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .14);
  transition: transform .15s ease;
}
a.lt-footer-pill:hover { transform: scale(1.04); }

/* Language switch and admin entry under the footer. Deliberately quiet:
   visitors are not who the admin link is for, so the row inherits the page's
   text colour and stays small.

   `.lt-page >` to outrank `.lt-page > :not(.lt-bg)`, which would stretch it
   to full width. `margin-top: auto` pins it to the bottom when the footer is
   off; after a footer, the footer already holds the bottom. */
.lt-page > .lt-bottom-links {
  width: auto;
  align-self: center;
  margin-top: auto;
  display: flex;
  gap: 16px;
  padding-top: 8px;
  font-size: 13px;
}
.lt-page > .lt-footer + .lt-bottom-links { margin-top: 16px; }
.lt-bottom-links a {
  padding: 8px 4px;
  color: inherit;
  opacity: .6;
  text-decoration: underline;
}
.lt-bottom-links a:hover { opacity: 1; }

/* ---------------------------------------------------------------- "View on mobile" QR */

.lt-qr { display: none; }
@media (min-width: 1100px) {
  .lt-qr {
    position: fixed;
    inset-inline-end: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--qr-color);
    font: 500 14px/1.2 var(--body-font);
  }
  .lt-qr p { margin: 0; }
}
/* White behind the modules on purpose: a light-on-dark QR is an inverted code
   and many phone cameras refuse to read it. */
.lt-qr-code { background: #fff; padding: 6px; border-radius: 8px; line-height: 0; }
.lt-qr .lt-qr-code svg { width: 104px; height: 104px; }

/* ---------------------------------------------------------------- Share sheet */

.lt-sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.lt-sheet[hidden] { display: none; }
.lt-sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 20, .45); animation: lt-fade .2s ease; }
.lt-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  background: #fff;
  color: #111;
  border-radius: 24px 24px 0 0;
  font-family: var(--body-font);
  animation: lt-sheet-up .28s cubic-bezier(.2, .8, .2, 1);
}
@media (min-width: 640px) {
  .lt-sheet { align-items: center; }
  .lt-sheet-panel { border-radius: 24px; }
}
.lt-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.lt-sheet-head h2 { margin: 0; font-size: 17px; }
.lt-sheet-x { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: #F1F2F4; color: #111; cursor: pointer; }
.lt-sheet-card { display: flex; align-items: center; gap: 12px; margin: 16px 0; padding: 12px; background: #F4F5F7; border-radius: 16px; }
.lt-sheet-card img { width: 44px; height: 44px; object-fit: contain; border-radius: 12px; background: #fff; }
.lt-sheet-card div { min-width: 0; }
.lt-sheet-card strong { display: block; font-size: 15px; }
.lt-sheet-card span { display: block; font-size: 13px; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; }

.lt-share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.lt-share-grid > * {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 2px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: #111;
  font: 500 12px/1.2 var(--body-font);
  text-decoration: none;
  cursor: pointer;
}
.lt-share-grid > *:hover { background: #F4F5F7; }
.lt-share-grid > [hidden] { display: none; }
.lt-share-ico { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: #F1F2F4; }
.lt-share-ico .icon { width: 22px; height: 22px; }

.lt-sheet-qr { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid #EEE; }
.lt-sheet-qr .lt-qr-code svg { width: 168px; height: 168px; }
.lt-sheet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font: 600 14px/1 var(--body-font);
  cursor: pointer;
}
.lt-sheet-btn .icon { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- Motion */

.anim-fade .lt-anim { animation: lt-fade .5s ease backwards; animation-delay: calc(var(--i, 0) * 55ms); }
.anim-rise .lt-anim { animation: lt-rise .55s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 55ms); }
.anim-pop .lt-anim { animation: lt-pop .45s cubic-bezier(.3, 1.4, .5, 1) backwards; animation-delay: calc(var(--i, 0) * 55ms); }
/* The editor re-renders the preview on every change; replaying the entrance
   each time would make the preview flicker. */
.is-preview .lt-anim { animation: none; }
html:has(.is-preview) { scrollbar-width: none; }

@keyframes lt-fade { from { opacity: 0; } }
@keyframes lt-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes lt-pop { from { opacity: 0; transform: scale(.9); } }
@keyframes lt-sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes lt-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes lt-shake {
  0%, 84%, 100% { transform: rotate(0); }
  86% { transform: rotate(-2deg); }
  89% { transform: rotate(2deg); }
  92% { transform: rotate(-2deg); }
  95% { transform: rotate(1.5deg); }
  98% { transform: rotate(-1deg); }
}
@keyframes lt-glow { 50% { box-shadow: var(--btn-shadow), 0 0 24px 4px var(--btn-shadow-color); } }

@media (prefers-reduced-motion: reduce) {
  .lt-anim, .hl-pulse, .hl-shake, .hl-glow, .lt-sheet-panel, .lt-sheet-backdrop { animation: none !important; }
}
