/* ==========================================================================
   Md. Ridwanul Islam Antu — portfolio stylesheet
   One shared file for every page. Plain CSS, no build step.
   ========================================================================== */

:root {
  --bg:        #14191B;   /* page background (gunmetal) */
  --surface:   #1C2326;   /* cards and panels */
  --border:    #2B3539;   /* borders, dividers */
  --border-2:  #4A585D;   /* stronger border / hover */
  --accent:    #2BC4A9;   /* instrument teal */
  --accent-hover: #45D6BC;
  --on-accent: #0F1416;   /* text on accent buttons */
  --inset:     #171D20;   /* image wells / placeholders */
  --heading:   #F4F7F7;
  --text:      #CFD8D9;
  --muted:     #9AAAAD;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --max: 1080px;
  --radius: 4px;
  --gutter: clamp(16px, 4vw, 32px);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { color: var(--heading); line-height: 1.25; margin: 0 0 .5em; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--heading); text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
ul { padding-left: 1.2em; }

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

.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: 8px 14px;
  font-weight: 600; text-decoration: none; border-radius: var(--radius);
}
.skip-link:focus { top: 14px; color: var(--on-accent); }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }



/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(20, 25, 27, .96);
  border-bottom: 1px solid var(--border);
}
.nav-bar { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--heading); }
.brand:hover { color: var(--heading); }
.monogram {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 2px solid var(--accent); border-radius: 2px;
  font-family: var(--font-mono); font-size: .8rem; font-weight: 700; letter-spacing: .04em;
  color: var(--accent);
}
.brand-name { font-weight: 600; font-size: 1.05rem; letter-spacing: .01em; }

.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 8px 12px; text-decoration: none;
  color: var(--text); font-size: .95rem; border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--heading); }
.nav-links a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--border-2); border-radius: var(--radius);
  color: var(--heading); width: 44px; height: 44px; cursor: pointer; padding: 0;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 20px; height: 2px; background: currentColor; margin: 0 auto; position: relative;
  transition: transform .2s ease;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after  { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after  { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 820px) {
  .nav-toggle { display: inline-block; }
  .nav-links {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; gap: 0; background: var(--bg);
    border-bottom: 1px solid var(--border); padding: 8px var(--gutter) 16px;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 12px 4px; border-bottom: 1px solid var(--border); }
  .nav-links a[aria-current="page"] { border-bottom-color: var(--border); border-left: 3px solid var(--accent); padding-left: 12px; }
  /* Without JS the menu stays visible so navigation always works */
  .no-js .nav-toggle { display: none; }
  .no-js .nav-links { display: flex; position: static; flex-wrap: wrap; flex-direction: row; border: 0; padding: 0 0 8px; }
  .no-js .nav-bar { flex-wrap: wrap; }
}

/* ---------- Sections ---------- */
main { display: block; }
.section { padding: clamp(48px, 8vw, 88px) 0; border-top: 1px solid var(--border); }
.section:first-child { border-top: 0; }
.section-title { font-size: clamp(1.5rem, 3vw, 1.9rem); margin-bottom: 28px; }
.section-title::after {
  content: ""; display: block; width: 40px; height: 3px; margin-top: 10px; background: var(--accent);
}
.section-sub { font-size: 1.2rem; margin: 48px 0 20px; }
.section-sub::after { content: ""; display: block; width: 28px; height: 2px; margin-top: 8px; background: var(--accent); }
.lead { font-size: 1.08rem; }
.page-intro { padding: clamp(48px, 8vw, 80px) 0 8px; }
.page-intro h1 { font-size: clamp(2rem, 4.5vw, 2.6rem); }
.page-intro h1::after { content: ""; display: block; width: 48px; height: 3px; margin-top: 12px; background: var(--accent); }
.page-intro p { color: var(--muted); }

/* ---------- Small mono labels / tags ---------- */
.mono, .eyebrow, .date, .tag, .status {
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .02em;
}
.eyebrow { color: var(--accent); margin: 0 0 14px; }
.date { color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 12px 0 0; }
.tag {
  border: 1px solid var(--border-2); color: var(--muted);
  padding: 2px 8px; border-radius: 2px; line-height: 1.6;
}
.status {
  display: inline-block; color: var(--muted); border-left: 2px solid var(--accent); padding-left: 8px;
}

/* Clearly marked placeholder (search the HTML for "PLACEHOLDER") */
.placeholder {
  font-family: var(--font-mono); font-size: .78rem; color: var(--muted);
  border: 1px dashed var(--border-2); padding: 1px 7px; border-radius: 2px; white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 10px 20px; border-radius: var(--radius); font-weight: 600; font-size: .95rem;
  text-decoration: none; border: 1px solid var(--accent); transition: background .15s ease, color .15s ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--heading); border-color: var(--border-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 16px; height: 16px; }

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 9vw, 104px) 0 clamp(48px, 8vw, 88px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 320px); gap: clamp(32px, 6vw, 72px); align-items: center; }
.hero h1 { font-size: clamp(1.8rem, 4.3vw, 3.2rem); letter-spacing: -.01em; margin-bottom: 16px; white-space: nowrap; }
@media (max-width: 480px) { .hero h1 { white-space: normal; } }  /* phones: allow wrapping */
.tagline { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--text); margin: 0; white-space: nowrap; }
@media (max-width: 480px) { .tagline { white-space: normal; } }  /* too narrow for one line on phones */
.hero-photo { max-width: 340px; width: 100%; justify-self: end; }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo { order: -1; justify-self: start; max-width: 220px; }
}

/* ---------- CAD-style photo frame ---------- */
.frame { position: relative; padding: 10px; }
.frame::before, .frame::after {
  content: ""; position: absolute; width: 28px; height: 28px; pointer-events: none;
}
.frame::before { top: 0; left: 0; border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.frame::after  { bottom: 0; right: 0; border-bottom: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.frame img { width: 100%; background: var(--surface); }
.frame--sm { padding: 6px; }
.frame--sm::before, .frame--sm::after { width: 16px; height: 16px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr .6fr; gap: 48px; align-items: start; }
.about-grid aside h3 { font-size: .8rem; font-family: var(--font-mono); color: var(--muted); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; gap: 24px; } }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column;
}
.card h3 { font-size: 1.1rem; margin-bottom: 6px; }
.card p { color: var(--text); font-size: .95rem; }
.card .meta { color: var(--muted); font-size: .9rem; margin: 0 0 4px; }
.card-current { border-color: var(--accent); }
.card-badge { align-self: flex-start; margin-bottom: 10px; color: var(--accent); font-family: var(--font-mono); font-size: .75rem; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.edu-card .date { margin-bottom: 8px; }
.edu-card .thesis { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: .92rem; }
.edu-card .thesis span { display: block; font-family: var(--font-mono); font-size: .75rem; color: var(--muted); margin-bottom: 2px; }

/* Image cards (research, projects, leadership): fixed 4:3 media */
.media-card { padding: 0; overflow: hidden; }
.media-card .media { aspect-ratio: 4 / 3; background: var(--inset); border-bottom: 1px solid var(--border); overflow: hidden; }
.media-card .media img { width: 100%; height: 100%; object-fit: cover; }
.media-card .media--contain img { object-fit: contain; background: #fff; }
.media-card .body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.media-card .body > :last-child { margin-bottom: 0; }
.media-card .card-foot { margin-top: auto; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.media-card ul { margin: 0 0 1em; padding-left: 1.1em; font-size: .93rem; }
.media-card li { margin-bottom: 4px; }
.result { font-size: .92rem; color: var(--heading); border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.result strong { color: var(--accent); font-weight: 600; }

/* Image placeholder tile (same 4:3 ratio) */
.media-placeholder {
  width: 100%; height: 100%; display: grid; place-items: center; text-align: center;
  background:
    linear-gradient(var(--border), var(--border)) center / 1px 100% no-repeat,
    linear-gradient(var(--border), var(--border)) center / 100% 1px no-repeat,
    var(--inset);
  color: var(--muted); font-family: var(--font-mono); font-size: .78rem;
}
.media-placeholder span { background: var(--inset); padding: 4px 10px; border: 1px dashed var(--border-2); }

.link-mono { font-family: var(--font-mono); font-size: .82rem; color: var(--heading); }
.link-mono::after { content: " ↗"; color: var(--accent); }

/* ---------- Experience (list entries) ---------- */
.entry {
  display: grid; grid-template-columns: 170px 1fr; gap: 24px;
  padding: 28px 0; border-top: 1px solid var(--border);
}
.entry:first-of-type { border-top: 0; padding-top: 0; }
.entry h3 { font-size: 1.15rem; margin-bottom: 2px; }
.entry .org { color: var(--muted); margin: 0 0 12px; }
.entry ul { margin: 0; }
.entry li { margin-bottom: 6px; }
.entry-media { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 14px; margin-top: 18px; }
.entry-media figure { margin: 0; }
.entry-media .ratio { aspect-ratio: 4 / 3; overflow: hidden; }
.entry-media img { width: 100%; height: 100%; object-fit: cover; }
.entry-media figcaption { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); margin-top: 6px; }
@media (max-width: 640px) {
  .entry { grid-template-columns: 1fr; gap: 6px; }
  .entry-media { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Leadership and activities (list with large thumbnails) ----------
   Same date column as the Professional entries; every thumbnail is the same 4:3 size. */
.lead-row {
  display: grid; grid-template-columns: 170px minmax(0, 1fr) 340px; gap: 24px 32px;
  padding: 32px 0; border-top: 1px solid var(--border); align-items: start;
}
.lead-row:first-child { border-top: 0; padding-top: 0; }
.lead-row h3 { font-size: 1.15rem; margin-bottom: 2px; }
.lead-row .org { color: var(--muted); margin: 0 0 12px; }
.res { list-style: none; padding: 12px 0 0; margin: 14px 0 0; border-top: 1px solid var(--border); display: grid; gap: 4px; font-size: .94rem; color: var(--heading); }
.res li { text-align: left; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; }
.res strong { color: var(--accent); font-weight: 600; }
.lead-thumb { margin: 0; }
.lead-thumb .ratio { aspect-ratio: 4 / 3; overflow: hidden; background: var(--inset); }
.lead-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lead-thumb figcaption { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); margin-top: 6px; }
@media (max-width: 960px) {
  .lead-row { grid-template-columns: minmax(0, 1fr) 280px; }
  .lead-row .date { grid-column: 1 / -1; margin: 0; }
}
@media (max-width: 640px) {
  .lead-row { grid-template-columns: 1fr; gap: 10px; }
  .lead-thumb { order: -1; }
  .lead-row .date { order: -2; }
}

/* ---------- Publications ---------- */
.pub-list { list-style: none; padding: 0; margin: 0; counter-reset: pub; }
.pub {
  counter-increment: pub; position: relative;
  padding: 22px 0 22px 56px; border-top: 1px solid var(--border);
}
.pub:first-child { border-top: 0; }
.pub::before {
  content: "[" counter(pub) "]"; position: absolute; left: 0; top: 22px;
  font-family: var(--font-mono); color: var(--accent); font-size: .85rem;
}
.pub .cite { margin: 0 0 8px; }
.pub .cite .title { color: var(--heading); }
.pub .pub-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.pub-year { font-family: var(--font-mono); color: var(--muted); font-size: .8rem; margin: 32px 0 0; }

/* ---------- Contact ---------- */
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 560px; }
.contact-item {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.contact-item svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.contact-item .label { display: block; font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }
.contact-item a { overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 36px; margin-top: 24px; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.footer-loc { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); margin: 0; display: flex; align-items: center; gap: 8px; }
.footer-loc svg { width: 14px; height: 14px; color: var(--accent); }
.social { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; }
.social a {
  display: grid; place-items: center; width: 40px; height: 40px; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.social a:hover { color: var(--accent); border-color: var(--accent); }
.social svg { width: 18px; height: 18px; }
.copyright { width: 100%; margin: 8px 0 0; font-size: .8rem; color: var(--muted); }

/* Visually hidden but readable by screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Dates inside cards stay orange (overrides .card p) */
.card .date { color: var(--accent); margin-bottom: 8px; }

/* ---------- Justified body text ----------
   Paragraphs and bullet points are justified. Hyphenation keeps word gaps even
   on narrow phone screens; short labels, tags, nav and footer stay left-aligned. */
p, .entry li, .media-card li, .card li {
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}
/* Phones: narrow columns leave wide gaps when justified, so align left there */
@media (max-width: 640px) {
  p, .entry li, .media-card li, .card li { text-align: left; -webkit-hyphens: manual; hyphens: manual; }
}
.eyebrow, .date, .tagline, .footer-loc, .copyright, .placeholder,
.tags li, .nav-links li, .social li, .contact-item, .pub-meta, .card-badge, .status {
  text-align: left;
  -webkit-hyphens: manual;
  hyphens: manual;
}

/* ---------- Polish ---------- */
.card { transition: border-color .15s ease; }
.card:hover { border-color: var(--border-2); }

/* A lone last card in a two-column grid spans the full row: image left, text right */
@media (min-width: 761px) {
  .grid-2 > .media-card:last-child:nth-child(odd) {
    grid-column: 1 / -1; flex-direction: row;
  }
  .grid-2 > .media-card:last-child:nth-child(odd) .media {
    flex: 0 0 calc(50% - 10px); border-bottom: 0; border-right: 1px solid var(--border);
  }
  .grid-2 > .media-card:last-child:nth-child(odd) .body { justify-content: center; padding: 28px 32px; }
  .grid-2 > .media-card:last-child:nth-child(odd) .card-foot { margin-top: 0; }
}
