/*
 * CodeCraftsMan site widgets: WhatsApp chat (chat.js) and the English/Arabic switcher
 * (translate.js). Written for this site; no plugin styles.
 */

/* Arabic letters for the site font. These faces only cover the Arabic Unicode ranges, so
   wherever "Plus Jakarta Sans" is used, Arabic text uses IBM Plex Sans Arabic (SIL OFL 1.1)
   at the same weight, while Latin text keeps the original font. */
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 300; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-arabic-300.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-arabic-400.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-arabic-500.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-arabic-600.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-arabic-700.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF; }

:root {
  --ccm-ink: #141017;
  --ccm-paper: #ffffff;
  --ccm-mist: #f3f3f1;
  --ccm-line: rgba(20, 16, 23, 0.14);
  --ccm-muted: #5f6567;
  --ccm-wa: #25d366;
  --ccm-away: #f0b429;
  --ccm-accent: #d9afd0;
  --ccm-gap: 20px;
  --ccm-font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ccm-shadow: 0 18px 50px rgba(20, 16, 23, 0.22);
}

/* ---------- Arabic page text ---------- */

/* Translated text reads right-to-left. The page layout itself is not mirrored, so the
   design stays exactly as it is. Letter spacing would break joined Arabic letters. */
html.ccm-ar [data-ccm-tr] { direction: rtl; }
html.ccm-ar [data-ccm-tr],
html.ccm-ar [data-ccm-tr] * { letter-spacing: normal !important; text-transform: none !important; }
html.ccm-ar :is(h1, h2, h3, h4, h5, h6)[data-ccm-tr],
html.ccm-ar :is(h1, h2, h3, h4, h5, h6) [data-ccm-tr] { line-height: 1.3 !important; }

/* ---------- shared ---------- */

/* Undo the theme's global button and form styles inside the widgets. */
#ccm-chat button, #ccm-lang {
  margin: 0; padding: 0; border: 0; border-radius: 0; background: none; color: inherit;
  font: inherit; line-height: inherit; letter-spacing: normal; text-transform: none;
  text-decoration: none; box-shadow: none; min-width: 0; min-height: 0; width: auto; height: auto;
}


#ccm-chat, #ccm-lang { font-family: var(--ccm-font); -webkit-font-smoothing: antialiased; }
#ccm-chat *, #ccm-lang * { box-sizing: border-box; }
#ccm-chat button, #ccm-lang { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#ccm-chat [hidden] { display: none !important; }
.ccm-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- language switcher ---------- */

#ccm-lang {
  position: fixed;
  left: max(var(--ccm-gap), env(safe-area-inset-left));
  bottom: max(var(--ccm-gap), env(safe-area-inset-bottom));
  z-index: 9990;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--ccm-ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  box-shadow: var(--ccm-shadow);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
#ccm-lang:hover { transform: translateY(-2px); background: #000; }
#ccm-lang:focus-visible { outline: 3px solid var(--ccm-accent); outline-offset: 3px; }
#ccm-lang svg { width: 18px; height: 18px; flex: none; }
#ccm-lang[aria-busy='true'] { pointer-events: none; opacity: 0.85; }
#ccm-lang[aria-busy='true'] svg { animation: ccm-spin 0.9s linear infinite; }

/* ---------- WhatsApp chat ---------- */

#ccm-chat {
  position: fixed;
  right: max(var(--ccm-gap), env(safe-area-inset-right));
  bottom: max(var(--ccm-gap), env(safe-area-inset-bottom));
  z-index: 9990;
  color: var(--ccm-ink);
  font-size: 14px;
  line-height: 1.5;
}

#ccm-chat .ccm-chat__launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--ccm-ink);
  color: #fff;
  box-shadow: var(--ccm-shadow);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
#ccm-chat .ccm-chat__launcher:hover { transform: translateY(-2px); background: #000; }
#ccm-chat .ccm-chat__launcher:focus-visible { outline: 3px solid var(--ccm-accent); outline-offset: 3px; }
#ccm-chat .ccm-chat__launcher svg { width: 28px; height: 28px; }
#ccm-chat .ccm-chat__launcher .ccm-chat__icon-close { display: none; width: 22px; height: 22px; }
#ccm-chat .ccm-chat__launcher[aria-expanded='true'] .ccm-chat__icon-wa { display: none; }
#ccm-chat .ccm-chat__launcher[aria-expanded='true'] .ccm-chat__icon-close { display: block; }
#ccm-chat .ccm-chat__dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--ccm-wa);
}
#ccm-chat.ccm-chat--away .ccm-chat__dot { background: var(--ccm-away); }

/* While a nudge is showing: an unread badge and one soft pulse on the button. */
#ccm-chat.ccm-chat--nudge .ccm-chat__launcher::after {
  content: '1';
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
#ccm-chat[dir='rtl'].ccm-chat--nudge .ccm-chat__launcher::after { left: auto; right: -4px; }
#ccm-chat.ccm-chat--nudge .ccm-chat__launcher { animation: ccm-ring 1.6s ease-out 2; }
@keyframes ccm-ring {
  0% { box-shadow: var(--ccm-shadow), 0 0 0 0 rgba(37, 211, 102, 0.5); }
  70% { box-shadow: var(--ccm-shadow), 0 0 0 16px rgba(37, 211, 102, 0); }
  100% { box-shadow: var(--ccm-shadow), 0 0 0 0 rgba(37, 211, 102, 0); }
}

#ccm-chat .ccm-chat__tip {
  position: absolute;
  right: 70px;
  bottom: 13px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--ccm-ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
@media (hover: hover) {
  #ccm-chat .ccm-chat__launcher:hover + .ccm-chat__tip,
  #ccm-chat .ccm-chat__launcher:focus-visible + .ccm-chat__tip { opacity: 1; transform: none; }
}
#ccm-chat.ccm-chat--open .ccm-chat__tip { display: none; }

/* Greeting bubble */
#ccm-chat .ccm-chat__greet {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: max-content;
  max-width: min(310px, calc(100vw - 2 * var(--ccm-gap)));
  animation: ccm-pop 0.28s ease-out both;
}
#ccm-chat .ccm-chat__greet-body {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 40px 12px 12px;
  border: 0;
  border-radius: 18px 18px 4px 18px;
  background: var(--ccm-paper);
  color: var(--ccm-ink);
  font-size: 13.5px;
  line-height: 1.45;
  text-align: start;
  box-shadow: var(--ccm-shadow);
}
#ccm-chat .ccm-chat__greet-body img { width: 34px; height: 34px; border-radius: 50%; flex: none; }
#ccm-chat .ccm-chat__greet-close {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ccm-muted);
}
#ccm-chat .ccm-chat__greet-close:hover { background: var(--ccm-mist); color: var(--ccm-ink); }
#ccm-chat .ccm-chat__greet-close svg { width: 12px; height: 12px; }

/* Panel */
#ccm-chat .ccm-chat__panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(360px, calc(100vw - 2 * var(--ccm-gap)));
  overflow: hidden;
  border-radius: 22px;
  background: var(--ccm-mist);
  box-shadow: 0 24px 70px rgba(20, 16, 23, 0.28);
  animation: ccm-pop 0.24s ease-out both;
  transform-origin: bottom right;
}
#ccm-chat .ccm-chat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 16px 18px;
  background: var(--ccm-ink);
  color: #fff;
}
#ccm-chat .ccm-chat__head img { width: 46px; height: 46px; border: 2px solid rgba(255, 255, 255, 0.16); border-radius: 50%; flex: none; }
#ccm-chat .ccm-chat__who { flex: 1; min-width: 0; }
#ccm-chat .ccm-chat__name { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
#ccm-chat .ccm-chat__status { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; color: rgba(255, 255, 255, 0.72); font-size: 12.5px; }
#ccm-chat .ccm-chat__status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ccm-wa); flex: none; }
#ccm-chat.ccm-chat--away .ccm-chat__status::before { background: var(--ccm-away); }
#ccm-chat .ccm-chat__close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  flex: none;
}
#ccm-chat .ccm-chat__close:hover { background: rgba(255, 255, 255, 0.18); }
#ccm-chat .ccm-chat__close svg { width: 14px; height: 14px; }

#ccm-chat .ccm-chat__body { display: grid; gap: 12px; padding: 18px; }
#ccm-chat .ccm-chat__bubble {
  justify-self: start;
  max-width: 92%;
  margin: 0;
  padding: 12px 14px;
  border-radius: 4px 18px 18px 18px;
  background: var(--ccm-paper);
  box-shadow: 0 1px 2px rgba(20, 16, 23, 0.06);
  font-size: 14.5px;
  line-height: 1.5;
}
#ccm-chat .ccm-chat__away-note { margin: -4px 0 0; color: var(--ccm-muted); font-size: 12.5px; }
#ccm-chat .ccm-chat__chips { display: flex; flex-wrap: wrap; gap: 8px; }
#ccm-chat .ccm-chat__chip {
  padding: 7px 13px;
  border: 1px solid var(--ccm-line);
  border-radius: 999px;
  background: var(--ccm-paper);
  color: var(--ccm-ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
#ccm-chat .ccm-chat__chip:hover { border-color: var(--ccm-ink); }
#ccm-chat .ccm-chat__chip[aria-pressed='true'] { border-color: var(--ccm-ink); background: var(--ccm-ink); color: #fff; }
#ccm-chat .ccm-chat__input {
  display: block;
  width: 100%;
  min-height: 92px;
  padding: 12px 14px;
  border: 1px solid var(--ccm-line);
  border-radius: 14px;
  background: var(--ccm-paper);
  color: var(--ccm-ink);
  font: 14px/1.5 var(--ccm-font);
  resize: none;
  -webkit-user-select: text !important;
  user-select: text !important;
}
#ccm-chat .ccm-chat__input:focus { outline: none; border-color: var(--ccm-ink); box-shadow: 0 0 0 3px rgba(217, 175, 208, 0.55); }
#ccm-chat .ccm-chat__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 999px;
  background: var(--ccm-ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.2s ease;
}
#ccm-chat .ccm-chat__send:hover { background: #000; }
#ccm-chat .ccm-chat__send:focus-visible, #ccm-chat .ccm-chat__chip:focus-visible, #ccm-chat .ccm-chat__close:focus-visible, #ccm-chat .ccm-chat__greet-body:focus-visible { outline: 3px solid var(--ccm-accent); outline-offset: 2px; }
#ccm-chat .ccm-chat__send svg { width: 22px; height: 22px; color: var(--ccm-wa); }
#ccm-chat .ccm-chat__note { margin: -2px 0 0; color: var(--ccm-muted); font-size: 12px; text-align: center; }

/* Arabic: the chat reads right-to-left */
#ccm-chat[dir='rtl'] .ccm-chat__bubble { border-radius: 18px 4px 18px 18px; }
#ccm-chat[dir='rtl'] .ccm-chat__greet-body { padding: 12px 12px 12px 40px; }
#ccm-chat[dir='rtl'] .ccm-chat__greet-close { right: auto; left: 6px; }
#ccm-chat[dir='rtl'] .ccm-chat__dot { right: auto; left: 3px; }
#ccm-chat[dir='rtl'] .ccm-chat__head { padding: 16px 18px 16px 16px; }

@keyframes ccm-pop { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes ccm-spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  :root { --ccm-gap: 14px; }
  #ccm-chat .ccm-chat__launcher { width: 54px; height: 54px; }
  #ccm-chat .ccm-chat__panel, #ccm-chat .ccm-chat__greet { bottom: 68px; }
  #ccm-chat .ccm-chat__panel { width: calc(100vw - 2 * var(--ccm-gap)); }
  #ccm-chat .ccm-chat__greet { max-width: calc(100vw - 2 * var(--ccm-gap) - 8px); }
  #ccm-lang { height: 42px; padding: 0 14px 0 12px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  #ccm-chat.ccm-chat--nudge .ccm-chat__launcher { animation: none; }
  #ccm-chat .ccm-chat__greet, #ccm-chat .ccm-chat__panel { animation: none; }
  #ccm-lang, #ccm-chat .ccm-chat__launcher, #ccm-chat .ccm-chat__tip { transition: none; }
}

/* ---------------------------------------------------------------- Copy protection
 * public/assets/protect.js. Looks and works like the WordPress plugin it replaced; the
 * notice is centred on every screen size and stays inside small phone screens. As on
 * WordPress, every page gets the arrow cursor, and pages marked ccm-protected (all but
 * Blog, Contact, Services, Work and Privacy Policy) also stop selection in CSS; the script
 * stops it everywhere.
 */
body {
  cursor: default;
}

body.ccm-protected {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

@media print {
  body * {
    display: none !important;
  }

  body::after {
    content: "You are not allowed to print preview this page, Thank you";
  }
}

#ccm-protect {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 99999999;
  box-sizing: border-box;
  width: min(329px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 36px;
  transform: translate(-50%, -50%);
  border: 1px solid #f5aca6;
  border-radius: 10px;
  background: #ffecec url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M8 1.5 15 14.5H1z' fill='%23f7c600' stroke='%23c48a00' stroke-linejoin='round'/%3E%3Cpath d='M8 6v4.2' stroke='%23333' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='12.3' r='.9' fill='%23333'/%3E%3C/svg%3E") no-repeat 10px 50%;
  box-shadow: 0 0 34px 2px rgb(242, 191, 191);
  color: #555;
  font-family: Tahoma, sans-serif;
  font-size: 11px;
  line-height: normal;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 900ms ease 0s;
}

#ccm-protect.ccm-protect--show {
  opacity: 1;
  visibility: visible;
}

#ccm-protect[dir='rtl'] {
  background-position: right 10px center;
}

#ccm-protect span {
  font-weight: bold;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- Comment form
 * public/assets/comments.js: the message shown after a comment is sent (or not).
 */
#ccm-comment-note {
  margin: 0 0 1.25em;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.5;
}

#ccm-comment-note[hidden] {
  display: none;
}

#ccm-comment-note.ccm-comment-note--sent {
  background: #e8f5ec;
  color: #1d5c34;
}

#ccm-comment-note.ccm-comment-note--failed {
  background: #fdecea;
  color: #8a2018;
}
