/* ============================================================
   Farhad Panahov — personal site
   Plain CSS, no build step. Tokens live in :root.

   Light ground, cobalt accent, rounded full-colour imagery.
   Type: Source Serif 4 (display) + IBM Plex Sans (everything else).
   To make the headline sans instead of serif, change --display below.
   ============================================================ */

:root {
  --ink:        #14171c;
  --ink-soft:   #3d444e;
  --muted:      #6a727d;
  --faint:      #9aa1ab;
  --paper:      #fbfaf8;
  --white:      #ffffff;
  --wash:       #f1efeb;
  --line:       #e7e3dc;
  --accent:     #2148cc;
  --accent-lo:  #eef1fd;

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans:  "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --display: var(--serif);   /* swap to var(--sans) for a geometric headline */

  --r:    16px;              /* image corner radius */
  --max:  1180px;
  --pad:  40px;
}

*, *::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: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

/* ---------- top bar ---------- */

.topbar { padding: 22px 0; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.02rem; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.brand .first { color: var(--ink); font-weight: 600; }
.brand .last  { color: var(--faint); font-weight: 400; }

.pillnav {
  display: flex; align-items: center; gap: 4px;
  background: var(--wash); border-radius: 999px; padding: 5px;
}
.pillnav a {
  color: var(--ink-soft);
  font-size: .84rem; font-weight: 500;
  padding: 8px 17px; border-radius: 999px;
  transition: background .16s ease, color .16s ease;
}
.pillnav a:hover { text-decoration: none; background: rgba(255,255,255,.75); color: var(--ink); }
.pillnav a[aria-current="page"] { background: var(--ink); color: #fff; }
.pillnav a[aria-current="page"]:hover { background: var(--ink); color: #fff; }

/* ---------- shared bits ---------- */

.label {
  font-size: .7rem; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 20px;
}

.section-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2rem, 4vw, 3.1rem); letter-spacing: -.03em; line-height: 1.05;
  margin: 0 0 34px;
}
.section-title .soft { color: var(--faint); }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--ink); color: #fff;
  border-radius: 999px; padding: 13px 22px;
  font-size: .85rem; font-weight: 500;
  transition: background .16s ease;
}
.btn:hover { text-decoration: none; background: var(--accent); color: #fff; }

/* ---------- hero ---------- */

.hero { padding: 30px 0 82px; }
.hero .wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 430px);
  gap: 68px; align-items: stretch;
}
.hero h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.9rem, 6vw, 4.9rem); letter-spacing: -.035em; line-height: 1.02;
  margin: 0 0 30px;
}
.hero h1 .accent { color: var(--accent); }
.hero p {
  font-size: .99rem; line-height: 1.66; color: var(--muted);
  max-width: 54ch; margin: 0 0 13px;
}
/* the closing personal line sits apart from the body copy — same type, just a rule above */
.hero hr { border: 0; border-top: 1px solid var(--line); margin: 21px 0 15px; }

/* two-layer portrait: risograph illustration over the photograph.
   Both layers are pinned to the same box, so they crop identically at
   any size and never drift. Hover fades the illustration away. */
.portrait {
  position: relative; margin: 0; align-self: stretch;
  overflow: hidden; border-radius: 22px;
  background: #ccd8d7;             /* matches the render's own ground */
  min-height: 460px;
}
.portrait img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 8%;
}
.portrait-riso { transition: opacity 550ms ease; }

@media (hover: hover) {
  .portrait:hover .portrait-riso { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .portrait-riso { transition: none; }
}

/* social row under the intro */
.social { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.social a {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--white);
  border-radius: 999px; padding: 11px 19px;
  font-size: .85rem; font-weight: 500; color: var(--ink);
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.social a:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); background: var(--accent-lo); }
.social svg { width: 15px; height: 15px; flex: none; fill: currentColor; }

/* ---------- work mosaic ---------- */

.band { padding: 76px 0; }
.band--wash { background: var(--wash); }
section { scroll-margin-top: 20px; }

.mosaic { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.tile { position: relative; display: flex; flex-direction: column; min-width: 0; }
.tile--large { grid-column: 1 / 3; grid-row: 1; }
.tile--tall  { grid-column: 3; grid-row: 1 / 3; }
.tile--sm    { grid-row: 2; }

.pic {
  position: relative; overflow: hidden;
  border-radius: var(--r); background: var(--wash); width: 100%;
}
.tile--large .pic { aspect-ratio: 16 / 9; }
.tile--sm .pic    { aspect-ratio: 4 / 3; }
.tile--tall .pic  { flex: 1 1 auto; min-height: 280px; }
.pic img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.tile:hover .pic img { transform: scale(1.05); }

.badge {
  display: inline-block;
  background: rgba(255,255,255,.93); color: var(--ink);
  border-radius: 999px; padding: 7px 13px;
  font-size: .62rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
}
.badge--role { background: var(--accent); color: #fff; }
.pill--role  { background: var(--accent-lo); color: var(--accent); }

/* badges always live in a .badges row, so any number of them flow side by side.
   Only the row is positioned — a badge itself never escapes its container. */
.badges { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; }
.pic .badges {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  max-width: calc(100% - 28px);
}

/* scrim so overlaid text stays legible whatever the photograph is doing */
.pic::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to top,
    rgba(10,14,20,.90) 0%, rgba(10,14,20,.55) 34%, rgba(10,14,20,0) 72%);
}
.tile-body {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 0;
  padding: 26px 26px 24px; color: #fff;
}
.tile--sm .tile-body { padding: 18px 18px 17px; }
.tile h3 {
  font-family: var(--display); font-weight: 700;
  font-size: 1.24rem; line-height: 1.18; letter-spacing: -.022em;
  margin: 0 0 7px; color: #fff;
}
.tile--large h3 { font-size: 1.7rem; }
.tile p {
  margin: 0; font-size: .9rem; line-height: 1.5; color: rgba(255,255,255,.82);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile--large p { font-size: .96rem; }
.tile a.cover { position: absolute; inset: 0; z-index: 3; }
/* ---------- work page: latest ---------- */

.latest {
  position: relative; display: block; overflow: hidden;
  border-radius: var(--r); background: var(--ink);
  aspect-ratio: 21 / 9; margin-bottom: 76px;
}
.latest img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.latest:hover img { transform: scale(1.03); }
.latest:hover { text-decoration: none; }
.latest::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(100deg, rgba(12,15,20,.90) 0%, rgba(12,15,20,.72) 42%, rgba(12,15,20,.15) 100%);
}
.latest-body {
  position: absolute; z-index: 2; left: 0; bottom: 0; top: 0;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 620px; padding: 44px 48px;
}
.latest .badges, .majorcard .badges { margin-bottom: 16px; }
.latest h3 {
  font-family: var(--display); font-weight: 700; color: #fff;
  font-size: clamp(1.6rem, 3vw, 2.5rem); line-height: 1.08; letter-spacing: -.03em;
  margin: 0 0 12px;
}
.latest p { margin: 0 0 22px; color: rgba(255,255,255,.8); font-size: 1rem; max-width: 52ch; }
.latest .btn { background: #fff; color: var(--ink); align-self: flex-start; }
.latest:hover .btn { background: var(--accent); color: #fff; }

/* ---------- work page: major cards ---------- */

.major { display: flex; flex-direction: column; gap: 26px; margin-bottom: 76px; }
.majorcard {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
  transition: border-color .16s ease;
}
.majorcard:hover { border-color: var(--accent); text-decoration: none; }
.majorcard-body { padding: 40px 42px; display: flex; flex-direction: column; justify-content: center; }
.majorcard .badge { background: var(--wash); color: var(--ink-soft); }
.majorcard .badge--role { background: var(--accent-lo); color: var(--accent); }
.majorcard h3 {
  font-family: var(--display); font-weight: 700; color: var(--ink);
  font-size: clamp(1.35rem, 2.3vw, 1.85rem); line-height: 1.14; letter-spacing: -.028em;
  margin: 0 0 12px;
}
.majorcard:hover h3 { color: var(--accent); }
.majorcard p { margin: 0; color: var(--muted); font-size: .97rem; }
.majorcard .more { margin-top: 20px; font-size: .84rem; font-weight: 500; color: var(--accent); }
.majorcard .more::after { content: " \2192"; }
.majorcard-pic { overflow: hidden; aspect-ratio: 3 / 2; }
.majorcard-pic img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.majorcard:hover .majorcard-pic img { transform: scale(1.05); }

/* ---------- chronological list ---------- */

.chrono { border-top: 1px solid var(--ink); }
.row {
  display: grid; grid-template-columns: 150px 1fr; gap: 10px 32px;
  padding: 24px 0; border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.row .yr { font-size: .8rem; color: var(--faint); letter-spacing: .04em; white-space: nowrap; }

/* title + subtitle are one clickable block */
.rowlink { display: block; color: inherit; }
.rowlink:hover { text-decoration: none; }
.rowlink:hover h4 { color: var(--accent); }
.rowlink h4 { transition: color .16s ease; }

/* secondary links (extra years, code, dashboard) sit under the subtitle */
.rowlinks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.rowlinks a {
  font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 13px; border-radius: 999px;
  background: var(--wash); color: var(--ink-soft);
  transition: background .16s ease, color .16s ease;
}
.rowlinks a:hover { text-decoration: none; background: var(--accent); color: #fff; }

/* year groups collapse */
.yeargroup { border-bottom: 1px solid var(--line); }
.yeargroup > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 22px 0; font-family: var(--display); font-weight: 700;
  font-size: 1.35rem; letter-spacing: -.025em; color: var(--ink);
}
.yeargroup > summary::-webkit-details-marker { display: none; }
.yeargroup > summary::after {
  content: ""; width: 8px; height: 8px; margin-top: -4px;
  border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint);
  transform: rotate(45deg); transition: transform .2s ease;
}
.yeargroup[open] > summary::after { transform: rotate(-135deg); margin-top: 2px; }
.yeargroup > summary:hover { color: var(--accent); }
.yeargroup > summary:hover::after { border-color: var(--accent); }
.yeargroup .row:last-of-type { border-bottom: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 11px; }
.pill {
  font-size: .6rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
}
.pill--src  { background: var(--wash); color: var(--ink-soft); }
.row h4 {
  font-family: var(--display); font-size: 1.2rem; font-weight: 700;
  letter-spacing: -.022em; line-height: 1.22; margin: 0 0 6px;
}
.row p { margin: 0; font-size: .94rem; color: var(--muted); max-width: 72ch; }

/* ---------- background columns ---------- */

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 50px; }
.cols h3 {
  font-size: .71rem; font-weight: 600; letter-spacing: .15em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 22px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.entry { margin-bottom: 22px; }
.entry:last-child { margin-bottom: 0; }
.entry .t { display: block; font-weight: 600; font-size: .99rem; line-height: 1.35; }
.entry .s { display: block; font-size: .92rem; color: var(--muted); }
.entry .d {
  display: block; font-size: .71rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); margin-top: 4px;
}

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

.footer { background: var(--ink); color: #fff; padding: 56px 0 40px; margin-top: 20px; }
.footer .row2 {
  display: flex; flex-wrap: wrap; gap: 30px; justify-content: space-between; align-items: flex-start;
  padding-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,.16);
}
.footer .name { font-family: var(--display); font-size: 1.4rem; font-weight: 700; letter-spacing: -.03em; }
.footer .place { color: rgba(255,255,255,.6); font-size: .93rem; margin-top: 4px; }
.footer nav { display: flex; flex-wrap: wrap; gap: 24px; }
.footer nav a { color: #fff; font-size: .86rem; font-weight: 500; }
.footer nav a:hover { color: #9dbcff; text-decoration: none; }

.social--dark { margin-top: 0; }
.social--dark a {
  background: transparent; border-color: rgba(255,255,255,.24); color: #fff;
}
.social--dark a:hover { background: #fff; border-color: #fff; color: var(--ink); }

.footer .fine { margin: 0; font-size: .79rem; color: rgba(255,255,255,.48); }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 14px 28px;
  justify-content: space-between; align-items: center; margin-top: 24px;
}
.footer-bottom nav { gap: 22px; }

/* ---------- interior page head ---------- */

.pagehead { padding: 20px 0 54px; }
.pagehead h1 {
  font-family: var(--display); font-size: clamp(2.4rem, 5vw, 3.8rem); font-weight: 700;
  letter-spacing: -.035em; line-height: 1.02; margin: 0 0 16px;
}
.pagehead h1 .accent { color: var(--accent); }
.pagehead p { color: var(--muted); max-width: 62ch; margin: 0; font-size: 1.02rem; }
@media (max-width: 780px) {
    }

/* ---------- CV document ---------- */

.doc { max-width: 820px; }
.doc h2 {
  font-family: var(--display); font-size: 1.65rem; font-weight: 700; letter-spacing: -.03em;
  margin: 50px 0 20px; padding-bottom: 13px; border-bottom: 1px solid var(--ink);
}
.doc h2:first-of-type { margin-top: 0; }
.doc h3 { font-size: 1.02rem; font-weight: 600; margin: 30px 0 2px; }
.doc .org {
  font-size: .71rem; letter-spacing: .11em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 14px;
}
.doc ul { margin: 0 0 16px; padding-left: 19px; }
.doc li { margin-bottom: 9px; color: var(--muted); }
.doc table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.doc td { padding: 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--muted); }
.doc td:first-child { color: var(--ink); font-weight: 500; padding-right: 28px; }
.doc td:last-child {
  text-align: right; white-space: nowrap; color: var(--faint);
  font-size: .71rem; letter-spacing: .1em; text-transform: uppercase;
}

/* ---------- responsive ---------- */

@media (max-width: 1040px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 40px; align-items: start; }
  .portrait { max-width: 340px; min-height: 0; aspect-ratio: 4 / 5; }
  .hero p { max-width: none; }
  .latest { aspect-ratio: 3 / 2; }
  .latest-body { max-width: none; padding: 32px 34px; }
}

@media (max-width: 880px) {
  .mosaic { grid-template-columns: 1fr 1fr; }
  .tile--large { grid-column: 1 / 3; grid-row: 1; }
  .tile--tall  { grid-column: 1 / 3; grid-row: 2; }
  .tile--tall .pic { aspect-ratio: 16 / 9; flex: 0 0 auto; min-height: 0; }
  .tile--sm    { grid-row: 3; }
  .majorcard { grid-template-columns: 1fr; }
  .majorcard-pic { order: -1; min-height: 220px; max-height: 280px; }
}

@media (max-width: 780px) {
  :root { --pad: 22px; }
  body { font-size: 16px; }
  .band { padding: 52px 0; }
  .hero { padding: 20px 0 56px; }
  .pillnav a { padding: 8px 13px; font-size: .8rem; }
  .row { grid-template-columns: 1fr; gap: 8px; }
  .row .yr { order: -1; }
  .cols { gap: 38px; }
  .latest-body { padding: 26px 24px; }
  .majorcard-body { padding: 28px 26px; }
}

@media (max-width: 560px) {
  .mosaic { grid-template-columns: 1fr; gap: 28px; }
  .tile--large, .tile--tall, .tile--sm { grid-column: 1; grid-row: auto; }
  .tile--large .pic, .tile--sm .pic, .tile--tall .pic { aspect-ratio: 16 / 10; }
  .topbar .wrap { flex-direction: column; align-items: flex-start; gap: 14px; }
  .latest { aspect-ratio: 4 / 5; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pic img, .latest img, .majorcard-pic img { transition: none; }
}

@media print {
  .topbar, .footer, .social { display: none; }
  body { background: #fff; font-size: 11pt; }
}
