/* Wesal design system.
 *
 * Light and flat on purpose. The mauve is sampled straight from the Wesal
 * logo (#89576f), on warm near-white paper - brand colour, not the
 * indigo-on-near-black-with-a-glow that every AI product now ships. Teal and
 * slate carry the other two sections. One type scale, logical properties
 * throughout, so the whole product mirrors cleanly between Arabic (RTL) and
 * English (LTR).
 *
 * The --green-* names are historical; they hold the brand mauve. Renaming
 * them would touch every file for no behavioural gain.
 */

:root {
  /* mauve - sampled from the logo, the primary voice */
  --green-50:  #f6eef2;
  --green-100: #e8d8e0;
  --green-300: #b48ea3;
  --green-500: #89576f;
  --green-600: #71455b;
  --green-700: #593448;

  /* slate - the personal section */
  --rose-50:  #eeeff5;
  --rose-300: #9ba2bd;
  --rose-500: #5c6487;
  --rose-600: #474e6d;

  /* teal - the technical section, clearly apart from the other two */
  --olive-50:  #e2f0ee;
  --olive-500: #1f6f68;

  /* paper */
  --bg: #faf7f8;
  --bg-2: #fffdfe;
  --surface: #ffffff;
  --surface-2: #faf6f8;
  --surface-3: #f2ebee;
  --line: #e7dce1;
  --line-soft: #f0e8ec;

  --text: #2f2a2d;
  --text-2: #6b6168;
  --text-3: #9a8f95;

  --ok: #2f7d5b;
  --warn: #b5812e;
  --bad: #c0455a;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 14px 40px -24px rgba(70, 45, 58, .38);
  --shadow-lift: 0 20px 44px -22px rgba(70, 45, 58, .32);

  --font: "IBM Plex Sans Arabic", "Plus Jakarta Sans", "Segoe UI", system-ui,
          -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* a quiet warm wash, not a glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(880px 580px at 12% -8%, rgba(137, 87, 111, .07), transparent 60%),
    radial-gradient(720px 500px at 100% 4%, rgba(31, 111, 104, .05), transparent 58%);
  pointer-events: none;
}

/* --------------------------------------------------------------- backdrop
   Shapes drifting behind the content, built by backdrop.js. Pinned to the
   viewport and never interactive, so it costs the layout nothing. */

.wesal-backdrop {
  position: fixed; inset: 0; z-index: -1;
  overflow: hidden; pointer-events: none;
}
.wb {
  position: absolute; display: block; opacity: var(--o);
  animation: wb-drift var(--dur) ease-in-out var(--delay) infinite;
  will-change: transform, opacity;
}
.wb svg { display: block; width: 100%; height: auto; }

@keyframes wb-drift {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: var(--o); }
  50%      { transform: translate3d(0, var(--drift), 0) rotate(var(--rot));
             opacity: calc(var(--o) * 1.75); }
}

@media (max-width: 720px) {
  /* fewer, smaller shapes on a phone: the content needs the room */
  .wb { transform: scale(.7); }
  .wb:nth-child(even) { display: none; }
}

/* ------------------------------------------------------------------ layout */

.shell { max-width: 1140px; margin: 0 auto; padding: 0 22px 80px; }
.shell-narrow { max-width: 780px; }

.topbar { display: flex; align-items: center; gap: 14px; padding: 20px 0 26px; }

.brand {
  display: flex; align-items: center; gap: 14px;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: start; cursor: zoom-in;
  border-radius: 12px;
}
.brand:focus-visible { outline: 2px solid var(--green-500); outline-offset: 4px; }
.brand-name { font-size: 23px; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }
.brand-sub { font-size: 13px; color: var(--text-3); line-height: 1.25; }

/* the logo, opened full size */
.brand-sheet {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(47, 42, 45, .55);
  backdrop-filter: blur(3px);
  padding: 24px; cursor: zoom-out;
  animation: sheet-in .18s ease-out;
}
.brand-sheet img {
  max-width: min(560px, 88vw); max-height: 80vh;
  width: auto; height: auto; display: block;
  border-radius: var(--radius); background: #fff;
  box-shadow: 0 30px 70px -24px rgba(47, 42, 45, .6);
  animation: sheet-rise .22s cubic-bezier(.22, .9, .3, 1);
}
@keyframes sheet-in { from { opacity: 0; } }
@keyframes sheet-rise { from { transform: translateY(14px) scale(.96); opacity: 0; } }
.topbar-spacer { flex: 1; }

.langswitch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.langswitch button {
  background: none; border: 0; color: var(--text-3);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 15px; border-radius: 999px; cursor: pointer;
}
.langswitch button[aria-pressed="true"] { background: var(--green-500); color: #fff; }

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-pad-lg { padding: 34px; }

.card-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.card-note { font-size: 13px; color: var(--text-3); margin: 0 0 18px; }

h1 { font-size: 32px; line-height: 1.22; margin: 0 0 10px; letter-spacing: -.025em; }
h2 { font-size: 20px; margin: 0 0 8px; letter-spacing: -.012em; }
.lede { color: var(--text-2); font-size: 15.5px; margin: 0 0 24px; }

/* ------------------------------------------------------------------- forms */

label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 0 0 7px; }
label .opt { font-weight: 400; color: var(--text-3); }

input[type=text], input[type=email], input[type=url], input[type=password],
input[type=time], textarea, select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font: inherit;
  font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(137, 87, 111, .16);
}
textarea { min-height: 112px; resize: vertical; line-height: 1.6; }
select { appearance: none; cursor: pointer; }

.field + .field { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .field + .field { margin-top: 0; }

.filebox {
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.filebox:hover, .filebox.drag { border-color: var(--green-500); background: var(--green-50); }
.filebox input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.filebox-name { font-size: 13.5px; color: var(--text-2); }
.filebox-hint { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.filebox.has-file { border-style: solid; border-color: var(--green-500); background: var(--green-50); }

/* ----------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--green-500);
  color: #fff; border: 0; border-radius: var(--radius-sm);
  padding: 13px 24px; font: inherit; font-size: 15px; font-weight: 650;
  cursor: pointer; transition: transform .12s, box-shadow .18s, background .15s;
  box-shadow: 0 8px 20px -12px rgba(89, 52, 72, .8);
}
.btn:hover:not(:disabled) { background: var(--green-600); transform: translateY(-1px);
                            box-shadow: 0 14px 26px -14px rgba(89, 52, 72, .9); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text-2);
  box-shadow: none; font-weight: 600;
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--green-300);
                                  color: var(--text); box-shadow: none; }
.btn-rec { background: #c0455a; box-shadow: 0 8px 20px -12px rgba(127, 42, 62, .9); }
.btn-rec:hover:not(:disabled) { background: #a63a4e; }
.btn-sm { padding: 8px 15px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-icon {
  padding: 7px; width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line); color: var(--text-3);
  box-shadow: none; font-size: 14px; cursor: pointer; font-family: inherit;
}
.btn-icon:hover:not(:disabled) { color: var(--text); border-color: var(--green-300);
                                 background: var(--surface-2); box-shadow: none; transform: none; }
.btn-icon:disabled { opacity: .35; cursor: not-allowed; }

/* ------------------------------------------------------------------- chips */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  padding: 3px 11px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.chip-general   { background: var(--green-50); color: var(--green-600); border-color: var(--green-100); }
.chip-technical { background: var(--olive-50); color: var(--olive-500); border-color: #c9e3df; }
.chip-personal  { background: var(--rose-50);  color: var(--rose-600);  border-color: #d8dce9; }
.chip-ok   { background: #e4f1e9; color: var(--ok);   border-color: #c7e2d3; }
.chip-warn { background: #f6edd8; color: var(--warn); border-color: #ecdcba; }
.chip-bad  { background: #fae5ea; color: var(--bad);  border-color: #f0ccd6; }

/* ------------------------------------------------------------------ Wesal */

.wesal-stage { position: relative; display: grid; place-items: center; }
.wesal-portrait { position: relative; z-index: 1; width: 100%; }
.wesal-svg { display: block; width: 100%; height: auto; }

/* The 3D canvas lies over the drawn portrait rather than replacing it: the
   SVG keeps holding the box open, so nothing reflows when the model lands. */
.wesal-3d-host { position: absolute; inset: 0; z-index: 2; display: none; }

/* Wesal's own artwork, in layers. Each sits in the same box as the base, so
   a single percentage drives her at every size. */
/* With the artwork mounted, the SVG placeholder steps out of the layout
   entirely: the rig's own aspect ratio sets the height, so every layer
   percentage lands exactly where the build script measured it. */
.wesal-stage.is-rig .wesal-portrait { display: none; }
.wesal-stage.is-rig .wesal-3d-host {
  position: relative; inset: auto; display: block;
  grid-area: 1 / 1; justify-self: stretch; width: 100%;
}
.wesal-rig { position: relative; width: 100%; }
.wesal-rig > * { position: absolute; }
.rig-base { inset: 0; width: 100%; height: 100%; object-fit: contain; }
.rig-jaw  { object-fit: fill; will-change: transform;
            transform-origin: center top; }
.rig-cavity { inset: 0; width: 100%; height: 100%; overflow: visible; }
.rig-mouth { fill: #6e3236; }
.rig-teeth { fill: #f6ece8; }
.rig-blink { opacity: 0; transition: opacity .06s linear; }
.rig-talk  { opacity: 0; will-change: opacity; }

/* She breathes. Without it a still photograph sits on the page looking
   switched off between questions. */
.wesal-stage.is-rig .wesal-rig { animation: wb-breathe 6s ease-in-out infinite; }
@keyframes wb-breathe {
  0%, 100% { transform: translateY(0) rotate(-.5deg) scale(1); }
  50%      { transform: translateY(-2.2%) rotate(.6deg) scale(1.016); }
}
.wesal-stage[data-state="speaking"].is-rig .wesal-rig { animation-duration: 4.5s; }
.wesal-3d { display: block; width: 100%; height: 100%; }
.wesal-stage.is-3d .wesal-3d-host { display: block; }
.wesal-stage.is-3d .wesal-portrait { visibility: hidden; }

.wesal-mark {
  display: inline-grid; place-items: center;
  border-radius: 50%; overflow: hidden;
  background: var(--green-50);
  border: 1px solid var(--green-100);
  box-shadow: 0 4px 12px -6px rgba(89, 52, 72, .3);
  flex: none;
}
.wesal-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wesal-mark .wesal-svg { width: 100%; height: 100%; }

/* idle life: a slow sway plus the smallest breath */
.wa-sway { animation: wa-sway 11s ease-in-out infinite alternate; transform-origin: 200px 400px; }
@keyframes wa-sway {
  0%   { transform: rotate(-.9deg) translate(-3px, 1px); }
  50%  { transform: rotate(.2deg)  translate(1px, -1.5px); }
  100% { transform: rotate(1deg)   translate(3px, .5px); }
}

.wa-eye { transform-box: fill-box; transform-origin: center; transition: transform .07s ease-in; }
.wa-eye.wa-blink { transform: scaleY(.06); }
.wa-iris { transition: transform .6s cubic-bezier(.22,.9,.3,1); }
.wa-lip-bottom { transition: transform .05s linear; }

/* the ring: quiet when idle, alive when she speaks or listens */
.wesal-ring { position: absolute; inset: 2%; z-index: 0; pointer-events: none; }
.wesal-ring span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(137, 87, 111, .22);
  animation: wa-ring 4.5s ease-out infinite;
}
.wesal-ring span:last-child { animation-delay: 2.25s; }
@keyframes wa-ring {
  0%   { transform: scale(.9); opacity: 0; }
  28%  { opacity: .45; }
  100% { transform: scale(1.1); opacity: 0; }
}
.wesal-stage[data-state="speaking"] .wesal-ring span {
  animation-duration: 2.2s; border-color: rgba(137, 87, 111, .5); }
.wesal-stage[data-state="speaking"] .wesal-ring span:last-child { animation-delay: 1.1s; }
.wesal-stage[data-state="listening"] .wesal-ring span {
  animation-duration: 2.8s; border-color: rgba(31, 111, 104, .55); border-width: 2px; }
.wesal-stage[data-state="listening"] .wesal-ring span:last-child { animation-delay: 1.4s; }
.wesal-stage[data-state="thinking"] .wesal-ring span {
  animation-duration: 5.5s; border-color: rgba(180, 142, 163, .5); }

/* ------------------------------------------------------------------ misc UI */

.bar { height: 5px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px;
         background: linear-gradient(90deg, var(--green-500), var(--green-300));
         transition: width .45s cubic-bezier(.22,.9,.3,1); }

.note { font-size: 13px; color: var(--text-3); }
.note-ok   { color: var(--ok); }
.note-warn { color: var(--warn); }
.note-bad  { color: var(--bad); }

.divider { height: 1px; background: var(--line-soft); margin: 22px 0; border: 0; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: -2px;
}
.btn-ghost .spinner, .note .spinner {
  border-color: rgba(107, 97, 104, .25); border-top-color: var(--text-2);
}
@keyframes spin { to { transform: rotate(360deg); } }

.dot-rec {
  width: 9px; height: 9px; border-radius: 50%; background: var(--bad);
  display: inline-block; animation: pulse 1.1s ease-in-out infinite;
  margin-inline-end: 7px;
}
@keyframes pulse { 50% { opacity: .22; } }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 12px; text-align: start; vertical-align: top;
         border-bottom: 1px solid var(--line-soft); }
th { color: var(--text-3); font-weight: 650; font-size: 12px;
     text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }

/* Anything the model wrote: the interview language is not always the site
   language, and a mixed Arabic/English sentence laid out in the wrong
   direction reorders itself. `plaintext` resolves each paragraph on its own. */
.bidi, [dir="auto"] { unicode-bidi: plaintext; text-align: start; }

.hide { display: none !important; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* mirrored glyphs: arrows that must follow reading direction */
[dir="rtl"] .flip { display: inline-block; transform: scaleX(-1); }

@media (max-width: 720px) {
  .shell { padding: 0 16px 60px; }
  .grid2 { grid-template-columns: 1fr; }
  .grid2 > .field + .field { margin-top: 16px; }
  h1 { font-size: 26px; }
  .card { padding: 20px; }
  .card-pad-lg { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .wesal-backdrop { display: none; }
  .wesal-stage.is-rig .wesal-rig { animation: none !important; }
  .wa-sway, .wesal-ring span, .dot-rec, .spinner { animation: none !important; }
  * { transition-duration: .01ms !important; }
}
