style.css 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. /*
  2. * Paper
  3. * A simple, clean, flexible Hugo theme
  4. * https://github.com/nanxiaobei/hugo-paper
  5. * Designed by MR.LEE (https://mrlee.me/)
  6. * Updated in 2019.10.17
  7. */
  8. /* Theme
  9. -------------------------------------------------- */
  10. :root {
  11. --gap: 24px;
  12. --content-gap: 40px;
  13. --nav-width: 1024px;
  14. --main-width: 640px;
  15. --header-height: 60px;
  16. --footer-height: 60px;
  17. --radius: 8px;
  18. --theme: #fff;
  19. --primary: rgba(0, 0, 0, 0.88);
  20. --secondary: rgba(0, 0, 0, 0.56);
  21. --tertiary: rgba(0, 0, 0, 0.16);
  22. --hljs-bg: #1c1d21;
  23. --code-bg: #f5f5f5;
  24. --border: #eee;
  25. }
  26. .dark {
  27. --theme: #3c3c3c;
  28. --primary: rgba(255, 255, 255, 0.88);
  29. --secondary: rgba(255, 255, 255, 0.56);
  30. --tertiary: rgba(255, 255, 255, 0.16);
  31. --hljs-bg: #2a2a2a;
  32. --code-bg: #4f4f4f;
  33. --border: #5f5f5f;
  34. }
  35. .list {
  36. background: linear-gradient(135deg, #ddd, #f5f5f5, #d5d5d5);
  37. }
  38. .dark.list {
  39. background: linear-gradient(135deg, #1c1c1c, #2a2a2a, #000);
  40. }
  41. /* Reset
  42. -------------------------------------------------- */
  43. *,
  44. *::before,
  45. *::after {
  46. box-sizing: border-box;
  47. }
  48. html {
  49. -webkit-tap-highlight-color: transparent;
  50. }
  51. body {
  52. margin: 0;
  53. color: var(--primary);
  54. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
  55. 'Open Sans', 'Helvetica Neue', sans-serif;
  56. font-size: 18px;
  57. line-height: 1.8;
  58. word-break: break-word;
  59. background: var(--theme);
  60. }
  61. article,
  62. aside,
  63. figcaption,
  64. figure,
  65. footer,
  66. header,
  67. hgroup,
  68. main,
  69. nav,
  70. section {
  71. display: block;
  72. }
  73. h1,
  74. h2,
  75. h3,
  76. h4,
  77. h5,
  78. h6 {
  79. margin-top: 0;
  80. margin-bottom: 0;
  81. line-height: 1.2;
  82. }
  83. p {
  84. margin-top: 0;
  85. margin-bottom: 0;
  86. }
  87. strong,
  88. b {
  89. font-weight: 500;
  90. }
  91. ul {
  92. margin: 0;
  93. padding: 0;
  94. }
  95. a {
  96. color: var(--primary);
  97. text-decoration: none;
  98. }
  99. figure {
  100. margin: 0;
  101. }
  102. table {
  103. width: 100%;
  104. border-collapse: collapse;
  105. border-spacing: 0;
  106. }
  107. button,
  108. input,
  109. textarea {
  110. padding: 0;
  111. font: inherit;
  112. background: transparent;
  113. border: 0;
  114. -webkit-appearance: none;
  115. }
  116. button,
  117. input[type='button'],
  118. input[type='submit'] {
  119. cursor: pointer;
  120. }
  121. input,
  122. textarea {
  123. padding: 0;
  124. border: 0;
  125. outline: 0;
  126. }
  127. input:-webkit-autofill,
  128. textarea:-webkit-autofill {
  129. box-shadow: 0 0 0 50px var(--theme) inset;
  130. }
  131. img {
  132. display: block;
  133. max-width: 100%;
  134. }
  135. /* Header
  136. -------------------------------------------------- */
  137. .nav {
  138. display: flex;
  139. flex-wrap: wrap;
  140. justify-content: space-between;
  141. max-width: calc(var(--nav-width) + var(--gap) * 2);
  142. margin-left: auto;
  143. margin-right: auto;
  144. }
  145. .nav a {
  146. display: block;
  147. line-height: var(--header-height);
  148. }
  149. .logo,
  150. .menu {
  151. margin-left: var(--gap);
  152. margin-right: var(--gap);
  153. }
  154. .logo a {
  155. font-size: 24px;
  156. font-weight: 700;
  157. }
  158. .menu {
  159. display: flex;
  160. list-style: none;
  161. word-break: keep-all;
  162. overflow-x: auto;
  163. }
  164. .menu li + li {
  165. margin-left: var(--gap);
  166. }
  167. .menu a {
  168. font-size: 16px;
  169. }
  170. /* Main
  171. -------------------------------------------------- */
  172. .main {
  173. position: relative;
  174. min-height: calc(100vh - var(--header-height) - var(--footer-height));
  175. max-width: calc(var(--main-width) + var(--gap) * 2);
  176. margin-left: auto;
  177. margin-right: auto;
  178. padding: var(--gap);
  179. }
  180. .page-header {
  181. margin-bottom: 24px;
  182. }
  183. .page-header h1 {
  184. font-size: 40px;
  185. }
  186. .pagination {
  187. display: flex;
  188. }
  189. .pagination a {
  190. color: var(--theme);
  191. font-size: 13px;
  192. line-height: 36px;
  193. background: var(--primary);
  194. border-radius: calc(36px / 2);
  195. }
  196. .pagination .prev {
  197. padding-left: 16px;
  198. padding-right: 18px;
  199. }
  200. .pagination .next {
  201. margin-left: auto;
  202. padding-left: 18px;
  203. padding-right: 16px;
  204. }
  205. /* Post entry
  206. -------------------------------------------------- */
  207. .first-entry {
  208. position: relative;
  209. display: flex;
  210. flex-direction: column;
  211. justify-content: center;
  212. height: 320px;
  213. margin-bottom: var(--header-height);
  214. }
  215. .first-entry .entry-header {
  216. overflow: hidden;
  217. display: -webkit-box;
  218. -webkit-box-orient: vertical;
  219. -webkit-line-clamp: 3;
  220. }
  221. .first-entry .entry-header h2 {
  222. font-size: 40px;
  223. }
  224. .first-entry .entry-content {
  225. margin-top: 14px;
  226. margin-bottom: 14px;
  227. font-size: 16px;
  228. -webkit-line-clamp: 3;
  229. }
  230. .first-entry .entry-footer {
  231. font-size: 14px;
  232. }
  233. .post-entry {
  234. position: relative;
  235. margin-bottom: var(--gap);
  236. padding: var(--gap);
  237. background: var(--theme);
  238. border-radius: var(--radius);
  239. transition: transform 0.1s;
  240. }
  241. .post-entry:active {
  242. transform: scale(0.96);
  243. }
  244. .entry-header h2 {
  245. font-size: 24px;
  246. }
  247. .entry-content {
  248. margin-top: 8px;
  249. margin-bottom: 8px;
  250. color: var(--secondary);
  251. font-size: 14px;
  252. line-height: 1.6;
  253. overflow: hidden;
  254. display: -webkit-box;
  255. -webkit-box-orient: vertical;
  256. -webkit-line-clamp: 2;
  257. }
  258. .entry-footer {
  259. color: var(--secondary);
  260. font-size: 13px;
  261. }
  262. .entry-link {
  263. position: absolute;
  264. left: 0;
  265. right: 0;
  266. top: 0;
  267. bottom: 0;
  268. }
  269. /* Post single
  270. -------------------------------------------------- */
  271. .post-header {
  272. margin-top: 24px;
  273. margin-bottom: var(--content-gap);
  274. }
  275. .post-title {
  276. margin-bottom: 2px;
  277. font-size: 40px;
  278. transform: translateX(-2px);
  279. }
  280. .post-meta {
  281. color: var(--secondary);
  282. font-size: 14px;
  283. }
  284. .post-content h1 {
  285. margin-top: 40px;
  286. margin-bottom: 32px;
  287. }
  288. .post-content h2 {
  289. margin-top: 32px;
  290. margin-bottom: 24px;
  291. }
  292. .post-content h3,
  293. .post-content h4,
  294. .post-content h5,
  295. .post-content h6 {
  296. margin-top: 24px;
  297. margin-bottom: 16px;
  298. }
  299. .post-content h1 {
  300. font-size: 40px;
  301. }
  302. .post-content h2 {
  303. font-size: 32px;
  304. }
  305. .post-content h3 {
  306. font-size: 24px;
  307. }
  308. .post-content h4 {
  309. font-size: 16px;
  310. }
  311. .post-content h5 {
  312. font-size: 14px;
  313. }
  314. .post-content h6 {
  315. font-size: 12px;
  316. }
  317. .post-content a {
  318. box-shadow: 0 1px 0 var(--primary);
  319. }
  320. .post-content a code {
  321. margin-left: 0;
  322. margin-right: 0;
  323. border-radius: 0;
  324. box-shadow: 0 -1px 0 var(--primary) inset;
  325. }
  326. .post-content del {
  327. text-decoration: none;
  328. background: linear-gradient(to right, var(--primary) 100%, transparent 0) 0 50% / 1px 1px repeat-x;
  329. }
  330. .post-content p,
  331. .post-content ul,
  332. .post-content ol,
  333. .post-content dl {
  334. margin-bottom: var(--content-gap);
  335. }
  336. .post-content ul,
  337. .post-content ol {
  338. padding-left: 20px;
  339. }
  340. .post-content li {
  341. margin-top: 5px;
  342. }
  343. .post-content li p {
  344. margin-bottom: 0;
  345. }
  346. .post-content dl {
  347. display: flex;
  348. flex-wrap: wrap;
  349. margin: 0;
  350. }
  351. .post-content dt {
  352. width: 25%;
  353. font-weight: 700;
  354. }
  355. .post-content dd {
  356. width: 75%;
  357. margin-left: 0;
  358. padding-left: 10px;
  359. }
  360. .post-content dt ~ dt,
  361. .post-content dd ~ dd {
  362. margin-top: 10px;
  363. }
  364. .post-content table {
  365. margin-bottom: 32px;
  366. }
  367. .post-content table th,
  368. .post-content table:not(.highlighttable) td {
  369. min-width: 80px;
  370. padding: 12px 8px;
  371. line-height: 1.5;
  372. border-bottom: 1px solid var(--border);
  373. }
  374. .post-content table th {
  375. font-size: 14px;
  376. text-align: left;
  377. }
  378. .post-content table:not(.highlighttable) td code:only-child {
  379. margin-left: 0;
  380. margin-right: 0;
  381. }
  382. .post-content .highlight,
  383. .post-content pre {
  384. margin-left: calc(var(--gap) * -1);
  385. margin-right: calc(var(--gap) * -1);
  386. margin-bottom: 32px;
  387. background: var(--hljs-bg) !important;
  388. border-radius: var(--radius);
  389. }
  390. .post-content ul pre {
  391. margin-left: calc(var(--gap) * -2);
  392. }
  393. .post-content .highlight pre {
  394. margin-left: 0;
  395. margin-right: 0;
  396. margin-bottom: 0;
  397. }
  398. /* table */
  399. .post-content .highlighttable {
  400. table-layout: fixed;
  401. }
  402. .post-content .highlighttable td:first-child {
  403. width: 40px;
  404. }
  405. .post-content .highlighttable td .linenodiv {
  406. padding-right: 0 !important;
  407. }
  408. .post-content .highlighttable td .linenodiv pre,
  409. .post-content .highlighttable td .highlight {
  410. margin-bottom: 0;
  411. }
  412. .post-content .highlighttable td .highlight pre code::-webkit-scrollbar {
  413. display: none;
  414. }
  415. /* inline */
  416. .post-content .highlight span {
  417. background: transparent !important;
  418. }
  419. .post-content code {
  420. margin-left: 4px;
  421. margin-right: 4px;
  422. padding: 4px 6px;
  423. font-family: Menlo, Monaco, 'Courier New', Courier, monospace;
  424. font-size: 0.78em;
  425. line-height: 1.5;
  426. background: var(--code-bg);
  427. border-radius: 2px;
  428. }
  429. .post-content pre code {
  430. display: block;
  431. margin-left: 0;
  432. margin-right: 0;
  433. padding: var(--gap);
  434. color: rgba(255, 255, 255, 0.8);
  435. background: transparent;
  436. border-radius: 0;
  437. }
  438. .post-content blockquote {
  439. margin: 0 0 0 calc(var(--gap) * -1);
  440. padding: 0 0 0 21px;
  441. border-left: 3px solid var(--primary);
  442. }
  443. .post-content hr {
  444. height: 1px;
  445. margin-top: 56px;
  446. margin-bottom: 56px;
  447. background: var(--tertiary);
  448. border-top: 0;
  449. border-bottom: 0;
  450. }
  451. .post-content iframe {
  452. max-width: 100%;
  453. }
  454. .post-footer {
  455. margin-top: 56px;
  456. }
  457. .post-tags li {
  458. display: inline-block;
  459. }
  460. .post-tags li + li {
  461. margin-left: 3px;
  462. }
  463. .post-tags a {
  464. display: block;
  465. padding-left: 14px;
  466. padding-right: 14px;
  467. color: var(--secondary);
  468. font-size: 14px;
  469. line-height: 34px;
  470. background: var(--code-bg);
  471. border-radius: 2px;
  472. }
  473. .post-tags a:hover {
  474. background: var(--border);
  475. }
  476. /* Footer
  477. -------------------------------------------------- */
  478. .footer {
  479. max-width: calc(var(--main-width) + var(--gap) * 2);
  480. margin-left: auto;
  481. margin-right: auto;
  482. padding: calc((var(--footer-height) - var(--gap)) / 2) var(--gap);
  483. color: var(--secondary);
  484. font-size: 12px;
  485. text-align: center;
  486. line-height: 24px;
  487. }
  488. .footer span {
  489. margin-left: 1px;
  490. margin-right: 1px;
  491. }
  492. .footer a {
  493. color: inherit;
  494. }
  495. .footer a:hover {
  496. color: var(--primary);
  497. border-bottom: 1px solid var(--primary);
  498. }
  499. /* 404
  500. -------------------------------------------------- */
  501. .not-found {
  502. position: absolute;
  503. left: 0;
  504. right: 0;
  505. display: flex;
  506. align-items: center;
  507. justify-content: center;
  508. height: 80%;
  509. font-size: 160px;
  510. font-weight: 700;
  511. }