/* Home screen (#home): the hub that opens after sign-in. body.is-home is set by setView (app.js) while #home
   is the active screen. Content and header buttons are built by home.js. Layout follows the approved design
   (HANDSCRIPT-assets/design/home-mockup.png): a header on the Hero scene, the welcome, the start card, four
   pastel cards and the latest conversation. Small text keeps a 4.5:1 contrast and large text 3:1 in both
   themes (checked in tests/browser_home_screen.cjs); where a design colour fell short, the nearest passing
   colour is used. */
:root,:root[data-theme=light]{
 --hs-home-tone-chat:#2F55D4;--hs-home-tone-chat-bg:#FBE3C2;--hs-home-card-chat:#FFF5E6;
 --hs-home-tone-text:#3B3FC9;--hs-home-tone-text-bg:#DEDAFB;--hs-home-card-text:#F2F0FF;
 --hs-home-tone-learn:#0F4C5C;--hs-home-tone-learn-bg:#C9F0E1;--hs-home-card-learn:#E6F8F0;
 --hs-home-badge:#C81E45;
 --hs-home-welcome:var(--hs-ink);--hs-home-name:#0A7686;--hs-home-slogan:var(--hs-muted);
 /* Start card: navy text on a turquoise gradient (6:1 or more at both ends). */
 --hs-home-start-a:#6CECEC;--hs-home-start-b:#14A4AE;--hs-home-start-ink:#062F3B;--hs-home-start-line:#062F3B33;
 /* The design's dark camera circle becomes a light one in Light (no dark surface in the light theme). */
 --hs-home-start-icon:#F2FFFE;--hs-home-start-icon-ink:#0B4F5C;
 --hs-home-avatar:#D7EEF1;--hs-home-avatar-ink:#0B4F5C;
}
:root[data-theme=dark]{
 --hs-home-tone-chat:#FDBA74;--hs-home-tone-chat-bg:#43291A;--hs-home-tone-text:#C4B5FD;--hs-home-tone-text-bg:#2E2552;
 --hs-home-tone-learn:#6EE7B7;--hs-home-tone-learn-bg:#123F35;
 --hs-home-card-chat:var(--hs-surface);--hs-home-card-text:var(--hs-surface);--hs-home-card-learn:var(--hs-surface);
 --hs-home-welcome:#f4f7ff;--hs-home-name:#2EE2E6;--hs-home-slogan:#d1dbee;
 /* Turquoise to petroleum, white text (5.9:1 or more at both ends). */
 --hs-home-start-a:#127A84;--hs-home-start-b:#0A3A47;--hs-home-start-ink:#fff;--hs-home-start-icon:#062A33;--hs-home-start-icon-ink:#fff;--hs-home-start-line:#ffffff4d;
 --hs-home-avatar:#1F3B4A;--hs-home-avatar-ink:#9BE7EE;
}

/* The brand returns to the home screen from every section (index.html: <a class="brand" href="#home">). */
.sidebar a.brand{color:inherit;text-decoration:none;border-radius:16px}
.sidebar a.brand:focus-visible{outline:2px solid var(--nav-focus,#5B4BD6);outline-offset:4px}
.sidebar .brand .hs-brand-tagline{display:block;margin-top:2px;font-size:12px;font-weight:700;line-height:1.4;color:var(--hs-muted);text-align:center}

/* Header on the scene (home only): no bar of its own. The bell, the account and the theme and language switches
   (icon buttons, same handlers as in the other sections); the private-processing and AI chips stay hidden here. */
body.is-home .main-area{position:relative}
html body.is-home .command-bar{position:absolute;z-index:4;top:21px;inset-inline-end:40px;min-height:0;padding:0;border:0;background:none}
body.is-home .command-bar > .breadcrumb,
body.is-home .command-bar .command-actions > :is(.secure-chip,.date-chip){display:none!important}
body.is-home .command-bar .command-actions{gap:8px}
body.is-home .command-bar .workspace-controls{margin:0;gap:8px}
html[data-theme] body.is-home:not(.auth-gate) .command-bar .workspace-controls button{width:44px;height:44px;min-width:44px;min-height:44px;padding:0;
  border:1px solid var(--hs-control-line);border-radius:50%;background:var(--hs-control);color:var(--hs-control-ink);box-shadow:none}
body.is-home .command-bar .workspace-controls button > span{display:none}
body.is-home .command-bar .workspace-controls svg{width:22px;height:22px}
body.phase8:not(.auth-gate):has(#home.is-active) > .semantic-motion{display:none}

/* Hero: the welcome, the product name and the line on Palestine, in place of the old title and paragraph. */
#home .hs-home-title{margin:0;display:grid;gap:2px;letter-spacing:0}
#home .hs-home-welcome{font-size:clamp(28px,2.6vw,40px);font-weight:800;line-height:1.35;color:var(--hs-home-welcome)}
/* The user's name stays on one line; a long one ends with an ellipsis instead of widening the page. */
#home .hs-home-user{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}
#home .hs-home-name{font-family:'Space Grotesk',Cairo,sans-serif;font-size:clamp(36px,3.8vw,58px);font-weight:700;line-height:1.1;letter-spacing:.02em;color:var(--hs-home-name);direction:ltr;unicode-bidi:isolate}
#home .hs-home-slogan{display:flex;align-items:center;gap:8px;margin:14px 0 0;font-size:16px;font-weight:600;line-height:1.7;color:var(--hs-home-slogan)}
#home .hs-home-heart{flex:none;width:20px;height:20px;fill:var(--hs-home-name);stroke:none}
/* The scene is dark until the light footage layer is live; the copy follows (hero-background.css does the same). */
html[data-theme=light] #handscript-hero:not(:has(.hs-hero-media.is-adaptive)){--hs-home-welcome:#f4f7ff;--hs-home-name:#2EE2E6;--hs-home-slogan:#d1dbee}
@media (max-width:820px){ html[data-theme=light] #handscript-hero{--hs-home-welcome:var(--hs-ink);--hs-home-name:#0A7686;--hs-home-slogan:var(--hs-muted)} }

/* Content under the Hero: phone layout first. */
#home .hs-home-content{display:grid;gap:14px}
#home :is(.hs-home-start,.hs-home-card,.hs-home-last){text-decoration:none;min-width:0;-webkit-tap-highlight-color:transparent}
#home :is(.hs-home-start,.hs-home-card,.hs-home-last):focus-visible{outline:3px solid var(--hs-link);outline-offset:3px}
#home .hs-home-content svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#home .hs-home-chevron{width:20px;height:20px;stroke-width:2.2}
html[dir="ltr"] #home .hs-home-chevron{transform:scaleX(-1)}

/* Start card: camera in a dark circle at the start, arrow in a clear circle at the end, then the privacy line. */
#home .hs-home-start{display:grid;gap:14px;padding:20px 18px 14px;border-radius:24px;color:var(--hs-home-start-ink);
  background:linear-gradient(120deg,var(--hs-home-start-a),var(--hs-home-start-b));box-shadow:0 18px 36px -20px var(--hs-shadow),inset 0 1px 0 #ffffff59}
#home .hs-home-start-main{display:flex;align-items:center;gap:16px}
#home .hs-home-start-icon{flex:none;display:grid;place-items:center;width:76px;height:76px;border-radius:50%;color:var(--hs-home-start-icon-ink);background:var(--hs-home-start-icon);box-shadow:0 10px 22px -12px #021a20}
#home .hs-home-start-icon svg{width:36px;height:36px;stroke-width:2}
#home .hs-home-start-body{flex:1;display:grid;gap:4px;min-width:0}
#home .hs-home-start-title{font-size:21px;font-weight:800;line-height:1.35}
#home .hs-home-start-text{font-size:15px;font-weight:600;line-height:1.6}
#home .hs-home-go{flex:none;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;border:1.5px solid var(--hs-home-start-line)}
#home .hs-home-start-foot{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;padding-top:12px;border-top:1px solid var(--hs-home-start-line);font-size:12px;font-weight:600;line-height:1.7}
#home .hs-home-privacy{display:flex;align-items:center;gap:8px}
#home .hs-home-privacy svg{flex:none;width:18px;height:18px}
#home .hs-home-offline-badge{padding:2px 10px;border-radius:999px;background:var(--hs-home-start-icon);color:var(--hs-home-start-icon-ink);font-weight:800}

/* Section cards: pastel surfaces in Light, the card surface in Dark; coloured icon tiles and a small arrow chip. */
#home .hs-home-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
#home .hs-home-card{display:grid;grid-template-columns:1fr auto;grid-template-areas:"tile go" "body body";align-items:start;gap:10px;padding:14px 14px 16px;
  border-radius:20px;border:1px solid var(--hs-line);color:var(--hs-ink);box-shadow:0 12px 26px -20px var(--hs-shadow)}
:root:not([data-theme=dark]) #home .hs-home-card{border-color:#ffffffb3}
#home .hs-home-card[data-card="chat"]{background:var(--hs-home-card-chat)}
#home .hs-home-card[data-card="text"]{background:var(--hs-home-card-text)}
#home .hs-home-card[data-card="learn"]{background:var(--hs-home-card-learn)}
#home .hs-home-tile{grid-area:tile;justify-self:start;display:grid;place-items:center;width:54px;height:54px;border-radius:18px}
#home .hs-home-tile svg{width:30px;height:30px;stroke-width:2}
#home .tone-chat{color:var(--hs-home-tone-chat);background:var(--hs-home-tone-chat-bg)}
#home .tone-text{color:var(--hs-home-tone-text);background:var(--hs-home-tone-text-bg)}
#home .tone-learn{color:var(--hs-home-tone-learn);background:var(--hs-home-tone-learn-bg)}
#home .hs-home-card-go{grid-area:go;display:grid;place-items:center;width:26px;height:32px;border-radius:10px;background:#ffffff8c;color:var(--hs-muted)}
:root[data-theme=dark] #home .hs-home-card-go{background:var(--hs-surface-2)}
#home .hs-home-card-go .hs-home-chevron{width:16px;height:16px}
#home .hs-home-card-body{grid-area:body;display:grid;gap:2px;min-width:0}
#home .hs-home-card-title{font-size:16px;font-weight:800;line-height:1.4;color:var(--hs-ink)}
#home .hs-home-card-text{font-size:13px;line-height:1.6;color:var(--hs-muted)}
/* Three cards since «السجل» was removed (2026-11-19): in two columns an odd last card spans the row as a
   horizontal card (icon, text, arrow), so the grid has no hole; four columns become one row of equal cards. */
#home .hs-home-card:last-child:nth-child(odd){grid-column:1/-1;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"tile body go";align-items:center;column-gap:14px}

/* Latest conversation: initials avatar, name and a continue or unread line; never the message text. */
#home .hs-home-last{display:flex;align-items:center;gap:14px;padding:14px 16px;border-radius:20px;border:1px solid var(--hs-line);background:var(--hs-surface);color:var(--hs-ink);
  box-shadow:0 12px 26px -20px var(--hs-shadow)}
#home .hs-home-avatar{flex:none;display:grid;place-items:center;width:56px;height:56px;border-radius:50%;color:var(--hs-home-avatar-ink);font-size:24px;font-weight:800;
  background:var(--hs-home-avatar)}
#home .hs-home-avatar[hidden]{display:none}
#home .hs-home-last-body{flex:1;display:grid;gap:1px;min-width:0}
#home .hs-home-last-label{font-size:12px;color:var(--hs-muted)}
#home .hs-home-last-name{font-size:17px;font-weight:800;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#home .hs-home-last-name:empty{display:none}
#home .hs-home-last-line{font-size:13px;line-height:1.6;color:var(--hs-muted)}
#home .hs-home-last[data-state="error"] .hs-home-last-line{color:var(--hs-danger-ink)}
#home .hs-home-last > .hs-home-card-go{width:32px;height:32px;background:none;color:var(--hs-ink)}

/* Header buttons (home only): messages bell with the unread count, and the account. */
.command-bar .hs-home-header-actions{display:none;align-items:center;gap:8px}
body.is-home .command-bar .hs-home-header-actions{display:flex}
.hs-home-header-button{position:relative;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;
  border:1px solid var(--hs-control-line);background:var(--hs-control);color:var(--hs-control-ink);text-decoration:none}
.hs-home-header-button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.hs-home-header-button:focus-visible{outline:2px solid var(--hs-link);outline-offset:2px}
.hs-home-badge{position:absolute;top:-4px;inset-inline-end:-4px;min-width:18px;height:18px;padding:0 5px;box-sizing:border-box;border-radius:999px;
  background:var(--hs-home-badge,#C81E45);color:#fff;font-size:11px;font-weight:800;line-height:18px;text-align:center}
.hs-home-badge[hidden]{display:none}

@media (max-width:760px){
  /* No bottom dock on the home screen; it stays in every other section. */
  body.is-home > nav.mobile-dock{display:none!important}
  /* Sections leave 156px for the dock (mobile-fixes.css); home only needs the safe area. */
  body.is-home #home.screen.is-active{padding-bottom:calc(24px + env(safe-area-inset-bottom))}
  /* The logo and tagline sit on the scene at the start, the bell and account at the end. */
  html[data-theme] body.is-home:not(.auth-gate) .app-shell > .sidebar{position:absolute;inset:0 0 auto;z-index:3;padding:12px 16px 0;background:transparent;border-bottom:0}
  html[data-theme] body.is-home:not(.auth-gate) .app-shell > .sidebar .brand{justify-content:flex-start;gap:8px;padding:0}
  html[data-theme] body.is-home:not(.auth-gate) .app-shell > .sidebar .brand .brand-glyph{width:52px;height:52px}
  html[data-theme] body.is-home .sidebar .brand .hs-brand-tagline{margin:0;font-size:13px;text-align:start}
  html[data-theme=dark] body.is-home .sidebar .brand .hs-brand-tagline{color:#d1dbee}
  html body.is-home .command-bar{top:20px;inset-inline-end:16px}
  /* Four 44px buttons (194px) at the end; the logo and tagline keep the rest and the tagline wraps before it reaches them. */
  html body.is-home .command-bar :is(.command-actions,.workspace-controls,.hs-home-header-actions){gap:6px}
  html[data-theme] body.is-home:not(.auth-gate) .app-shell > .sidebar .brand{max-width:calc(100% - 214px)}
  html[data-theme] body.is-home .sidebar .brand .hs-brand-tagline{font-size:12px;line-height:1.35}
}

/* Phone and small tablet. UI audit 2026-12-01 I11: the footage is its own 16:9 row at the TOP of the scene (the header
   sits on it; the scene is one column, hero-background.css) and the welcome is the next row, so the hand and the
   network never run behind the words (they used to fill the whole scene behind the welcome). */
@media (max-width:820px){
  #home > #handscript-hero{min-height:0;padding:0 0 22px;margin-bottom:14px}
  #home > #handscript-hero .hs-hero-media{position:relative;inset:auto;grid-row:1;width:100%;height:auto;aspect-ratio:16/9}
  #home > #handscript-hero > div{grid-row:2}
  #home > #handscript-hero > div{margin-inline:20px}
  #home .hs-home-welcome{font-size:29px}
  #home .hs-home-name{font-size:38px}
  #home .hs-home-slogan{margin-top:10px;font-size:15px}
  /* Nothing runs behind the words any more, so no shade is needed over them. */
  #home > #handscript-hero .hs-hero-contrast{display:none}
  #home .hs-home-start-main{gap:12px}
  #home .hs-home-start-icon{width:66px;height:66px}
  #home .hs-home-start-icon svg{width:32px;height:32px}
  #home .hs-home-start-title{font-size:20px;white-space:nowrap}
  #home .hs-home-go{width:40px;height:40px}
}
@media (max-width:760px){ #home > #handscript-hero{padding-bottom:26px} }

/* Computer: the start card (8 of 12 columns) beside the latest conversation (4), then the section cards. */
@media (min-width:761px){
  #home .hs-home-content{grid-template-columns:repeat(12,minmax(0,1fr));gap:18px}
  #home .hs-home-start{grid-column:span 8;padding:24px 24px 16px}
  #home .hs-home-start-title{font-size:23px}
  #home .hs-home-last{grid-column:span 4;flex-direction:column;align-items:flex-start;justify-content:center;text-align:start}
  #home .hs-home-last > .hs-home-card-go{display:none}
  #home .hs-home-content:not(:has(.hs-home-last)) .hs-home-start{grid-column:1/-1}
  #home .hs-home-cards{grid-column:1/-1;order:2;gap:18px}
  #home .hs-home-card{padding:18px}
}
@media (min-width:1240px){
  #home .hs-home-cards{grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr)}
  #home .hs-home-card:last-child:nth-child(odd){grid-column:auto;grid-template-columns:1fr auto;grid-template-areas:"tile go" "body body";align-items:start;column-gap:10px}
}

/* A shorter scene on the home screen of a computer so the cards start within the first screen
   (hero-background.css: min-height clamp(560px,39vw,720px), padding 170px/164px). The header sits on it. */
@media (min-width:821px){
  #home > #handscript-hero{min-height:clamp(420px,31vw,560px);padding-top:108px;padding-bottom:100px}
  #home > #handscript-hero .hs-hero-contrast{top:106px;bottom:100px}
}

/* Profile photos (profile-photo.js) over the initial: the header account button and the «آخر محادثة» avatar keep
   their size, shape and focus ring; the initial stays underneath as the fallback. */
.hs-home-account{overflow:hidden}
.hs-home-account>img.hs-photo,#home .hs-home-avatar>img.hs-photo{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:50%}
#home .hs-home-avatar{position:relative;overflow:hidden}

/* «من نحن» footer link (home.js): small, centred under the cards, a 44 px tap target. */
#home .hs-home-footer{margin:18px 0 0;text-align:center;font-size:14px}
#home .hs-home-about{display:inline-flex;align-items:center;min-height:44px;padding:0 14px;color:var(--hs-muted,inherit);text-decoration:underline;text-underline-offset:3px}
#home .hs-home-about:hover{color:var(--hs-link,inherit)}
