/*
Theme Name: Emin Budak Blog
Theme URI: https://eminbudak.com/blog/
Description: The Wiro Blog theme restyled for eminbudak.com: monochrome, terminal, the same title bar and status bar as the site.
Author: M. Emin Budak
Version: 2.0.0
Requires PHP: 8.0
Text Domain: wiro-blog
*/

:root {
  --bg: #0a0a0a;
  --bg-2: #101010;
  --fg: #ececec;
  --text: #cfcfcf;
  --mid: #b3b3b3;
  --dim: #7d7d7d;
  --shade: #585858;
  --faint: #3a3a3a;
  --line: #1c1c1c;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad-x: clamp(16px, 3.2vw, 64px);
  --bar-h: 40px;
}

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

html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px / 1.6 var(--mono);
  font-variant-ligatures: none;
  font-feature-settings: "zero" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--fg); color: var(--bg); }
a { color: inherit; }
a:focus-visible { outline: 1px solid var(--fg); outline-offset: 2px; }
img { display: block; max-width: 100%; height: auto; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 10; padding: 8px 12px; background: var(--fg); color: var(--bg); text-decoration: none; }
.skip:focus { top: 12px; }
.sr-only, .screen-reader-text { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { width: min(100% - var(--pad-x) * 2, 1100px); margin-inline: auto; }
.wrap-text { width: min(100% - var(--pad-x) * 2, 720px); margin-inline: auto; }
.screen { flex: 1; padding: clamp(28px, 5vw, 64px) 0 clamp(56px, 8vw, 96px); }

/* ------------------------------------------------------------ chrome */

.titlebar {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: var(--bar-h); padding: 0 var(--pad-x);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  color: var(--dim); font-size: 12.5px; white-space: nowrap;
}
.lights { display: flex; gap: .6em; }
.lights i { width: 10px; height: 10px; border: 1px solid var(--faint); border-radius: 50%; }
.title { text-decoration: none; }
.title .sep { color: var(--faint); }
.title:hover { color: var(--fg); }
.topnav { justify-self: end; display: flex; gap: 2.2ch; }
.topnav a { text-decoration: none; }
.topnav a:hover { color: var(--fg); }

.statusbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 2ch;
  min-height: var(--bar-h); padding: 8px var(--pad-x);
  background: var(--bg-2); border-top: 1px solid var(--line);
  color: var(--dim); font-size: 12.5px;
}
.tabs { display: flex; gap: 1.2ch; }
.session-name { color: var(--mid); }
.win { padding: 0 .6ch; text-decoration: none; }
.win:hover { color: var(--fg); }
.win.is-active { background: var(--fg); color: var(--bg); }
.foot-links { display: flex; gap: 2ch; }
.foot-links a { text-decoration: none; }
.foot-links a:hover { color: var(--fg); }
.copy { color: var(--faint); }

/* ------------------------------------------------------------ terminal lines */

.line { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.gap { margin-top: 2.2em; }
.dim { color: var(--dim); }
.dot { color: var(--faint); margin: 0 .6ch; }
.ps1 { color: var(--dim); }
.ps1 b { color: var(--fg); font-weight: 700; }
a.ps1 { text-decoration: none; }
a.ps1:hover, a.ps1:focus-visible { background: var(--fg); color: var(--bg); outline: none; }
a.ps1:hover b, a.ps1:focus-visible b { color: var(--bg); }
.cmd { color: var(--fg); margin-bottom: .6em; }

.blog-title {
  margin: .3em 0 .2em;
  font: 800 clamp(48px, 9vw, 112px) / .95 var(--mono);
  letter-spacing: -.05em;
  color: var(--fg);
}
.blog-lead { max-width: 60ch; margin: 1em 0 0; color: var(--mid); font-size: 15px; }
.blog-lead a, .line a, .whoami a { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: .22em; }
.blog-lead a:hover, .line a:hover, .whoami a:hover { background: var(--fg); color: var(--bg); text-decoration: none; }

.dirs { display: flex; flex-wrap: wrap; gap: .4em 3ch; }
.dirs a { font-weight: 700; text-decoration: none; color: var(--mid); }
.dirs a:hover, .dirs a.is-active { background: var(--fg); color: var(--bg); }

/* ls -lt */
.listing { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.row a {
  position: relative;
  display: grid; grid-template-columns: 11ch 7ch 20ch minmax(0, 1fr); gap: 2ch; align-items: baseline;
  padding: .8em .4ch; border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--mid);
  transition: background .15s, color .15s;
}
.row time { color: var(--dim); font-variant-numeric: tabular-nums; }
.row-min { color: var(--shade); }
.row-cat { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title { color: var(--fg); font-weight: 500; }
.row a:hover { background: var(--fg); color: var(--bg); }
.row a:hover time, .row a:hover .row-min, .row a:hover .row-cat, .row a:hover .row-title { color: var(--bg); }
.row-thumb {
  position: absolute; right: 1ch; top: 50%; z-index: 3;
  width: 240px; aspect-ratio: 16 / 9; overflow: hidden;
  border: 1px solid var(--faint); background: var(--bg);
  opacity: 0; pointer-events: none; transform: translate(10px, -50%);
  transition: opacity .2s, transform .2s;
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
@media (hover: hover) and (min-width: 900px) {
  .row a:hover .row-thumb { opacity: 1; transform: translate(0, -50%); }
}

.pagination { display: flex; gap: 3ch; margin-top: 2em; }
.pagination a, .pagination span { text-decoration: none; color: var(--mid); }
.pagination .current { background: var(--fg); color: var(--bg); padding: 0 .6ch; }
.pagination a:hover { color: var(--fg); }

.search-form { display: flex; gap: 1ch; margin: 1em 0 2em; max-width: 60ch; }
.search-form input {
  flex: 1; min-width: 0; height: 40px; padding: 0 1.2ch;
  background: var(--bg-2); color: var(--fg); border: 1px solid var(--faint);
  font: 400 15px var(--mono);
}
.search-form .btn { height: 40px; padding: 0 2ch; border: 0; background: var(--fg); color: var(--bg); font: 700 13px var(--mono); cursor: pointer; }
.nf { min-height: 50vh; }

/* ------------------------------------------------------------ article */

.article-head { padding-bottom: 1.6em; }
.article-title {
  max-width: 24ch; margin: .45em 0 .35em;
  font: 800 clamp(34px, 5.4vw, 64px) / 1.02 var(--mono);
  letter-spacing: -.045em; color: var(--fg); text-wrap: balance;
}
.article-meta { margin: 0; color: var(--dim); font-size: 13px; }
.article-meta a { color: var(--mid); text-decoration: none; }
.article-meta a:hover { color: var(--fg); }
.article-lead { max-width: 62ch; margin: 1.4em 0 0; font: 400 18px/1.6 var(--sans); color: var(--mid); }
.article-cover { margin-bottom: clamp(32px, 5vw, 56px); }
.article-cover img { width: 100%; border: 1px solid var(--line); }

.prose { font: 400 17.5px/1.75 var(--sans); color: var(--text); }
.prose > * { margin: 0 0 1.15em; }
.prose h2 { margin: 2.2em 0 .7em; font: 700 22px/1.3 var(--mono); letter-spacing: -.02em; color: var(--fg); }
.prose h2::before { content: "## "; color: var(--faint); }
.prose h3 { margin: 1.8em 0 .5em; font: 700 17px/1.4 var(--mono); color: var(--fg); }
.prose h3::before { content: "### "; color: var(--faint); }
.prose h4 { margin: 1.5em 0 .4em; font: 700 15px var(--mono); color: var(--fg); }
.prose a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--shade); text-underline-offset: 4px; }
.prose a:hover { background: var(--fg); color: var(--bg); text-decoration: none; }
.prose strong { color: var(--fg); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .35em 0; }
.prose ul li::marker { content: "- "; color: var(--dim); font-family: var(--mono); }
.prose ol li::marker { color: var(--dim); font-family: var(--mono); font-size: .9em; }
.prose blockquote { margin: 1.6em 0; padding-left: 2ch; border-left: 1px solid var(--mid); color: var(--fg); }
.prose hr { border: 0; border-top: 1px dashed var(--faint); margin: 2.4em 0; }
.prose code { padding: .1em .35em; background: var(--bg-2); border: 1px solid var(--line); font: 400 .88em var(--mono); color: var(--fg); }
.prose pre { overflow-x: auto; padding: 18px 20px; background: var(--bg-2); border: 1px solid var(--line); font: 400 14px/1.6 var(--mono); color: var(--fg); }
.prose pre code { padding: 0; border: 0; background: none; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; font: 400 14px/1.5 var(--mono); }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { color: var(--dim); font-weight: 500; border-bottom-color: var(--faint); }
.prose figure { margin: 2em 0; }
.prose img { border: 1px solid var(--line); }
.prose figcaption, .prose .wp-caption-text { margin-top: 8px; font: 400 13px var(--mono); color: var(--dim); }

.article-foot { padding-top: 1em; }
.tags a { text-decoration: none; color: var(--mid); margin-right: 1.4ch; }
.tags a:hover { background: var(--fg); color: var(--bg); }
.whoami { margin-top: 3em; padding-top: 1.6em; border-top: 1px dashed var(--faint); }
.whoami .line + .line { margin-top: .3em; }
.related { margin-top: clamp(48px, 7vw, 88px); }

@media (max-width: 760px) {
  .titlebar { grid-template-columns: auto 1fr; gap: 2ch; }
  .title { text-align: right; }
  .topnav { display: none; }
  .row a { grid-template-columns: 11ch minmax(0, 1fr); gap: .2em 2ch; }
  .row-min, .row-cat { display: none; }
  .prose { font-size: 17px; }
}
