/* /dev/notes — a responsive rewrite of the "Lightweight" Tumblr theme by Artur Kim. */

:root {
  --page-bg: #1b1c1f;
  --card-bg: #fff;
  --card-border: #000;
  --text: #333;
  --muted: #555;
  --rule: #ccc;
  --accent: #a33446;
  --heading: #000;
  --code-bg: #f6f6f6;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color-scheme: light;
}

/* Opt-in dark theme, toggled by public/javascripts/theme.js */
:root[data-theme="dark"] {
  --card-bg: #23252a;
  --text: #d8d8d8;
  --muted: #a0a0a0;
  --rule: #3c3f45;
  --accent: #e0667a;
  --heading: #f2f2f2;
  --code-bg: #1b1c1f;
  color-scheme: dark;
}
:root[data-theme="dark"] .post-type a,
:root[data-theme="dark"] .post-meta a,
:root[data-theme="dark"] .pagination .previous-page a,
:root[data-theme="dark"] .pagination .next-page a { filter: invert(.8); }

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, h5, h6, p, ul, ol, dl, dd, pre, blockquote, figure { margin: 0; }
ul, ol { padding: 0; }
img, video, iframe { max-width: 100%; height: auto; }
input, button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Global elements */
body {
  background: var(--page-bg);
  color: var(--text);
  font: 15px/1.6 var(--font-body);
  padding: 20px 10px;
}
p, ul, ol, dd, pre, blockquote, table { margin-bottom: 20px; }
pre, code { font: 13px/1.6 var(--font-mono); }
code { background: var(--code-bg); padding: 1px 4px; border-radius: 3px; }
pre { background: var(--code-bg); border: 1px solid var(--rule); padding: 10px; overflow-x: auto; white-space: pre; }
pre code { background: none; padding: 0; }
blockquote { border-left: 5px solid var(--rule); color: var(--muted); font-style: italic; padding-left: 10px; }
table { border: 1px solid var(--rule); border-collapse: collapse; width: 100%; text-align: left; display: block; overflow-x: auto; }
tr { border-bottom: 1px solid var(--rule); }
th, td { padding: .5em 1em; }
hr { border: 0; border-top: 1px solid var(--rule); margin-bottom: 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); color: var(--heading); line-height: 1.3; margin-bottom: 10px; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.3em; }
img { border: 1px solid var(--rule); }
a img:hover, a img:focus { border-color: var(--accent); }

/* Structure */
#wrapper {
  background: var(--card-bg);
  border: 10px solid var(--card-border);
  margin: 0 auto;
  box-sizing: content-box; /* 795px of content + padding + border = the original 915px box */
  max-width: 795px;
  padding: 20px 50px;
}
#footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 12px;
  padding: 20px 0 0;
}

/* Header */
#branding { padding: 40px 0; text-align: center; }
#branding h1 { margin: 0; }
#branding h1 a { color: var(--heading); font: 50px/1 var(--font-heading); text-decoration: none; }
#branding h1 a:hover, #branding h1 a:focus { color: var(--accent); }

#access { border-bottom: 1px solid var(--rule); font-size: 12px; padding: 10px 0; }
#access .menu { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
#pages ul { display: flex; gap: 10px; list-style: none; margin: 0; }
#pages a { color: var(--muted); text-transform: uppercase; padding: 6px 0; display: inline-block; }
.theme-toggle { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 6px 0; text-transform: uppercase; }
.theme-toggle:hover, .theme-toggle:focus { color: var(--accent); text-decoration: underline; }
#search form { display: flex; gap: 4px; }
#search input { background: none; border: 1px solid var(--rule); font-size: 12px; padding: 5px 6px; min-height: 30px; }
#search input.search-text { width: 140px; }
#search input.search-submit { color: var(--muted); cursor: pointer; }
#search input.search-submit:hover { border-color: var(--accent); color: var(--accent); }

/* Posts */
.post { border-top: 1px solid var(--rule); padding: 20px 0 40px 78px; position: relative; }
.post-type a {
  position: absolute; left: 0; top: 20px;
  width: 48px; height: 48px;
  overflow: hidden; text-indent: -9999px;
  border: 0;
  background: url("/images/lightweight-icons.png") no-repeat 0 0;
  transition: transform .15s;
}
.post-type-link .post-type a { background-position: 0 -144px; }
.post-type a:hover, .post-type a:focus { transform: rotate(15deg); }
.post-content h3 { font-size: 22px; margin-bottom: 15px; }
.post-content img { margin-bottom: 20px; padding: 10px; }
.post-content ul, .post-content ol { padding-left: 30px; }
.post-content ul ul, .post-content ol ol { margin-bottom: 0; }
.post-type-link .link-wrap { margin-bottom: 20px; }

.gist { margin-bottom: 20px; }
.gist pre { margin-bottom: 0; border-bottom: 0; }
.gist-meta { border: 1px solid var(--rule); background: var(--code-bg); font-size: 12px; padding: 4px 10px; }
.gist-meta a { color: var(--muted); }

.tags { font-size: 12px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tags a { border: 1px solid var(--rule); border-radius: 30px; color: var(--muted); padding: 2px 10px; }
.tags a:hover, .tags a:focus { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.post-meta { font-size: 12px; display: flex; flex-wrap: wrap; gap: 0 20px; }
.post-meta a { color: var(--muted); padding: 1px 0 1px 20px; background: url("/images/lightweight-small-icons.png") no-repeat 0 0; }
.post-meta .comments a { background-position: 0 -16px; }

.post-footer { border-top: 1px solid var(--rule); font-size: 12px; padding: 10px 0; text-transform: uppercase; }
#disqus_thread { border-top: 1px solid var(--rule); padding-top: 20px; }

/* Search results */
#content > ul { list-style: disc; padding-left: 30px; margin-top: 20px; }

/* Pagination */
.pagination {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  padding: 16px 0;
  text-transform: uppercase;
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
}
.pagination a { color: var(--muted); display: inline-block; line-height: 16px; }
/* 16px-tall links so the 16px sprite shows exactly one icon */
.pagination .previous-page a { background: url("/images/lightweight-small-icons.png") no-repeat left -48px; padding-left: 20px; }
.pagination .next-page a { background: url("/images/lightweight-small-icons.png") no-repeat right -64px; padding-right: 20px; }

/* Small screens */
@media (max-width: 600px) {
  body { padding: 0; }
  #wrapper { border-width: 0; padding: 10px 16px; }
  #branding { padding: 20px 0; }
  #branding h1 a { font-size: 36px; }
  .post { padding-left: 0; }
  .post-type { display: none; }
  #search form, #search input.search-text { width: 100%; }
}
