/* Keyan Azbijari — personal page.
   Visual language: a worn guidebook page. Paper, ink, one ochre route line
   drawn down the margin with numbered belays for each section, and a
   topographic knoll fading in from the top-right corner. */

:root {
  --paper: #f4eddc;
  --paper-2: #ebe2cc;
  --ink: #221f1a;
  --ink-2: #625a4e;
  --rule: #d3c8ae;
  --route: #b2452b;
  --contour-opacity: .16;

  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Noto Serif", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;

  --measure: 44rem;
  --gutter: 3.75rem;   /* space reserved on the left for the route line */
  --line-x: 1.25rem;   /* x of the route line centre inside that gutter  */
  --belay: 28px;       /* diameter of the numbered belay circles          */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1917;
    --paper-2: #24211d;
    --ink: #e9e2d3;
    --ink-2: #a89f90;
    --rule: #3a352e;
    --route: #e07a52;
    --contour-opacity: .22;
  }
}

* { box-sizing: border-box; }

html {
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 var(--serif);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
}

/* paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .7 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* contour lines: the svg is used as a mask so the ink colour follows the theme */
.topo {
  position: absolute;
  top: -60px;
  right: -180px;
  width: min(820px, 120vw);
  aspect-ratio: 1000 / 720;
  z-index: -1;
  pointer-events: none;
  background: var(--ink);
  opacity: var(--contour-opacity);
  -webkit-mask: url("assets/topo.svg") no-repeat center / contain;
  mask: url("assets/topo.svg") no-repeat center / contain;
}

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

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--route) 55%, transparent);
  text-underline-offset: .16em;
  transition: color .15s, text-decoration-color .15s;
}
a:hover { color: var(--route); text-decoration-color: var(--route); }
a:focus-visible { outline: 2px solid var(--route); outline-offset: 3px; border-radius: 2px; }

.masthead, main, footer {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ---- masthead ------------------------------------------------------------ */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  padding-top: 1.4rem;
  padding-bottom: 1.4rem;
  font: 12px/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.masthead a { text-decoration: none; color: var(--ink-2); }
.masthead a:hover { color: var(--route); }
.masthead .brand { color: var(--ink); }
.masthead nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }

/* ---- entry (header block) ------------------------------------------------ */

main { padding-top: 3.5rem; }

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem 2.5rem;
  align-items: start;
  padding-left: var(--gutter);
  margin-bottom: 4.5rem;
}

.eyebrow {
  margin: 0 0 .9rem;
  font: 12px/1.4 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--route);
}

h1 {
  margin: 0 0 .9rem;
  font-size: clamp(2.25rem, 1.4rem + 3vw, 3.1rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.012em;
  text-wrap: balance;
}

.lede {
  margin: 0 0 1.75rem;
  font-size: 1.1rem;
  line-height: 1.5;
  max-width: 34rem;
  text-wrap: pretty;
}

.card {
  margin: 0;
  padding: .85rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: grid;
  row-gap: .3rem;
  font-size: .95rem;
}
.card > div { display: grid; grid-template-columns: 6rem minmax(0, 1fr); column-gap: 1rem; align-items: baseline; }
.card dt, .links dt {
  margin: 0;
  font: 11px/1.6 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.card dd, .links dd { margin: 0; }

/* headshot as a small mounted print */
.photo {
  margin: .25rem 0 0;
}
.photo img {
  display: block;
  width: 136px;
  height: 136px;
  padding: 4px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 2px;
  box-shadow: 0 1px 0 var(--rule);
}
.photo figcaption {
  margin-top: .55rem;
  font: 11px/1.4 var(--mono);
  letter-spacing: .06em;
  color: var(--ink-2);
  white-space: nowrap;
}

/* ---- the route ----------------------------------------------------------- */

.route {
  position: relative;
  padding-left: var(--gutter);
  padding-bottom: 14px;
  counter-reset: pitch;
}

/* the line itself: a gently wandering solid stroke, tiled vertically, masked
   so the colour is a css var. 14px wide tile, 120px tall, seamless. */
.route::before {
  content: "";
  position: absolute;
  top: calc(var(--belay) / 2);
  bottom: 7px;
  left: calc(var(--line-x) - 7px);
  width: 14px;
  background: var(--route);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='120'%3E%3Cpath d='M7 0C11 20 11 40 7 60C3 80 3 100 7 120' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E") repeat-y left top / 14px 120px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='120'%3E%3Cpath d='M7 0C11 20 11 40 7 60C3 80 3 100 7 120' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E") repeat-y left top / 14px 120px;
  animation: draw 1.4s cubic-bezier(.3, .6, .2, 1) both;
}

@keyframes draw {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0 0); }
}

.pitch {
  position: relative;
  margin-bottom: 3.25rem;
  scroll-margin-top: 1.5rem;
  counter-increment: pitch;
}

/* numbered belay */
.pitch::before {
  content: counter(pitch);
  position: absolute;
  top: 0;
  left: calc(var(--line-x) - var(--gutter) - var(--belay) / 2);
  width: var(--belay);
  height: var(--belay);
  border: 1.5px solid var(--route);
  border-radius: 50%;
  background: var(--paper);
  color: var(--route);
  font: 12px/calc(var(--belay) - 3px) var(--mono);
  text-align: center;
  z-index: 1;
}

h2 {
  margin: 0 0 .9rem;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: var(--belay); /* line box = belay height so both sit on one axis */
  letter-spacing: -.005em;
}

.pitch:last-of-type { margin-bottom: 2rem; }

.pitch p { margin: 0 0 .9rem; max-width: 38rem; text-wrap: pretty; }
.pitch p:last-child { margin-bottom: 0; }

/* publication */
.pub h3 {
  margin: 0 0 .35rem;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  max-width: 34rem;
  text-wrap: balance;
}
.pub .authors { font-size: .97rem; margin-bottom: .3rem; }
.pub .me { font-weight: 600; }
.pub .venue {
  font: 12.5px/1.6 var(--mono);
  color: var(--ink-2);
  margin-bottom: .6rem;
}
.pub-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
  font: 12px/1.6 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pub-links a { color: var(--route); text-decoration-color: transparent; }
.pub-links a:hover { text-decoration-color: var(--route); }

/* education */
.edu {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 38rem;
}
.edu li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: .7rem 0;
  border-top: 1px solid var(--rule);
}
.edu li:last-child { border-bottom: 1px solid var(--rule); }
.edu .degree { display: block; }
.edu .school { display: block; color: var(--ink-2); font-size: .95rem; }
.edu .when {
  flex: none;
  font: 12px/1.9 var(--mono);
  letter-spacing: .04em;
  color: var(--ink-2);
  white-space: nowrap;
}

/* contact */
.links { margin: 0; display: grid; row-gap: .35rem; }
.links > div { display: grid; grid-template-columns: 6rem minmax(0, 1fr); column-gap: 1rem; align-items: baseline; }

/* end of route: a two-bolt anchor */
.anchor {
  position: absolute;
  left: calc(var(--line-x) - 14px);
  bottom: 0;
  width: 28px;
  height: 14px;
  color: var(--route);
}
.anchor svg { display: block; }

/* ---- footer -------------------------------------------------------------- */

footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  padding-bottom: 3rem;
  font: 12px/1.7 var(--mono);
  letter-spacing: .03em;
  color: var(--ink-2);
}
footer p { margin: 0; padding-left: var(--gutter); }
footer p:first-child { color: var(--ink); }

/* ---- small screens ------------------------------------------------------- */

@media (max-width: 600px) {
  :root {
    --gutter: 2.4rem;
    --line-x: .65rem;
    --belay: 24px;
  }
  html { font-size: 16px; }
  .masthead, main, footer { padding-left: 1.1rem; padding-right: 1.1rem; }
  .masthead { padding-top: 1.1rem; }
  main { padding-top: 2.25rem; }
  .topo { right: -120px; top: -30px; width: 460px; }

  .entry {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 3.5rem;
  }
  .photo { order: -1; width: 104px; }
  .photo img { width: 104px; height: 104px; }
  .lede { font-size: 1.05rem; }
  .card > div, .links > div { grid-template-columns: 5rem minmax(0, 1fr); }
  .pitch::before { font-size: 11px; }
  .pitch { margin-bottom: 2.75rem; }
  .edu li { flex-direction: column; align-items: flex-start; gap: .1rem; }
  .edu .when { line-height: 1.6; }
}

/* ---- motion & print ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .route::before { animation: none; }
  a { transition: none; }
}

@media print {
  body::before, .topo { display: none; }
  html { background: #fff; color: #000; font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
}
