/* ------------------------------------------------------------------
   Theme tokens: terminal green on charcoal. No white backgrounds.
   ------------------------------------------------------------------ */
:root {
  --bg: #161816;
  --bg-deep: #161816;
  --surface: #1f221f;
  --surface-2: #306230;
  --line: #2b2f2b;
  --line-strong: #6b7368;
  --green: #9bbc0f;
  --green-2: #9bbc0f;
  --green-dim: #6b7368;
  --green-faint: #306230;
  --text: #f4f6ee;
  --text-soft: #f4f6ee;
  --muted: #9aa197;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-ar: "IBM Plex Sans Arabic", "Tajawal", "Segoe UI", Tahoma, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --topbar-h: 60px;
  --panel-w: 420px;
  --panel-h: 42vh;
  --edge: max(24px, 3vw);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 32% 45%, #1f221f 0%, rgba(22, 24, 22, 0) 70%),
    radial-gradient(circle at 1px 1px, #2b2f2b 1px, transparent 0) 0 0 / 28px 28px,
    var(--bg);
  background-attachment: fixed;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: 6px;
}

.ar {
  font-family: var(--font-ar);
  direction: rtl;
  unicode-bidi: isolate;
}

.skip {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--green);
  color: #161816;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus {
  top: 12px;
}

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 clamp(12px, 3vw, 32px);
  background: rgba(22, 24, 22, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}
/* The logo is shown exactly as supplied (no filters or tints). */
.brand__logo {
  flex: none;
  width: auto;
  height: 38px;
}
.logo {
  display: block;
  width: auto;
  height: auto;
}
.logo--intro {
  height: 76px;
}
.logo--outro {
  height: 60px;
}
.intro-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.intro-top .kicker {
  margin: 0;
}
.brand__name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--green);
  transform-origin: 0 50%;
  transform: scaleX(0);
  box-shadow: none;
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  color: var(--text);
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.btn .icon {
  width: 16px;
  height: 16px;
}
.btn--primary {
  background: var(--green);
  color: #161816;
}
.btn--primary:hover {
  background: var(--green);
  box-shadow: 0 0 0 3px #306230;
}
.btn--outline,
.btn--select {
  border-color: var(--green-dim);
  color: var(--green);
}
.btn--outline:hover,
.btn--select:hover {
  background: var(--green-faint);
  border-color: var(--green);
}
.btn--select {
  background: transparent;
}
.btn--ghost {
  border-color: var(--line);
  color: var(--text-soft);
}
.btn--ghost:hover {
  border-color: var(--green-dim);
  color: var(--green);
}
.btn--empty {
  border: 1px dashed #6b7368;
  color: var(--muted);
  cursor: not-allowed;
  font-weight: 500;
}
.btn--empty small {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.8;
}

/* ------------------------------------------------------------------ canvas + track */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  touch-action: pan-y;
}
.no-3d #scene {
  display: none;
}

.track {
  position: relative;
  z-index: 0;
  pointer-events: none;
}
.step {
  height: 100vh;
}

/* ------------------------------------------------------------------ cards */
.hud {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  z-index: 5;
  pointer-events: none;
}

.card {
  position: absolute;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim) transparent;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s ease-out, transform 0.16s ease-out, visibility 0s linear 0.16s;
}
.card.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), visibility 0s;
}
.is-loading .card {
  display: none;
}

/* Side layout: cards on the right, console on the left. */
.layout-side .card {
  right: var(--edge);
  top: 50%;
  width: var(--panel-w);
  max-height: calc(100% - 40px);
  transform: translate(16px, -50%);
}
.layout-side .card.is-active {
  transform: translate(0, -50%);
}

/* Bottom layout (phones, tablets in portrait): cards sit under the console. */
.layout-bottom .card {
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  width: min(640px, calc(100% - 20px));
  max-height: var(--panel-h);
  padding: 18px 18px 16px;
  transform: translate(-50%, 18px);
}
.layout-bottom .card.is-active {
  transform: translate(-50%, 0);
}

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 10px;
}

.card h1 {
  font-size: clamp(30px, 3.2vw, 44px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card h2 {
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.lead {
  margin-top: 14px;
  color: var(--text-soft);
  font-size: 15.5px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

/* Intro */
.role {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--green);
}
.intro-ar {
  margin-top: 16px;
  padding: 2px 14px 2px 0;
  border-right: 2px solid var(--green);
}
.intro-ar__name {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.35;
}
.intro-ar__role {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-soft);
}

/* Outro */
.outro-ar {
  margin-top: 8px;
  width: fit-content;
  font-size: 22px;
  font-weight: 600;
  color: var(--green);
}
.outro-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
}
.outro-foot a {
  color: var(--muted);
  text-decoration: none;
}
.outro-foot a:hover {
  color: var(--green);
}

/* ------------------------------------------------------------------ project panel */
.glyph {
  fill: var(--green);
}
.pj-head {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 16px;
  align-items: start;
}
.pj-glyph {
  width: 46px;
  height: 46px;
  padding: 6px;
  border: 1px solid var(--green-dim);
  border-radius: 10px;
  background: var(--bg);
}
.pj-head .kicker {
  margin-bottom: 4px;
}
.pj-head h2 .alt {
  font-weight: 500;
  color: var(--muted);
}
.pj-ar {
  margin-top: 4px;
  width: fit-content;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--green);
}
.pj-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 14px;
}
.ctx {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-soft);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--green-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  white-space: nowrap;
}
.tag--live {
  color: var(--green);
  background: var(--green-faint);
}
.tag--live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.tag--in-progress {
  border-style: dashed;
  color: var(--green);
}
.tag--completed {
  color: var(--text);
  background: #306230;
}

.pj-body {
  margin: 18px 0 0;
  display: grid;
  gap: 14px;
}
.pj-row {
  display: grid;
  gap: 4px;
}
.pj-body dt {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-2);
}
.pj-body dd {
  margin: 0;
  font-size: 15px;
  color: var(--text-soft);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}
.chips li {
  padding: 4px 10px;
  border-radius: 999px;
  border: 0;
  background: #306230;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #f4f6ee;
}

.pj-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.private {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px dashed var(--green-dim);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}
.private svg {
  width: 16px;
  height: 16px;
}

/* Item navigation: stays visible at the bottom of the panel. */
.pj-nav {
  position: sticky;
  bottom: -26px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px -28px -26px;
  padding: 12px 28px 14px;
  border-top: 1px solid var(--line);
  background: #1f221f;
  border-radius: 0 0 var(--radius) var(--radius);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.navbtn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}
.navbtn:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-faint);
}
.dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}
.dots i {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: #2b2f2b;
}
.dots i.on {
  width: 14px;
  background: var(--green);
  box-shadow: none;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Club roles */
.org {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--green);
}
.points {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.points li {
  position: relative;
  padding-left: 20px;
  font-size: 15px;
  color: var(--text-soft);
}
.points li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--green);
}

/* Skills & certificates */
.chips--lg {
  margin-top: 18px;
  gap: 8px;
}
.chips--lg li {
  padding: 7px 13px;
  font-size: 13px;
}
.certs {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.certs li {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid #2b2f2b;
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.certs strong {
  font-size: 15px;
  font-weight: 600;
}
.certs span {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
}

/* Intro motto and contact */
.motto {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--green);
}
.motto::before {
  content: "> ";
  color: var(--green-dim);
}
.actions--contact .btn--email {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu__go {
  color: var(--green-dim);
  font-size: 12px;
}

/* Compact panel on small screens */
.layout-bottom .card h1 {
  font-size: 28px;
}
.layout-bottom .card h2 {
  font-size: 21px;
}
.layout-bottom .lead {
  margin-top: 10px;
  font-size: 14.5px;
  line-height: 1.5;
}
.layout-bottom .actions {
  margin-top: 14px;
}
.layout-bottom .intro-ar {
  margin-top: 10px;
}
.layout-bottom .intro-ar__name {
  font-size: 21px;
}
.layout-bottom .intro-ar__role {
  font-size: 14px;
}
.layout-bottom .pj-head {
  grid-template-columns: 38px 1fr;
  gap: 12px;
}
.layout-bottom .pj-glyph {
  width: 38px;
  height: 38px;
  padding: 5px;
}
.layout-bottom .pj-ar {
  font-size: 18px;
}
.layout-bottom .pj-meta {
  margin-top: 10px;
}
.layout-bottom .pj-body {
  margin-top: 12px;
  gap: 10px;
}
.layout-bottom .pj-body dd {
  font-size: 14px;
  line-height: 1.5;
}
.layout-bottom .pj-links {
  margin-top: 14px;
}
.layout-bottom .btn {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

/* ------------------------------------------------------------------ scroll hint */
.scroll-hint {
  position: fixed;
  z-index: 4;
  bottom: 28px;
  left: calc((100vw - var(--panel-w) - 2 * var(--edge)) / 2);
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.3s;
}
.scroll-hint span {
  display: inline-block;
  color: var(--green);
  animation: nudge 2.2s ease-in-out infinite;
}
.scroll-hint.is-hidden,
.layout-bottom .scroll-hint {
  opacity: 0;
}
@keyframes nudge {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(3px);
  }
}

/* ------------------------------------------------------------------ menu */
.menu {
  padding: 0;
  margin: calc(var(--topbar-h) + 10px) var(--edge) auto auto;
  width: min(430px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - var(--topbar-h) - 30px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #1f221f;
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.menu[open] {
  display: flex;
}
.menu::backdrop {
  background: rgba(22, 24, 22, 0.75);
  backdrop-filter: blur(2px);
}
.menu__inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}
.menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.menu__head h2 {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}
.menu__close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: none;
  color: var(--text-soft);
  font-size: 14px;
  cursor: pointer;
}
.menu__close:hover {
  border-color: var(--green-dim);
  color: var(--green);
}
.menu__list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  flex: 1;
}
.menu__item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-decoration: none;
}
.menu__item:hover,
.menu__item:focus-visible {
  background: var(--surface-2);
  border-color: var(--line);
}
.menu__item[aria-current="true"] {
  border-color: var(--green-dim);
  background: var(--green-faint);
}
.menu__glyph {
  width: 34px;
  height: 34px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.menu__text {
  display: grid;
  min-width: 0;
}
.menu__title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
}
.menu__title .ar {
  margin-inline-start: 6px;
  color: var(--green);
  font-weight: 600;
}
.menu__tagline {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu__foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.menu__foot a {
  color: var(--muted);
  text-decoration: none;
}
.menu__foot a:hover {
  color: var(--green);
}

/* Phone: the menu is a bottom sheet */
.layout-bottom .menu {
  margin: auto 0 0 0;
  width: 100%;
  max-height: 80dvh;
  border-radius: 18px 18px 0 0;
  border-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 560px) {
  .brand__name {
    display: none;
  }
  .btn--select,
  .btn--ghost {
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }
  .menu__item .tag {
    display: none;
  }
}

@media (max-width: 340px) {
  .btn--select span {
    display: none;
  }
}

/* ------------------------------------------------------------------ misc */
.noscript {
  position: fixed;
  inset: auto 16px 16px 16px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  z-index: 50;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* Compact versions of the new parts on small screens */
.layout-bottom .pj-nav {
  bottom: -16px;
  margin: 14px -18px -16px;
  padding: 10px 18px 12px;
}
.layout-bottom .navbtn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
.layout-bottom .logo--intro {
  height: 52px;
}
.layout-bottom .logo--outro {
  height: 44px;
}
.layout-bottom .intro-top {
  margin-bottom: 8px;
}
.layout-bottom .motto {
  margin-top: 10px;
  font-size: 13.5px;
}
.layout-bottom .points li,
.layout-bottom .certs strong {
  font-size: 14px;
}
.layout-bottom .points {
  margin-top: 12px;
}
.layout-bottom .chips--lg {
  margin-top: 12px;
}
@media (max-width: 380px) {
  .layout-bottom .dots {
    display: none;
  }
}

/* ------------------------------------------------------------------
   Brand palette rules (override earlier rules):
   - #306230 fills always carry #f4f6ee text.
   - Panels and cards use the divider colour for their edges;
     #6b7368 is only for button and input outlines.
   ------------------------------------------------------------------ */
.card,
.menu {
  border-color: var(--line);
}
.btn--outline:hover,
.btn--select:hover,
.navbtn:hover {
  background: #306230;
  border-color: var(--green);
  color: var(--text);
}
.tag {
  border-color: transparent;
  background: #306230;
  color: var(--text);
}
.tag--live,
.tag--completed {
  color: var(--text);
  background: #306230;
}
.tag--in-progress {
  color: var(--text);
  background: #306230;
  border: 1px dashed var(--green);
}
.menu__item:hover,
.menu__item:focus-visible {
  background: var(--bg);
}
.menu__item[aria-current="true"] {
  background: #306230;
  border-color: #306230;
}
.menu__item[aria-current="true"] .ar,
.menu__item[aria-current="true"] .menu__tagline {
  color: var(--text);
}
.ctx {
  color: var(--muted);
}
.pj-body dd {
  color: var(--text);
}
.points li {
  color: var(--text);
}
