/* Hadi Yaqoobi — a quiet, readable academic portfolio. */
:root {
  color-scheme: light;
  --paper: #f7f6f2;
  --paper-alt: #eeede7;
  --ink: #172b3a;
  --body: #344550;
  --muted: #59666c;
  --accent: #345e75;
  --accent-dark: #21465c;
  --rule: #d5d8d3;
  --rule-dark: #9ba8aa;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --measure: 1040px;
}

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

html {
  scroll-padding-top: 2rem;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

::selection {
  background: #d6e3e7;
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  overflow-wrap: anywhere;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
}

h1,
h2,
h3,
p,
dl,
ol,
ul,
blockquote {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-weight: 400;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

h1,
h2 {
  font-family: var(--serif);
}

h1 {
  margin-bottom: 1.5rem;
  font-size: clamp(2.65rem, 5.5vw, 4.6rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.8rem, 3.2vw, 2.55rem);
  line-height: 1.2;
  letter-spacing: -0.028em;
}

h3 {
  margin-bottom: 0.75rem;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.015em;
}

p {
  margin-bottom: 1.25rem;
}

strong {
  color: var(--ink);
  font-weight: 600;
}

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

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

.container {
  width: min(var(--measure), calc(100% - 5rem));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 1rem;
  left: 1rem;
  padding: 0.7rem 1rem;
  transform: translateY(-200%);
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 3rem;
  padding-block: 1.5rem;
}

.brand {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.45;
}

.brand strong {
  font-family: var(--serif);
  font-size: 1.38rem;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.brand span {
  margin-top: 0.17rem;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 1.65rem;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-block: 0.45rem;
  border-bottom: 1px solid transparent;
  color: var(--body);
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--accent-dark);
}

.eyebrow,
.note-label {
  display: block;
  margin-bottom: 1.15rem;
  color: var(--accent);
  font-size: 0.69rem;
  font-weight: 650;
  line-height: 1.6;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero {
  padding-block: 4.6rem 4.4rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(230px, 0.85fr);
  align-items: center;
  gap: 4rem;
}

.hero-copy {
  min-width: 0;
}

.hero h1 {
  max-width: 12ch;
}

.intro,
.lede {
  max-width: 62ch;
  color: var(--body);
  font-size: clamp(1.07rem, 1.8vw, 1.22rem);
  line-height: 1.65;
}

.hero-links,
.contact-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.6rem;
  margin-top: 1.8rem;
}

.text-link {
  display: inline-block;
  padding-block: 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.6rem 1.05rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--paper);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
}

.research-note {
  padding: 1.65rem 1.6rem 1.5rem;
  border-top: 2px solid var(--accent);
  background: var(--paper-alt);
}

.research-note .note-label {
  margin-bottom: 1.05rem;
}

.research-note h2 {
  font-size: 1.65rem;
  line-height: 1.25;
}

.research-note p {
  font-size: 0.88rem;
  line-height: 1.7;
}

.research-note a {
  font-size: 0.83rem;
  font-weight: 600;
}

.research-note > :last-child {
  margin-bottom: 0;
}

.section {
  padding-block: 3.3rem;
  border-top: 1px solid var(--rule);
}

.section-head {
  max-width: 700px;
  margin-bottom: 2.3rem;
}

.section-head .eyebrow {
  margin-bottom: 0.7rem;
}

.section-head p {
  max-width: 63ch;
  margin-bottom: 0;
}

.interest-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.25rem;
}

.interest {
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule-dark);
}

.interest .index {
  display: block;
  margin-bottom: 1.05rem;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 0.98rem;
  font-variant-numeric: lining-nums;
}

.interest h3 {
  font-family: var(--serif);
  font-size: 1.43rem;
  font-weight: 400;
  line-height: 1.25;
}

.interest p {
  margin-bottom: 0;
  font-size: 0.92rem;
  line-height: 1.75;
}

.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(200px, 0.8fr);
  gap: 4rem;
}

.feature-copy h2 {
  max-width: 24ch;
}

.feature-copy p {
  max-width: 62ch;
}

.status {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--accent-dark);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.035em;
}

.feature-side {
  padding-left: 1.7rem;
  border-left: 1px solid var(--rule);
}

.feature-side dl {
  margin: 0;
}

.feature-side dt {
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.feature-side dd {
  margin: 0 0 1.4rem;
  color: var(--ink);
  font-size: 0.91rem;
  line-height: 1.6;
}

.feature-side dd:last-child {
  margin-bottom: 0;
}

.work-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.5fr);
  gap: 1.5rem 3.5rem;
  padding-block: 1.8rem;
  border-top: 1px solid var(--rule);
}

.work-row:last-child {
  padding-bottom: 0;
}

.work-meta span {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.77rem;
}

.work-meta h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.3;
}

.work-detail p {
  margin-bottom: 0.55rem;
  font-size: 0.95rem;
}

.page-intro {
  padding-block: 4rem 2.8rem;
}

.page-intro h1 {
  max-width: 20ch;
  font-size: clamp(2.55rem, 5vw, 3.85rem);
}

.page-intro .lede {
  margin-bottom: 0;
}

.article-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.6fr) minmax(190px, 1fr);
  align-items: start;
  gap: 4rem;
  padding-block: 0.3rem 4rem;
}

.prose {
  min-width: 0;
}

.prose > section {
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

.prose > section + section {
  margin-top: 2.6rem;
}

.prose h2 {
  margin-top: 0;
  font-size: 1.9rem;
}

.prose .status {
  margin-bottom: 0.9rem;
}

.prose h3 {
  margin-top: 1.8rem;
}

.prose p,
.prose li {
  overflow-wrap: break-word;
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
  margin-bottom: 1.5rem;
}

.prose li {
  margin-bottom: 0.6rem;
  padding-left: 0.2rem;
}

.prose li::marker {
  color: var(--accent);
}

.prose blockquote {
  margin: 1.8rem 0;
  padding: 0.1rem 0 0.1rem 1.3rem;
  border-left: 2px solid var(--accent);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.65;
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.page-aside {
  margin-top: 0;
  padding: 1.3rem 0 0 1.4rem;
  border-top: 1px solid var(--rule-dark);
  border-left: 1px solid var(--rule);
}

.page-aside h2 {
  margin-bottom: 0.8rem;
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-aside ol {
  padding-left: 1.2rem;
  margin-bottom: 1.8rem;
}

.page-aside li {
  padding-left: 0.1rem;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.83rem;
}

.page-aside a {
  text-decoration-color: var(--rule-dark);
}

.page-aside p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.75;
}

.step-list {
  margin-block: 1.5rem;
}

.step-list li {
  padding-bottom: 1rem;
}

.step-list li strong {
  display: block;
  margin-bottom: 0.3rem;
}

.step-list li p {
  margin-bottom: 0;
}

.callout {
  margin-block: 1.8rem;
  padding: 1.35rem 1.5rem;
  border-left: 2px solid var(--accent);
  background: var(--paper-alt);
  font-size: 0.94rem;
}

.callout > :last-child {
  margin-bottom: 0;
}

.table-wrap {
  max-width: 100%;
  margin-block: 1.8rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.6;
  text-align: left;
}

caption {
  padding-bottom: 0.75rem;
  color: var(--ink);
  font-weight: 600;
  text-align: left;
}

th,
td {
  padding: 0.9rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  border-top: 1px solid var(--rule-dark);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
}

th:first-child,
td:first-child {
  padding-left: 0;
}

th:last-child,
td:last-child {
  padding-right: 0;
}

.credential-row {
  position: relative;
  padding: 1.5rem 7rem 1.5rem 0;
  border-top: 1px solid var(--rule);
}

.credential-row h3 {
  margin-bottom: 0.35rem;
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 400;
}

.credential-row p {
  margin-bottom: 0.4rem;
  font-size: 0.94rem;
}

.credential-year {
  position: absolute;
  top: 1.65rem;
  right: 0;
  color: var(--muted);
  font-size: 0.81rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.certificate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 2.25rem;
}

.certificate {
  min-width: 0;
  padding-block: 1.3rem;
  border-top: 1px solid var(--rule);
}

.certificate h3 {
  margin-bottom: 0.45rem;
  font-size: 1rem;
}

.certificate p {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.certificate a {
  font-size: 0.82rem;
}

.contact-band {
  padding-block: 2.8rem 3.4rem;
  border-top: 1px solid var(--rule-dark);
}

.contact-band h2 {
  font-size: 2rem;
}

.contact-band p {
  max-width: 65ch;
  margin-bottom: 0;
}

.contact-links {
  margin-top: 1.2rem;
}

.contact-links a {
  padding-block: 0.4rem;
  font-size: 0.9rem;
}

.site-footer {
  border-top: 1px solid var(--rule);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem 2rem;
  padding-block: 1.4rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.65;
}

.footer-inner p {
  margin: 0;
}

.footer-inner a {
  color: var(--muted);
}

@media (hover: hover) {
  a:hover {
    color: var(--accent-dark);
    text-decoration-thickness: 2px;
  }

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

  .site-nav a:hover {
    border-bottom-color: var(--rule-dark);
    color: var(--accent-dark);
  }

  .button-link:hover {
    border-color: var(--accent-dark);
    background: var(--accent-dark);
    color: var(--paper);
  }
}

@media (max-width: 900px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
  }

  .site-nav {
    gap: 0.2rem 1.4rem;
  }

  .hero-grid,
  .feature-grid {
    gap: 2.5rem;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(215px, 1fr);
  }

  .interest-grid {
    gap: 1.6rem;
  }

  .article-grid {
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 2rem;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 16px;
  }

  .container {
    width: calc(100% - 3rem);
  }

  .header-inner {
    align-items: flex-start;
    padding-block: 1.2rem 0.75rem;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    gap: 0.2rem 1.35rem;
  }

  .hero {
    padding-block: 3rem;
  }

  .hero-grid,
  .feature-grid,
  .article-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.25rem;
  }

  .hero h1 {
    max-width: 16ch;
    font-size: clamp(2.7rem, 8.4vw, 3.7rem);
  }

  .hero-links {
    margin-top: 1.4rem;
  }

  .research-note {
    max-width: 100%;
    padding: 1.4rem 1.5rem;
  }

  .research-note h2 {
    max-width: 25ch;
  }

  .research-note p {
    max-width: 65ch;
  }

  .section {
    padding-block: 2.5rem;
  }

  .section-head {
    margin-bottom: 1.8rem;
  }

  .interest-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.7rem;
  }

  .interest {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0 0.75rem;
  }

  .interest .index {
    grid-row: 1 / span 2;
    padding-top: 0.15rem;
  }

  .interest p {
    grid-column: 2;
  }

  .feature-side {
    padding: 1.3rem 0 0;
    border-top: 1px solid var(--rule);
    border-left: 0;
  }

  .work-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
    padding-block: 1.5rem;
  }

  .page-intro {
    padding-block: 2.9rem 2.3rem;
  }

  .page-intro h1 {
    font-size: clamp(2.45rem, 8vw, 3.4rem);
  }

  .article-grid {
    padding-bottom: 2.8rem;
  }

  .page-aside {
    padding: 1.25rem 0 0;
    border-left: 0;
  }

  .page-aside ol {
    columns: 2 180px;
    column-gap: 2rem;
  }

  .page-aside li {
    break-inside: avoid;
  }

  .prose h2 {
    margin-top: 2.2rem;
    padding-top: 1.5rem;
  }

  .contact-band {
    padding-block: 2.4rem 2.7rem;
  }
}

@media (max-width: 430px) {
  .container {
    width: calc(100% - 2.25rem);
  }

  .brand strong {
    font-size: 1.32rem;
  }

  .site-nav {
    gap: 0.15rem 1.1rem;
  }

  .site-nav a {
    font-size: 0.81rem;
  }

  .hero h1 {
    font-size: clamp(2.3rem, 10vw, 2.85rem);
  }

  .hero-links,
  .contact-links {
    column-gap: 1.2rem;
  }

  .research-note {
    padding: 1.3rem;
  }

  .certificate-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .credential-row {
    padding-right: 0;
  }

  .credential-year {
    position: static;
    display: block;
    margin-top: 0.7rem;
    text-align: left;
  }

  .callout {
    padding: 1.1rem;
  }

  th,
  td {
    padding-inline: 0.6rem;
  }
}

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

@media print {
  @page {
    margin: 18mm;
  }

  body {
    display: block;
    min-height: 0;
    background: #fff;
    color: #222;
    font-size: 10pt;
    line-height: 1.5;
  }

  .container {
    width: 100%;
    max-width: none;
  }

  .skip-link,
  .site-nav,
  .page-aside {
    display: none;
  }

  .header-inner {
    padding-block: 0 1rem;
  }

  .hero,
  .page-intro,
  .section,
  .contact-band {
    padding-block: 1.4rem;
  }

  h1,
  .hero h1,
  .page-intro h1 {
    max-width: none;
    font-size: 28pt;
  }

  h2,
  .prose h2 {
    font-size: 18pt;
  }

  h1,
  h2,
  h3,
  .section-head {
    break-after: avoid;
  }

  p,
  li {
    orphans: 3;
    widows: 3;
  }

  .article-grid,
  .hero-grid,
  .feature-grid {
    display: block;
  }

  .research-note,
  .callout {
    background: none;
  }

  .research-note,
  .feature-side {
    margin-top: 1.2rem;
  }

  .interest,
  .work-row,
  .credential-row,
  .certificate,
  tr {
    break-inside: avoid;
  }

  a,
  .button-link {
    color: #222;
    background: none;
    text-decoration: underline;
  }

  .button-link {
    min-height: 0;
    padding: 0;
    border: 0;
  }

  .table-wrap {
    overflow: visible;
  }

  .footer-inner {
    padding-block: 1rem 0;
  }
}

/* Keep section navigation ahead of long articles on phones. */
@media (max-width: 700px) {
  .article-grid > .page-aside { order: -1; }
  .page-aside ol { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.4rem; margin-bottom: 0; }
  .page-aside > p { display: none; }
}
