/* ==========================================================================
   alex-markin.com — design system
   Full spec: DESIGN-SYSTEM.md (read it before editing).
   Everything derives from the tokens below. Never hard-code a color or
   font-family in a rule — reference a token.
   ========================================================================== */

:root {
  /* color — warm greys on pure black, olive accent */
  --bg:        #000000;  /* page background, always pure black */
  --ink:       #ccc6b9;  /* default text + links */
  --ink-bright:#eae5da;  /* display text (the name) */
  --ink-hover: #ffffff;  /* link hover */
  --muted:     #847e70;  /* descriptions, taglines, secondary text */
  --faint:     #66614f;  /* mono tags, metadata */
  --footnote:  #5c574a;  /* footer text */
  --accent:    #7d8f5c;  /* olive — section headings only */
  --hairline:  #35322a;  /* dotted leader lines */
  --rule:      #24221d;  /* solid horizontal rules (footer) */
  --border:    #2a2822;  /* borders on images / counter chip */
  --chip-bg:   #131311;  /* visitor-counter chip background */

  /* type */
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", "SF Mono", Menlo, monospace;

  /* type scale */
  --fs-display: 44px;    /* h1 name */
  --fs-body:    16px;    /* default */
  --fs-desc:    14.5px;  /* descriptions under links */
  --fs-heading: 12px;    /* section headings (mono) */
  --fs-tag:     11px;    /* leader-line tags (mono) */
  --fs-meta:    11.5px;  /* header meta line (mono) */
  --fs-footer:  10.5px;  /* footer (mono) */

  /* layout */
  --page-max:   1100px;
  --col-min:    340px;   /* min column width before grid collapses */
  --gap-col:    64px;
  --gap-row:    44px;
  --radius:     2px;     /* images only — everything else is square */
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --------------------------------------------------------------------------
   page shell
   -------------------------------------------------------------------------- */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 56px 48px 12px;
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--col-min), 1fr));
  gap: var(--gap-row) var(--gap-col);
  margin-bottom: 48px;
}

/* stacked sections sharing one grid column (e.g. contact above social) */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap-row);
}

/* --------------------------------------------------------------------------
   header (identity block)
   -------------------------------------------------------------------------- */

.intro {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 4px;
}

.photo {
  display: block;
  width: 148px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  filter: grayscale(0.25);
  background: var(--chip-bg);
}

/* on pages other than the homepage, the portrait and the name link home.
   the anchor is layout-neutral: the image keeps its own treatment, and the
   name keeps --ink-bright, hovering to white like any other link. */
.photo-link {
  display: block;
  flex: none;
  line-height: 0;
}

.name a { color: inherit; }

.name a:hover,
.name a:focus-visible { color: var(--ink-hover); }

.intro-text {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 8px;
}

.name {
  margin: 0;
  font-family: var(--mono);
  font-weight: 600;
  font-size: var(--fs-display);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-transform: lowercase;
  color: var(--ink-bright);
}

.tagline {
  margin: 0;
  font-size: var(--fs-body);
  color: var(--muted);
}

.meta {
  margin: 0;
  font-family: var(--mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.08em;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   sections + headings
   -------------------------------------------------------------------------- */

.heading {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: var(--fs-heading);
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   links + leader lines (the core list pattern)
   <li class="row"><a>title</a><span class="leader"></span><span class="tag">tag</span></li>
   -------------------------------------------------------------------------- */

a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover,
a:focus-visible {
  color: var(--ink-hover);
}

/* external destinations receive a compact machine-voice marker. Photo links
   are already visibly interactive through their image treatment. */
a[target="_blank"]:not(.flickr-photo-link)::after {
  content: "↗";
  margin-left: 0.15em;
  font-family: var(--mono);
  font-size: var(--fs-tag);
  letter-spacing: 0;
}

.links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.links li { margin: 8px 0; }

.row {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.row a { white-space: nowrap; }

/* Extend the first link over its full leader row, so the title, dotted line,
   and tag all share one click target without changing their visual treatment. */
.row > a:first-child::before {
  content: "";
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.leader {
  flex: 1;
  border-bottom: 1px dotted var(--hairline);
}

.tag {
  font-family: var(--mono);
  font-size: var(--fs-tag);
  color: var(--faint);
}

/* live "how long ago" timestamp, mono machine-voice, populated by JS from the
   GitHub API. hidden until (and unless) it has content so a failed/slow fetch
   leaves no gap. see the timestamp note in DESIGN-SYSTEM.md. */
.ago {
  font-family: var(--mono);
  font-size: var(--fs-tag);
  color: var(--faint);
  white-space: nowrap;
}
.ago:empty { display: none; }

/* publications variant: title row + description line.
   .entries (cv experience/education) shares the same rhythm */
.pubs,
.entries { display: flex; flex-direction: column; gap: 18px; list-style: none; margin: 0; padding: 0; }

.desc {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--fs-desc);
}

.desc a { color: var(--accent); }

/* --------------------------------------------------------------------------
   cv entries (cv.html)
   -------------------------------------------------------------------------- */

/* date range sitting in a .row's right-hand slot. same machine voice as .tag,
   but free-form text rather than a one-word tag, so it must not wrap. */
.dates {
  font-family: var(--mono);
  font-size: var(--fs-tag);
  color: var(--faint);
  white-space: nowrap;
}

/* detail lines under an entry — .desc voice, one point per line, no bullets.
   the extra top margin keeps them from merging with the place line above. */
.notes {
  list-style: none;
  margin: 7px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: var(--fs-desc);
}

.notes li { margin: 2px 0; }

/* latest photo from the curated flickr album; the whole section stays hidden
   until the feed has supplied a valid image and link */
.flickr-photo { margin: 0; }

.flickr-photo-link {
  display: block;
  margin-bottom: 8px;
}

.flickr-photo-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  filter: grayscale(0.25);
  background: var(--chip-bg);
}

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

.footer {
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 24px;
  font-family: var(--mono);
  font-size: var(--fs-footer);
  letter-spacing: 0.06em;
  color: var(--footnote);
}

.footer-domain { justify-self: end; }

.footer a { color: inherit; }

.footer a:hover,
.footer a:focus-visible { color: var(--ink-hover); }

.copy-markdown {
  justify-self: center;
  margin: 0;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: none;
  color: var(--muted);
  font: inherit;
  letter-spacing: inherit;
  text-transform: lowercase;
  cursor: pointer;
  transition: color 0.15s ease;
}

.copy-markdown:hover,
.copy-markdown:focus-visible {
  color: var(--ink-hover);
}

.copy-source {
  position: fixed;
  inset: 0 auto auto -9999px;
}

.counter-chip {
  background: var(--chip-bg);
  border: 1px solid var(--border);
  padding: 1px 5px;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   mobile
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .page { padding: 36px 24px 12px; }
  .intro {
    justify-content: center;
    text-align: center;
  }
  .intro-text {
    flex-basis: 100%;
    min-width: 0;
    align-items: center;
    padding-top: 0;
  }
  .name { font-size: 32px; }
  .photo { width: 116px; }

  /* long titles + tag can outgrow narrow viewports; let the title wrap
     instead of forcing the tag to hug (or clip past) the edge */
  .row { flex-wrap: wrap; row-gap: 2px; }
  .row a { white-space: normal; }
  .leader { min-width: 16px; }

  .footer { grid-template-columns: auto auto; justify-content: space-between; }
  .copy-markdown { grid-column: 1 / -1; grid-row: 1; margin-bottom: 4px; }
  .footer-date { grid-column: 1; grid-row: 2; }
  .footer-domain { grid-column: 2; grid-row: 2; }
}
