/* adnanakil.com
   One column, two typefaces, one accent — the red "a" carried over from the
   old site. Everything else is spacing. */

:root {
  --serif: "Source Serif 4", Charter, Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --paper: #fcfcfa;
  --ink: #1b1a18;
  --muted: #6d6c66;
  --faint: #97968d;
  --rule: #e4e3dd;
  --accent: #b81e00;
  --accent-line: rgba(184, 30, 0, 0.4);

  --w: 40rem;
  --gutter: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121211;
    --ink: #e9e8e3;
    --muted: #9c9b93;
    --faint: #78776f;
    --rule: #2c2b28;
    --accent: #ff6242;
    --accent-line: rgba(255, 98, 66, 0.45);
  }
}

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

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

body {
  margin: 0;
  padding: 0 var(--gutter);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.masthead,
main,
.colophon {
  max-width: var(--w);
  margin-inline: auto;
}

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

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  position: static;
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.875rem;
  padding: 0.5rem 0;
}

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

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 3.5rem 0 3.25rem;
}

.wordmark {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

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

.masthead nav {
  display: flex;
  gap: 1.25rem;
  font-family: var(--sans);
  font-size: 0.875rem;
}

.masthead nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  transition: color 0.15s ease;
}

.masthead nav a:hover {
  color: var(--ink);
}

.masthead nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: 0 1px 0 var(--accent);
}

/* ---------- index ---------- */

.index,
.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}

.year-group {
  position: relative;
  margin-bottom: 2.75rem;
}

.year {
  margin: 0 0 1rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--faint);
}

/* Wide enough for margin notes: the year steps out of the column. */
@media (min-width: 62rem) {
  .year {
    position: absolute;
    top: 0.9rem;
    left: -6rem;
    width: 4rem;
    margin: 0;
    text-align: right;
  }
}

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1.5rem;
  align-items: baseline;
  padding: 0.7rem 0;
}

.entry-link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: transparent;
  text-underline-offset: 0.2em;
  text-wrap: pretty;
  transition: text-decoration-color 0.15s ease;
}

.entry-link:hover {
  text-decoration-color: var(--accent);
}

.entry-date {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  white-space: nowrap;
}

.entry-tags {
  grid-column: 1 / -1;
  margin: 0.25rem 0 0;
  font-family: var(--sans);
  font-size: 0.75rem;
}

.entry-tags a {
  color: var(--faint);
  text-decoration: none;
}

.entry-tags a:hover {
  color: var(--accent);
}

.entry-tags a + a::before {
  content: " · ";
  color: var(--faint);
}

/* ---------- project tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.9rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.25rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  transition: border-color 0.15s ease;
}

.tile:hover,
.tile:focus-within {
  border-color: var(--accent-line);
}

.tile-name {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.tile-name a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: transparent;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.15s ease;
}

.tile:hover .tile-name a {
  text-decoration-color: var(--accent);
}

/* The whole tile is the link. Secondary links inside sit above this layer. */
.tile-name a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.tile-description {
  margin: 0 0 0.9rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

.tile-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: auto 0 0;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--faint);
}

.tile-tech span + span::before {
  content: " · ";
  color: var(--faint);
}

.tile-site {
  position: relative;
  z-index: 1;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.tile-site:hover {
  color: var(--accent);
}

.empty {
  margin-top: 2.5rem;
  color: var(--muted);
}

/* ---------- posts and pages ---------- */

.post h1,
.page-title {
  margin: 0 0 0.6rem;
  font-weight: 600;
  font-size: clamp(1.55rem, 1.25rem + 1.4vw, 2.05rem);
  line-height: 1.18;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.page-title em {
  font-style: italic;
  color: var(--muted);
}

.meta {
  margin: 0 0 2.75rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--faint);
}

/* Scoped under .post so these win against the prose link rules below, which
   share the same specificity and come later in the file. */
.post .meta a {
  color: var(--faint);
  text-decoration: none;
}

.post .meta a:hover {
  color: var(--accent);
}

.meta-sep {
  padding: 0 0.3em;
  color: var(--faint);
}

.meta .tag + .tag::before {
  color: var(--faint);
}

.meta .tag + .tag::before {
  content: " · ";
  color: var(--rule);
}

.post p,
.post ul,
.post ol {
  margin: 0 0 1.35em;
}

.post ul,
.post ol {
  padding-left: 1.25rem;
}

.post li {
  margin-bottom: 0.45em;
}

.post h2 {
  margin: 2.4em 0 0.7em;
  font-size: 1.2em;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.post a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 0.18em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.post a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.post blockquote {
  margin: 1.8em 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
}

.post blockquote p {
  margin-bottom: 0.5em;
}

.post blockquote p:last-child {
  margin-bottom: 0;
}

.post em {
  font-style: italic;
}

.post sup {
  font-size: 0.7em;
  line-height: 0;
  vertical-align: super;
}

.post sup a {
  text-decoration: none;
  color: var(--accent);
}

.post img {
  max-width: 100%;
  height: auto;
}

.notes {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--muted);
}

.notes ol {
  margin: 0;
  padding-left: 1.1rem;
}

.notes li {
  margin-bottom: 0.6em;
}

.notes a {
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ---------- tail ---------- */

.back {
  margin: 4rem 0 0;
  font-family: var(--sans);
  font-size: 0.8125rem;
}

.back a {
  color: var(--faint);
  text-decoration: none;
}

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

.colophon {
  margin-top: 5rem;
  padding: 1.5rem 0 4rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--faint);
}

.colophon p {
  margin: 0;
}

.colophon a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.16em;
}

.colophon a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
