/* Sudoku Cube — roadmap page (roadmap/ and <lang>/roadmap/), on top of site.css.
   Rendered by i18n/build.py from i18n/roadmap.json. Status is carried by the
   cube on the spine:
     shipped   solid, lit cyan cube
     testing   blue cube with a scan line: built, hidden while it is tested
     progress  orange cube that fills to its progress and turns slowly
     planned   magenta wireframe cube
   Everything uses logical properties so Arabic mirrors without overrides. */

/* Hero ------------------------------------------------------------------ */
.rm-hero { padding-block: 56px 40px; position: relative; overflow: hidden; }
.rm-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(45% 60% at 78% 40%, rgba(32,217,168,.13), transparent 65%),
    radial-gradient(40% 50% at 8% 100%, rgba(233,79,193,.10), transparent 60%);
}
.rm-hero .wrap { position: relative; display: grid; grid-template-columns: 1.2fr .8fr; gap: 32px; align-items: center; }
.rm-hero h1 { margin: 14px 0 16px; }
.rm-hero h1 span { color: var(--cyan); }
.rm-hero .lede { font-size: 19px; color: var(--muted); max-width: 52ch; }
.rm-updated { margin-top: 18px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--dim); letter-spacing: .06em; }

.tally { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; list-style: none; }
.tally li {
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
}
.tally b { font-family: 'Chakra Petch', sans-serif; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.tally span { font-size: 14px; color: var(--muted); }
.tally .t-shipped b { color: var(--cyan); }
.tally .t-progress b { color: var(--orange); }
.tally .t-planned b { color: var(--magenta); }

/* The hero reuses the landing page's cube loop (.cube-media in site.css). */
.rm-hero .cube-media { width: 100%; max-width: 400px; justify-self: end; }

/* Filters --------------------------------------------------------------- */
.rm-filters { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 8px 28px; }
.rm-filters button {
  font: inherit; font-size: 14px; color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; transition: color .15s, background .15s, border-color .15s;
}
.rm-filters button:hover { color: var(--text); background: var(--panel-2); }
.rm-filters button[aria-pressed="true"] { color: var(--text); background: var(--panel-2); border-color: #35507a; }
.rm-filters button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.dot { width: 9px; height: 9px; border-radius: 2px; transform: rotate(45deg); }
.dot.shipped { background: var(--cyan); }
.dot.progress { background: var(--orange); }
.dot.planned { border: 1.5px dashed var(--magenta); }

/* Timeline -------------------------------------------------------------- */
.timeline { position: relative; list-style: none; padding-block-end: 40px; --spine: 64px; }
.timeline::before, .timeline .fill {
  content: ''; position: absolute; inset-block: 0; inset-inline-start: 50%;
  width: 2px; margin-inline-start: -1px; background: var(--line); border-radius: 2px;
}
.timeline .fill {
  clip-path: inset(0 0 calc((1 - var(--p, 0)) * 100%) 0);
  background: linear-gradient(to bottom, var(--cyan) 0%, var(--cyan) calc(var(--now, 70) * 1%), var(--blue) calc(var(--now, 70) * 1% + 1%), var(--orange), var(--magenta));
  box-shadow: 0 0 12px rgba(32,217,168,.5);
}

.season {
  position: relative; z-index: 1; display: flex; justify-content: center; padding-block: 26px 14px;
}
.season span {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); background: var(--ground); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
}

.ev { position: relative; display: grid; grid-template-columns: 1fr var(--spine) 1fr; align-items: center; padding-block: 12px; }
.ev .card { grid-column: 1; grid-row: 1; }
.ev .node { grid-column: 2; grid-row: 1; }
.ev:nth-child(even of .ev) .card { grid-column: 3; }
.ev .card::before { /* connector from the card to the spine */
  content: ''; position: absolute; top: 50%; width: 22px; height: 1px; background: var(--line);
  inset-inline-end: -22px;
}
.ev:nth-child(even of .ev) .card::before { inset-inline-end: auto; inset-inline-start: -22px; }

.card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 20px; width: 100%; max-width: 460px; justify-self: end;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .5s, border-color .2s;
}
.ev:nth-child(even of .ev) .card { justify-self: start; }
.card:hover { border-color: #2b4263; }
.ev.planned .card { background: transparent; border-style: dashed; border-color: #3a2a45; }
.ev.progress .card { border-color: #4a3510; background: linear-gradient(160deg, #1a1a1c, var(--panel) 55%); }

.card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 8px; }
.when { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.ev.shipped .when { color: var(--cyan); }
.ev.progress .when { color: var(--orange); }
.ev.planned .when { color: var(--magenta); }
.kind {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; background: var(--panel-2); color: var(--muted);
}
.kind.achievement { color: #8fd0ff; background: rgba(40,160,255,.12); }
.version { margin-inline-start: auto; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--dim); }
.card h3 { font-size: 21px; margin-bottom: 6px; }
.card p { color: var(--muted); font-size: 15.5px; line-height: 1.55; }
.card .big-n { font-family: 'Chakra Petch', sans-serif; color: #8fd0ff; font-size: 44px; line-height: 1; margin-bottom: 4px; font-variant-numeric: tabular-nums; }

.meter { margin-top: 14px; }
.meter-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.meter-row b { color: var(--orange); font-variant-numeric: tabular-nums; }
.meter-track { height: 8px; border-radius: 8px; background: #241c10; overflow: hidden; }
.meter-track i {
  display: block; height: 100%; width: var(--w); border-radius: 8px;
  background: repeating-linear-gradient(-45deg, var(--orange) 0 8px, #ffbe45 8px 16px);
  background-size: 22.6px 22.6px; animation: stripes 1.2s linear infinite;
}
@keyframes stripes { to { background-position: 22.6px 0; } }
[dir="rtl"] .meter-track i { animation-direction: reverse; }

/* The spine cube: one small CSS 3D cube per milestone */
.node { display: grid; place-items: center; perspective: 300px; position: relative; z-index: 1; }
.cube {
  --s: 26px; width: var(--s); height: var(--s); position: relative;
  transform-style: preserve-3d; transform: rotateX(-28deg) rotateY(40deg);
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.cube i { position: absolute; inset: 0; border: 1.5px solid; border-radius: 3px; }
.cube i:nth-child(1) { transform: translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(2) { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(3) { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.ev:hover .cube { transform: rotateX(-28deg) rotateY(130deg); }

.shipped .cube i {
  border-color: #7ff0d0;
  background:
    linear-gradient(90deg, transparent 32%, rgba(10,16,24,.35) 32% 36%, transparent 36% 64%, rgba(10,16,24,.35) 64% 68%, transparent 68%),
    linear-gradient(0deg, transparent 32%, rgba(10,16,24,.35) 32% 36%, transparent 36% 64%, rgba(10,16,24,.35) 64% 68%, transparent 68%),
    var(--cyan);
}
.shipped .cube i:nth-child(5) { filter: brightness(1.25); }
.shipped .cube i:nth-child(2), .shipped .cube i:nth-child(4) { filter: brightness(.72); }
.shipped .node::after {
  content: ''; position: absolute; width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(rgba(32,217,168,.35), transparent 70%); z-index: -1;
}

.progress .cube { animation: node-spin 7s linear infinite; }
@keyframes node-spin { to { transform: rotateX(-28deg) rotateY(400deg); } }
.progress .cube i {
  border-color: var(--orange);
  background: linear-gradient(to top, rgba(245,162,11,.9) calc(var(--p) * 1%), rgba(245,162,11,.08) calc(var(--p) * 1%));
}
.progress .node::after {
  content: ''; position: absolute; width: 46px; height: 46px; border-radius: 50%;
  border: 1.5px solid var(--orange); opacity: 0; z-index: -1; animation: ping 2.4s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.5); opacity: 0; } }

.planned .cube i { border: 1.5px dashed var(--magenta); background: rgba(233,79,193,.05); }
.planned .cube { animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { translate: 0 -4px; } }

/* Under test: built but hidden. A blue cube with a scan line passing through it. */
.ev.testing .when { color: #8fd0ff; }
.ev.testing .card { border-color: #1d3d5c; background: linear-gradient(160deg, #0f2033, var(--panel) 55%); }
.kind.testing { color: #8fd0ff; background: rgba(40,160,255,.12); }
.testing .cube i {
  border-color: var(--blue);
  background: linear-gradient(to bottom, rgba(40,160,255,.08) 0 40%, rgba(143,208,255,.95) 40% 52%, rgba(40,160,255,.08) 52%) 0 0 / 100% 250% no-repeat, rgba(40,160,255,.18);
  animation: scan 2.2s ease-in-out infinite;
}
@keyframes scan { from { background-position: 0 100%, 0 0; } to { background-position: 0 0, 0 0; } }
.dot.testing { background: var(--blue); }
.tally .t-testing b { color: var(--blue); }
.test-note { margin-top: 12px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: #8fd0ff; }
.test-note::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 8px var(--blue); animation: warm 1.6s ease-in-out infinite; }

/* Small additions: a compact card and a smaller cube */
.ev.small .card { padding: 12px 16px 14px; }
.ev.small .card h3 { font-size: 16.5px; margin-bottom: 2px; }
.ev.small .card p { font-size: 14px; }
.ev.small .card-top { margin-bottom: 4px; }
.ev.small .cube { --s: 17px; }
.ev.small.shipped .node::after { width: 28px; height: 28px; }

/* Work running in parallel: two cards on one row, joined at a shared cube */
.ev.pair .card:nth-of-type(1) { grid-column: 1; justify-self: end; }
.ev.pair .card:nth-of-type(2) { grid-column: 3; justify-self: start; }
.ev.pair .card:nth-of-type(1)::before { inset-inline-start: auto; inset-inline-end: -22px; }
.ev.pair .card:nth-of-type(2)::before { inset-inline-end: auto; inset-inline-start: -22px; }
.ev.pair .node { flex-direction: column; gap: 10px; }
.pair-label {
  position: absolute; top: -8px; left: 50%; translate: -50% 0; white-space: nowrap; z-index: 1;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--orange); background: var(--ground); padding: 2px 10px; border: 1px dashed #4a3510; border-radius: 999px;
}
.ev.pair { padding-block-start: 30px; }

/* "You are here" marker between shipped work and work in progress */
.now {
  position: relative; z-index: 1; display: flex; justify-content: center; padding-block: 22px;
}
.now span {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ground); background: var(--orange); border-radius: 999px; padding: 7px 16px;
  box-shadow: 0 0 0 6px var(--ground), 0 0 28px rgba(245,162,11,.45);
}
.now span::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ground); animation: warm 1.6s ease-in-out infinite; }

/* Entry motion. Items visible at load are never hidden; only items below the
   fold are parked, and only when motion is allowed. */
.ev.is-pending .card { opacity: 0; transform: translateX(calc(var(--dir, -1) * 28px)); }
.ev.is-pending .cube { transform: rotateX(-28deg) rotateY(-140deg) scale(.4); }
.ev:nth-child(even of .ev) { --dir: 1; }
[dir="rtl"] .ev { --dir: 1; }
[dir="rtl"] .ev:nth-child(even of .ev) { --dir: -1; }

.rm-foot-note { color: var(--dim); font-size: 14px; max-width: 62ch; padding-block: 8px 56px; }

/* Narrow screens: the spine moves to the start edge, every card on one side */
@media (max-width: 760px) {
  .rm-hero .wrap { grid-template-columns: 1fr; }
  .rm-hero .cube-media { max-width: 340px; justify-self: center; }
  .timeline { --spine: 44px; }
  .timeline::before, .timeline .fill { inset-inline-start: calc(var(--spine) / 2); }
  .ev { grid-template-columns: var(--spine) 1fr; column-gap: 14px; }
  .ev .node { grid-column: 1; }
  .ev .card, .ev:nth-child(even of .ev) .card { grid-column: 2; justify-self: stretch; max-width: none; }
  .ev .card::before, .ev:nth-child(even of .ev) .card::before { inset-inline-start: -14px; inset-inline-end: auto; width: 14px; }
  .ev.pair { row-gap: 12px; align-items: start; }
  .ev.pair .card:nth-of-type(1), .ev.pair .card:nth-of-type(2) { grid-column: 2; justify-self: stretch; }
  .ev.pair .card:nth-of-type(2) { grid-row: 2; }
  .ev.pair .card:nth-of-type(1)::before, .ev.pair .card:nth-of-type(2)::before { inset-inline-start: -14px; inset-inline-end: auto; }
  .ev.pair .node { grid-row: 1 / 3; align-self: center; }
  .pair-label { left: auto; translate: none; inset-inline-start: calc(var(--spine) + 14px); }
  .season, .now { justify-content: flex-start; }
  .ev, .ev:nth-child(even of .ev) { --dir: -1; }
  [dir="rtl"] .ev, [dir="rtl"] .ev:nth-child(even of .ev) { --dir: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .progress .cube, .planned .cube, .progress .node::after, .testing .cube i, .test-note::before,
  .meter-track i, .now span::before { animation: none; }
  .card, .cube { transition: none; }
}

/* Arabic: tracking pulls the cursive joins apart, and the mono face has no
   Arabic glyphs, so every mono label falls back to the body face. The version
   tag carries dir="ltr" and keeps its mono look. */
[dir="rtl"] .when, [dir="rtl"] .kind, [dir="rtl"] .season span, [dir="rtl"] .now span,
[dir="rtl"] .rm-updated, [dir="rtl"] .pair-label {
  letter-spacing: normal; font-family: 'Manrope', system-ui, sans-serif;
}
