/* alex-j.dev — Alex Smith
   Plain CSS, no frameworks. One typeface, no accent colour. */

[data-theme="light"] {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #555555;
  --box: #999999;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #aaaaaa;
  --box: #666666;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Sitka Text", Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.page {
  position: relative;
  max-width: 56rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 13rem 1fr;
  grid-template-rows: auto 1fr auto;
  column-gap: 2.5rem;
}

/* ---------- sidebar ---------- */
/* Both sidebar blocks are <aside>, so target them by class, not element. */

.intro {
  grid-column: 1;
  grid-row: 1;
  padding-top: 0.5rem;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.3rem;
}

h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
}

.tagline {
  margin: 0;
  color: var(--muted);
}

.intro h2 {
  margin-top: 1.5rem;
}

.reading {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  padding: 1.5rem 0 0.5rem;
}

.reading h2 {
  margin-top: 0;
}

.reading p {
  margin: 0 0 0.5rem;
  padding-left: 0.8rem;
  text-indent: -0.8rem;
}

/* ---------- sections ---------- */

main {
  grid-column: 2;
  grid-row: 1 / 3;
}

section {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem 1.25rem;
  border: 1px solid var(--box);
}

main > section:first-child {
  margin-top: 0;
}

h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  font-weight: 700;
}

p {
  margin: 0 0 0.8rem;
}

p:last-child {
  margin-bottom: 0;
}

/* ---------- lists ---------- */

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

li + li {
  margin-top: 1rem;
}

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.name {
  font-weight: 700;
}

.when {
  flex: none;
  font-size: 0.9rem;
  color: var(--muted);
}

li p {
  margin: 0.1rem 0 0;
  color: var(--muted);
}

/* Trailing note under a list. */
.more {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- links ---------- */

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ---------- theme toggle ---------- */

#theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin: -0.5rem;
  padding: 0.5rem;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

#theme-toggle:hover {
  color: var(--fg);
  text-decoration: underline;
}

[data-theme="light"] .to-light { display: none; }
[data-theme="dark"] .to-dark { display: none; }

/* ---------- error page ---------- */

.page.error {
  display: block;
  max-width: 34rem;
}

.error .side-head {
  margin-bottom: 0;
}

/* The name is a link home here, but shouldn't read as one at rest. */
.error h1 a {
  text-decoration: none;
}

.error h1 a:hover {
  text-decoration: underline;
}

.error footer {
  text-align: left;
}

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

footer {
  grid-column: 1 / -1;
  margin-top: 3rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: right;
}

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

@media (max-width: 600px) {
  .page { display: block; }

  .intro { padding-top: 0; }

  main { margin-top: 2.25rem; }

  .reading {
    margin-top: 2.25rem;
    padding: 0;
  }
}

@media (max-width: 480px) {
  body { font-size: 1rem; }

  .page { padding: 3rem 1.25rem 2.5rem; }

  section { padding: 0.9rem 1rem 1rem; }

  .row { flex-direction: column; gap: 0; }
}

/* ---------- print ---------- */

@media print {
  /* Always print light, whatever the on-screen theme. */
  [data-theme="dark"] {
    --bg: #ffffff;
    --fg: #000000;
    --muted: #444444;
    --box: #888888;
    color-scheme: light;
  }

  #theme-toggle { display: none; }

  /* Preserve the destination of the compact GitHub contact link on paper. */
  .intro a[href^="http"]::after {
    content: " (" attr(href) ")";
    overflow-wrap: anywhere;
  }
}
