:root {
  --bg: #ffffff;
  --text: #1f2328;
  --text-muted: #828282;
  --link: #1c59d1;
  --link-visited: #6a3aaa;
  --border: #e0ddd5;
  --primary: #e82314;
  --tag-bg: #f0eee8;
  --tag-text: #5c5747;
  --tag-media-bg: #fce8e6;
  --tag-media-text: #c5221f;
  --font-monospace:
    ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono,
    monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #121213;
    --text: #d0d0d0;
    --text-muted: #888888;
    --link: #99c3ff;
    --link-visited: #b48ead;
    --border: #333333;
    --tag-bg: #252525;
    --tag-text: #a0a0a0;
    --tag-media-bg: #2d1a1a;
    --tag-media-text: #f28b82;
  }
}

[data-theme="light"] {
  --bg: #ffffff;
  --text: #1f2328;
  --text-muted: #828282;
  --link: #1c59d1;
  --link-visited: #6a3aaa;
  --border: #e0ddd5;
  --tag-bg: #f0eee8;
  --tag-text: #5c5747;
  --tag-media-bg: #fce8e6;
  --tag-media-text: #c5221f;
}

[data-theme="dark"] {
  --bg: #121213;
  --text: #d0d0d0;
  --text-muted: #888888;
  --link: #99c3ff;
  --link-visited: #b48ead;
  --border: #333333;
  --tag-bg: #252525;
  --tag-text: #a0a0a0;
  --tag-media-bg: #2d1a1a;
  --tag-media-text: #f28b82;
}

[data-theme="black"] {
  --bg: #000000;
  --text: #cccccc;
  --text-muted: #777777;
  --link: #99c3ff;
  --link-visited: #b48ead;
  --border: #222222;
  --tag-bg: #1a1a1a;
  --tag-text: #999999;
  --tag-media-bg: #261212;
  --tag-media-text: #f28b82;
}

[data-theme="green"] {
  --bg: #0c0c0c;
  --text: #20c20e;
  --text-muted: #1a8a14;
  --link: #33d117;
  --link-visited: #2aaa15;
  --border: #143214;
  --primary: #20c20e;
  --tag-bg: #112211;
  --tag-text: #33aa22;
  --tag-media-bg: #1a2a11;
  --tag-media-text: #55dd44;
}

[data-theme="orange"] {
  --bg: #fff;
  --text: #000000;
  --text-muted: #828282;
  --link: #000000;
  --link-visited: #828282;
  --border: #e0ddd5;
  --primary: #ff6600;
  --tag-bg: #ededde;
  --tag-text: #828282;
  --tag-media-bg: #ffecd9;
  --tag-media-text: #ff6600;
  --site-container-bg: #f6f6ef;
  --story-title-weight: 400;
}

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

body {
  margin: 0;
  font-family:
    "Google Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-size: inherit;
  font-weight: 700;
}

p {
  margin: 0.5em 0;
}

.icon {
  width: 1em;
  height: 1em;
  vertical-align: middle;
  fill: currentColor;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 14px;
  background: var(--site-container-bg, none);
}

.site-nav {
  display: grid;
  grid-template-columns: auto 1fr;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  margin-bottom: 8px;
  gap: 0 12px;
}

.nav-logo {
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  color: var(--primary);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.nav-logo:hover {
  text-decoration: none;
  color: oklch(0.63 0.3 27);
}

.nav-logo svg {
  border-radius: 6px;
}

.nav-content {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 15px;
  min-width: 0;
}

.nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-slogan {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-picker {
  position: relative;
}

.theme-picker__toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
}

.theme-picker__toggle:hover {
  color: var(--text);
}

.theme-picker__popup {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  flex-direction: column;
  min-width: 100px;
  z-index: 100;
  display: none;
}

.theme-picker__popup:not([hidden]) {
  display: flex;
}

.theme-picker__option {
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 6px 12px;
  text-align: left;
  cursor: pointer;
}

.theme-picker__option:hover {
  background: var(--border);
}

.theme-picker__option--active {
  color: var(--primary);
  font-weight: 700;
}

.nav-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  -webkit-mask-image: linear-gradient(
    to right,
    #000 calc(100% - 24px),
    transparent
  );
}

.nav-bottom:not(.is-overflowing) {
  mask-image: none;
  -webkit-mask-image: none;
}

.nav-bottom::-webkit-scrollbar {
  display: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.nav-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  padding: 1px 5px;
  border-radius: 9999px;
  background: var(--primary);
  color: #fff;
  line-height: 1.3;
  vertical-align: middle;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user form {
  margin: 0;
}

.nav-user button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.nav-user button:hover {
  text-decoration: underline;
}

.site-footer {
  margin-top: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.site-footer__links {
  display: flex;
  gap: 12px;
}

.site-footer a {
  color: var(--text-muted);
  font-weight: 700;
}

.site-footer a:hover {
  color: var(--text);
}
