* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
}

img,
video {
  display: block;
  max-width: 100%;
}

.muted {
  color: var(--muted);
}

/* Layout */
.site-header,
main,
.site-footer {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
}

.site-header {
  padding: 16px;
  container-type: inline-size;
}

/* Logo left at full height of the text block; name and subtitle stacked and left-aligned against it.
   The subtitle is one line that fills its column, so the block's height follows from the width.
   The math below makes the logo's height equal that block height at every screen width, no JS.
   Logo aspect is 101:144 (.7014). Name row 24px + 2px gap + subtitle (14/380 of its width). */
.hd {
  --col: calc((100cqw - 30.23px) / 1.02584);
  --h: calc(26px + 0.03684 * var(--col));
  display: grid;
  grid-template-columns: calc(var(--h) * 0.7014) 1fr;
  column-gap: 12px;
  align-items: start;
}

.site-header a {
  text-decoration: none;
}

.brand {
  display: contents;
}

.logo {
  grid-row: 1 / span 2;
  grid-column: 1;
  display: block;
  height: var(--h);
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wordmark {
  grid-column: 2;
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 24px;
}

.tagline {
  grid-column: 2;
  display: block;
  max-width: 100%;
  height: auto;
  margin-top: 2px;
  fill: var(--muted);
  font-family: inherit;
}

.site-footer {
  padding: 24px 16px 40px;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}

/* Feed: flat posts, hairline dividers */
.post {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

/* Feed: the whole post is a tap target for its own page (stretched date link); real controls stay on top. */
.post.tap {
  position: relative;
}

.post.tap .meta a[href^="/p/"]::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post.tap a,
.post.tap audio,
.post.tap video,
.post.tap iframe,
.post.tap button {
  position: relative;
  z-index: 1;
}

.post.tap .meta a[href^="/p/"] {
  position: static;
}

.pad {
  padding: 16px;
}

.embed {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #000;
}

.square {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--media);
}

.caption {
  margin: 0;
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 13px;
  color: var(--muted);
}

.meta > a:first-child {
  margin-right: auto;
}

.meta a {
  text-decoration: none;
}

.meta a:hover {
  text-decoration: underline;
}

.post .square + .pad {
  padding-bottom: 8px;
}

.post > .pad:first-child {
  padding-bottom: 8px;
}

.end {
  text-align: left;
  color: var(--muted);
  font-size: 14px;
  margin: 0;
  padding: 8px 16px 40px;
}

/* Text */
.text-title {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
}

h1.caption {
  margin: 0 0 12px;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.pad p {
  margin: 0 0 12px;
}

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

/* Quote */
.quote {
  margin: 0;
}

.quote blockquote {
  margin: 0;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.3;
}

.quote blockquote::before {
  content: "\201C";
}

.quote blockquote::after {
  content: "\201D";
}

.quote figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.quote figcaption::before {
  content: "— ";
}

/* Link: plain title and domain */
.link-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  margin-bottom: 8px;
}

.link-card strong {
  font-size: 18px;
  font-weight: 600;
}

.link-card:hover strong {
  text-decoration: underline;
}

.link-card span {
  color: var(--muted);
  font-size: 14px;
}

/* Audio */
.audio {
  display: flex;
  gap: 16px;
  align-items: center;
}

.cover {
  width: 96px;
  height: 96px;
  flex: none;
  object-fit: cover;
}

.audio-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.audio-body audio {
  width: 100%;
  margin-top: 8px;
}

.share {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0 16px 16px;
  font-size: 14px;
}

.share a,
.share button {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

#install {
  font: inherit;
  color: var(--bg);
  background: var(--text);
  border: 0;
  padding: 12px 16px;
  cursor: pointer;
}

.meta .text-me,
.meta .sh {
  padding: 8px 14px;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
}

.meta .sh {
  font-family: inherit;
  background: none;
  cursor: pointer;
}

.meta .text-me:hover,
.meta .sh:hover {
  text-decoration: none;
  border-color: var(--muted);
}

/* Feed / Grid toggle */
.views {
  display: flex;
  gap: 16px;
  padding: 0 16px 16px;
  font-size: 14px;
}

.views a {
  color: var(--muted);
  text-decoration: none;
}

.views a[aria-current] {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Grid: three across, square tiles */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--line);
  color: var(--text);
  text-decoration: none;
}

.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile.txt {
  padding: 8px;
  background: transparent;
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
}

.tile.q {
  font-family: Georgia, "Times New Roman", Times, serif;
}

.grid + .end {
  margin-top: 16px;
}
