:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --line: #262626;
  --text: #f2f2f2;
  --text-secondary: #9a9a9a;
  --text-tertiary: #6e6e6e;
  --accent: #ff5c00;
  --accent-hover: #ff7a2e;
  --accent-soft: rgba(255, 92, 0, 0.14);
  --activity-empty: #1c1c1c;
  --cursor-fill: #0a0a0a;
  --cursor-stroke: #f2f2f2;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

@font-face {
  font-family: "Thmanyah Sans";
  src: url("assets/fonts/thmanyahsans-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Sans";
  src: url("assets/fonts/thmanyahsans-Medium.otf") format("opentype");
  font-weight: 500;
  font-display: swap;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizelegibility;
}

::selection {
  background: var(--accent);
  color: #000;
}

h1,
h2,
p {
  margin: 0;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

/* ---------- layout ---------- */

.page {
  position: relative;
  max-width: 36rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 3rem 1.5rem;
}

@media (min-width: 768px) {
  .page {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
}

/* language toggle */
.lang-toggle {
  position: absolute;
  top: 3rem;
  inset-inline-end: 1.5rem;
  border: none;
  font: inherit;
  z-index: 30;
}

@media (min-width: 768px) {
  .lang-toggle {
    top: 4rem;
  }
}

.lang-toggle-flag {
  font-size: 14px;
  line-height: 1;
}

/* Arabic mode */
html[lang="ar"] body {
  font-family: "Thmanyah Sans", "Geist", system-ui, -apple-system, "Segoe UI",
    Tahoma, Arial, sans-serif;
}

html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] .writing-toggle-title {
  letter-spacing: 0;
}

html[lang="ar"] .intro-bio,
html[lang="ar"] .writing-body {
  line-height: 2;
}

html[lang="ar"] .project-role {
  letter-spacing: 0;
}

html[lang="ar"] .activity-scroll {
  direction: ltr;
}

[dir="rtl"] .writing-toggle-chevron {
  transform: rotate(90deg);
}

[dir="rtl"] .writing-toggle[aria-expanded="true"] .writing-toggle-chevron {
  transform: rotate(0deg);
}

/* mount reveal wrappers (heights animated by JS) */
.mount {
  overflow: hidden;
  margin-bottom: 48px;
}

.mount-last {
  margin-bottom: 0;
}

.mount-inner {
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: flex-start;
}

.mount-inner-end {
  justify-content: flex-end;
}

/* ---------- intro ---------- */

.intro-mark {
  display: block;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.25rem;
  border-radius: 25%;
  object-fit: cover;
}

h1 {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: calc(2 / 1.5);
}

h2 {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: calc(2 / 1.5);
  color: var(--text);
}

.intro-bio {
  margin-top: 1rem;
  max-width: 32rem;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.75rem;
  color: var(--text-secondary);
}

/* ---------- keywords + tooltips ---------- */

.keyword {
  position: relative;
  color: var(--text);
  font-weight: 500;
  outline: none;
  transition: color 0.16s;
}

.keyword:hover,
.keyword:focus-visible {
  color: var(--accent);
}

.tooltip-bubble {
  position: fixed;
  z-index: 10;
  width: max-content;
  max-width: min(24rem, 100vw - 3rem);
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--line);
  color: var(--text);
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom;
  transform: translateY(calc(0.35rem - 100%)) scale(0.96);
  transition: opacity 0.16s, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.tooltip-bubble.is-open,
.keyword:focus-visible > .tooltip-bubble,
.activity-day:focus-visible > .tooltip-bubble {
  opacity: 1;
  transform: translateY(-100%) scale(1);
}

/* ---------- writing ---------- */

.writing-item {
  margin-top: 24px;
}

.writing-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  color: inherit;
  font: inherit;
  background: none;
  border: none;
  padding: 0;
}

.writing-toggle-title {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  transition: opacity 0.2s;
}

.writing-toggle-chevron {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--text);
  transform: rotate(-90deg);
  transform-origin: 50%;
  transition: opacity 0.2s, transform 0.3s var(--ease-out);
}

.writing-toggle[aria-expanded="true"] .writing-toggle-chevron {
  transform: rotate(0deg);
}

.writing-toggle:hover .writing-toggle-title,
.writing-toggle:hover .writing-toggle-chevron {
  opacity: 0.7;
}

.writing-body-wrap {
  overflow: hidden;
  height: 0;
  transition: height 0.45s var(--ease-out);
}

.writing-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 32rem;
  padding-top: 1.5rem;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--text-secondary);
}

/* ---------- projects ---------- */

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 2px;
}

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.project-preview {
  width: 100%;
  overflow: visible;
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--line);
  border-radius: 0.5rem;
  transition: box-shadow 0.16s;
}

.project-preview:hover {
  box-shadow: 0 0 0 2px var(--accent);
}

.project-cover {
  aspect-ratio: 40 / 21;
  width: 100%;
  border-radius: 0.5rem 0.5rem 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(80% 120% at 50% 0%, var(--accent-soft), transparent 70%),
    #101010;
}

.project-cover-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 22.5%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.project-body {
  padding: 1rem;
}

.project-body > p {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5rem;
  color: var(--text-secondary);
}

.project-ctas {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.project-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent);
  color: #000;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  padding: 0.24rem 0.48rem;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: opacity 0.16s, background 0.16s;
}

.project-cta:hover {
  background: var(--accent-hover);
}

.project-role {
  margin-inline-start: auto;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ---------- achievements & wins ---------- */

.wins {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.wins-intro {
  font-size: 15px;
  line-height: 1.5rem;
  color: var(--text-secondary);
}

.wins-frame {
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--line);
  border-radius: 0.5rem;
  overflow: hidden;
  margin: 2px;
}

.wins-gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  direction: ltr;
}

.wins-gallery::-webkit-scrollbar {
  display: none;
}

.wins-gallery img {
  display: block;
  width: 100%;
  flex-shrink: 0;
  aspect-ratio: 40 / 21;
  object-fit: cover;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.wins-gallery-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--line);
}

.wins-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-tertiary);
  transition: color 0.16s;
}

.wins-arrow:hover,
.wins-arrow:focus-visible {
  color: var(--accent);
}

.wins-dots {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.wins-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  border: none;
  padding: 0;
  background: var(--line);
  transition: background 0.16s, transform 0.16s;
}

.wins-dot.is-active {
  background: var(--accent);
  transform: scale(1.25);
}

.wins-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
}

.win-row {
  padding: 0.75rem 0;
}

.win-row + .win-row {
  border-top: 1px solid var(--line);
}

.win-badge-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.win-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.win-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.4;
  color: var(--text);
}

.win-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 0.35rem;
  padding: 0.14rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

.win-brief {
  margin-top: 0.375rem;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

html[lang="ar"] .win-title {
  letter-spacing: 0;
}

html[lang="ar"] .win-brief {
  line-height: 1.9;
}

/* ---------- activity ---------- */

.activity {
  margin-top: 1.5rem;
}

.activity-scroll {
  scrollbar-width: none;
  padding: 2px;
}

.activity-scroll::-webkit-scrollbar {
  display: none;
}

.activity-grid {
  display: grid;
  grid-template-rows: repeat(7, 8px);
  grid-auto-columns: 8px;
  grid-auto-flow: column;
  gap: 2px;
  width: max-content;
}

.activity-day {
  position: relative;
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--activity-empty);
  outline: none;
}

.activity-day[data-level="1"] { background: #6b2600; }
.activity-day[data-level="2"] { background: #b34100; }
.activity-day[data-level="3"] { background: #ff5c00; }
.activity-day[data-level="4"] { background: #ff9a4d; }

.activity-day[data-level]:not([data-level="0"]):hover,
.activity-day[data-level]:not([data-level="0"]):focus-visible {
  z-index: 20;
}

.activity-scroll-mobile {
  display: none;
}

@media (max-width: 575px) {
  .activity-scroll-desktop {
    display: none;
  }
  .activity-scroll-mobile {
    display: block;
    width: 100%;
  }
  .activity-grid-mobile {
    grid-template-rows: repeat(7, auto);
    grid-template-columns: repeat(30, minmax(0, 1fr));
    grid-auto-columns: unset;
    width: 100%;
    -webkit-user-select: none;
    user-select: none;
  }
  .activity-grid-mobile .activity-day {
    aspect-ratio: 1;
    width: 100%;
    height: auto;
  }
}

.activity-caption {
  margin-top: 0.75rem;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
}

.activity-caption a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.16s;
}

.activity-caption a:hover {
  color: var(--accent);
}

/* ---------- connect ---------- */

.connect-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 2px;
  color: var(--text-tertiary);
}

.connect-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.25rem;
  width: 1.25rem;
  color: inherit;
  transition: color 0.16s;
}

.connect-icon:hover,
.connect-icon:focus-visible {
  color: var(--accent);
}

.connect-card {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--line);
  color: var(--text-tertiary);
  border-radius: 0.35rem;
  padding: 0.25rem 0.375rem;
  text-decoration: none;
  transition: color 0.16s, background 0.16s, box-shadow 0.16s;
}

.connect-card-avatar {
  padding-left: calc(0.375rem - 2px);
}

.connect-card-icon {
  width: 19px;
  height: 19px;
  border-radius: 25%;
  object-fit: cover;
}

.connect-card-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color 0.16s;
}

.connect-card:hover,
.connect-card:focus-visible {
  background: #1c1c1c;
  box-shadow: 0 0 0 2px var(--accent);
  color: var(--text);
}

.connect-card:hover .connect-card-label,
.connect-card:focus-visible .connect-card-label {
  color: var(--text);
}

.ping-dot {
  position: relative;
  display: flex;
  height: 0.5rem;
  width: 0.5rem;
}

.ping-dot-wave {
  position: absolute;
  display: inline-flex;
  height: 100%;
  width: 100%;
  border-radius: 9999px;
  background: rgba(255, 92, 0, 0.6);
  opacity: 0.75;
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.ping-dot-core {
  position: relative;
  display: inline-flex;
  height: 0.5rem;
  width: 0.5rem;
  border-radius: 9999px;
  background: var(--accent);
}

@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* ---------- smooth cursor ---------- */

.has-smooth-cursor,
.has-smooth-cursor * {
  cursor: none !important;
}

.smooth-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform-origin: 12.5px 2.5px;
  will-change: transform;
  transition: opacity 0.25s;
}

.smooth-cursor.is-visible {
  opacity: 1;
}

.smooth-cursor svg {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  transform-origin: 12.5px 2.5px;
  transition: opacity 0.16s, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.cursor-hand {
  opacity: 0;
  transform: scale(0.72) rotate(-12deg);
}

.smooth-cursor.is-hand .cursor-arrow {
  opacity: 0;
  transform: scale(0.72) rotate(12deg);
}

.smooth-cursor.is-hand .cursor-hand {
  opacity: 1;
  transform: scale(1);
}

@media (pointer: coarse) {
  .smooth-cursor {
    display: none;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .smooth-cursor {
    display: none;
  }
  .tooltip-bubble {
    transition: opacity 0.12s;
    transform: translateY(-100%);
  }
  .writing-body-wrap,
  .writing-toggle-chevron,
  .mount {
    transition: none !important;
  }
  .ping-dot-wave {
    animation: none;
  }
}
