/* ==========================================================================
   hassankhalil.ai
   Cool paper, green-black ink, one deep-teal signal. Newsreader for voice,
   IBM Plex Sans for structure. Mobile-first: most visitors arrive by QR code.
   ========================================================================== */

:root {
  --paper:    #f7f8f7;
  --paper-2:  #edf0ee;
  --paper-3:  #ffffff;
  --rule:     #d5dcd9;
  --rule-soft:#e4e9e7;
  --ink:      #14211e;
  --ink-2:    #42524e;
  --ink-3:    #5f6e6a;
  --accent:   #0e5c55;
  --accent-d: #0a423d;
  --accent-l: #7ed4c6;
  --deep:     #0f1f1c;

  --serif: 'Newsreader', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans:  'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --gut: clamp(1.25rem, 5vw, 2.5rem);
  --max: 68rem;
  --bar-h: 3.5rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
p, ul, dl, dd, dt, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-d); }

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

svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--accent); color: var(--paper);
  padding: 0.7rem 1.1rem; font-size: 0.9rem; text-decoration: none;
}
.skip:focus { left: 0; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gut);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  text-decoration: none;
  color: var(--paper);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.72rem 1.1rem;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn:hover { background: var(--accent-d); border-color: var(--accent-d); color: var(--paper); }
.btn svg { align-self: center; flex: none; }

.btn--sm { padding: 0.45rem 0.8rem; font-size: 0.875rem; }

.btn--lg {
  font-size: 1rem;
  padding: 0.95rem 1.35rem;
}
.btn__note { font-size: 0.8rem; opacity: 0.72; font-weight: 400; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.btn__short { display: none; }

/* ── Sticky bar ──────────────────────────────────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--rule-soft);
}
.bar__in {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gut);
  min-height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.bar__id {
  display: flex; align-items: center; gap: 0.55rem;
  text-decoration: none; color: var(--ink); margin-right: auto;
}
.bar__mark {
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--paper);
  background: var(--accent);
  border-radius: 2px;
  width: 1.75rem; height: 1.75rem;
  display: grid; place-items: center;
  flex: none;
}
.bar__name { font-size: 0.9rem; font-weight: 500; letter-spacing: 0.01em; }
.bar__nav { display: none; }

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  padding-block: clamp(2.25rem, 7vw, 4.5rem) clamp(2.5rem, 7vw, 4.5rem);
}

.hero__grid {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

.hero__status {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.84rem; font-weight: 500; color: var(--ink-2);
  justify-self: start;
}
.dot {
  width: 0.45rem; height: 0.45rem; border-radius: 50%;
  background: var(--accent); flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.hero__name {
  font-family: var(--serif);
  font-size: clamp(3.1rem, 15vw, 5.5rem);
  line-height: 0.92;
  letter-spacing: -0.028em;
  font-weight: 400;
  font-variation-settings: 'opsz' 60;
}

.hero__role {
  font-size: clamp(1rem, 3.6vw, 1.2rem);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.002em;
}

.hero__claim {
  font-family: var(--serif);
  font-size: clamp(1.08rem, 3.9vw, 1.3rem);
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 34em;
}

.hero__cta { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.hero__cta .btn { flex: 1 1 auto; justify-content: center; }

.hero__where {
  font-size: 0.86rem;
  color: var(--ink-3);
  max-width: 40em;
}

.hero__portrait {
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  background: var(--paper-2);
}
.hero__portrait img {
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  object-position: 50% 22%;
}

/* Mobile: interleave the portrait, and keep both actions above the fold —
   most visitors land here from a QR code on a phone. */
@media (max-width: 43.99em) {
  .hero__grid { gap: 1.1rem; }
  .hero__lede { display: contents; }
  .hero__status   { order: 1; }
  .hero__name     { order: 2; }
  .hero__role     { order: 3; margin-top: -0.35rem; }
  .hero__portrait { order: 4; margin-top: 0.2rem; max-width: 22rem; }
  .hero__cta      { order: 5; }
  .hero__claim    { order: 6; margin-top: 0.35rem; }
  .hero__where    { order: 7; }
  .hero__portrait img { aspect-ratio: 16 / 10; }
}

@media (min-width: 44em) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(13.5rem, 0.9fr);
    gap: clamp(1.75rem, 5vw, 4rem);
  }
  .hero__name { font-size: clamp(3.4rem, 7.4vw, 6.5rem); }
  .hero__lede { display: grid; gap: 1.35rem; justify-items: start; }
  .hero__role { margin-top: -0.6rem; }
  .hero__cta .btn { flex: 0 0 auto; }
  .hero__portrait { margin-top: 0.4rem; }
  .hero__portrait img { aspect-ratio: 4 / 5; object-position: 50% 18%; }
}

/* ── The ledger: the page's one bold element ─────────────────────────────── */

.ledger { margin-top: clamp(2.5rem, 7vw, 4rem); }

.ledger__title {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  padding-bottom: 0.7rem;
  border-bottom: 2px solid var(--ink);
}

.ledger__rows { display: grid; }

.row {
  position: relative;
  padding-block: 0.85rem;
}
.row::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  border-bottom: 1px solid var(--rule);
  transform-origin: left;
}

.row dt {
  font-size: 0.9rem;
  color: var(--ink-3);
  line-height: 1.45;
}
.row dd {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 6.5vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-variation-settings: 'opsz' 36;
  font-variant-numeric: tabular-nums lining-nums;
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 0 0.4rem;
  margin-top: 0.1rem;
}
.row .was { color: var(--ink-3); font-size: 0.66em; }
.row .arrow { color: var(--accent); font-size: 0.6em; font-family: var(--sans); }
.row .now { color: var(--ink); }
.row .plus { color: var(--accent); }

@media (min-width: 46em) {
  .row {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    padding-block: 1.05rem;
  }
  .row dt {
    display: flex;
    align-items: baseline;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.95rem;
  }
  .row dt::after {
    content: "";
    flex: 1 1 auto;
    min-width: 1.5rem;
    margin: 0 0.7rem;
    border-bottom: 1px dotted var(--rule);
    transform: translateY(-0.28em);
  }
  .row dd { flex: 0 0 auto; margin-top: 0; }
}

/* ── Bands ───────────────────────────────────────────────────────────────── */

.band { padding-block: clamp(3rem, 8vw, 5.5rem); }
.band--alt { background: var(--paper-2); border-block: 1px solid var(--rule-soft); }

.band__title {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  padding-bottom: 0.7rem;
  border-bottom: 2px solid var(--ink);
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}
/* Sub-headings inside a column sit closer to their own content. */
.band__title--space { margin-top: clamp(2rem, 5vw, 2.75rem); margin-bottom: 1.1rem; }

.prose {
  font-size: 0.98rem;
  color: var(--ink-2);
  line-height: 1.68;
  max-width: 40em;
}

/* ── Roles ───────────────────────────────────────────────────────────────── */

.role { padding-bottom: clamp(2rem, 5vw, 3rem); }
.role + .role { padding-top: clamp(2rem, 5vw, 3rem); border-top: 1px solid var(--rule); }
.role:last-child { padding-bottom: 0; }

.role__dates {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}
.role__place { font-size: 0.84rem; color: var(--ink-3); }

.role__title {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 4.6vw, 1.8rem);
  line-height: 1.22;
  letter-spacing: -0.014em;
  margin-top: 0.6rem;
  font-variation-settings: 'opsz' 32;
}
.role__org {
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--accent);
  margin-top: 0.2rem;
  margin-bottom: 1.1rem;
}
.role__org a { text-decoration: none; }
.role__org a:hover { text-decoration: underline; }
.role__note { font-weight: 400; color: var(--ink-3); }

@media (min-width: 52em) {
  .role { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); }
  .role__title { margin-top: -0.35rem; }
}

/* ── Bullet points ───────────────────────────────────────────────────────── */

.points { display: grid; gap: 0.75rem; max-width: 42em; }
.points li {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.97rem;
  line-height: 1.62;
  color: var(--ink-2);
}
.points li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.68em;
  width: 0.34rem; height: 0.34rem;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.55;
}

.stack {
  margin-top: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink-3);
  max-width: 42em;
}
.stack__k {
  color: var(--ink-2);
  font-weight: 600;
  margin-right: 0.3rem;
}

/* ── Projects ────────────────────────────────────────────────────────────── */

.projects { display: grid; gap: 1rem; }

.proj {
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: clamp(1.25rem, 4vw, 1.85rem);
}
.proj__name {
  font-family: var(--serif);
  font-size: clamp(1.45rem, 5vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.016em;
  font-variation-settings: 'opsz' 32;
}
.proj__sub { font-size: 0.95rem; font-weight: 500; color: var(--accent); margin-top: 0.15rem; }
.proj__when {
  font-size: 0.8rem;
  color: var(--ink-3);
  margin-top: 0.5rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--rule-soft);
  margin-bottom: 1rem;
  font-variant-numeric: lining-nums;
}

/* The flagship gets the full measure; the three shorter projects share a row,
   so no card is padded out to match a neighbour it has nothing in common with. */
@media (min-width: 52em) {
  .projects { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
  .proj:first-child { grid-column: 1 / -1; }
  .proj:first-child .points {
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem 2.75rem;
    max-width: none;
  }
}
@media (min-width: 68em) {
  .projects { grid-template-columns: repeat(3, 1fr); }
  .proj:first-child { grid-column: 1 / -1; }
  .proj:first-child .points { grid-template-columns: repeat(3, 1fr); gap: 0 2.25rem; }
}

/* ── Skills ──────────────────────────────────────────────────────────────── */

.skills { display: grid; }
.skill { padding-block: 1.1rem; border-bottom: 1px solid var(--rule); }
.skill:first-child { padding-top: 0; }
.skill dt {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.skill dd {
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 46em;
}

@media (min-width: 52em) {
  .skill {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    padding-block: 1.35rem;
  }
  .skill dt { margin-bottom: 0; }
}

/* ── Education ───────────────────────────────────────────────────────────── */

.edu__grid { display: grid; gap: clamp(2.5rem, 6vw, 4rem); }
@media (min-width: 52em) {
  .edu__grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

.edu { padding-bottom: 1.35rem; margin-bottom: 1.35rem; border-bottom: 1px solid var(--rule); }
.edu:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.edu__when { font-size: 0.82rem; color: var(--ink-3); font-variant-numeric: lining-nums; }
.edu__what {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 4vw, 1.4rem);
  line-height: 1.28;
  letter-spacing: -0.012em;
  margin-top: 0.25rem;
  font-variation-settings: 'opsz' 28;
}
.edu__where { font-size: 0.95rem; font-weight: 500; color: var(--accent); margin-top: 0.25rem; }
.edu__note { font-size: 0.88rem; color: var(--ink-3); margin-top: 0.2rem; }

.certs { display: grid; gap: 0.8rem; }
.certs li {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-2);
  padding-left: 1.15rem;
  position: relative;
}
.certs li::before {
  content: "";
  position: absolute; left: 0; top: 0.62em;
  width: 0.34rem; height: 0.34rem; border-radius: 1px;
  background: var(--accent); opacity: 0.55;
}
.certs__note { display: block; font-size: 0.85rem; color: var(--ink-3); }

/* ── Contact ─────────────────────────────────────────────────────────────── */

.foot {
  background: var(--deep);
  color: var(--paper);
  padding-block: clamp(3.25rem, 9vw, 6rem);
}
.foot__head {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 7vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.022em;
  max-width: 14em;
  font-variation-settings: 'opsz' 48;
}
.foot__lede {
  font-family: var(--serif);
  font-size: clamp(1.02rem, 3.6vw, 1.2rem);
  line-height: 1.62;
  color: color-mix(in srgb, var(--paper) 72%, var(--deep));
  max-width: 32em;
  margin-top: 1rem;
}

.foot__links {
  display: grid;
  gap: 0.9rem;
  margin-bottom: clamp(1.75rem, 5vw, 2.5rem);
}
.foot__links li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.6rem; }
.foot__links a {
  font-size: clamp(1.02rem, 4vw, 1.15rem);
  font-weight: 500;
  color: var(--accent-l);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent-l) 40%, transparent);
  word-break: break-word;
}
.foot__links a:hover { color: var(--paper); border-bottom-color: var(--paper); }
.foot__tag {
  font-size: 0.78rem;
  color: color-mix(in srgb, var(--paper) 55%, var(--deep));
}

.foot .btn {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--deep);
}
.foot .btn:hover { background: var(--accent-l); border-color: var(--accent-l); color: var(--deep); }

.foot__fine {
  font-size: 0.85rem;
  color: color-mix(in srgb, var(--paper) 55%, var(--deep));
  max-width: 34em;
  margin-top: 1.75rem;
}
.foot__fine--last {
  max-width: none;
  margin-top: clamp(1.5rem, 4vw, 2rem);
  padding-top: 1.25rem;
  border-top: 1px solid color-mix(in srgb, var(--paper) 15%, var(--deep));
}

.foot__grid { display: grid; gap: clamp(2rem, 5vw, 2.5rem) clamp(2.5rem, 7vw, 5rem); }
.foot__reach {
  padding-top: clamp(1.5rem, 4vw, 2rem);
  border-top: 1px solid color-mix(in srgb, var(--paper) 18%, var(--deep));
}

@media (min-width: 52em) {
  .foot__grid { grid-template-columns: minmax(0, 1.05fr) minmax(17rem, 0.85fr); align-items: start; }
  .foot__say { grid-column: 1; }
  .foot__reach { grid-column: 2; padding-top: 0.85rem; border-top: 0; }
  .foot__fine--last { grid-column: 1 / -1; }
}

/* ── Anchor offset under the sticky bar ──────────────────────────────────── */

#top, #work, #projects, #skills, #education, #contact { scroll-margin-top: calc(var(--bar-h) + 0.75rem); }

/* ── Desktop nav ─────────────────────────────────────────────────────────── */

@media (min-width: 62em) {
  .bar__nav { display: flex; gap: 1.5rem; margin-right: 1.5rem; }
  .bar__nav a {
    font-size: 0.88rem;
    color: var(--ink-2);
    text-decoration: none;
    padding-block: 0.25rem;
    border-bottom: 1px solid transparent;
  }
  .bar__nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }
  .bar__nav a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--accent); }
}

@media (max-width: 22em) {
  .bar .btn__full { display: none; }
  .bar .btn__short { display: inline; }
  .bar__name { display: none; }
}

/* ── One orchestrated load sequence, hero only ───────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .js .hero__status,
  .js .hero__name,
  .js .hero__role,
  .js .hero__portrait,
  .js .hero__claim,
  .js .hero__cta,
  .js .hero__where,
  .js .ledger__title {
    opacity: 0;
    transform: translateY(0.5rem);
    animation: settle 620ms cubic-bezier(0.22, 0.68, 0.3, 1) forwards;
  }
  .js .hero__status   { animation-delay:  40ms; }
  .js .hero__name     { animation-delay:  90ms; }
  .js .hero__role     { animation-delay: 180ms; }
  .js .hero__portrait { animation-delay: 240ms; }
  .js .hero__claim    { animation-delay: 300ms; }
  .js .hero__cta      { animation-delay: 360ms; }
  .js .hero__where    { animation-delay: 420ms; }
  .js .ledger__title  { animation-delay: 480ms; }

  /* The measurement rules draw themselves in. */
  .js .row::after { transform: scaleX(0); animation: rule 520ms cubic-bezier(0.3, 0.7, 0.3, 1) forwards; }
  .js .row:nth-child(1)::after { animation-delay: 560ms; }
  .js .row:nth-child(2)::after { animation-delay: 620ms; }
  .js .row:nth-child(3)::after { animation-delay: 680ms; }
  .js .row:nth-child(4)::after { animation-delay: 740ms; }
  .js .row:nth-child(5)::after { animation-delay: 800ms; }

  .js .row dt, .js .row dd { opacity: 0; animation: settle 520ms ease-out forwards; }
  .js .row:nth-child(1) dt, .js .row:nth-child(1) dd { animation-delay: 580ms; }
  .js .row:nth-child(2) dt, .js .row:nth-child(2) dd { animation-delay: 640ms; }
  .js .row:nth-child(3) dt, .js .row:nth-child(3) dd { animation-delay: 700ms; }
  .js .row:nth-child(4) dt, .js .row:nth-child(4) dd { animation-delay: 760ms; }
  .js .row:nth-child(5) dt, .js .row:nth-child(5) dd { animation-delay: 820ms; }
}

@keyframes settle { to { opacity: 1; transform: none; } }
@keyframes rule   { to { transform: scaleX(1); } }

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

/* ── Print ───────────────────────────────────────────────────────────────── */

@media print {
  .bar, .hero__cta, .skip, .hero__status { display: none; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .band, .hero { padding-block: 0.6rem; }
  .band--alt { background: #fff; }
  .foot { background: #fff; color: #000; padding-block: 1rem; }
  .foot__links a, .foot__lede, .foot__fine, .foot__tag { color: #000; }
  .proj, .role { break-inside: avoid; }
  a { text-decoration: none; }
}
