/* Core Styling inspired by matthaldane.com */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;600&display=swap');

body {
  background-color: #101015;
  color: #E8E3D3;
  font-family: "IBM Plex Mono", "Courier New", Courier, monospace;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  padding-bottom: 60px;
}

.container {
  max-width: 650px;
  margin: 0 auto;
  padding: 0 20px;
}

.masthead {
  border-bottom: 1px solid #1c1c24;
  margin-bottom: 40px;
  padding: 30px 0;
}

.masthead-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.site-title {
  color: #D4C5B0;
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.site-title:hover {
  color: #dfd4c4;
}

.site-subtitle {
  color: #8c8578;
  font-size: 0.9rem;
}

/* Post Styling */
.post-item {
  border: 1px solid #1c1c24;
  border-radius: 6px;
  background-color: #0b0b0f;
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.post-item:hover {
  border-color: #D4C5B0;
  box-shadow: 0 4px 12px rgba(212, 197, 176, 0.05);
}

.post-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #8c8578;
  margin-bottom: 12px;
}

.post-source {
  color: #D4C5B0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.post-date a {
  color: #8c8578;
  text-decoration: none;
}

.post-date a:hover {
  color: #dfd4c4;
  text-decoration: underline;
}

.post-content {
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.post-content a {
  color: #D4C5B0;
  text-decoration: none;
}

.post-content a:hover {
  color: #dfd4c4;
  text-decoration: underline;
}

/* Mastodon HTML content overrides */
.post-content p {
  margin: 0 0 1em 0;
}
.post-content p:last-child {
  margin-bottom: 0;
}

/* Media Grid Styles */
.post-media-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
}

.post-media-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #1c1c24;
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}

.post-media-grid img:hover {
  opacity: 0.9;
}

/* Prevents image warping when zooming in on object-fit: cover elements */
.medium-zoom-image--opened {
  object-fit: contain !important;
}

/* Grid presets based on image count */
.post-media-grid[data-count="1"] {
  grid-template-columns: 1fr;
}
.post-media-grid[data-count="1"] img {
  max-height: 450px;
  height: auto;
  object-fit: contain;
  background-color: #0b0b0f;
}

.post-media-grid[data-count="2"] {
  grid-template-columns: 1fr 1fr;
  height: 280px;
}

.post-media-grid[data-count="3"] {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 380px;
}
.post-media-grid[data-count="3"] img:first-child {
  grid-row: span 2;
}

.post-media-grid[data-count="4"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 480px;
}

/* Footer */
.footer {
  margin-top: 60px;
  border-top: 1px solid #1c1c24;
  padding-top: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: #8c8578;
}

.footer a {
  color: #D4C5B0;
  text-decoration: none;
}

.footer a:hover {
  color: #dfd4c4;
  text-decoration: underline;
}

/* Webmention Section for local posts */
.webmentions {
  margin-top: 40px;
  border-top: 1px solid #1c1c24;
  padding-top: 30px;
}

.webmentions-title {
  color: #D4C5B0;
  font-size: 1.1rem;
  margin-bottom: 20px;
  text-transform: uppercase;
}

.webmention-item {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.webmention-avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid #1c1c24;
}

.webmention-body {
  flex: 1;
}

.webmention-meta {
  color: #8c8578;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.webmention-author {
  color: #D4C5B0;
  font-weight: 600;
  text-decoration: none;
}

.webmention-content {
  color: #E8E3D3;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #101015;
}
::-webkit-scrollbar-thumb {
  background: #1c1c24;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #D4C5B0;
}

/* YouTube Inline Player Styles */
.yt-embed-container {
  position: relative;
  width: 100%;
  margin-top: 15px;
  border: 1px solid #1c1c24;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.yt-facade {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.yt-facade::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(16, 16, 21, 0.55);
  transition: background-color 0.25s ease;
}

.yt-facade:hover::before {
  background-color: rgba(16, 16, 21, 0.35);
}

.yt-play-button {
  position: relative;
  z-index: 2;
  background: #1a1a24;
  color: #D4C5B0;
  border: 1px solid #D4C5B0;
  padding: 10px 20px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.yt-facade:hover .yt-play-button {
  background: #D4C5B0;
  color: #101015;
  box-shadow: 0 0 10px rgba(212, 197, 176, 0.4);
}

.yt-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
}

/* External Link Card Preview */
.external-card {
  display: flex;
  margin-top: 15px;
  border: 1px solid #1c1c24;
  border-radius: 4px;
  overflow: hidden;
  background-color: #0b0b0f;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.external-card:hover {
  border-color: #D4C5B0;
  box-shadow: 0 4px 12px rgba(212, 197, 176, 0.05);
}

.external-thumb {
  flex: 0 0 160px;
  width: 160px;
  height: 120px;
  border-right: 1px solid #1c1c24;
  overflow: hidden;
}

.external-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.external-info {
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.external-title {
  margin: 0 0 4px 0;
  color: #D4C5B0;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.external-card:hover .external-title {
  color: #dfd4c4;
}

.external-description {
  margin: 0 0 8px 0;
  font-size: 0.75rem;
  color: #8c8578;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.external-url {
  font-size: 0.7rem;
  color: #8c8578;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .external-card {
    flex-direction: column;
  }
  .external-thumb {
    flex: 0 0 auto;
    width: 100%;
    height: 140px;
    border-right: none;
    border-bottom: 1px solid #1c1c24;
  }
}

/* Profile Header Styling */
.profile-header {
  border: none;
  background-color: transparent;
  margin-top: 15px; /* Pushed closer to the top */
  margin-bottom: 30px;
}

.profile-banner {
  width: 100%;
  height: 180px;
  overflow: hidden;
  border: 1px solid #1c1c24;
  border-radius: 6px;
}

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

.profile-info-container {
  padding: 0 0px 10px 0px; /* Align content perfectly with the post cards below */
  position: relative;
}

.profile-avatar-wrapper {
  position: relative;
  margin-top: -45px;
  margin-bottom: 12px;
  display: inline-block;
}

.profile-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid #101015; /* Match body background for a clean cutout overlap */
  box-shadow: 0 0 0 1px #1c1c24;
  background-color: #101015;
  object-fit: cover;
  display: block;
}

.profile-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-name-group {
  display: flex;
  flex-direction: column;
}

.profile-display-name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  color: #E8E3D3;
}

.profile-handle {
  font-size: 0.8rem;
  color: #8c8578;
}

.profile-bio {
  margin: 4px 0 8px 0;
  font-size: 0.95rem;
  color: #D4C5B0;
  line-height: 1.5;
}

.profile-meta-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8rem;
  color: #8c8578;
  border-top: 1px solid #1c1c24;
  padding-top: 12px;
  margin-top: 4px;
}

.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-meta-item a {
  color: #D4C5B0;
  text-decoration: none;
}

.profile-meta-item a:hover {
  color: #dfd4c4;
  text-decoration: underline;
}

.profile-meta-item .icon {
  color: #8c8578;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .profile-banner {
    height: 120px;
  }
  .profile-avatar-wrapper {
    margin-top: -35px;
  }
  .profile-avatar {
    width: 70px;
    height: 70px;
  }
  .profile-meta-links {
    flex-direction: column;
    gap: 8px;
  }
}

/* Post Interaction Action Button */
.interaction-action a {
  color: #D4C5B0;
  text-decoration: none;
  border: 1px solid #1c1c24;
  padding: 3px 8px;
  border-radius: 4px;
  background-color: #101015;
  transition: all 0.2s ease;
  display: inline-block;
}

.interaction-action a:hover {
  border-color: #D4C5B0;
  color: #101015;
  background-color: #D4C5B0;
  box-shadow: 0 0 8px rgba(212, 197, 176, 0.2);
}
