/* ==========================================================================
   Ekra Hossain - Portfolio design system
   Dark-first. Tokens are the single source of truth for colour and spacing.
   ========================================================================== */

:root {
  /* Surface */
  --bg: #0b1120;
  --bg-elevated: rgba(30, 41, 59, 0.45);
  --bg-chip: rgba(45, 212, 191, 0.1);

  /* Ink - values below verified against --bg */
  --text: #94a3b8;        /* body      6.6:1 */
  --text-strong: #e2e8f0; /* headings 14.4:1 */
  --text-muted: #7c8ba1;  /* meta      4.6:1 */

  /* Accent */
  --accent: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.16);
  --accent-line: rgba(148, 163, 184, 0.35);

  /* Lines */
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.28);

  /* Type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 180ms;
  --base: 260ms;

  /* z-index scale - 10 content, 20 sticky, 30 overlay, 50 skip link */
  --z-content: 10;
  --z-sticky: 20;
  --z-overlay: 30;
  --z-skip: 50;
}

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

html {
  scroll-behavior: smooth;
  /* Sticky mobile bar must not cover anchor targets */
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
  /* Guard against horizontal scroll. This belongs on html, not body:
     overflow on body makes body the scroll container and breaks
     position: sticky for its descendants. */
  overflow-x: hidden;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;          /* 16px floor on mobile */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--text-strong);
  line-height: 1.2;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

p { margin: 0 0 1rem; max-width: 65ch; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration: none; }

img, svg { max-width: 100%; display: block; }

ul { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--accent-soft); color: var(--text-strong); }

/* --- Focus: never removed, only restyled ------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: var(--z-skip);
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: #042f2e;
  font-weight: 600;
  border-radius: 0 0 6px 6px;
  transition: top var(--fast) var(--ease);
}
.skip-link:focus { top: 0; }

/* --- Cursor spotlight --------------------------------------------------- */
.spotlight {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
  background: radial-gradient(
    600px circle at var(--spot-x, 50%) var(--spot-y, 0%),
    rgba(45, 212, 191, 0.07),
    transparent 70%
  );
  opacity: 0;
  transition: opacity var(--base) var(--ease);
}
.spotlight.is-active { opacity: 1; }

/* ==========================================================================
   Layout
   ========================================================================== */

.layout {
  max-width: 1152px;
  margin: 0 auto;
  padding: 1.5rem;
}

@media (min-width: 1024px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 3.5rem;
    padding: 0 3rem;
  }
}

/* --- Sticky rail -------------------------------------------------------- */
.rail { padding: 3rem 0 2rem; }

@media (min-width: 1024px) {
  .rail {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    max-height: 100vh;
    padding: 6rem 0;
  }
}

/* Short laptop screens: tighten the rail so it never clips its own content */
@media (min-width: 1024px) and (max-height: 900px) {
  .rail { padding: 3rem 0; }
  .nav { margin-top: 2rem; }
  .nav__link { padding: 0.55rem 0; }
  .socials { margin-top: 1.25rem; }
}

.rail__avatar {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 2px solid var(--border-strong);
  object-fit: cover;
  margin-bottom: 1.5rem;
}

.rail__name {
  font-size: clamp(2.25rem, 6vw, 3rem);
  font-weight: 700;
}

.rail__role {
  margin-top: 0.75rem;
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  font-weight: 500;
  color: var(--text-strong);
}

.rail__tagline {
  margin-top: 1rem;
  max-width: 24rem;
}

.rail__meta {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text);
}

.rail__meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.rail__meta svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--accent); }

/* --- Scroll-spy nav ----------------------------------------------------- */
.nav { display: none; }

@media (min-width: 1024px) {
  .nav { display: block; margin-top: 4rem; }
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--fast) var(--ease);
}

.nav__indicator {
  width: 2rem;
  height: 1px;
  background: var(--accent-line);
  transition: width var(--base) var(--ease), background-color var(--base) var(--ease);
}

.nav__link:hover,
.nav__link:focus-visible { color: var(--text-strong); }

.nav__link:hover .nav__indicator,
.nav__link:focus-visible .nav__indicator { width: 4rem; background: var(--text-strong); }

.nav__link[aria-current="true"] { color: var(--text-strong); }
.nav__link[aria-current="true"] .nav__indicator { width: 4rem; background: var(--accent); }

/* --- Social row --------------------------------------------------------- */
.socials {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 2rem;
  margin-left: -0.7rem; /* optical alignment against the icon box padding */
}

.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;              /* touch target floor */
  height: 44px;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

.socials a:hover { color: var(--accent); background: var(--bg-elevated); }
.socials svg { width: 22px; height: 22px; }

/* ==========================================================================
   Content
   ========================================================================== */

.content { padding-bottom: 4rem; }

@media (min-width: 1024px) {
  .content { padding: 6rem 0; }
}

.section { margin-bottom: 5rem; scroll-margin-top: 5rem; }
.section:last-of-type { margin-bottom: 3rem; }

.section__heading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-strong);
  margin-bottom: 1.5rem;
}

/* Section label: a sticky bar on mobile, where the rail nav is hidden.
   On desktop it is visually hidden but stays in the accessibility tree,
   so every section keeps a real heading for screen readers. */
.section__label {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  margin: 0 -1.5rem 1.25rem;
  padding: 0.85rem 1.5rem;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-strong);
}

@media (min-width: 1024px) {
  .section__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.lede { font-size: 1.0625rem; }

.accent { color: var(--accent); }
.strong { color: var(--text-strong); font-weight: 500; }

/* --- Entry card (experience / projects) --------------------------------- */
.entries { display: flex; flex-direction: column; gap: 0.5rem; }

.entry {
  position: relative;
  display: grid;
  gap: 0.5rem;
  padding: 1.25rem;
  margin: 0 -1.25rem;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background-color var(--base) var(--ease),
              border-color var(--base) var(--ease),
              box-shadow var(--base) var(--ease);
}

@media (min-width: 768px) {
  .entry { grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0.5rem 1.5rem; }
}

/* Hover changes colour and shadow only - never size, so nothing reflows */
.entry:hover,
.entry:focus-within {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: 0 12px 30px -18px rgba(2, 6, 23, 0.9);
}

.entry__period {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-top: 0.3rem;
  white-space: nowrap;
}

.entry__title {
  font-size: 1.05rem;
  font-weight: 600;
  transition: color var(--fast) var(--ease);
}

.entry:hover .entry__title,
.entry:focus-within .entry__title { color: var(--accent); }

.entry__org {
  display: block;
  font-size: 0.9375rem;
  color: var(--text);
  margin-top: 0.15rem;
}

.entry__sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.entry__body { margin-top: 0.85rem; font-size: 0.9375rem; }

.entry__body li {
  position: relative;
  padding-left: 1.15rem;
  margin-bottom: 0.5rem;
}

.entry__body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 1px;
  background: var(--accent);
}

/* Card-wide link: the anchor covers the card, text stays selectable */
.entry__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
}

.arrow {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 0.3rem;
  vertical-align: -2px;
  transition: transform var(--fast) var(--ease);
}

.entry:hover .arrow,
.entry:focus-within .arrow { transform: translate(3px, -3px); }

/* --- Tag pills ---------------------------------------------------------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-chip);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.6;
}

/* --- Inline link -------------------------------------------------------- */
.link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.1rem;
  color: var(--text-strong);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.link:hover .arrow { transform: translate(3px, -3px); }

/* Back arrow points left, so it travels left on hover */
.arrow--back { margin: 0 0.3rem 0 0; }
.link:hover .arrow--back { transform: translateX(-3px); }

.link--cta {
  margin-top: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
}

/* --- Resume button ------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.6rem 1.15rem;
  margin-top: 1.75rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease);
}

.btn:hover { background: var(--accent-soft); }
.btn svg { width: 16px; height: 16px; }

/* --- Skills ------------------------------------------------------------- */
.skills { display: grid; gap: 1.25rem; }

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

.skill-group {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.22);
  transition: border-color var(--base) var(--ease);
}

.skill-group:hover { border-color: var(--border-strong); }

.skill-group__title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.skill-group__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.875rem;
}

.skill-group__list li {
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.09);
  color: var(--text);
}

/* --- Tech logo strip ---------------------------------------------------- */
.logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.logos img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: 0.6;
  filter: grayscale(1);
  transition: opacity var(--base) var(--ease), filter var(--base) var(--ease);
}

.logos img:hover { opacity: 1; filter: none; }

/* --- Strengths ---------------------------------------------------------- */
.strengths { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }

/* --- Single-column page (contact) --------------------------------------- */
.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

@media (min-width: 1024px) {
  .page { padding: 6rem 1.5rem; }
}

.page__title {
  margin-top: 2rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
}

.contact-list {
  margin: 2.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.contact-row {
  display: grid;
  gap: 0.15rem 1.5rem;
  align-items: baseline;
  padding: 0.9rem 1rem;
  margin: 0 -1rem;
  border-radius: 10px;
  transition: background-color var(--base) var(--ease);
}

@media (min-width: 640px) {
  .contact-row { grid-template-columns: 10rem minmax(0, 1fr); }
}

.contact-row:hover { background: var(--bg-elevated); }

.contact-row dt {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-row dt svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent); }

.contact-row dd { margin: 0; color: var(--text-strong); }

/* --- Footer ------------------------------------------------------------- */
.footer {
  font-size: 0.875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.footer p { max-width: 60ch; }

/* ==========================================================================
   Reveal on scroll
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}

.reveal.is-visible { opacity: 1; transform: none; }

/* ==========================================================================
   Reduced motion - the page degrades to static and fully legible
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal { opacity: 1; transform: none; }
  .spotlight { display: none; }
}

/* Pointer-less devices get no spotlight */
@media (hover: none) {
  .spotlight { display: none; }
}

/* ==========================================================================
   Print - the page doubles as a printable resume
   ========================================================================== */

@media print {
  :root { --text: #1f2937; --text-strong: #000; --text-muted: #4b5563; --accent: #0f766e; }
  body { background: #fff; color: #1f2937; }
  .spotlight, .nav, .socials, .btn, .skip-link { display: none !important; }

  /* Restore section labels as ordinary headings on paper */
  .section__label {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    clip-path: none;
    margin: 0 0 0.75rem;
    padding: 0;
    background: none;
    color: #000;
  }
  .layout { display: block; padding: 0; max-width: none; }
  .rail, .content { padding: 0; position: static; max-height: none; }
  .entry { break-inside: avoid; margin: 0; }
  .reveal { opacity: 1; transform: none; }
}
