/* ──────────────────────────────────────────────────────
   Issam Gharsallah · portfolio
   Dark · serif/sans · warm-black · amber glow
   ────────────────────────────────────────────────────── */

:root {
  /* palette — warm dark theme */
  --bg:           #14120B;
  --bg-2:         #1B1810;
  --bg-3:         #221E14;
  --line:         rgba(237, 236, 236, .08);
  --line-strong:  rgba(237, 236, 236, .14);
  --ink:          #EDECEC;             /* near-white */
  --ink-soft:     rgba(237, 236, 236, .70);   /* ≈ 8:1 */
  --ink-mute:     rgba(237, 236, 236, .62);   /* ≈ 6.5:1 */
  --ink-faint:    rgba(237, 236, 236, .50);   /* ≈ 4.7:1 — AA */

  --orange:       #F97316;
  --orange-soft:  rgba(249, 115, 22, .14);
  --orange-glow:  rgba(249, 115, 22, .55);
  --green:        #34D399;

  /* fonts */
  --f-serif:      "Gilda Display", "Times New Roman", serif;
  --f-italic:     "Instrument Serif", "Times New Roman", serif;
  --f-sans:       "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
  --f-mono:       "Geist Mono", ui-monospace, monospace;

  /* layout */
  --col:          720px;        /* main reading column */
  --pad-x:        clamp(1.25rem, 4vw, 2.25rem);

  /* motion */
  --ease:         cubic-bezier(.2, .7, .2, 1);
  --ease-out:     cubic-bezier(.16, 1, .3, 1);
}

/* ── reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; scroll-behavior: smooth; scroll-padding-top: 24px; scroll-padding-bottom: 96px; }
img, svg { display: block; max-width: 100%; }
button, a { color: inherit; }
ul, ol { list-style: none; padding: 0; margin: 0; }
em, i { font-style: italic; }

body {
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  font-feature-settings: "ss01";
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

::selection { background: var(--orange); color: var(--bg); }

a { color: inherit; text-decoration: none; transition: color .2s var(--ease); }

/* ── ambient glow (top-right amber) ── */
.glow {
  position: fixed;
  top: -20%;
  right: -10%;
  width: 80vw;
  height: 80vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(50% 50% at 50% 50%, var(--orange-glow) 0%, transparent 65%);
  filter: blur(40px);
  opacity: .55;
}
.glow::after {
  content: "";
  position: absolute;
  inset: 18% 18% auto auto;
  width: 38%;
  height: 38%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 200, 110, .55) 0%, transparent 70%);
  filter: blur(20px);
}

/* ── page container ── */
.page {
  position: relative;
  z-index: 1;
  max-width: var(--col);
  margin: 0 auto;
  padding: clamp(2.5rem, 8vw, 5.5rem) var(--pad-x) 8rem;
}

/* ── HERO ── */
.hero { padding-top: 1rem; }

.hero__row {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-bottom: 2rem;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background:
    radial-gradient(120% 120% at 30% 20%, #3a311e 0%, #1d1810 60%, #14120B 100%);
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 22px -8px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.04);
  position: relative;
  overflow: hidden;
}
.avatar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 50% at 70% 25%, rgba(249, 165, 80, .35) 0%, transparent 65%);
}
.avatar__mono {
  position: relative;
  font-family: var(--f-serif);
  font-size: 20px;
  letter-spacing: -.02em;
  color: var(--ink);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: 13px;
  line-height: 1;
  padding: .42rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(237, 236, 236, .03);
  color: var(--ink-soft);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pill--status .pill__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .6);
  animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.hero__name {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 36px;
  letter-spacing: -0.6px;
  color: var(--ink);
  margin: 0 0 1.6rem;
}

.hero__bio {
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 26px;
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
  max-width: 64ch;
}
.hero__bio strong {
  color: var(--ink);
  font-weight: 500;
}
.hero__bio em {
  font-family: var(--f-italic);
  font-size: 19px;
  font-style: italic;
  color: var(--ink);
  letter-spacing: -.005em;
  line-height: 1;
  vertical-align: -1px;
}

.hero__cta {
  font-size: 14.5px;
  color: var(--ink-mute);
  margin: 0;
}
.hero__cta a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  transition: text-decoration-color .25s var(--ease), color .25s var(--ease);
}
.hero__cta a:hover {
  color: var(--orange);
  text-decoration-color: var(--orange);
}

/* ── BLOCKS ── */
.block {
  margin-top: clamp(4rem, 9vw, 6rem);
}
.block__title {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: 22px;
  line-height: 28px;
  letter-spacing: -0.4px;
  color: var(--ink);
  margin: 0 0 1.75rem;
}
.block__lede {
  font-size: 15px;
  line-height: 24px;
  color: var(--ink-mute);
  margin: -1rem 0 2rem;
  max-width: 56ch;
}

/* ── PROJECTS GRID ── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(.85rem, 1.5vw, 1.1rem);
}
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.proj {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  transition: transform .4s var(--ease-out), border-color .4s var(--ease-out);
  position: relative;
  isolation: isolate;
}
.proj:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
}

.proj__art {
  aspect-ratio: 16 / 11;
  display: grid;
  place-items: center;
  position: relative;
  padding: 1.5rem;
  overflow: hidden;
}
.proj__meta {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .9rem 1rem 1.1rem;
  background: rgba(237, 236, 236, .02);
  border-top: 1px solid var(--line);
}
.proj__name {
  font-family: var(--f-serif);
  font-size: 18px;
  letter-spacing: -.01em;
  color: var(--ink);
}
.proj__role {
  font-size: 13px;
  color: var(--ink-mute);
}

a.proj { color: inherit; }
a.proj:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.proj__arrow {
  display: inline-block;
  font-size: 14px;
  color: var(--ink-mute);
  transition: transform .3s var(--ease), color .3s var(--ease);
}
a.proj:hover .proj__arrow { transform: translate(2px, -2px); color: var(--orange); }
.proj__caption {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
}

/* — variant: GoodPlace (blue) — */
.proj--blue .proj__art {
  background:
    radial-gradient(70% 80% at 85% 10%, rgba(255, 255, 255, .22) 0%, transparent 60%),
    linear-gradient(135deg, #19b1f0 0%, #0171cd 100%);
  color: #fff;
  flex-direction: column;
  gap: .5rem;
  text-align: center;
}
.proj--blue .proj__wordmark em { color: #fff; opacity: .85; }
.proj--blue .proj__caption { color: rgba(255, 255, 255, .8); }

/* — variant: devkit (terminal) — */
.proj--term .proj__art {
  background: linear-gradient(180deg, #16171B 0%, #0D0E11 100%);
  place-items: center start;
  align-content: center;
  gap: .45rem;
  font-family: var(--f-mono);
  font-size: 13px;
  color: #D6D6D6;
}
.term__line { display: block; }
.term__prompt { color: var(--orange); margin-right: .4rem; }
.term__line--ok { color: var(--green); }

/* — variant: cream with simpleCV wordmark — */
.proj--cream .proj__art {
  background: linear-gradient(180deg, #EFEAD8 0%, #E5DFC9 100%);
  color: #2A2417;
}
.proj__wordmark {
  font-family: var(--f-serif);
  font-size: clamp(2.4rem, 5.5vw, 3.4rem);
  line-height: 1;
  letter-spacing: -.03em;
}
.proj__wordmark em {
  font-family: var(--f-italic);
  font-style: italic;
  color: #6E5A2C;
}
.proj__wave {
  position: absolute;
  bottom: 18%;
  left: 12%;
  right: 12%;
  height: 22px;
  color: rgba(42, 36, 23, .35);
}

/* — variant: dark/screen — */
.proj--dark .proj__art {
  background:
    radial-gradient(70% 80% at 80% 0%, rgba(249, 115, 22, .35) 0%, transparent 60%),
    linear-gradient(180deg, #1B1A1A 0%, #0E0D0D 100%);
  color: #F4F4F4;
  flex-direction: column;
  gap: .35rem;
  align-items: flex-start;
  justify-items: start;
  text-align: left;
}
.proj__hero {
  font-family: var(--f-serif);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1;
  color: var(--orange);
  letter-spacing: -.01em;
}
.proj__sub {
  font-size: 13px;
  color: rgba(255,255,255,.6);
  font-family: var(--f-mono);
  letter-spacing: .04em;
}
.proj__bars {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.4rem;
  display: flex;
  gap: .35rem;
}
.proj__bars span {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,.08);
}
.proj__bars span:nth-child(1) { background: rgba(249, 115, 22, .8); flex: 1.6; }
.proj__bars span:nth-child(2) { background: rgba(249, 115, 22, .35); }

/* ── EXPERIENCE / AI list — leader dotted rows ── */
.exp, .ai-list {
  border-top: 1px solid var(--line);
}
.exp li, .ai-list li {
  display: grid;
  align-items: baseline;
  grid-template-columns: minmax(140px, auto) 1fr auto;
  gap: 1rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.exp__co, .ai-list__name {
  font-family: var(--f-sans);
  font-weight: 500;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: -.005em;
}
.exp__role, .ai-list__desc {
  font-size: 14px;
  color: var(--ink-mute);
  position: relative;
  padding-right: 1rem;
}
.exp__date, .ai-list__tag {
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .exp li, .ai-list li {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: .15rem .75rem;
  }
  .exp__role, .ai-list__desc {
    grid-column: 1 / -1;
  }
  .exp__date, .ai-list__tag {
    grid-column: 2;
    grid-row: 1;
  }
}

.ai-list li { position: relative; }
.ai-list li::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 1.35rem;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--orange);
  opacity: 0;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.ai-list li:hover::before { opacity: 1; transform: translateX(2px); }
@media (max-width: 720px) { .ai-list li::before { display: none; } }

/* ── STACK ── */
.stack-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .65rem;
  padding-bottom: .25rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .42rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(237, 236, 236, .03);
  color: var(--ink);
  font-size: 13px;
}
.badge__glyph {
  display: grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 5px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  background: var(--orange);
  color: #1A0E03;
}
.badge__glyph--ng { background: #DD0031; color: #fff; }
.badge__glyph--ts { background: #3178C6; color: #fff; font-size: 9px; }
.badge__glyph--gql { background: #E10098; color: #fff; }
.badge__glyph--fig { background: #1E1E1E; color: #fff; }
.stack-row__link {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-mute);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.stack-row__link:hover { color: var(--orange); text-decoration-color: var(--orange); }

.stack-full {
  margin-top: 1.25rem;
  border-top: 1px dashed var(--line);
  padding-top: 1.25rem;
}
.stack-full[open] summary { color: var(--ink); }
.stack-full summary {
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  list-style: none;
  user-select: none;
}
.stack-full summary::-webkit-details-marker { display: none; }
.stack-full summary::before {
  content: "[ + ] ";
  color: var(--orange);
}
.stack-full[open] summary::before { content: "[ − ] "; }
.stack-grid {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 2rem;
}
@media (max-width: 540px) { .stack-grid { grid-template-columns: 1fr; } }
.stack-grid h4 {
  font-family: var(--f-serif);
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 .55rem;
}
.stack-grid ul li {
  font-size: 14px;
  color: var(--ink-soft);
  padding: .25rem 0;
  border-bottom: 1px dashed var(--line);
}

/* ── FOOTER ── */
.foot {
  margin-top: clamp(4rem, 8vw, 5.5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  position: relative;
}
.foot::before {
  content: "";
  position: absolute;
  top: -56px;
  left: 0; right: 0;
  height: 40px;
  background-image: radial-gradient(circle, var(--ink-faint) 1px, transparent 1.2px);
  background-size: 14px 14px;
  -webkit-mask-image: linear-gradient(to right, transparent, black 20%, black 80%, transparent);
  mask-image: linear-gradient(to right, transparent, black 20%, black 80%, transparent);
  opacity: .5;
}

.foot__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (max-width: 540px) { .foot__cols { grid-template-columns: 1fr; } }
.foot__k {
  display: block;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .85rem;
}
.foot__col p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-soft);
  max-width: 32ch;
}
.foot__col a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.foot__col a:hover { color: var(--orange); text-decoration-color: var(--orange); }
.foot__pills {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  max-width: 240px;
}
.foot__pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .55rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: .12em;
  color: var(--ink-soft);
  transition: border-color .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.foot__pill:hover {
  color: var(--orange);
  border-color: var(--orange);
  transform: translateX(3px);
}
.foot__copy {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 2.5rem 0 0;
  text-align: center;
}

/* ── BOTTOM PILL DOCK ── */
.dock {
  position: fixed;
  left: 50%;
  bottom: clamp(.85rem, 2.5vw, 1.5rem);
  transform: translateX(-50%);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(20, 18, 11, .82);
  border: 1px solid rgba(237, 236, 236, .08);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow:
    0 12px 40px -12px rgba(0,0,0,.7),
    0 0 0 1px rgba(255,255,255,.02) inset;
}
.dock__pill {
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 500;
  padding: .5rem .85rem;
  border-radius: 999px;
  color: var(--ink-mute);
  transition: color .2s var(--ease), background .25s var(--ease);
  white-space: nowrap;
}
.dock__pill:hover { color: var(--ink); }
.dock__pill.is-active {
  background: var(--orange);
  color: #1A0E03;
  box-shadow:
    0 6px 18px -6px rgba(249, 115, 22, .55),
    inset 0 0 0 1px rgba(255,255,255,.18);
}
.dock__pill--ghost {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  padding: 0;
  margin-left: 2px;
  color: var(--ink-mute);
}
.dock__pill--ghost:hover { color: var(--ink); }

@media (max-width: 540px) {
  .dock { gap: 0; padding: 4px; font-size: 12px; }
  .dock__pill { padding: .4rem .65rem; font-size: 12px; }
}

/* ── motion preferences ── */
@media (prefers-reduced-motion: reduce) {
  .pill__dot { animation: none; }
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
