/* Tokens */
:root {
  color-scheme: light dark;
  --surface: #f6f3f8;
  --surface-raised: #fffaff;
  --ink: #29232f;
  --muted: #716a79;
  --line: #d9d0de;
  --plum: #613c74;
  --coral: #bd5a49;
  --radius: 1rem;
  --shadow: 0 0.75rem 2rem rgb(52 31 67 / 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1.55;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.15;
}

h1 {
  margin: 0;
}

h2 {
  margin: 1.5rem 0 0.5rem;
}

a {
  color: var(--plum);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--coral);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
video:focus-visible,
audio:focus-visible {
  outline: 0.2rem solid var(--coral);
  outline-offset: 0.2rem;
}

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

audio {
  display: block;
  max-width: 100%;
}

/* Shell/profile */
.site-shell {
  width: min(100% - 2rem, 76rem);
  margin-inline: auto;
  padding-block: 2.5rem;
}

.archive-layout {
  display: grid;
  grid-template-columns: minmax(15rem, 0.7fr) minmax(0, 1.6fr);
  align-items: start;
  gap: 2rem;
}

.archive-sidebar {
  position: sticky;
  top: 1.5rem;
  overflow: visible;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.profile-header {
  margin-bottom: 1rem;
}

.profile-name {
  color: var(--plum);
  font-size: clamp(1.8rem, 5vw, 2.7rem);
}

.mirror-notice {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-banner {
  position: relative;
  margin: -1.25rem -1.25rem 0;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--line);
}

.profile-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 0.2rem solid transparent;
  border-radius: inherit;
  z-index: 1;
}

.profile-banner:focus-within::after {
  border-color: var(--coral);
}

.profile-banner .media-asset,
.profile-banner img {
  width: 100%;
}

.profile-banner img {
  aspect-ratio: 3 / 1;
  object-fit: cover;
}

.profile-avatar {
  position: relative;
  width: 5.5rem;
  margin: -2.75rem 0 0.75rem 0.5rem;
}

.profile-avatar .media-asset,
.profile-avatar img {
  width: 5.5rem;
  aspect-ratio: 1;
  overflow: hidden;
  border: 0.3rem solid var(--surface-raised);
  border-radius: 50%;
  background: var(--surface-raised);
}

.profile-avatar img {
  object-fit: cover;
}

.profile-bio,
.profile-fields {
  overflow-wrap: anywhere;
}

.profile-bio p {
  margin: 0 0 1rem;
}

.profile-fields {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  margin: 1rem 0;
  border-top: 1px solid var(--line);
}

.profile-fields dt,
.profile-fields dd {
  margin: 0;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}

.profile-fields dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.profile-fields dd {
  text-align: right;
}

/* Timeline/posts */
.archive-timeline {
  min-width: 0;
}

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

.timeline-entry {
  margin: 0 0 1.25rem;
}

.post-card {
  overflow: hidden;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.post-card:hover,
.post-card:focus-within {
  transform: translateY(-0.15rem);
  box-shadow: 0 1rem 2.5rem rgb(52 31 67 / 0.14);
}

.post-meta {
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
}

.post-content {
  max-width: 68ch;
  overflow-wrap: anywhere;
}

.post-content p:first-child {
  margin-top: 0;
}

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

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

/* Context/media */
.post-warning,
.reply-context,
.poll-card,
.quote-card,
.unavailable {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border-left: 0.3rem solid var(--coral);
  background: color-mix(in srgb, var(--coral) 9%, var(--surface-raised));
  overflow-wrap: anywhere;
}

.reply-context {
  border-left-color: var(--plum);
  background: color-mix(in srgb, var(--plum) 8%, var(--surface-raised));
}

.poll-card {
  border-left-color: var(--plum);
}

.quote-card {
  border-left-color: var(--muted);
  background: color-mix(in srgb, var(--muted) 8%, var(--surface-raised));
}

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

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.media-asset {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.media-asset img {
  width: 100%;
  max-height: 30rem;
  border-radius: 0.65rem;
  object-fit: cover;
}

.media-asset video,
.media-asset audio {
  width: 100%;
}

.media-asset span {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

/* Navigation */
.archive-nav,
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.archive-nav a,
.pagination a {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.85rem;
  text-decoration: none;
}

.pagination {
  justify-content: flex-end;
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 48rem) {
  .site-shell {
    width: min(100% - 1.25rem, 48rem);
    padding-block: 1.25rem;
  }

  .archive-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .archive-sidebar {
    position: static;
  }

  .profile-banner {
    margin: -1.25rem -1.25rem 0;
  }

  .profile-avatar {
    margin-top: 0.75rem;
    margin-left: 0;
  }
}

@media (max-width: 32rem) {
  .site-shell {
    width: min(100% - 0.75rem, 32rem);
  }

  .post-card,
  .archive-sidebar {
    padding: 1rem;
  }

  .profile-banner {
    margin: -1rem -1rem 0;
  }

  .post-meta,
  .post-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Dark/motion */
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #211c25;
    --surface-raised: #2e2633;
    --ink: #f2eaf5;
    --muted: #c7bacb;
    --line: #5a4b60;
    --plum: #d9a9ee;
    --coral: #ffad9c;
    --shadow: 0 0.75rem 2rem rgb(0 0 0 / 0.28);
  }

  a:hover {
    color: #ffd1c7;
  }

  .post-card:hover,
  .post-card:focus-within {
    box-shadow: 0 1rem 2.5rem rgb(0 0 0 / 0.4);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
