/* roberttwomey.com — one small stylesheet, no framework. */

:root {
  --bg: #fff;
  --fg: #111;
  --muted: #666;
  --rule: #e4e4e4;
  --hover: #ddd;
  --soft: #aaa; /* the WordPress theme's hover grey */
  --measure: 52rem;
  --gap: 1.25rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111;
    --fg: #eee;
    --muted: #999;
    --rule: #2a2a2a;
    --hover: #333;
  }
}
:root[data-theme="dark"] {
  --bg: #111;
  --fg: #eee;
  --muted: #999;
  --rule: #2a2a2a;
  --hover: #333;
}

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

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

body {
  margin: 0 auto;
  max-width: 72rem;
  padding: 0 16px;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.6 Lato, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

a { color: inherit; }
a:hover { background: var(--hover); }

/* Sizes follow the WordPress theme: 18px light caps titles, 16px caps headings. */
h1 { font-size: 1.125rem; font-weight: 300; text-transform: uppercase; letter-spacing: .02em; line-height: 1.4; margin: 0 0 1.5rem; }
h2 { font-size: 1rem; font-weight: 400; text-transform: uppercase; line-height: 1.4; margin: 2.5rem 0 .75rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 2rem 0 .5rem; }

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
}
.site-title {
  text-decoration: none;
  text-transform: uppercase;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.6;
}
.site-title:hover { background: none; color: var(--soft); }
.site-header { position: relative; }
.site-header nav { display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; font-size: 1rem; text-transform: uppercase; }
.site-header nav > a, .menu > summary { text-decoration: none; color: var(--fg); }
.site-header nav > a:hover, .site-header nav > a[aria-current],
.menu > summary:hover, .menu > summary[aria-current], .menu[open] > summary { background: none; color: var(--soft); }

/* Dropdowns (Projects, News) */
.menu > summary { cursor: pointer; list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: " ▾"; font-size: .75em; }
.menu-panel {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  top: 100%;
  max-height: 75vh;
  overflow-y: auto;
  padding: .75rem 1rem 1rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  box-shadow: 0 .5rem 1.5rem rgb(0 0 0 / .12);
  text-transform: none; /* only the top-level labels are caps */
}
.menu-panel ul { list-style: none; margin: 0; padding: 0; }
.menu-panel li a { display: block; padding: .45rem 0; text-decoration: none; line-height: 1.35; }
.menu-panel li a:hover { background: none; color: var(--soft); }
.menu-years { display: flex; flex-wrap: wrap; gap: .1rem .6rem; margin: .75rem 0 0; padding-top: .75rem; border-top: 1px solid var(--rule); font-size: .85rem; }
.menu-years a { color: var(--muted); }
.menu-all { display: inline-block; margin-top: .75rem; color: var(--muted); font-size: .85rem; }

@media (min-width: 48rem) {
  .menu { position: relative; }
  .menu-panel { left: auto; right: -1rem; top: calc(100% + .5rem); width: 26rem; }
}
/* Bridge the gap between label and panel so hover-to-open (nav.njk) isn't lost. */
.menu[open]::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: .6rem; }

.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: .85rem;
}

/* Long-form text (projects, posts, pages) */
.prose { max-width: var(--measure); }
.prose p, .prose ul, .prose ol { margin: 0 0 1rem; }
.prose img, .prose video { display: block; width: 100%; height: auto; margin: 1.5rem 0 .5rem; }
.prose picture { display: block; }
.prose figure { margin: 1.5rem 0; }
.prose figcaption, .prose .caption { color: var(--muted); font-size: .85rem; }
.prose blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 2px solid var(--rule); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.subtitle, .meta { color: var(--muted); margin: -.5rem 0 1.5rem; }
.meta { margin: 0 0 .25rem; font-size: .9rem; }

/* Video / audio embeds */
.prose iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  margin: 1.5rem 0;
}
.prose iframe[src*="soundcloud"] { aspect-ratio: auto; height: 166px; }

/* Project grid */
.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: var(--gap);
}
.grid a { display: block; text-decoration: none; }
.grid a:hover { background: none; }
.grid img, .grid .no-thumb {
  display: block;
  width: 100%;
  height: auto; /* let aspect-ratio win over the img height attribute */
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--rule);
}
.grid picture { display: block; }
.grid .label { display: block; padding: .4rem 0 0; font-size: .875rem; }
.grid a:hover .label { color: var(--soft); }

/* News lists */
.news-list { list-style: none; padding: 0; margin: 0; max-width: var(--measure); }
.news-list li { display: grid; grid-template-columns: 10rem 1fr; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--rule); }
.news-list time { color: var(--muted); font-size: .9rem; }
@media (max-width: 36rem) {
  .news-list li { grid-template-columns: 1fr; gap: 0; }
}

.recent { margin-top: 3rem; }
.more, .back { margin-top: 1.5rem; }
.more a, .back a { color: var(--muted); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* About page */
.about::after { content: ""; display: table; clear: both; }
.about p { hyphens: auto; }
.about h2:first-of-type { margin-top: 0; }
.prose .portrait {
  float: right;
  width: 9rem;
  height: auto;
  margin: .3rem 0 1rem 1.25rem;
}
.about picture { display: contents; }
@media (min-width: 40rem) {
  .prose .portrait { width: 15rem; margin-left: 2rem; }
  /* Justify only where the lines are long enough to avoid rivers of space. */
  .about p { text-align: justify; }
}
.about-links {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .4rem 1.5rem;
  margin: 2rem 0 0;
}
.about-links dt { text-transform: uppercase; font-size: .85rem; color: var(--muted); padding-top: .1rem; }
.about-links dd { margin: 0; }

.prose .social { list-style: none; display: flex; gap: 1.25rem; margin: 2rem 0 0; padding: 0; }
.social a { display: block; color: var(--fg); }
.social a:hover { background: none; color: var(--soft); }
.social svg { display: block; width: 1.75rem; height: 1.75rem; }
