/* ==========================================================================
   إحراز — Home dashboard (home.html, assets/home.js), after the Eduzen learning
   dashboard, mirrored right-to-left: a big light greeting, soft white cards
   with 28px corners on the grey canvas (nav.css), purple + yellow for data,
   one purple button for the next step. Section colours come in as --k (icon),
   --t (tint) and --l (soft line) on each item.
   Only shapes move (gauge ticks, bars); text never animates.
   ========================================================================== */
.home-page .main { max-width: none; }
#hm-root { display: grid; gap: 16px; }
.db .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- header: the greeting, then one strip of numbers ---------- */
.home-page .dash-head { padding-top: 4px; align-items: flex-start; }
.home-page .dash-title { font-size: clamp(28px, 2.6vw, 38px); font-weight: var(--w-regular); line-height: 1.3; }
.hm-wave { display: inline-block; font-size: .85em; }
/* ---------- small square tiles beside the greeting: one number and one word each (the countdown is the gradient one) ---------- */
.home-page .dash-head { align-items: center; }
.home-page .dash-tools { gap: 12px; }
.db-squares { display: flex; gap: 10px; }
.db-sq { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; width: 124px; min-height: 92px; padding: 12px 16px; border-radius: 20px;
  background: var(--card-bg); color: var(--ink); text-decoration: none; transition: box-shadow var(--dur-fast); }
.db-sq b { font-size: 26px; font-weight: var(--w-regular); line-height: 1.1; align-self: flex-start; }
.db-sq__t { font-size: 12px; line-height: 1.4; color: var(--ink-2); }
a.db-sq:hover { box-shadow: 0 0 0 1px var(--border-strong); }
.db-sq--glow { background: var(--glow); color: #fff; }
.db-sq--glow .db-sq__t { color: rgba(255, 255, 255, .92); }
a.db-sq--glow:hover { box-shadow: 0 12px 24px -14px rgba(150, 100, 200, .6); }
a.db-sq:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- the grid: chart + today on top; level, week, skills under them ---------- */
.db { display: grid; gap: 16px; align-items: stretch;
  grid-template-columns: minmax(300px, .9fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "today chart chart" "level week skills"; }
.db-card { position: relative; min-width: 0; display: flex; flex-direction: column; padding: 18px 20px; border-radius: 24px; background: var(--card-bg); }
.db-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px; }
.db-head h2 { font-size: clamp(17px, 1.3vw, 20px); font-weight: var(--w-regular); line-height: 1.35; }
.db-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.db .icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* the round «open» button in a card's corner */
.db-go { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--lilac); color: var(--ink); transition: background-color var(--dur-fast), color var(--dur-fast); }
.db-go .icon { width: 15px; height: 15px; }
.db-go:hover { background: var(--ink); color: var(--on-accent); }
.db-pill { flex: none; padding: 6px 14px; border-radius: var(--r-pill); background: var(--lilac); font-size: 12.5px; color: var(--ink-2); transition: background-color var(--dur-fast); }
.db-pill:hover { background: var(--border); color: var(--ink); }
.db-ico { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--t); color: var(--k); }
.db-ico .icon { width: 17px; height: 17px; }
.db-sub { font-size: 14px; font-weight: var(--w-medium); margin-bottom: 4px; }
.db-sub small { font-size: 12.5px; color: var(--muted); font-weight: var(--w-regular); margin-inline-start: 4px; }
.db-none { font-size: 13.5px; color: var(--muted); padding: 6px 0; }

/* ---------- «أداؤك اليومي» ---------- */
.db-chart { grid-area: chart; }
.db-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: 12.5px; color: var(--ink); }
.db-legend li { display: inline-flex; align-items: center; gap: 8px; }
.db-legend li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--k); }
.db-plot { margin-top: auto; }
.db-plot__svg { position: relative; }
.db-plot__svg svg { display: block; width: 100%; height: auto; overflow: visible; }
.db-grid line { stroke: #d6d6db; stroke-width: 1; stroke-dasharray: 3 6; }
.db-yaxis text { font-family: var(--font); font-size: 12px; fill: var(--muted); direction: ltr; }
.db-mark circle:nth-child(1) { fill: var(--sun); opacity: .28; }
.db-mark circle:nth-child(2) { fill: var(--sun); }
.db-mark circle:nth-child(3) { fill: var(--ink); }
/* the feature tile: the purple-to-gold gradient, the newest change in a big light number */
.db-bubble { position: absolute; z-index: 2; display: grid; justify-items: center; gap: 2px; min-width: 110px; padding: 10px 16px; border-radius: 18px;
  background: var(--glow); color: #fff; text-align: center; white-space: nowrap; pointer-events: none;
  box-shadow: 0 18px 34px -16px rgba(150, 100, 200, .55); transform: translate(-50%, calc(-100% - 18px)); }
.db-bubble.is-start { transform: translate(-16%, calc(-100% - 18px)); }
.db-bubble.is-end { transform: translate(-84%, calc(-100% - 18px)); }
.db-bubble.is-low { transform: translate(-50%, 18px); }
.db-bubble.is-low.is-start { transform: translate(-16%, 18px); }
.db-bubble.is-low.is-end { transform: translate(-84%, 18px); }
.db-bubble b { font-size: 26px; font-weight: var(--w-regular); line-height: 1.15; }
.db-bubble small { font-size: 11.5px; opacity: .92; }
.db-empty { position: absolute; inset: 30% 14% auto; text-align: center; font-size: 14px; color: var(--muted); background: rgba(255, 255, 255, .9); padding: 12px 16px; border-radius: 16px; }
.db-xaxis { position: relative; height: 24px; margin: 6px 0 0; padding: 0; list-style: none; }
.db-xaxis li { position: absolute; top: 0; transform: translateX(-50%); font-size: 12px; color: var(--muted); white-space: nowrap; }
.db-xaxis .is-today { color: var(--ink); font-weight: var(--w-semibold); }

/* ---------- «خطة اليوم»: the gauge and the next step ---------- */
.db-today { grid-area: today; }
/* the number sits inside the arc; the caption under the arc's ends, never between them (it can be two lines) */
.db-gauge { position: relative; width: min(100%, 250px); margin: 4px auto 0; }
.db-gauge svg { display: block; width: 100%; height: auto; overflow: visible; }
.db-gauge line { stroke: #e6e6ea; stroke-width: 12; stroke-linecap: round; }
.db-gauge line.is-on { transition: stroke 260ms ease, stroke-opacity 260ms ease; transition-delay: calc(var(--i) * 26ms); }
.is-loaded .db-gauge line.is-on { stroke: var(--violet); stroke-opacity: var(--o); }
.db-gauge__arc { fill: none; stroke: #e6e6ea; stroke-width: 2; }
.db-gauge__dot { fill: var(--ink); }
.db-gauge__mid { display: grid; justify-items: center; gap: 6px; text-align: center; }
.db-gauge__mid strong { font-size: 34px; font-weight: var(--w-regular); line-height: 1.1; margin-top: -1.2em; }
.db-gauge__mid small { max-width: 100%; font-size: 13px; color: var(--ink-2); line-height: 1.6; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.db-today__acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: auto; padding-top: 14px; }
.db-today__acts .btn { min-height: 44px; padding-inline: 14px; font-size: 14px; white-space: normal; text-align: center; line-height: 1.4; }
.btn--soft { background: var(--violet-soft); color: var(--accent-press); }
.btn--soft:hover { background: #e4d8fd; }
/* ---------- «تقدّمك»: two big numbers over thick bars ---------- */
.db-level { grid-area: level; }
.db-bigs { display: grid; gap: 18px; margin-top: 6px; }
.db-big__n { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.db-big__go { margin-inline-start: auto; font-size: 12.5px; font-weight: var(--w-semibold); color: var(--accent); text-decoration: underline; text-decoration-color: var(--violet-2); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.db-big__n b { font-size: 32px; font-weight: var(--w-regular); line-height: 1.1; }
.db-big__n span { font-size: 14px; color: var(--ink-2); }
.db-big__n small { margin-inline-start: auto; font-size: 12.5px; color: var(--muted); }
/* the thick bar: a gradient fill on a striped track */
.db-bar { display: block; height: 6px; border-radius: 99px; background: var(--lilac); overflow: hidden; }
.db-bar i { display: block; height: 100%; border-radius: inherit; }
.db-bar--thick { height: 18px; background: repeating-linear-gradient(90deg, #e3e3e8 0 2px, transparent 2px 5px), var(--lilac); }
.db-bar--violet i { background: linear-gradient(to left, var(--violet), var(--violet-2)); }
.db-bar--sun i { background: linear-gradient(to left, var(--sun), var(--sun-2)); }
.db-bar--mint i { background: linear-gradient(to left, var(--mint), var(--mint-2)); }

/* ---------- «أسبوعك»: day pills, then at most three quiet task rows ---------- */
.db-week { grid-area: week; }
.db-days { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-bottom: 16px; }
.db-days button { display: grid; justify-items: center; gap: 2px; padding: 8px 0 10px; border: 0; border-radius: 16px; background: none; font: inherit; color: var(--ink); cursor: pointer; transition: background-color var(--dur-fast), color var(--dur-fast); }
.db-days button small { font-size: 11px; color: var(--muted); }
.db-days button b { font-size: 17px; font-weight: var(--w-medium); line-height: 1.2; }
.db-days .is-today:not([aria-selected="true"]) b { color: var(--accent); }
.db-days button:hover { background: var(--lilac); }
.db-days button[aria-selected="true"] { background: var(--ink); color: #fff; }
.db-days button[aria-selected="true"] small { color: rgba(255, 255, 255, .7); }
.db-days button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.db-dayview { flex: 1; }
.db-sub { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 13.5px; font-weight: var(--w-medium); }
.db-sub small { font-size: 12px; color: var(--muted); font-weight: var(--w-regular); }
.db-none { font-size: 13px; color: var(--muted); padding: 4px 0; }
.db-tasklist { display: grid; gap: 6px; }
.db-tk { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: var(--lilac); color: var(--ink); text-decoration: none; transition: background-color var(--dur-fast); }
a.db-tk:hover { background: var(--border); }
a.db-tk:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.db-tk b { min-width: 0; font-size: 13px; font-weight: var(--w-medium); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-tk__ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); color: var(--k); }
.db-tk__ico .icon { width: 15px; height: 15px; }
.db-tk__min { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.db-tk__ok { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: #fff; }
.db-tk__ok .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.db-tk__go { padding: 4px 14px; border-radius: var(--r-pill); background: var(--accent); color: #fff; font-size: 12.5px; font-weight: var(--w-semibold); }
.is-next .db-tk { background: var(--violet-soft); }
.is-next a.db-tk:hover { background: #e4d8fd; }
.is-done .db-tk b { color: var(--muted); }
.db-more { display: inline-block; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.db-more:hover { color: var(--ink); }

/* ---------- «مهاراتك»: a grid of soft tiles ---------- */
.db-skills { grid-area: skills; }
.db-skills__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.db-skill { position: relative; display: grid; align-content: start; gap: 2px; padding: 12px 14px 14px; border-radius: 18px;
  background: color-mix(in srgb, var(--t) 45%, var(--surface)); color: var(--ink); text-decoration: none; transition: background-color var(--dur-fast); }
.db-skill:hover { background: var(--t); }
.db-skill:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.db-skill .db-ico { width: 32px; height: 32px; margin-bottom: 6px; border-radius: 10px; background: var(--surface); }
.db-skill .db-ico .icon { width: 16px; height: 16px; }
.db-skill b { font-size: 14px; font-weight: var(--w-semibold); line-height: 1.4; }
.db-skill small { font-size: 11.5px; color: var(--ink-2); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-skill .db-bar { height: 4px; margin-top: 8px; background: rgba(255, 255, 255, .8); }
.db-skill .db-bar i { background: var(--k); }
/* something due for review: a small red dot in the corner */
.db-skill[data-review]::after { content: ""; position: absolute; top: 12px; inset-inline-end: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--terracotta); box-shadow: 0 0 0 3px rgba(255, 255, 255, .9); }

/* ---------- smaller screens ---------- */
@media (max-width: 1280px) {
  .db { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "today level" "chart chart" "week skills"; }
}
@media (max-width: 960px) {
  #hm-root, .db { gap: 12px; }
  /* phones: the greeting, then the three tiles in one row under it */
  .home-page .dash-head { flex-wrap: wrap; }
  .home-page .dash-tools { flex: 1 1 100%; }
  .db-squares { flex: 1; }
  .db-sq { flex: 1; width: auto; min-height: 78px; padding: 10px 12px; }
  .db-sq b { font-size: 22px; }
  .db { grid-template-columns: minmax(0, 1fr); grid-template-areas: "today" "chart" "week" "level" "skills"; }
  .db-card { padding: 16px; border-radius: 22px; }
  .db-xaxis li { font-size: 11.5px; }
  .db-bubble { min-width: 0; padding: 8px 12px; border-radius: 14px; }
  .db-bubble b { font-size: 20px; }
  .db-bubble small { font-size: 11.5px; }
}
@media (max-width: 560px) {
  .home-page .dash-title { font-size: 25px; }
  .db-days button small { font-size: 10px; }
  .db-gauge { width: min(100%, 220px); }
  .db-gauge__mid strong { font-size: 30px; }
  .db-big__n b { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .db-gauge line.is-on { transition: none; }
}
