/*
 * mizan.md: a bio page drawn as a Markdown file open in a code editor,
 * in the design's "editor palette". Every color lives in a token below.
 */

/*
 * JetBrains Mono, self-hosted (SIL Open Font License 1.1,
 * https://github.com/JetBrains/JetBrainsMono). Each file is a variable font
 * covering every weight; browsers only download one when the page uses
 * characters in its unicode-range. Later rules win where ranges overlap.
 */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Arial resized to JetBrains Mono's metrics, so text doesn't jump when the font loads */
@font-face {
  font-family: "JetBrains Mono Fallback";
  src: local("Arial");
  ascent-override: 75.79%;
  descent-override: 22.29%;
  line-gap-override: 0%;
  size-adjust: 134.59%;
}

:root {
  --font-mono: "JetBrains Mono", "JetBrains Mono Fallback";

  /* Editor palette */
  --blue: #7aa2f7;
  --cyan: #7dcfff;
  --purple: #bb9af7;
  --green: #9ece6a;
  --teal: #73daca;
  --orange: #ff9e64;

  /* Links, cursors and the open tab. The design's alternates: var(--blue), var(--green), var(--purple) */
  --accent: var(--cyan);

  /* Surfaces */
  --desk: #16161e;
  --window: #1a1b26;
  --chrome: #16161e;
  --code-bg: #1f2335;
  --hover-bg: #24283b;
  --border: #292e42;

  /* Text */
  --text: #a9b1d6;
  --text-strong: #c0caf5;
  --text-hover: #ffffff;
  --text-dim: #868fbb;
  --gutter: #3b4261;
  --gutter-hover: #737aa2;

  /* Sticky title bar + tabs, plus breathing room: keeps focused links and
     #section targets from scrolling under the header (WCAG 2.4.11) */
  --anchor-offset: 104px;

  color-scheme: dark;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--anchor-offset);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--desk);
}

a {
  color: var(--text-strong);
}

a:hover {
  color: var(--text-hover);
}

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

/* ---------- Window chrome ---------- */

.desk {
  box-sizing: border-box;
  min-height: 100vh;
  padding: 32px 16px 48px;
  background: var(--desk);
  color: var(--text);
  font-family: var(--font-mono), ui-monospace, monospace;
}

.window {
  max-width: 1120px;
  margin: 0 auto;
  background: var(--window);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: clip; /* rounds the corners; unlike hidden, keeps the header sticky */
  box-shadow: 0 16px 40px -24px rgb(0 0 0 / 0.5);
}

.window-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}

.traffic-lights {
  display: flex;
  gap: 8px;
}

.traffic-lights > span {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--border);
}

.titlebar-branch {
  margin-left: auto;
}

.tabs {
  display: flex;
  overflow-x: auto;
  font-size: 14px;
}

.tab {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 18px;
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-strong);
  background: var(--hover-bg);
}

/* After .tab:hover so the open tab keeps its look on hover */
.tab[aria-current="page"] {
  color: var(--text-strong);
  background: var(--window);
  box-shadow: inset 0 2px 0 var(--accent);
}

/* Ring inside the tab: the tab bar scrolls sideways, so it clips anything drawn outside */
.tab:focus-visible {
  outline-offset: -5px;
}

.statusbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 0 18px;
  border-top: 1px solid var(--border);
  background: var(--chrome);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  line-height: 30px;
}

.statusbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

/* Branch badge, flush with the window's left edge */
.statusbar-branch {
  margin-left: -18px;
  padding: 0 10px;
  background: var(--blue);
  color: var(--desk);
  font-weight: 700;
}

/* ---------- Editor lines ---------- */

.editor {
  counter-reset: line-number;
  padding: 40px 32px 56px 8px;
  font-size: 16px;
  line-height: 1.75;
}

.line {
  position: relative;
  min-height: 1.75em;
  padding-left: 76px;
  overflow-wrap: anywhere;
}

/* Gutter number. The empty alt text keeps screen readers from reading it. */
.line::before {
  counter-increment: line-number;
  content: counter(line-number);
  content: counter(line-number) / "";
  position: absolute;
  left: 0;
  width: 48px;
  text-align: right;
  font-size: 14px;
  line-height: inherit;
  color: var(--gutter);
}

.line:hover {
  background: var(--hover-bg);
}

.line:hover::before {
  color: var(--gutter-hover);
}

h2.line,
h3.line {
  margin: 0;
  font-family: inherit;
  line-height: inherit;
}

/* Safari drops list semantics when bullets are off; the markup adds role="list" */
.md-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.code {
  background: var(--code-bg);
}

/* ---------- Syntax ---------- */

.dim {
  color: var(--text-dim);
}

/* Before the token colors, so a bold number can still be orange */
.strong {
  color: var(--text-strong);
  font-weight: 700;
}

.tok-heading {
  color: var(--blue);
}

.tok-key,
.tok-prompt {
  color: var(--purple);
}

.tok-str,
.tok-check {
  color: var(--green);
}

.tok-meta {
  color: var(--teal);
}

.tok-num {
  color: var(--orange);
}

.h2 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.h3 {
  font-size: 21px;
  font-weight: 700;
  color: var(--text-strong);
}

/* ---------- Links and chips ---------- */

.md-link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.md-link:hover {
  text-decoration-thickness: 2px;
}

/* Links keep the accent on hover; only the underline thickens */
a.md-link,
a.md-link:hover {
  color: var(--accent);
}

.ext {
  display: inline-block; /* keeps the underline off the arrow */
  margin-left: 0.2em;
  font-size: 0.9em;
  font-weight: 400;
  text-decoration: none;
}

.social-link {
  display: inline-block;
  box-sizing: border-box;
  min-width: 24px;
  min-height: 24px;
  padding: 2px 4px;
  text-align: center;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
}

.chip {
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--orange);
}

/* ---------- Page blocks ---------- */

.measure {
  max-width: 900px;
}

.measure-wide {
  max-width: 940px;
}

.wrap-row {
  padding-block: 6px;
}

.title-line {
  padding-block: 16px;
}

.title {
  margin: 0;
  font-size: clamp(26px, 7.2vw, 104px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.05em;
  color: var(--text-strong);
}

/* The name may wrap, so wider letter spacing (WCAG 1.4.12) moves "Rahman"
   down a line instead of cutting it off. The last word keeps its cursor. */
.title-end {
  white-space: nowrap;
}

.tagline {
  max-width: 940px;
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.55;
  color: var(--text-strong);
}

.contact-email {
  padding-block: 8px;
  font-size: clamp(22px, 3.4vw, 44px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.contact-email .md-link {
  text-decoration-thickness: 2px;
}

/* ---------- Caret ---------- */

.caret {
  display: inline-block;
  width: 0.5em;
  background: var(--accent);
}

/* Four blinks (4.4 s, under WCAG's 5 s limit) each time the cursor scrolls
   into view: caret.js sets data-blinking. Steady under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .caret[data-blinking] {
    animation: blink 1.1s steps(1) 4;
  }
}

.title .caret {
  height: 0.85em;
  margin-left: 0.12em;
  vertical-align: -0.06em;
}

.contact-email .caret {
  height: 0.9em;
  margin-left: 0.15em;
  vertical-align: -0.1em;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------- Preferences and small screens ---------- */

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

@media (max-width: 720px) {
  .desk {
    padding: 12px 8px 24px;
  }

  .editor {
    padding: 28px 16px 40px 4px;
    font-size: 15px;
  }

  .line {
    padding-left: 44px;
  }

  .line::before {
    width: 28px;
    font-size: 12px;
  }

  .h2 {
    font-size: 24px;
  }

  /* 8.2vw, shrunk below ~370px so the 9.42em-wide name still fits on one
     line next to 82px of padding and gutter */
  .title {
    font-size: min(8.2vw, (100vw - 82px) / 9.5);
  }

  .tagline {
    font-size: 17px;
  }
}
