/*-----------------------------------*\
  Md. Rifat Rahman — personal site
  Light academic paper theme
\*-----------------------------------*/


/*-----------------------------------*\
  #FONTS
  Self-hosted variable fonts — no third-party request, so the page keeps
  its typography even if a CDN is slow, blocked or offline.
\*-----------------------------------*/

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-var.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}


/*-----------------------------------*\
  #TOKENS
\*-----------------------------------*/

:root {

  /* colour */
  --paper:        #faf8f4;
  --paper-tint:   #f2eee6;
  --ink:          #1c1c1e;
  --ink-soft:     #45454c;
  --ink-faint:    #78787f;
  --accent:       #8a2b2b;
  --accent-soft:  #b4756f;
  --rule:         #e2ddd2;
  --rule-strong:  #cdc6b8;

  /* type */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --fs-name:  2.05rem;
  --fs-h2:    1.72rem;
  --fs-h3:    1.3rem;
  --fs-body:  0.97rem;
  --fs-meta:  0.85rem;
  --fs-label: 0.72rem;

  /* layout */
  --col:      250px;
  --gap:      60px;
  --max:      1120px;
}


/*-----------------------------------*\
  #RESET
\*-----------------------------------*/

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

* { margin: 0; padding: 0; }

ul, ol { list-style: none; }

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

img { display: block; max-width: 100%; height: auto; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

address { font-style: normal; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}


/*-----------------------------------*\
  #LAYOUT
\*-----------------------------------*/

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 22px 90px;
}

@media (min-width: 900px) {

  .wrap {
    display: grid;
    grid-template-columns: var(--col) 1fr;
    gap: var(--gap);
    padding: 72px 40px 120px;
  }

}


/*-----------------------------------*\
  #SIDEBAR
\*-----------------------------------*/

.sidebar { padding-bottom: 34px; }

@media (min-width: 900px) {

  /* the aside stretches so its rule runs the full height of the page,
     while the content inside it stays pinned as you scroll */
  .sidebar {
    padding-bottom: 0;
    padding-right: 34px;
    border-right: 1px solid var(--rule);
  }

  .sidebar-inner {
    position: sticky;
    top: 72px;
  }

}

.portrait {
  width: 108px;
  height: 108px;
  border-radius: 3px;
  object-fit: cover;
  background: var(--paper-tint);
  margin-bottom: 20px;
  filter: grayscale(100%);
  transition: filter 0.35s ease;
}

.portrait:hover { filter: grayscale(0%); }

.name {
  font-family: var(--serif);
  font-size: var(--fs-name);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.role {
  color: var(--ink-soft);
  font-size: var(--fs-meta);
  line-height: 1.5;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 18px;
}

.contact-list { display: grid; gap: 13px; }

/* label above value — a long email has the full column width and so
   never breaks mid-word */
.contact-row { font-size: var(--fs-meta); }

.contact-key {
  display: block;
  color: var(--ink-faint);
  font-size: var(--fs-label);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 1px;
}

.contact-val {
  display: inline;
  color: var(--ink-soft);
  min-width: 0;
  overflow-wrap: anywhere;
}

a.contact-val {
  border-bottom: 1px solid var(--rule-strong);
  transition: color 0.2s ease, border-color 0.2s ease;
}

a.contact-val:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}


/*-----------------------------------*\
  #NAV
\*-----------------------------------*/

.nav {
  border-bottom: 1px solid var(--rule);
  margin-bottom: 40px;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
}

.nav-link {
  position: relative;
  padding: 0 0 13px;
  color: var(--ink-faint);
  font-size: var(--fs-meta);
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-link:hover { color: var(--ink); }

.nav-link.active { color: var(--ink); }

.nav-link.active::after { transform: scaleX(1); }


/*-----------------------------------*\
  #PAGES
\*-----------------------------------*/

.page { display: none; }

.page.active {
  display: block;
  animation: fade 0.3s ease both;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.page-title {
  font-family: var(--serif);
  font-size: var(--fs-h2);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 30px;
}

.block { margin-bottom: 52px; }

.block:last-child { margin-bottom: 0; }

.block-title {
  font-family: var(--serif);
  font-size: var(--fs-h3);
  font-weight: 500;
  letter-spacing: -0.005em;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: 22px;
}


/*-----------------------------------*\
  #PROSE
\*-----------------------------------*/

.lede p {
  color: var(--ink-soft);
  margin-bottom: 15px;
  max-width: 68ch;
}

.lede p:last-child { margin-bottom: 0; }

.lede em { font-style: italic; }

.lede a,
.entry-note a {
  color: var(--accent);
  border-bottom: 1px solid rgba(138, 43, 43, 0.28);
  transition: border-color 0.2s ease;
}

.lede a:hover,
.entry-note a:hover { border-bottom-color: var(--accent); }


/*-----------------------------------*\
  #INTERESTS
\*-----------------------------------*/

.interests {
  display: grid;
  gap: 18px;
}

@media (min-width: 640px) {
  .interests { grid-template-columns: 1fr 1fr; gap: 22px 40px; }
}

.interest-term {
  font-weight: 600;
  font-size: var(--fs-meta);
  letter-spacing: 0.005em;
  margin-bottom: 3px;
}

.interest-desc {
  color: var(--ink-faint);
  font-size: var(--fs-meta);
  line-height: 1.6;
}


/*-----------------------------------*\
  #CV ENTRIES
\*-----------------------------------*/

.entries { counter-reset: e; }

.entry {
  counter-increment: e;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 2px 12px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}

.entry:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.entry::before {
  content: counter(e) ".";
  grid-column: 1;
  grid-row: 1;
  color: var(--accent-soft);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.55;
}

.entry-body {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.entry-title {
  font-size: var(--fs-body);
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 2px;
}

.entry-org {
  color: var(--ink-soft);
  font-size: var(--fs-meta);
  line-height: 1.55;
}

.entry-org a {
  border-bottom: 1px solid var(--rule-strong);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.entry-org a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.entry-meta {
  color: var(--ink-faint);
  font-size: var(--fs-meta);
  line-height: 1.55;
}

.entry-note {
  color: var(--ink-soft);
  font-size: var(--fs-meta);
  line-height: 1.68;
  margin-top: 9px;
  max-width: 66ch;
}

.entry-date {
  grid-column: 2;
  grid-row: 2;
  color: var(--ink-faint);
  font-size: var(--fs-label);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  margin-top: 7px;
}

@media (min-width: 720px) {

  .entry {
    grid-template-columns: 26px 1fr auto;
    column-gap: 18px;
  }

  .entry-date {
    grid-column: 3;
    grid-row: 1;
    text-align: right;
    margin-top: 4px;
  }

}


/*-----------------------------------*\
  #TAGS
\*-----------------------------------*/

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--ink-soft);
  font-size: var(--fs-label);
  letter-spacing: 0.02em;
  padding: 2px 8px;
  background: var(--paper-tint);
}

.skill-row {
  display: grid;
  gap: 8px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}

.skill-row:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

@media (min-width: 640px) {
  .skill-row {
    grid-template-columns: 160px 1fr;
    gap: 16px;
    align-items: start;
  }
}

.skill-key {
  color: var(--ink-faint);
  font-size: var(--fs-label);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding-top: 3px;
}


/*-----------------------------------*\
  #FILTERS
\*-----------------------------------*/

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 26px;
}

.filter-btn {
  color: var(--ink-faint);
  font-size: var(--fs-meta);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.filter-btn:hover { color: var(--ink); }

.filter-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}


/*-----------------------------------*\
  #PROJECTS
\*-----------------------------------*/

.project { display: none; }

.project.active {
  display: block;
  animation: fade 0.3s ease both;
}

.project {
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}

.project:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 20px;
  margin-bottom: 9px;
}

.project-name {
  font-size: var(--fs-body);
  font-weight: 600;
  line-height: 1.45;
}

.project-link {
  color: var(--accent);
  font-size: var(--fs-meta);
  white-space: nowrap;
  border-bottom: 1px solid rgba(138, 43, 43, 0.28);
  transition: border-color 0.2s ease;
}

.project-link:hover { border-bottom-color: var(--accent); }

.project-kind {
  color: var(--ink-faint);
  font-size: var(--fs-label);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.project .tags { margin-bottom: 10px; }

.project-text {
  color: var(--ink-soft);
  font-size: var(--fs-meta);
  line-height: 1.68;
  max-width: 68ch;
}


/*-----------------------------------*\
  #CONTACT
\*-----------------------------------*/

.contact-lines { display: grid; gap: 14px; max-width: 520px; }

.contact-line {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.contact-line:last-child { border-bottom: none; padding-bottom: 0; }

.contact-line a {
  color: var(--accent);
  border-bottom: 1px solid rgba(138, 43, 43, 0.28);
  overflow-wrap: anywhere;
  transition: border-color 0.2s ease;
}

.contact-line a:hover { border-bottom-color: var(--accent); }


/*-----------------------------------*\
  #PRINT
\*-----------------------------------*/

@media print {

  .nav, .filters, .portrait { display: none; }

  .page { display: block !important; }

  .wrap {
    display: block;
    max-width: none;
    padding: 0;
  }

  .sidebar {
    position: static;
    border: none;
    padding: 0 0 20px;
  }

  body { font-size: 11pt; background: #fff; }

  .entry, .project { break-inside: avoid; }

}


.doc-link { color: #0645ad; }
