:root {
  /* Matches the directory's palette (go.drveri.com) so the blog reads as
     part of the same site rather than a differently-themed sub-app. */
  --accent: #0E7C7B;
  --accent-dark: #0A5F5E;
  --border: #E8E1D5;
  --text: #211D18;
  --text-dim: #746A5D;
  --danger: #B23B3B;
  --bg: #F0E3C8;
  --bg-alt: #F8F0DF;
  --surface: #FFFFFF;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.page {
  max-width: 720px;
  margin: 0 auto;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(115deg, #0A5F5E, #12817E 55%, #17968F);
  box-shadow: 0 2px 16px rgba(10, 60, 58, 0.22);
}

.topbar h1,
.topbar .site-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.topbar-heading {
  min-width: 0;
}

.site-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar .site-link {
  color: #fff;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.site-nav a {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.link-button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.link-button:hover {
  background: var(--bg-alt);
}

.topbar .link-button {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.topbar .link-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.link-button.danger {
  color: var(--danger);
  border: none;
  padding: 4px 0;
}

.inline-form {
  margin: 0;
}

.composer {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.composer-title {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  padding: 4px 0;
}

.toolbar {
  display: flex;
  gap: 6px;
  margin: 4px 0;
}

.toolbar button {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.toolbar button:hover {
  background: var(--bg-alt);
}

.composer textarea {
  width: 100%;
  min-height: 80px;
  border: none;
  background: transparent;
  color: var(--text);
  resize: vertical;
  font-size: 18px;
  font-family: inherit;
  outline: none;
}

.composer-help {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.word-count {
  font-size: 13px;
  color: var(--text-dim);
}

.word-count.over-limit {
  color: var(--danger);
  font-weight: 700;
}

.composer-error {
  background: #f6ddd3;
  color: var(--danger);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  margin: 8px 0 0;
}

.composer-footer button,
.auth-card button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.composer-footer button:hover,
.auth-card button:hover {
  background: var(--accent-dark);
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
}

.post {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(55, 42, 31, 0.07);
  overflow: hidden;
}

.post-title {
  margin: -18px -18px 14px -18px;
  padding: 14px 18px;
  background: var(--bg-alt);
  border-bottom: 2px solid var(--accent);
  font-size: 17px;
  line-height: 1.3;
}

.post-title a {
  color: inherit;
  text-decoration: none;
}

.post-title a:hover {
  text-decoration: underline;
}

.post-content {
  margin: 0 0 12px;
  word-wrap: break-word;
  line-height: 1.5;
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
}

.post-content a {
  color: var(--accent);
  text-decoration: none;
}

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

.post-content .hashtag {
  font-weight: 600;
}

.post-heading {
  text-align: left;
  margin: 14px 0 8px;
  line-height: 1.3;
  color: var(--text);
}

h2.post-heading {
  font-size: 16px;
}

h3.post-heading {
  font-size: 14px;
}

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

.table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.post-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.post-table th,
.post-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.post-table th {
  background: var(--bg-alt);
  font-weight: 700;
}

.post-table tr:last-child td {
  border-bottom: none;
}

.post-figure {
  margin: 12px 0;
  text-align: center;
}

.post-figure img,
.post-figure .embed-image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 0;
}

.post-figure figcaption {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.embed-image,
.embed-video-file {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 8px 0;
}

.embed-video {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  margin: 8px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.embed-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.embed-source {
  display: block;
  font-size: 12px;
  color: var(--text-dim) !important;
  word-break: break-all;
  margin: -4px 0 8px;
}

.post-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.post-byline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.post-avatar {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.post-author {
  font-weight: 600;
  font-size: 13px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
}

.post-time {
  color: var(--text-dim);
  font-size: 13px;
}

.share-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 2px;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
}

.share-btn:hover,
.share-btn.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.action-link {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.action-link:hover {
  text-decoration: underline;
}

.tag-banner {
  padding: 12px 20px;
  font-size: 14px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.tag-banner a {
  color: var(--accent);
  text-decoration: none;
}

.tag-banner a:hover {
  text-decoration: underline;
}

.delete-form {
  margin: 0;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.auth-subtitle {
  color: var(--text-dim);
  margin: 0 0 20px;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--text-dim);
}

.auth-card input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
}

.auth-card input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.auth-back {
  margin-top: 16px;
  font-size: 14px;
}

.back-to-feed {
  padding: 16px 20px;
}

.auth-back a {
  color: var(--accent);
  text-decoration: none;
}

.error {
  background: #f6ddd3;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin: 0 0 16px;
}

.settings {
  padding: 20px;
}

.settings-heading {
  font-size: 22px;
  margin: 0 0 16px;
}

.settings-success {
  background: #e5ecd8;
  color: #4d6b33;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin: 0 0 16px;
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(55, 42, 31, 0.06);
}

.settings-section h2 {
  margin: 0 0 14px;
  font-size: 16px;
}

.settings-section form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-section label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--text-dim);
}

.settings-section input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
}

.settings-section input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.settings-section button {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.settings-section button:hover {
  background: var(--accent-dark);
}
